import org.junit.Before;
import org.junit.Test;
import org.wamblee.general.SystemClock;
+import org.wamblee.xmlrouter.common.Id;
import org.wamblee.xmlrouter.config.DocumentType;
import org.wamblee.xmlrouter.config.RouterConfig;
import org.wamblee.xmlrouter.config.Transformation;
EventListener logListener = new LoggingEventListener(Level.INFO);
listener = spy(logListener);
routerService = new XMLRouter(new SystemClock(), config, listener);
- configService = new XMLRouterConfigService(config);
+ configService = new XMLRouterConfigService("app", config);
source1 = mock(DOMSource.class);
source2 = mock(DOMSource.class);
DocumentType type = mock(DocumentType.class);
when(type.isInstance(any(DOMSource.class))).thenReturn(true);
when(type.getName()).thenReturn(aType);
- RouterConfig routerConfig = configService.emptyConfig();
+ when(type.getId()).thenReturn(new Id<DocumentType>(aType));
+ RouterConfig routerConfig = configService.emptyConfig("app");
routerConfig.documentTypeConfig().add(type);
return routerConfig;
}
public void testOneTransformationOneDestination() {
RouterConfig routerConfig = registerDocumentType("any");
Transformation transformation = mock(Transformation.class);
- when(transformation.getName()).thenReturn("trans");
+ when(transformation.getId())
+ .thenReturn(new Id<Transformation>("trans"));
when(transformation.getFromType()).thenReturn("any");
when(transformation.getToType()).thenReturn("bla");
when(transformation.transform(same(source1))).thenReturn(source2);
when(destination.receive(any(DOMSource.class))).thenReturn(true);
routerService.publish("bla", source1);
verify(listener).delivered(any(EventInfo.class),
- anyListOf(Transformation.class), anyLong(), anyString(), eq(true));
+ anyListOf(Transformation.class), anyString(), eq(true));
verify(transformation).transform(source1);
verify(destination).receive(same(source2));