use of io.atlasmap.java.test.TargetTestClass in project atlasmap by atlasmap.
the class JavaFieldReaderTest method testReadTopmostListComplex.
@Test
public void testReadTopmostListComplex() throws Exception {
List<TargetTestClass> complexList = Arrays.asList(new TargetTestClass[] { new TargetTestClass(), new TargetTestClass(), new TargetTestClass() });
complexList.get(0).setAddress(new TargetAddress());
complexList.get(0).getAddress().setAddressLine1("123 any street");
complexList.get(2).setAddress(new TargetAddress());
complexList.get(2).getAddress().setAddressLine1("1234 any street");
reader.setDocument(complexList);
read("/<0>/address/addressLine1", FieldType.STRING);
assertEquals(0, audits.size());
assertEquals("123 any street", field.getValue());
assertEquals(0, audits.size());
readGroup("/<>/address/addressLine1", FieldType.STRING);
assertEquals(0, audits.size());
assertNotNull(fieldGroup);
assertEquals(2, fieldGroup.getField().size());
Field f = fieldGroup.getField().get(0);
assertEquals("/<0>/address/addressLine1", f.getPath());
assertEquals("123 any street", f.getValue());
f = fieldGroup.getField().get(1);
assertEquals("/<2>/address/addressLine1", f.getPath());
assertEquals("1234 any street", f.getValue());
assertEquals(0, audits.size());
}
use of io.atlasmap.java.test.TargetTestClass in project atlasmap by atlasmap.
the class BaseJavaFieldWriterTest method reset.
@BeforeEach
public void reset() {
classLoader = Thread.currentThread().getContextClassLoader();
writerUtil = new JavaFieldWriterUtil(conversionService);
writer = new JavaFieldWriter(writerUtil);
writer.setTargetValueConverter(new TargetValueConverter(classLoader, conversionService, writerUtil));
field = null;
segmentContexts = new LinkedList<>();
targetTestClassInstance = new TargetTestClass();
targetTestClassInstance.setContact(new TargetContact());
targetTestClassInstance.setAddress(new TargetAddress());
targetOrderListInstance = new TestListOrders();
targetOrderListInstance.setOrders(new LinkedList<>());
targetOrderListInstance.getOrders().add(new TargetOrder());
targetOrderListInstance.getOrders().add(new TargetOrder());
targetTestClassInstance.setListOrders(targetOrderListInstance);
targetOrderArrayInstance = new TargetOrderArray();
targetOrderArrayInstance.setOrders(new BaseOrder[2]);
targetOrderArrayInstance.getOrders()[0] = new TargetOrder();
targetOrderArrayInstance.getOrders()[1] = new TargetOrder();
targetTestClassInstance.setOrderArray(targetOrderArrayInstance);
audits = new Audits();
}
use of io.atlasmap.java.test.TargetTestClass in project atlasmap by atlasmap.
the class JavaFieldWriterTest method testClassLookupReflection.
@Test
public void testClassLookupReflection() throws Exception {
writer.setRootObject(new TargetTestClass());
write("/address/addressLine1", "123 any street");
TargetTestClass o = (TargetTestClass) writer.getRootObject();
ensureNotNullAndClass(o, TargetTestClass.class);
ensureNotNullAndClass(o.getAddress(), TargetAddress.class);
assertEquals("123 any street", o.getAddress().getAddressLine1());
}
use of io.atlasmap.java.test.TargetTestClass in project atlasmap by atlasmap.
the class JavaFieldWriterTest method testClassLookupAbstract.
@Test
public void testClassLookupAbstract() throws Exception {
writer.setRootObject(new TargetTestClass());
assertThrows(AtlasException.class, () -> {
write(createField("/orders[4]/address/addressLine1", "hello world."));
});
}
use of io.atlasmap.java.test.TargetTestClass in project atlasmap by atlasmap.
the class JavaFieldWriterTest method testSimpleClassLookup.
@Test
public void testSimpleClassLookup() throws Exception {
this.writer.setRootObject(new TargetTestClass());
write("/address/addressLine1", "123 any street");
TargetTestClass o = (TargetTestClass) writer.getRootObject();
ensureNotNullAndClass(o, TargetTestClass.class);
ensureNotNullAndClass(o.getAddress(), TargetAddress.class);
assertEquals("123 any street", o.getAddress().getAddressLine1());
}
Aggregations