import static junit.framework.Assert.*;
import java.util.Collection;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.xml.transform.dom.DOMSource;
-import org.junit.Before;
import org.junit.Test;
import org.wamblee.xmlrouter.common.Id;
import org.wamblee.xmlrouter.config.Transformation;
private TransformationPaths transformations;
- @Before
- public void setUp() {
- transformations = new TransformationPaths();
- }
-
private Map<Id<Transformation>, Transformation> createTransformations(
long aStartId, Transformation... aTransformations) {
Map<Id<Transformation>, Transformation> res = new LinkedHashMap<Id<Transformation>, Transformation>();
@Test
public void testOneTransformation() {
- transformations.replaceTransformations(createTransformations(10L,
+ transformations = new TransformationPaths(createTransformations(10L,
new MyTransformation("A", "B")));
System.out.println(transformations.toString());
@Test
public void testMultipleTransformations() {
- transformations.replaceTransformations(createTransformations(10L,
+ transformations = new TransformationPaths(createTransformations(10L,
new MyTransformation("A", "B"), new MyTransformation("B", "C"),
new MyTransformation("C", "A")));
System.out.println(transformations);
assertEquals(2, transformations.getPath("C", "B").size());
- transformations.replaceTransformations(createTransformations(10L,
+ transformations = new TransformationPaths(createTransformations(10L,
new MyTransformation("B", "C"), new MyTransformation("C", "A")));
assertNull(transformations.getPath("C", "B"));
@Test
public void testUnknownDestination() {
- transformations.replaceTransformations(createTransformations(10L,
+ transformations = new TransformationPaths(createTransformations(10L,
new MyTransformation("A", "B")));
assertNull(transformations.getPath("A", "D"));
}
@Test
public void testWithoutTransformations() {
+ transformations = new TransformationPaths(
+ new HashMap<Id<Transformation>, Transformation>());
Collection<String> res = transformations.getPossibleTargetTypes("a");
assertEquals(1, res.size());