[
https://issues.apache.org/jira/browse/APEXMALHAR-2157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15387736#comment-15387736
]
ASF GitHub Bot commented on APEXMALHAR-2157:
--------------------------------------------
Github user chinmaykolhatkar commented on a diff in the pull request:
https://github.com/apache/apex-malhar/pull/348#discussion_r71710711
--- Diff:
library/src/test/java/com/datatorrent/lib/formatter/JsonFormatterTest.java ---
@@ -182,14 +173,19 @@ public void testJSONToPOJONoFieldPOJO()
Assert.assertEquals(0, validDataSink.collectedTuples.size());
Assert.assertEquals(1, invalidDataSink.collectedTuples.size());
Assert.assertEquals(o, invalidDataSink.collectedTuples.get(0));
+ Assert.assertEquals(1, operator.getIncomingTuplesCount());
+ Assert.assertEquals(0, operator.getEmittedObjectCount());
+ Assert.assertEquals(1, operator.getErrorTupleCount());
}
public static class Test1Pojo
{
public int a;
public long b;
+ @JsonProperty("c2")
public String c;
public List<String> d;
+ @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy/MM/dd")
--- End diff --
This looks good... Can you also add few other fields and see how the values
interact for them:
1. java.util.Date without annotation.. What is the expected format and does
the test pass with default format?
2. java.util.Time... Is there any annotation for that? If yes, can you test
out Time field for both annotation and without annotation.... If there is no
annotation, please add just a new Time field and see default format.
3. Please add tests for different patterns as well.. Just a single pattern
is not enough.. Please include other time and timezone etc fields also in
pattern.
4. What happens if the shape is change? What are the possible values for
that?
> Improvements in JSON Formatter
> ------------------------------
>
> Key: APEXMALHAR-2157
> URL: https://issues.apache.org/jira/browse/APEXMALHAR-2157
> Project: Apache Apex Malhar
> Issue Type: Improvement
> Reporter: shubham pathak
> Assignee: shubham pathak
> Priority: Minor
>
> We need following features in existing JSON Formatter
> 1. Ability to provide date format for different date fields in POJO. Current
> implementation accepts just one format and applies the same to all date
> fields.
> 2. Ability to provide JSON field to POJO field mapping.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)