use of org.kie.workbench.common.widgets.client.datamodel.testclasses.Purchase in project kie-wb-common by kiegroup.
the class PackageDataModelParametricTypesTest method testParametricMethod.
@Test
public void testParametricMethod() throws Exception {
final ModuleDataModelOracle moduleLoader = ModuleDataModelOracleBuilder.newModuleOracleBuilder(new RawMVELEvaluator()).addClass(Purchase.class).build();
final PackageDataModelOracle packageLoader = PackageDataModelOracleBuilder.newPackageOracleBuilder(new RawMVELEvaluator(), "org.kie.workbench.common.widgets.client.datamodel.testclasses").setModuleOracle(moduleLoader).build();
// Emulate server-to-client conversions
final Caller<IncrementalDataModelService> service = new MockIncrementalDataModelServiceCaller(packageLoader);
final AsyncPackageDataModelOracle oracle = new AsyncPackageDataModelOracleImpl(service, validatorInstance);
final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload();
dataModel.setPackageName(packageLoader.getPackageName());
dataModel.setModelFields(packageLoader.getModuleModelFields());
dataModel.setFieldParametersType(packageLoader.getModuleFieldParametersType());
PackageDataModelOracleTestUtils.populateDataModelOracle(mock(Path.class), new MockHasImports(), oracle, dataModel);
assertNotNull(oracle);
assertEquals("Product", oracle.getParametricFieldType("Purchase", "customerPurchased(Integer)"));
}
Aggregations