}
private ExtendedRouterConfig routerConfig;
+ private XMLRouterConfiguration config;
private XMLRouter router;
private DOMSource source1;
private DOMSource source2;
@Before
public void setUp() {
routerConfig = new SingleRouterConfig(new AtomicLong(1L));
+ config = new XMLRouterConfigurationImpl(routerConfig);
EventListener logListener = new LoggingEventListener(Level.INFO);
listener = spy(logListener);
- router = new XMLRouter(new SystemClock(), routerConfig, listener);
+ router = new XMLRouter(new SystemClock(), config, listener);
source1 = mock(DOMSource.class);
source2 = mock(DOMSource.class);
source3 = mock(DOMSource.class);
when(transformation.getToType()).thenReturn("bla");
when(transformation.transform(same(source1))).thenReturn(source2);
routerConfig.transformationConfig().add(transformation);
+ config.getTransformations().replaceTransformations(
+ routerConfig.transformationConfig().map());
Destination destination = mock(Destination.class);
when(
source1, null);
routerConfig.transformationConfig().add(transformation);
+ config.getTransformations().replaceTransformations(
+ routerConfig.transformationConfig().map());
Destination destination = mock(Destination.class);
when(
source1, source2);
routerConfig.transformationConfig().add(transformation2);
+ config.getTransformations().replaceTransformations(
+ routerConfig.transformationConfig().map());
when(
destination.chooseFromTargetTypes((Collection<String>) anyObject()))
.thenReturn(Arrays.asList("bla", "bla2"));
Transformation transformation = createTransformation("any", "other",
source1, source2);
routerConfig.transformationConfig().add(transformation);
+ config.getTransformations().replaceTransformations(
+ routerConfig.transformationConfig().map());
router.publish("source", source1);
verify(listener, times(2)).delivered(any(EventInfo.class),
Transformation t2 = createTransformation("intermediate", "other",
source2, source3);
routerConfig.transformationConfig().add(t2);
+ config.getTransformations().replaceTransformations(
+ routerConfig.transformationConfig().map());
router.publish("source", source1);
verify(listener).delivered(any(EventInfo.class),