added first version of configuraiton api and simple function test.
[xmlrouter] / impl / src / test / java / org / wamblee / xmlrouter / impl / XMLRouterTest.java
index 7da3de5f932119f0499bb00761f00fb199aa24fa..baa63a16c7a6de2cc7121ce85407a8131fbf4a13 100644 (file)
@@ -80,8 +80,7 @@ public class XMLRouterTest {
     @Before
     public void setUp() {
         routerConfig = new SingleRouterConfig(new AtomicLong(1L));
-        config = new XMLRouterConfigurationImpl(routerConfig,
-            new TransformationPaths());
+        config = new XMLRouterConfigurationImpl(routerConfig);
         EventListener logListener = new LoggingEventListener(Level.INFO);
         listener = spy(logListener);
         router = new XMLRouter(new SystemClock(), config, listener);
@@ -276,6 +275,8 @@ public class XMLRouterTest {
         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(
@@ -338,6 +339,8 @@ public class XMLRouterTest {
             source1, null);
 
         routerConfig.transformationConfig().add(transformation);
+        config.getTransformations().replaceTransformations(
+            routerConfig.transformationConfig().map());
 
         Destination destination = mock(Destination.class);
         when(
@@ -356,6 +359,8 @@ public class XMLRouterTest {
             source1, source2);
 
         routerConfig.transformationConfig().add(transformation2);
+        config.getTransformations().replaceTransformations(
+            routerConfig.transformationConfig().map());
         when(
             destination.chooseFromTargetTypes((Collection<String>) anyObject()))
             .thenReturn(Arrays.asList("bla", "bla2"));
@@ -400,6 +405,8 @@ public class XMLRouterTest {
         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),
@@ -421,6 +428,8 @@ public class XMLRouterTest {
         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),