adding testcase for handling missing attributes when fail.on.missing.attribute='false'
@@ -226,9 +226,12 @@ public class JsonSourceMapperTestCase {
Assert.assertEquals(null, event.getData(1));
break;
case 3:
- Assert.assertEquals(56.0f, event.getData(1));
+ Assert.assertEquals(null, event.getData(0));
break;
case 4:
+ Assert.assertEquals(56.0f, event.getData(1));
+ break;
+ case 5:
Assert.assertEquals(57.6f, event.getData(1));
break;
default:
@@ -261,6 +264,12 @@ public class JsonSourceMapperTestCase {
" \"volume\":100\n" +
" }\n" +
" }");
+ InMemoryBroker.publish("stock", " {\n" +
+ " \"event\":{\n" +
+ " \"price\":56,\n" +
+ " \"volume\":100\n" +
+ " }\n" +
+ " }");
InMemoryBroker.publish("stock", " {\n" +
" \"event\":{\n" +
" \"symbol\":\"WSO2\",\n" +
@@ -271,7 +280,7 @@ public class JsonSourceMapperTestCase {
Thread.sleep(100);
//assert event count
- Assert.assertEquals("Number of events", 4, count.get());
+ Assert.assertEquals("Number of events", 5, count.get());
executionPlanRuntime.shutdown();
}
