use of org.kie.workbench.common.services.datamodel.backend.server.builder.projects.ModuleDataModelOracleBuilder in project kie-wb-common by kiegroup.
the class ModuleDataModelFactFieldsGenericsTest method testModuleDMOGenericParameters.
@Test
public void testModuleDMOGenericParameters() throws Exception {
final ModuleDataModelOracleBuilder builder = ModuleDataModelOracleBuilder.newModuleOracleBuilder(new RawMVELEvaluator());
final ModuleDataModelOracleImpl oracle = new ModuleDataModelOracleImpl();
final ClassFactBuilder cb = new ClassFactBuilder(builder, ProductOrder.class, false, TypeSource.JAVA_PROJECT);
cb.build(oracle);
assertEquals(1, oracle.getModuleModelFields().size());
assertContains(ProductOrder.class.getName(), oracle.getModuleModelFields().keySet());
assertEquals(2, oracle.getModuleFieldParametersType().size());
String genericType = oracle.getModuleFieldParametersType().get(ProductOrder.class.getName() + "#products");
assertNotNull(genericType);
assertEquals(Product.class.getName(), genericType);
genericType = oracle.getModuleFieldParametersType().get(ProductOrder.class.getName() + "#productComparator");
assertNotNull(genericType);
assertEquals(Product.class.getName(), genericType);
assertNotNull(cb.getInternalBuilders().get(Product.class.getName()));
}
use of org.kie.workbench.common.services.datamodel.backend.server.builder.projects.ModuleDataModelOracleBuilder in project kie-wb-common by kiegroup.
the class ModuleDataModelOracleUtilsTest method init.
@Before
public void init() {
try {
ModuleDataModelOracleUtilsTest.class.getClassLoader().loadClass(ExternalPojo1.class.getName());
ModuleDataModelOracleBuilder dmoBuilder = ModuleDataModelOracleBuilder.newModuleOracleBuilder(new RawMVELEvaluator());
dmoBuilder.addPackage(TEST_PACKAGE);
dmoBuilder.addClass(ExternalPojo1.class, false, TypeSource.JAVA_DEPENDENCY);
dmoBuilder.addClass(ExternalPojo2.class, false, TypeSource.JAVA_DEPENDENCY);
dmoBuilder.addClass(ExternalEnum1.class, false, TypeSource.JAVA_DEPENDENCY);
dmoBuilder.addClass(ExternalEnum2.class, false, TypeSource.JAVA_DEPENDENCY);
dataModelOracle = dmoBuilder.build();
} catch (Exception e) {
fail("Model loading failed: " + e.getMessage());
}
}
Aggregations