use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class ConditionColumnPluginTest method testIsFieldBindingValidWhenPluginBindingAndFactPatternBoundNameHaveTheSameValue.
@Test
public void testIsFieldBindingValidWhenPluginBindingAndFactPatternBoundNameHaveTheSameValue() {
final PatternWrapper patternWrapper = mock(PatternWrapper.class);
final FactPattern factPattern = new FactPattern() {
{
setBoundName("$fact");
}
};
doReturn(BaseSingleFieldConstraint.TYPE_LITERAL).when(plugin).constraintValue();
doReturn(factPattern).when(patternWrapper).makeFactPattern();
doReturn(patternWrapper).when(plugin).patternWrapper();
doReturn("$fact").when(plugin).getBinding();
assertFalse(plugin.isFieldBindingValid());
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class ConditionColumnPluginTest method testSetValueList.
@Test
public void testSetValueList() throws Exception {
final String valueList = "valueList";
final DTCellValue52 cellValue52 = mock(DTCellValue52.class);
final PatternWrapper pattern = mock(PatternWrapper.class);
final DataType.DataTypes dataTypes = DataType.DataTypes.STRING;
plugin.setupDefaultValues();
doReturn("FactType").when(pattern).getFactType();
doReturn(dataTypes).when(cellValue52).getDataType();
doReturn(cellValue52).when(editingCol).getDefaultValue();
doReturn(editingCol).when(plugin).editingCol();
doReturn(pattern).when(plugin).patternWrapper();
doReturn(oracle).when(presenter).getDataModelOracle();
plugin.setValueList(valueList);
verify(editingCol).setValueList(valueList);
verify(plugin).assertDefaultValue();
verify(plugin).fireChangeEvent(valueOptionsPage);
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class PatternPageTest method testSetEditingPattern.
@Test
public void testSetEditingPattern() throws Exception {
when(view.getEntryPointName()).thenReturn("entryPoint");
final PatternWrapper pattern = spy(newPattern("factType1", "boundName1", false));
page.setEditingPattern(pattern);
verify(pattern).setEntryPointName("entryPoint");
verify(plugin).setEditingPattern(pattern);
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class NewPatternPresenterTest method testAddPatternWhenIsNegatePatternMatch.
@Test
public void testAddPatternWhenIsNegatePatternMatch() throws Exception {
final PatternWrapper pattern52 = mock(PatternWrapper.class);
doReturn("").when(view).getSelectedFactType();
doReturn("").when(view).getBindingText();
doReturn(true).when(view).isNegatePatternMatch();
doReturn(pattern52).when(presenter).pattern52();
presenter.addPattern();
verify(patternPage).setEditingPattern(pattern52);
verify(patternPage).prepareView();
verify(view).hide();
verify(view, never()).showError(any());
}
use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.
the class ActionSetFactPluginTest method testNewPatternWrapperWhenPatternIsNotFound.
@Test
public void testNewPatternWrapperWhenPatternIsNotFound() throws Exception {
final Set<PatternWrapper> actionWrappers = new HashSet<>();
final ActionWrapper actionWrapper = mockActionWrapper("boundName", "factType");
doReturn(actionWrappers).when(plugin).getPatterns();
final PatternWrapper patternWrapper = plugin.newPatternWrapper(actionWrapper);
assertEquals(actionWrapper.getBoundName(), patternWrapper.getBoundName());
assertEquals(actionWrapper.getFactType(), patternWrapper.getFactType());
}
Aggregations