flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmetzger <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-1615] [java api] SimpleTweetInputFormat
Date Thu, 12 Mar 2015 09:56:16 GMT
Github user rmetzger commented on a diff in the pull request:

    https://github.com/apache/flink/pull/442#discussion_r26288947
  
    --- Diff: flink-contrib/src/test/java/org/apache/flink/contrib/SimpleTweetInputFormatTest.java
---
    @@ -0,0 +1,76 @@
    +package org.apache.flink.contrib;
    +
    +import org.apache.flink.configuration.Configuration;
    +import org.apache.flink.contrib.tweetinputformat.io.SimpleTweetInputFormat;
    +import org.apache.flink.contrib.tweetinputformat.model.tweet.Tweet;
    +import org.apache.flink.contrib.tweetinputformat.model.tweet.entities.HashTags;
    +import org.apache.flink.core.fs.FileInputSplit;
    +import org.apache.flink.core.fs.Path;
    +import org.junit.Assert;
    +import org.junit.Before;
    +import org.junit.Test;
    +import java.io.File;
    +import java.util.ArrayList;
    +import java.util.Iterator;
    +import java.util.List;
    +
    +
    +public class SimpleTweetInputFormatTest {
    +
    +    private Tweet tweet;
    +
    +    private SimpleTweetInputFormat simpleTweetInputFormat;
    +
    +    private FileInputSplit fileInputSplit;
    +
    +    protected Configuration config;
    +
    +    protected File tempFile;
    +
    +
    +    @Before
    +    public void testSetUp() {
    +
    +
    +        simpleTweetInputFormat = new SimpleTweetInputFormat();
    +
    +        File jsonFile = new  File("../flink-contrib/src/main/resources/HashTagTweetSample.json");
    +
    +        fileInputSplit = new FileInputSplit(0, new Path(jsonFile.getPath()), 0, jsonFile.length(),
new String[] {"localhost"});
    +    }
    +
    +    @Test
    +    public void testTweetInput() throws Exception {
    +
    +
    +        simpleTweetInputFormat.open(fileInputSplit);
    +        List<String> result;
    +
    +        while (!simpleTweetInputFormat.reachedEnd()) {
    +            tweet = new Tweet();
    +            tweet = simpleTweetInputFormat.nextRecord(tweet);
    +
    +            if(tweet != null){
    --- End diff --
    
    Can you make the test fail if `tweet` is null?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message