Search in sources :

Example 21 with ModuleDataModelOracleBuilder

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()));
}
Also used : RawMVELEvaluator(org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator) Product(org.kie.workbench.common.services.datamodel.backend.server.testclasses.Product) ModuleDataModelOracleImpl(org.kie.soup.project.datamodel.commons.oracle.ModuleDataModelOracleImpl) ClassFactBuilder(org.kie.workbench.common.services.datamodel.backend.server.builder.projects.ClassFactBuilder) ProductOrder(org.kie.workbench.common.services.datamodel.backend.server.testclasses.ProductOrder) ModuleDataModelOracleBuilder(org.kie.workbench.common.services.datamodel.backend.server.builder.projects.ModuleDataModelOracleBuilder) Test(org.junit.Test)

Example 22 with ModuleDataModelOracleBuilder

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());
    }
}
Also used : RawMVELEvaluator(org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator) ExternalPojo1(org.kie.workbench.common.services.datamodeller.driver.testclasses.ExternalPojo1) ModuleDataModelOracleBuilder(org.kie.workbench.common.services.datamodel.backend.server.builder.projects.ModuleDataModelOracleBuilder) Before(org.junit.Before)

Aggregations

ModuleDataModelOracleBuilder (org.kie.workbench.common.services.datamodel.backend.server.builder.projects.ModuleDataModelOracleBuilder)22 RawMVELEvaluator (org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator)21 ClassFactBuilder (org.kie.workbench.common.services.datamodel.backend.server.builder.projects.ClassFactBuilder)21 ModuleDataModelOracleImpl (org.kie.soup.project.datamodel.commons.oracle.ModuleDataModelOracleImpl)20 Test (org.junit.Test)19 Annotation (org.kie.soup.project.datamodel.oracle.Annotation)14 Set (java.util.Set)12 PackageDataModelOracle (org.kie.soup.project.datamodel.oracle.PackageDataModelOracle)12 PackageDataModelOracleBuilder (org.kie.workbench.common.services.datamodel.backend.server.builder.packages.PackageDataModelOracleBuilder)12 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)12 IncrementalDataModelService (org.kie.workbench.common.services.datamodel.service.IncrementalDataModelService)12 Path (org.uberfire.backend.vfs.Path)12 Map (java.util.Map)4 FactBuilder (org.kie.workbench.common.services.datamodel.backend.server.builder.projects.FactBuilder)3 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1 ModuleDataModelOracle (org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle)1 Product (org.kie.workbench.common.services.datamodel.backend.server.testclasses.Product)1