Package de.jetwick.data

Examples of de.jetwick.data.JTweet


    }

    @Test
    public void testSearchAnchors() throws Exception {
        JUser peter = new JUser("peter");
        JTweet tw1 = new JTweet(1L, "peter #java is cool!", peter);
        JUser peter2 = new JUser("peter2");
        JTweet tw2 = new JTweet(2L, "@peter java is cool!", peter2);
        twSearch.store(tw1, false);
        twSearch.store(tw2, true);

        assertEquals(1, twSearch.search("#java").size());
        assertEquals(1, twSearch.search("@peter").size());
View Full Code Here


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

    @Test
    public void testCamelCase() throws Exception {
        JTweet tw1 = new JTweet(1L, "peter iBood is cool!", new JUser("peter1"));
        JTweet tw2 = new JTweet(2L, "ibood is cool!", new JUser("peter2"));
        JTweet tw3 = new JTweet(3L, "peter iBOOD is cool!", new JUser("peter3"));
        JTweet tw4 = new JTweet(4L, "Ibood is cool!", new JUser("peter4"));
        JTweet tw5 = new JTweet(5L, "iBOOD.com", new JUser("peter5"));

        twSearch.store(tw1, false);
        twSearch.store(tw2, false);
        twSearch.store(tw3, false);
        twSearch.store(tw5, false);
View Full Code Here

    @Test
    public void testSearchJavaScript() throws Exception {
        // keepwords.txt
        JUser peter = new JUser("peter1");
        JTweet tw1 = new JTweet(1L, "peter JavaScript is cool!", peter);
        JUser peter2 = new JUser("peter2");
        JTweet tw2 = new JTweet(2L, "java is cool!", peter2);
        JTweet tw3 = new JTweet(3L, "peter javascript is cool!", new JUser("peter3"));
        twSearch.store(tw1, false);
        twSearch.store(tw2, false);
        twSearch.store(tw3, true);

        assertEquals(1, twSearch.search("java").size());
View Full Code Here

    @Test
    public void testLoc() {
        JUser user = new JUser("peter");
        user.setLocation("TEST");
        JTweet tw;
        tw = new JTweet(1L, "test tweet text", user);
        twSearch.store(tw, false);
        tw = new JTweet(2L, "test tweet text2", user);
        twSearch.store(tw, true);
        List<JUser> res = new ArrayList<JUser>();
        twSearch.query(res, new TweetQuery().addFilterQuery("loc", "TEST"));
        assertEquals(1, res.size());
        assertEquals(2, res.get(0).getOwnTweets().size());

        user = new JUser("peter");
        tw = new JTweet(3L, "test tweet text", user);
        tw.setLocation("TEST3");
        twSearch.store(tw, false);

        tw = new JTweet(4L, "test tweet text", user);
        tw.setLocation("TEST4");
        twSearch.store(tw, true);
        res = new ArrayList<JUser>();
        twSearch.query(res, new TweetQuery().addFilterQuery("loc", "TEST3"));
        assertEquals(1, res.size());
        assertEquals(1, res.get(0).getOwnTweets().size());
View Full Code Here

    public void testDelete() throws Exception {
        // do not throw exception
        twSearch.delete(Collections.EMPTY_LIST);

        JUser otherUser = new JUser("otherUser");
        JTweet tw2 = new JTweet(2L, "java is cool and stable!", otherUser);
        twSearch.store(tw2, false);
        twSearch.refresh();
        assertEquals(1, twSearch.search("java").size());

        twSearch.delete(Arrays.asList(tw2));
View Full Code Here

    }

    @Test
    public void testGeo() throws Exception {
        JUser otherUser = new JUser("otherUser");
        JTweet tw2 = new JTweet(2L, "java is cool and stable!", otherUser);
        twSearch.store(tw2.setGeoLocation(123, 321), false);
        twSearch.refresh();

        assertEquals(1, twSearch.search("java").size());
        assertEquals(1, twSearch.searchGeo(123, 321, 1).size());
        assertEquals(0, twSearch.searchGeo(123, 100, 1).size());
View Full Code Here

    }

    @Test
    public void testMain() {
        todoTweets.add(new JTweet(1L, "test too short", new JUser("test")).setRetweetCount(2));
        todoTweets.add(new JTweet(2L, "test this is not too short bercasu we addded a lot of unknown noise words", new JUser("test")).setRetweetCount(2));

        bot.start(1, 0);

        assertEquals(1, retweeted.size());
        assertTrue(retweeted.contains(2L));
View Full Code Here

    }

    @Test
    public void testGetReplies() {
        JUser usera = new JUser("usera");
        JTweet tw = new JTweet(1L, "this is a Test ", usera);
        JUser userb = new JUser("userb");
        JTweet tw2 = new JTweet(2L, "this is a Test ", userb);
        tw2.addReply(tw);
        twSearch.store(tw, true);
        twSearch.store(tw2, true);

        assertEquals(0, twSearch.searchReplies(1L, true).size());
        assertEquals(0, twSearch.searchReplies(2L, true).size());
View Full Code Here

        assertTrue(retweeted.contains(2L));
    }

    @Test
    public void testAvoidSimilarRetweets() {
        todoTweets.add(new JTweet(1L, "Dear kids, There is NO Santa Claus. Those presents are from your parents. \"With love, WikiLeaks\"", new JUser("ihackinjosh")).setRetweetCount(5));
        todoTweets.add(new JTweet(2L, "Dear Kids, There is no Santa. Those presents are from your parents. Sincerely, Wikileaks. http://lil.as/1Nu (via @sapnabhavnani)", new JUser("dearblankplease")).setRetweetCount(4));

        bot.start(2, 0);

        assertEquals(1, retweeted.size());
        assertTrue(retweeted.contains(1L));
View Full Code Here

    }

    @Test
    public void testGetRetweets() {
        JUser usera = new JUser("usera");
        JTweet tw = new JTweet(1L, "this is a Test ", usera);
        JUser userb = new JUser("userb");
        JTweet tw2 = new JTweet(2L, "rt @usera: this is a Test ", userb);
        tw.addReply(tw2);
        twSearch.store(tw, false);
        twSearch.store(tw2, true);

        assertEquals(1, twSearch.searchReplies(1L, true).size());
View Full Code Here

TOP

Related Classes of de.jetwick.data.JTweet

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.