Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

APEXMALHAR-2316 Moved suitable code to activate() for initializing tu… #484

Closed
wants to merge 1 commit into from

Conversation

KapoorHitesh
Copy link
Contributor

…ple class attribute. @bhupeshchawda @chinmaykolhatkar please review.

Copy link
Contributor

@devtagare devtagare left a 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 ?

@KapoorHitesh
Copy link
Contributor Author

@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.
Should I remove the test application and add it when I make the code changes for the above scenario?

@KapoorHitesh
Copy link
Contributor Author

@devtagare have made the appropriate code changes please review

import org.xml.sax.SAXException;

Copy link
Contributor

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

Copy link
Contributor

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"))));
Copy link
Contributor

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
Copy link
Contributor

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;
Copy link
Contributor

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?

@KapoorHitesh
Copy link
Contributor Author

KapoorHitesh commented Nov 22, 2016

@bhupeshchawda have made the suggested code changes. Please review.

… initializing tuple class attribute and changed the argument type of DocumentBuilder.parse() to InputSource.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants