Search in sources :

Example 21 with PatternWrapper

use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.

the class ActionSetFactPluginTest method testIsNewFactPatternWhenIsNew.

@Test
public void testIsNewFactPatternWhenIsNew() throws Exception {
    mockPatterns();
    plugin.setEditingPattern(new PatternWrapper("factType", "bananna"));
    assertTrue(plugin.isNewFactPattern());
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) Test(org.junit.Test)

Example 22 with PatternWrapper

use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.

the class ActionSetFactPluginTest method testGetFactType.

@Test
public void testGetFactType() {
    final PatternWrapper patternWrapper = mock(PatternWrapper.class);
    final String expectedFactType = "factType";
    when(patternWrapper.getFactType()).thenReturn(expectedFactType);
    when(plugin.patternWrapper()).thenReturn(patternWrapper);
    final String actualFactType = plugin.getFactType();
    verify(patternWrapper).getFactType();
    assertEquals(expectedFactType, actualFactType);
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) Test(org.junit.Test)

Example 23 with PatternWrapper

use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.

the class ActionSetFactPluginTest method testNewPatternWrapperWhenPatternIsFound.

@Test
public void testNewPatternWrapperWhenPatternIsFound() throws Exception {
    final PatternWrapper expectedWrapper = mockPatternWrapper("boundName");
    final Set<PatternWrapper> actionWrappers = new HashSet<PatternWrapper>() {

        {
            add(expectedWrapper);
        }
    };
    doReturn(actionWrappers).when(plugin).getPatterns();
    final PatternWrapper actualWrapper = plugin.newPatternWrapper(mockActionWrapper("boundName", "factType"));
    assertSame(expectedWrapper, actualWrapper);
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 24 with PatternWrapper

use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.

the class ActionSetFactPluginTest method testSetFactFieldWhenColumnIsNotNew.

@Test
public void testSetFactFieldWhenColumnIsNotNew() {
    final ActionInsertFactWrapper actionWrapper = mock(ActionInsertFactWrapper.class);
    final PatternWrapper patternWrapperMock = patternWrapperMock("factType", "boundName");
    doReturn(false).when(plugin).isNewColumn();
    doReturn(true).when(plugin).isNewFactPattern();
    doReturn(actionWrapper).when(plugin).editingWrapper();
    doReturn(patternWrapperMock).when(plugin).patternWrapper();
    doReturn("type").when(oracle).getFieldType(any(), any());
    plugin.setFactField("selectedValue");
    verify(actionWrapper).setFactField(eq("selectedValue"));
    verify(actionWrapper).setFactType(eq("factType"));
    verify(actionWrapper).setBoundName(eq("boundName"));
    verify(actionWrapper).setType(eq("type"));
    verify(plugin).fireChangeEvent(fieldPage);
    verify(plugin, never()).newActionInsertFactWrapper();
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) ActionInsertFactWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionInsertFactWrapper) Test(org.junit.Test)

Example 25 with PatternWrapper

use of org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper in project drools-wb by kiegroup.

the class PatternPage method setSelectedEditingPattern.

void setSelectedEditingPattern() {
    final String selectedValue = view.getSelectedValue();
    final PatternWrapper patternWrapper = findPatternWrapperByKey(selectedValue);
    setEditingPattern(patternWrapper);
}
Also used : PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper)

Aggregations

PatternWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper)52 Test (org.junit.Test)41 HashSet (java.util.HashSet)11 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)9 BRLRuleModel (org.drools.workbench.models.guided.dtable.shared.model.BRLRuleModel)6 Mockito.anyString (org.mockito.Mockito.anyString)6 DTColumnConfig52 (org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52)4 ActionWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWrapper)4 FactPattern (org.drools.workbench.models.datamodel.rule.FactPattern)3 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)3 ActionWorkItemWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemWrapper)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Optional (java.util.Optional)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 Dependent (javax.enterprise.context.Dependent)2 Event (javax.enterprise.event.Event)2 Inject (javax.inject.Inject)2 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)2