Package de.jetwick.data

Examples of de.jetwick.data.JTweet


        assertEquals(2L, (long) twSearch.searchReplies(1L, true).iterator().next().getTwitterId());
    }

    @Test
    public void testFindDuplicates() {
        twSearch.store(new JTweet(1L, "wikileaks is not a wtf", new JUser("userA")), false);
        twSearch.store(new JTweet(2L, "news about wikileaks", new JUser("userB")), false);

        // find dup is restricted to the last hour so use a current date
        MyDate dt = new MyDate();
        JTweet tw3 = new JTweet(3L, "wtf means wikileaks task force", new JUser("userC")).setCreatedAt(dt.toDate());
        JTweet tw4 = new JTweet(4L, "wtf wikileaks task force", new JUser("userD")).setCreatedAt(dt.plusMinutes(1).toDate());
        JTweet tw5 = new JTweet(5L, "RT @userC: wtf means wikileaks task force", new JUser("userE")).setCreatedAt(dt.plusMinutes(1).toDate());       
        twSearch.queueObjects(Arrays.asList(tw3, tw4, tw5));
        twSearch.forceEmptyQueueAndRefresh();
        assertEquals("should be empty. should NOT find tweet 4 because it is younger", 0, tw3.getDuplicates().size());
        assertEquals("should find tweet 3", 1, tw4.getDuplicates().size());

        Map<Long, JTweet> map = new LinkedHashMap<Long, JTweet>();
        JTweet tw = new JTweet(10L, "wtf wikileaks task force", new JUser("peter")).setCreatedAt(dt.plusMinutes(1).toDate());
        map.put(10L, tw);
        twSearch.findDuplicates(map);
        assertEquals("should find tweets 3 and 4", 2, tw.getDuplicates().size());
    }
View Full Code Here


    }
   
    @Test
    public void testSpamDuplicates() {
        MyDate dt = new MyDate();
        JTweet tw1 = new JTweet(1L, "2488334. Increase your twitter followers now! Buy Twitter Followers", new JUser("userA")).setCreatedAt(dt.plusMinutes(1).toDate());
        JTweet tw2 = new JTweet(2L, "349366. Increase your twitter followers now! Buy Twitter Followers", new JUser("userB")).setCreatedAt(dt.plusMinutes(1).toDate());
        JTweet tw3 = new JTweet(31L, "2040312. Increase your twitter followers now! Buy Twitter Followers", new JUser("userC")).setCreatedAt(dt.plusMinutes(1).toDate());       
        twSearch.queueObjects(Arrays.asList(tw1, tw2, tw3));
        twSearch.forceEmptyQueueAndRefresh();

        assertEquals(0, tw1.getDuplicates().size());
        assertEquals(1, tw2.getDuplicates().size());
        assertEquals(2, tw3.getDuplicates().size());
    }
View Full Code Here

       
        twSearch.testUpdate(createTweet(3L, "C", "u3").setInReplyTwitterId(1L));
        assertEquals(3, twSearch.getFeededTweets());

        // now check if C was properly connected with A and D
        JTweet twC = twSearch.findByTwitterId(3L);
        assertEquals(1, twC.getReplyCount());

        // A should have C as reply
        JTweet twA = twSearch.findByTwitterId(1L);
        assertEquals(1, twA.getReplyCount());

        // now check if B was properly connected with A
        twSearch.testUpdate(createTweet(2L, "B", "u2").setInReplyTwitterId(1L));

        twA = twSearch.findByTwitterId(1L);
        assertEquals(2, twA.getReplyCount());

        // return null when not found
        assertNull(twSearch.findByTwitterId(23L));
    }
View Full Code Here

        assertEquals(2, twSearch.findByUserName("peter").getOwnTweets().size());
    }

    @Test
    public void testDoNotSaveSecondUser() {
        JTweet fTweet = createTweet(5, "@peter @karsten bla bli", "peter");
        twSearch.testUpdate(fTweet);

        assertNull(twSearch.findByUserName("karsten"));
        assertNotNull(twSearch.findByUserName("peter"));
    }
View Full Code Here

        assertNotNull(twSearch.findByUserName("peter"));
    }

    @Test
    public void testFindById() {
        JTweet tw = createTweet(5L, "test", "peter");
        twSearch.testUpdate(tw);

        assertEquals("test", twSearch.findByTwitterId(5L).getText());

        tw = createTweet(6L, "test2", "peter");
View Full Code Here

        assertNotNull(twSearch.findByUserName("peter"));
    }

    @Test
    public void testIdVsName() {
        JTweet fTweet = createTweet(5, "@karsten bla bli", "peter");
        twSearch.testUpdate(fTweet);

        fTweet = createTweet(6, "@peter bla bli", "karsten");
        twSearch.testUpdate(fTweet);
        assertNotNull(twSearch.findByUserName("karsten"));
View Full Code Here

    @Test
    public void testFillTranslateMapTodoIntegrationTest() {
        ResultsPanel panel = (ResultsPanel) tester.startPanel(ResultsPanel.class);

        panel.fillTranslateMap(Arrays.asList(
                new JTweet(1L, "cars are great but are too expensive", new JUser("empty")),
                new JTweet(2L, "autos sind toll aber überflüssig", new JUser("empty"))),
                "de");

        assertTrue(panel.getTranslateMap().get(1L).contains("aber"));
        assertTrue(panel.getTranslateMap().get(2L).contains("aber"));
    }
View Full Code Here

            }

            @Override
            public long search(String q, Collection<JTweet> result, int tweets, long lastMillis) {
                JUser u = new JUser("timetabling");
                JTweet tw1 = new JTweet(1L, "... Egypt. http://apne.ws/dERa4A - XY #tEst", u);
                result.add(tw1);
                return lastMillis;
            }

            @Override
View Full Code Here

        ElasticUserSearch userSearch = userSearchTester.getSearch();
        ElasticTweetSearch tweetSearch = tweetSearchTester.getSearch();

        // already existing tweets must not harm
        tweetSearch.store(new JTweet(3L, "duplication tweet", new JUser("tmp")), true);
        TwitterSearch tws = new TwitterSearch() {

            @Override
            public boolean isInitialized() {
                return true;
            }

            @Override
            public long search(String q, Collection<JTweet> result, int tweets, long lastMillis) {
                JUser u = new JUser("timetabling");
                JTweet tw1 = new JTweet(1L, "test", u);
                result.add(tw1);

                tw1 = new JTweet(2L, "java test", u);
                result.add(tw1);

                // this tweet will be ignored and so it won't be indexed!
                tw1 = new JTweet(3L, "duplicate tweet", new JUser("anotheruser"));
                result.add(tw1);

                tw1 = new JTweet(4L, "reference a user: @timetabling", new JUser("user3"));
                result.add(tw1);

                assertEquals(4, result.size());
                return lastMillis;
            }
View Full Code Here

            @Override
            public long search(String q, Collection<JTweet> result, int tweets, long lastMillis) {
                // make retweet older otherwise no retweet detection!
                Date dt = new Date();
                JTweet tw1 = new JTweet(10L, "A new #browser performance test: Rendering the #linux kernel impact graph on #github: http://t.co/0NCINwv", new JUser("jbandi")).setCreatedAt(dt);
                result.add(tw1);
                JTweet tw2 = new JTweet(11L, "RT @jbandi: A new #browser performance test: Rendering the #linux kernel impact graph on #github: http://t.co/0NCINwv", new JUser("adietisheim")).setCreatedAt(new Date(dt.getTime() + 1));
                result.add(tw2);
                return lastMillis;
            }

            @Override
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.