@Before public void setup() throws Exception { dataFlow = new DataFlowBuilder() .withAnnotatedDataBuilder(TestBuilderA.class) .withAnnotatedDataBuilder(TestBuilderB.class) .withAnnotatedDataBuilder(TestBuilderC.class) .withTargetData("F") .build(); executor.registerExecutionListener(new TestListenerWithContextCheck()); }
@Test public void testBuilderRunWithContextBeingPassed() throws Exception { DataFlowInstance dataFlowInstance = new DataFlowInstance(); dataFlowInstance.setId("testflow"); dataFlowInstance.setDataFlow(dataFlow); { DataBuilderContext context = new DataBuilderContext(); context.saveContextData(KEY, VALUE); DataDelta dataDelta = new DataDelta( Lists.newArrayList( new TestDataA("Hello"), new TestDataB("World"), new TestDataD("this"), new TestDataG("Hmmm"))); DataExecutionResponse response = executor.run(dataFlowInstance, dataDelta); Assert.assertEquals(3, response.getResponses().size()); Assert.assertTrue(response.getResponses().containsKey("C")); Assert.assertTrue(response.getResponses().containsKey("E")); Assert.assertTrue(response.getResponses().containsKey("F")); } }