use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.
the class JavaConstructServiceComplexTest method testConstructTargetOrderFiltered.
@Test
public void testConstructTargetOrderFiltered() throws Exception {
JavaClass javaClass = generateOrder("Target");
Object targetObject = constructService.constructClass(javaClass, Arrays.asList("address"));
assertNotNull(targetObject);
assertTrue(targetObject instanceof TargetOrder);
TargetOrder order = (TargetOrder) targetObject;
assertNotNull(order.getAddress());
assertTrue(order.getAddress() instanceof TargetAddress);
TargetAddress address = (TargetAddress) order.getAddress();
assertNull(address.getAddressLine1());
assertNull(address.getAddressLine2());
assertNull(address.getCity());
assertNull(address.getState());
assertNull(address.getZipCode());
assertNull(order.getContact());
}
use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.
the class JavaConstructServiceSimpleTest method generateJavaClass.
protected JavaClass generateJavaClass(String className) {
JavaClass j = new JavaClass();
j.setClassName(className);
return j;
}
use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.
the class JavaConstructServiceTest method generateJavaClassInvalidEmptyClassName.
protected JavaClass generateJavaClassInvalidEmptyClassName() {
JavaClass j = new JavaClass();
j.setClassName("");
return j;
}
use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.
the class JavaConstructServiceTest method testConstructClassCollectionList.
@Test
public void testConstructClassCollectionList() throws Exception {
JavaClass javaClass = generateJavaClassCollection("java.lang.String", CollectionType.LIST, null, null);
javaClass.setCollectionClassName("java.util.ArrayList");
Object stringList = constructService.constructClass(javaClass, null);
assertNotNull(stringList);
assertTrue(stringList instanceof ArrayList<?>);
assertTrue(((List<?>) stringList).isEmpty());
}
use of io.atlasmap.java.v2.JavaClass in project atlasmap by atlasmap.
the class ClassInspectionService method inspectClass.
public JavaClass inspectClass(String className, String classpath) throws InspectionException {
if (LOG.isDebugEnabled()) {
LOG.debug("Inspecting class: " + className + ", classPath: " + classpath);
}
if (className == null || classpath == null) {
throw new InspectionException("ClassName and Classpath must be specified");
}
JavaClass d = null;
try {
JarClassLoader jcl = new JarClassLoader(new String[] { "target/reference-jars" });
Class<?> clazz = jcl.loadClass(className);
d = inspectClass(jcl, clazz);
} catch (ClassNotFoundException cnfe) {
if (LOG.isDebugEnabled()) {
LOG.debug("Class was not found: " + className);
}
d = AtlasJavaModelFactory.createJavaClass();
d.setClassName(className);
d.setStatus(FieldStatus.NOT_FOUND);
}
return d;
}
Aggregations