-
Notifications
You must be signed in to change notification settings - Fork 152
APEXMALHAR-2316 Moved suitable code to activate() for initializing tu… #484
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes seem fine.
Could you please check why the build failed ?
@devtagare I analyzed the build failure and it appears to be failing because DocumentBuilder is using String argument instead of InputSource and hence the test application is throwing the same exception multiple times and the log limit is getting exceeded. |
@devtagare have made the appropriate code changes please review |
66bc956
to
7e8bd29
Compare
import org.xml.sax.SAXException; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove unnecessary changes
parsedOutput.emit(doc); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unnecessary
@@ -94,9 +100,8 @@ public void processTuple(String inputTuple) | |||
DocumentBuilder builder; | |||
try { | |||
builder = factory.newDocumentBuilder(); | |||
Document doc = builder.parse(inputTuple); | |||
Document doc = builder.parse(new InputSource(new ByteArrayInputStream(inputTuple.getBytes("utf-8")))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make it capital "UTF-8" ?
Configuration conf = new Configuration(false); | ||
lma.prepareDAG(new XmlParserTest(), conf); | ||
LocalMode.Controller lc = lma.getController(); | ||
lc.run(10000);// runs for 10 seconds and quits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the right way to run a test. Need to validate the results after the test is run.
See https://github.com/apache/apex-malhar/blob/master/stream/src/test/java/org/apache/apex/malhar/stream/FunctionOperator/FunctionOperatorTest.java for an example.
{ | ||
if (emitTuple) { | ||
output.emit(xmlSample); | ||
emitTuple = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why emit just one tuple?
e1fffa1
to
182c5b2
Compare
@bhupeshchawda have made the suggested code changes. Please review. |
… initializing tuple class attribute and changed the argument type of DocumentBuilder.parse() to InputSource.
0101667
to
ded9c03
Compare
…ple class attribute. @bhupeshchawda @chinmaykolhatkar please review.