Package de.jetwick.tw.queue

Examples of de.jetwick.tw.queue.QueueThread


            // try updating can fail so try max 3 times
            for (int trial = 0; trial < 3; trial++) {
                MyTweetGrabber grabber = new MyTweetGrabber().setMyBoundSet(boundSet).
                        init(null, null, tmpUser.getTerm()).setTweetsCount((int) tmpUser.getCount()).
                        setRmiClient(rmiProvider).setTwitterSearch(twSearch);
                QueueThread pkg = grabber.queueTweetPackage();
                Thread t = new Thread(pkg);
                t.start();
                try {
                    t.join();
                    if (pkg.getException() == null)
                        break;

                    logger.warn(trial + "> Try again feeding of user " + tmpUser.getTerm() + " for tweet package " + pkg);
                } catch (InterruptedException ex) {
                    logger.warn("interrupted", ex);
View Full Code Here


        tweetCount = count;
        return this;
    }

    public QueueThread queueTweetPackage() {
        return new QueueThread() {

            @Override
            public void run() {
                if (!tweetSearch.isInitialized())
                    return;
View Full Code Here

    public boolean isSearchDoneInLastMinutes(String string) {
        return !lastSearches.get().add(string.toLowerCase());
    }

    public QueueThread queueArchiving() {
        return new QueueThread() {

            @Override
            public void run() {
                try {
                    JUser user = new JUser(userName);
View Full Code Here

    @Test
    public void testQueueWhenNoResults() throws InterruptedException {
        TweetSearchPage page = getInstance(TweetSearchPage.class);

        QueueThread pkg = page.queueTweets(null, "java", null);
        Thread t = new Thread(pkg);
        t.start();
        t.join();
        assertNotNull(sentTweets);
View Full Code Here

    @Test
    public void testQueueWhenUserSearch() throws InterruptedException {
        TweetSearchPage page = getInstance(TweetSearchPage.class);

        QueueThread p = page.queueTweets(null, null, "java");
        p.run();
        assertNotNull(sentTweets);

        assertEquals("", qString);
        assertEquals("#java", uString);
    }
View Full Code Here

    @Test
    public void testAvoidDuplicateSearchEnqueueing() throws InterruptedException {
        TweetSearchPage page = getInstance(TweetSearchPage.class);

        QueueThread p = page.queueTweets(null, null, "java");
        p.run();
        assertNotNull(sentTweets);
        assertEquals("", qString);
        assertEquals("#java", uString);

        reset();
        p = page.queueTweets(null, null, "Java");
        p.run();
        assertNull(sentTweets);
        assertEquals("", qString);
        assertEquals("", uString);

//        reset();
View Full Code Here

TOP

Related Classes of de.jetwick.tw.queue.QueueThread

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.