use of org.kie.soup.project.datamodel.commons.oracle.ModuleDataModelOracleImpl in project kie-wb-common by kiegroup.
the class PackageDataModelFactAnnotationsTest method testIncorrectPackageDMOAnnotationAttributes.
@Test
public void testIncorrectPackageDMOAnnotationAttributes() throws Exception {
// Build ModuleDMO
final ModuleDataModelOracleBuilder moduleBuilder = ModuleDataModelOracleBuilder.newModuleOracleBuilder(new RawMVELEvaluator());
final ModuleDataModelOracleImpl moduleLoader = new ModuleDataModelOracleImpl();
final ClassFactBuilder cb = new ClassFactBuilder(moduleBuilder, Smurf.class, false, type -> TypeSource.JAVA_PROJECT);
cb.build(moduleLoader);
// Build PackageDMO. Defaults to defaultpkg
final PackageDataModelOracleBuilder packageBuilder = PackageDataModelOracleBuilder.newPackageOracleBuilder(new RawMVELEvaluator());
packageBuilder.setModuleOracle(moduleLoader);
final PackageDataModelOracle packageLoader = packageBuilder.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.setTypeAnnotations(packageLoader.getModuleTypeAnnotations());
dataModel.setTypeFieldsAnnotations(packageLoader.getModuleTypeFieldsAnnotations());
PackageDataModelOracleTestUtils.populateDataModelOracle(mock(Path.class), new MockHasImports(), oracle, dataModel);
assertEquals(0, oracle.getFactTypes().length);
oracle.getTypeAnnotations("Smurf", new Callback<Set<Annotation>>() {
@Override
public void callback(final Set<Annotation> annotations) {
assertNotNull(annotations);
assertEquals(0, annotations.size());
}
});
}
use of org.kie.soup.project.datamodel.commons.oracle.ModuleDataModelOracleImpl in project drools-wb by kiegroup.
the class RuleModellerConditionSelectorPopupTest method setupAsyncPackageDataModelOracle.
private void setupAsyncPackageDataModelOracle() {
// DSL sentences enabled
doReturn(true).when(ruleModeller).isDSLEnabled();
// Setup Facts
final ModuleDataModelOracle moduleDataModelOracle = new ModuleDataModelOracleImpl();
moduleDataModelOracle.addModuleModelFields(new HashMap<String, ModelField[]>() {
{
put("Applicant", new ModelField[] { new ModelField("this", "Applicant", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.BOTH, "Applicant") });
}
});
// DSL Conditions present
dataModel = PackageDataModelOracleBuilder.newPackageOracleBuilder(new RawMVELEvaluator()).addExtension(DSLConditionSentence.INSTANCE, Collections.singletonList(dslSentence)).setModuleOracle(moduleDataModelOracle).build();
dataModelPayload = new PackageDataModelOracleBaselinePayload();
dataModelPayload.setModelFields(dataModel.getModuleModelFields());
dataModelPayload.setAllPackageElements(dataModel.getAllExtensions());
asyncPackageDataModelOracleFactory.makeAsyncPackageDataModelOracle(resourcePath, dataModelPayload);
}
use of org.kie.soup.project.datamodel.commons.oracle.ModuleDataModelOracleImpl in project drools-wb by kiegroup.
the class TestDslFileIndexer method getModuleDataModelOracle.
@Override
protected ModuleDataModelOracle getModuleDataModelOracle(final Path path) {
final ModuleDataModelOracle dmo = new ModuleDataModelOracleImpl();
dmo.addModuleModelFields(new HashMap<String, ModelField[]>() {
{
put("org.drools.workbench.screens.dsltext.backend.server.indexing.classes.Applicant", new ModelField[] { new ModelField("age", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER) });
put("org.drools.workbench.screens.dsltext.backend.server.indexing.classes.Mortgage", new ModelField[] { new ModelField("amount", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER), new ModelField("applicant", "org.drools.workbench.screens.dsltext.backend.server.indexing.classes.Applicant", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, "org.drools.workbench.screens.dsltext.backend.server.indexing.classes.Applicant") });
}
});
return dmo;
}
use of org.kie.soup.project.datamodel.commons.oracle.ModuleDataModelOracleImpl in project drools-wb by kiegroup.
the class TestGuidedRuleDrlFileIndexer method getModuleDataModelOracle.
@Override
protected ModuleDataModelOracle getModuleDataModelOracle(final Path path) {
final ModuleDataModelOracle dmo = new ModuleDataModelOracleImpl();
dmo.addModuleModelFields(new HashMap<String, ModelField[]>() {
{
put("org.drools.workbench.screens.guided.rule.backend.server.indexing.classes.Applicant", new ModelField[] { new ModelField("age", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER) });
put("org.drools.workbench.screens.guided.rule.backend.server.indexing.classes.Mortgage", new ModelField[] { new ModelField("amount", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER), new ModelField("applicant", "org.drools.workbench.screens.guided.rule.backend.server.indexing.classes.Applicant", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, "org.drools.workbench.screens.guided.rule.backend.server.indexing.classes.Applicant") });
}
});
return dmo;
}
use of org.kie.soup.project.datamodel.commons.oracle.ModuleDataModelOracleImpl in project drools-wb by kiegroup.
the class TestDecisionTableXLSFileIndexer method getModuleDataModelOracle.
@Override
protected ModuleDataModelOracle getModuleDataModelOracle(final Path path) {
final ModuleDataModelOracle dmo = new ModuleDataModelOracleImpl();
dmo.addModuleModelFields(new HashMap<String, ModelField[]>() {
{
put("org.drools.workbench.screens.dtablexls.backend.server.indexing.classes.Applicant", new ModelField[] { new ModelField("age", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER) });
put("org.drools.workbench.screens.dtablexls.backend.server.indexing.classes.Mortgage", new ModelField[] { new ModelField("amount", "java.lang.Integer", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, DataType.TYPE_NUMERIC_INTEGER), new ModelField("applicant", "org.drools.workbench.screens.dtablexls.backend.server.indexing.classes.Applicant", ModelField.FIELD_CLASS_TYPE.REGULAR_CLASS, ModelField.FIELD_ORIGIN.DECLARED, FieldAccessorsAndMutators.ACCESSOR, "org.drools.workbench.screens.dtablexls.backend.server.indexing.classes.Applicant") });
}
});
return dmo;
}
Aggregations