Package de.jetwick.data

Examples of de.jetwick.data.JUser


            public void updateFromTwitter(Collection<String> friends, String screenName, int max) {
                friends.add("add_at_least_one_friend");
            }
        };

        JUser user = new JUser("peter");
        helper.updateFriendsOf(user);
        assertEquals(1, list.size());

        helper.updateFriendsOf(user);
        assertEquals(1, list.size());

        // force 'aging' of user update
        user.setLastFriendsUpdate(new MyDate().minusDays(4).toDate());
        helper.updateFriendsOf(user);
        assertEquals(2, list.size());

        user.setLastFriendsUpdate(new MyDate().minusDays(3).toDate());
        assertEquals(1, helper.updateFriendsOf(user).size());
        assertEquals(2, list.size());
    }
View Full Code Here


            public void updateFromTwitter(Collection<String> friends, String screenName, int max) {
                throw new RuntimeException();
            }
        };

        JUser user = new JUser("peter");
        user.setFriends(Arrays.asList("test", "pest"));
        assertEquals(2, helper.updateFriendsOf(user).size());
        assertEquals(2, user.getFriends().size());
    }
View Full Code Here

    }

    @Test
    public void testSimilarQuery() {
        SimilarTweetQuery q = new SimilarTweetQuery(
                new JTweet(1L, "Test test jAva http://blabli", new JUser("tmp")), false);

        assertTrue(q.calcTerms().contains("test"));
        assertTrue(q.calcTerms().contains("java"));
        assertFalse("query mustn't contain links or parts of links", q.calcTerms().contains("http"));
        q = new SimilarTweetQuery(new JTweet(1L, "RT @user: test", new JUser("tmp")), false);
        assertFalse("query mustn't contain user", q.calcTerms().contains("user"));
    }
View Full Code Here

            twText = url + " " + twText;
            index = 0;
        }

        UrlEntry ue = new UrlEntry(index, index + url.length(), url);
        return new JTweet(id, twText, new JUser(user)).setCreatedAt(new Date(id)).addUrlEntry(ue);
    }
View Full Code Here

                extractor.toSaveHtml("http://test.de\nbli"));
    }
   
    @Test
    public void testUrlEntriesToAvoidMemoryLeak() {
        extractor.setTweet(new JTweet(1L, "test", new JUser("tester")).addUrlEntry(new UrlEntry(1, 2, "test.de"))).run();
        assertEquals(1, extractor.getUrlEntrySize());
        extractor.setTweet(new JTweet(1L, "test", new JUser("tester")).addUrlEntry(new UrlEntry(10, 2, "test.de"))).run();
        assertEquals(1, extractor.getUrlEntrySize());
    }
View Full Code Here

        super.setUp(userSearch);
    }

    @Test
    public void testDelete() throws Exception {
        JUser user = new JUser("karsten");

        userSearch.save(user, true);
        assertEquals(1, userSearch.search("karsten").size());

        userSearch.delete(user, true);
View Full Code Here

    }

    @Test
    public void testUpdate() throws Exception {
        assertEquals(0, userSearch.search("karsten").size());
        JUser user = new JUser("karsten");

        userSearch.save(user, true);
        assertEquals(1, userSearch.search("karsten").size());

        user = new JUser("karsten");
        user.setDescription("test");
        userSearch.save(user, true);

        assertEquals(1, userSearch.search("test").size());

        user = new JUser("peter");
        new JTweet(4, "users without a tweet get indexed!", user);
        userSearch.update(user, true, true);

        assertEquals(1, userSearch.search("peter").size());
    }
View Full Code Here

        assertEquals(1, userSearch.search("peter").size());
    }

    @Test
    public void testUpdate2() throws Exception {
        JUser user = new JUser("karsten");
        user.addSavedSearch(new SavedSearch(1, new UserQuery("test")));
        user.addSavedSearch(new SavedSearch(2, new UserQuery("test2")));
        userSearch.save(user, true);
        assertEquals(1, userSearch.search("karsten").size());
        user = userSearch.search("karsten").iterator().next();
        assertEquals(2, user.getSavedSearches().size());
    }
View Full Code Here

    }

    @Test
    public void testUpdateBatch() throws Exception {
        Set<JUser> list = new LinkedHashSet<JUser>();
        JUser user = new JUser("karsten");
        list.add(user);
        JUser user2 = new JUser("peter");
        list.add(user2);
        userSearch.bulkUpdate(list, userSearch.getIndexName());
        userSearch.refresh();
        assertEquals(1, userSearch.search("karsten").size());
        assertEquals(1, userSearch.search("peter").size());
View Full Code Here

    @Test
    public void testUserUpdate() {
        TwitterSearch st = twitterSearch;
        List<JUser> users = new ArrayList<JUser>();
        JUser user1 = new JUser("pannous");
        users.add(user1);
        JUser user2 = new JUser("timetabling");
        users.add(user2);

        st.updateUserInfo(users);
        assertNotNull(user2.getDescription());
        assertTrue(user2.getDescription().trim().length() > 0);
    }
View Full Code Here

TOP

Related Classes of de.jetwick.data.JUser

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.