apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sandeepdeshmukh <...@git.apache.org>
Subject [GitHub] incubator-apex-malhar pull request: APEXMALHAR-2057 : CSVParser fa...
Date Mon, 16 May 2016 14:52:33 GMT
Github user sandeepdeshmukh commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-malhar/pull/243#discussion_r63366117
  
    --- Diff: contrib/src/test/java/com/datatorrent/contrib/parser/CsvPOJOParserTest.java
---
    @@ -292,30 +313,68 @@ public void TestParserHeaderAsInput()
         Assert.assertEquals(0, objectPort.collectedTuples.size());
         Assert.assertEquals(0, pojoPort.collectedTuples.size());
         Assert.assertEquals(1, error.collectedTuples.size());
    +    KeyValPair<String,String> errorTuple = (KeyValPair<String, String>)error.collectedTuples.get(0);
    +    Assert.assertEquals(input, errorTuple.getKey());
       }
     
       @Test
       public void TestParserLessFields()
       {
    +    String input = "1234,98233,adxyz,0.2,2015-03-08 03:37:12,11/12/2012,12,y,OPTIMIZATION";
         parser.beginWindow(0);
    -    parser.in.process("1234,98233,adxyz,0.2,2015-03-08 03:37:12,11/12/2012,12,y,OPTIMIZATION".getBytes());
    +    parser.in.process(input.getBytes());
         parser.endWindow();
         Assert.assertEquals(0, objectPort.collectedTuples.size());
         Assert.assertEquals(0, pojoPort.collectedTuples.size());
         Assert.assertEquals(1, error.collectedTuples.size());
    +    KeyValPair<String,String> errorTuple = (KeyValPair<String, String>)error.collectedTuples.get(0);
    +    Assert.assertEquals(input, errorTuple.getKey());
    +  }
    +
    +  @Test
    +  public void TestParserLessFieldsOnlyPOJOPortConnected()
    +  {
    +    String input = "1234,98233,adxyz,0.2,2015-03-08 03:37:12,11/12/2012,12,y,OPTIMIZATION";
    +    parser.parsedOutput.setSink(null);
    +    parser.beginWindow(0);
    +    parser.in.process(input.getBytes());
    +    parser.endWindow();
    +    Assert.assertEquals(0, objectPort.collectedTuples.size());
    +    Assert.assertEquals(0, pojoPort.collectedTuples.size());
    +    Assert.assertEquals(1, error.collectedTuples.size());
    +    KeyValPair<String, String> errorTuple = (KeyValPair<String, String>)error.collectedTuples.get(0);
    +    Assert.assertEquals(input, errorTuple.getKey());
       }
     
       @Test
       public void TestParserMoreFields()
       {
     
    +    String input = "1234,98233,adxyz,0.2,2015-03-08 03:37:12,11/12/2012,12,y,OPTIMIZATION,CAMP_AD,Y,yes,ExtraField";
         parser.beginWindow(0);
    -    parser.in.process("1234,98233,adxyz,0.2,2015-03-08 03:37:12,11/12/2012,12,y,OPTIMIZATION,CAMP_AD,Y,yes,ExtraField"
    -        .getBytes());
    +    parser.in.process(input.getBytes());
    +    parser.endWindow();
    +    Assert.assertEquals(0, objectPort.collectedTuples.size());
    +    Assert.assertEquals(0, pojoPort.collectedTuples.size());
    +    Assert.assertEquals(1, error.collectedTuples.size());
    +    KeyValPair<String, String> errorTuple = (KeyValPair<String, String>)error.collectedTuples.get(0);
    +    Assert.assertEquals(input, errorTuple.getKey());
    +  }
    +
    +  @Test
    +  public void TestParserMoreFieldsOnlyPOJOPortConnected()
    +  {
    +    String input = "1234,98233,adxyz,0.2,2015-03-08 03:37:12,11/12/2012,12,y,OPTIMIZATION,CAMP_AD,Y,yes,ExtraField";
    +    parser.parsedOutput.setSink(null);
    +    parser.beginWindow(0);
    +    parser.in.process(input.getBytes());
         parser.endWindow();
         Assert.assertEquals(0, objectPort.collectedTuples.size());
         Assert.assertEquals(0, pojoPort.collectedTuples.size());
         Assert.assertEquals(1, error.collectedTuples.size());
    +    Assert.assertEquals(1, error.collectedTuples.size());
    --- End diff --
    
    Looks like  duplicate line, same as 374. Could you please remove that.


---
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