use of org.kie.soup.project.datamodel.oracle.DropDownData in project drools-wb by kiegroup.
the class CallMethodWidget method valueEditor.
private Widget valueEditor(final CallFieldValue val) {
String type = "";
if (oracle.isGlobalVariable(this.mCall.getVariable())) {
type = oracle.getGlobalVariable(this.mCall.getVariable());
} else {
Map<String, String> mFactTypes = scenario.getVariableTypes();
type = mFactTypes.get(this.mCall.getVariable());
}
DropDownData enums = oracle.getEnums(type, val.field, this.mCall.getCallFieldValuesMap());
return new MethodParameterCallValueEditor(val, enums, executionTrace, scenario, val.type, oracle);
}
use of org.kie.soup.project.datamodel.oracle.DropDownData in project drools-wb by kiegroup.
the class EnumLoaderUtilitiesTest method checkEmptyDefinition.
@Test
public void checkEmptyDefinition() {
final Callback<Map<String, String>> callback = (result) -> assertTrue(result.isEmpty());
enumLoaderUtilities.getEnums(new DropDownData(), callback, presenter, onFetchCommand, onFetchCompleteCommand);
assertNoInteractions();
}
use of org.kie.soup.project.datamodel.oracle.DropDownData in project drools-wb by kiegroup.
the class ConstraintValueEditorHelperTest method testSimpleField.
@Test
public void testSimpleField() throws Exception {
AsyncPackageDataModelOracle oracle = mock(AsyncPackageDataModelOracle.class);
FactPattern pattern = new FactPattern();
SingleFieldConstraint constraint = new SingleFieldConstraint();
constraint.setFieldBinding("pp");
constraint.setFactType("House");
constraint.setFieldName("parent");
constraint.setFieldType("org.mortgages.Parent");
pattern.addConstraint(constraint);
model.addLhsItem(pattern);
when(oracle.getFieldClassName("House", "parent")).thenReturn("org.mortgages.Parent");
ConstraintValueEditorHelper helper = new ConstraintValueEditorHelper(model, oracle, "House", "parent", constraint, "Parent", new DropDownData());
helper.isApplicableBindingsInScope("pp", new Callback<Boolean>() {
@Override
public void callback(Boolean result) {
assertTrue(result);
}
});
}
use of org.kie.soup.project.datamodel.oracle.DropDownData in project drools-wb by kiegroup.
the class ConstraintValueEditorHelperTest method testBoundFieldOfDifferentType.
@Test
public void testBoundFieldOfDifferentType() throws Exception {
final AsyncPackageDataModelOracle oracle = mock(AsyncPackageDataModelOracle.class);
final FactPattern pattern = new FactPattern();
final SingleFieldConstraint isFinished = new SingleFieldConstraint();
isFinished.setFieldBinding("$finished");
isFinished.setFactType("House");
isFinished.setFieldName("finished");
isFinished.setFieldType("java.time.LocalDate");
isFinished.setOperator("!= null");
pattern.addConstraint(isFinished);
model.addLhsItem(pattern);
final SingleFieldConstraint isFinishedAfter = new SingleFieldConstraint();
isFinishedAfter.setFactType("House");
isFinishedAfter.setFieldName("cost");
isFinishedAfter.setFieldType("java.util.BigDecimal");
isFinishedAfter.setOperator("==");
pattern.addConstraint(isFinishedAfter);
model.addLhsItem(pattern);
when(oracle.getFieldClassName("House", "finished")).thenReturn("java.time.LocalDate");
when(oracle.getFieldClassName("House", "cost")).thenReturn("java.util.BigDecimal");
ConstraintValueEditorHelper helper = new ConstraintValueEditorHelper(model, oracle, "House", "cost", isFinished, "LocalDate", new DropDownData());
helper.isApplicableBindingsInScope("$finished", result -> assertFalse(result));
}
use of org.kie.soup.project.datamodel.oracle.DropDownData in project drools-wb by kiegroup.
the class ConstraintValueEditorHelperTest method isEnumEquivalentNullDropDownData.
@Test
public void isEnumEquivalentNullDropDownData() throws Exception {
final DropDownData dropDownData = null;
Assertions.assertThat(ConstraintValueEditorHelper.isEnumEquivalent(new String[] { "a", "b", "c" }, dropDownData)).isFalse();
}
Aggregations