Search in sources :

Example 1 with GuidedDecisionTableAccordionItem

use of org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem in project drools-wb by kiegroup.

the class ColumnsPagePresenterTest method testRefreshActionsWidgetWhenActionColumnsIsEmpty.

@Test
public void testRefreshActionsWidgetWhenActionColumnsIsEmpty() {
    final List<ActionCol52> actionColumns = new ArrayList<>();
    final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
    final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
    final Label blankSlate = mock(Label.class);
    doReturn(verticalPanel).when(presenter).getActionsWidget();
    doReturn(columnManagementView).when(presenter).getActionsPanel();
    doReturn(blankSlate).when(presenter).blankSlate();
    doReturn(item).when(accordion).getItem(ACTION);
    presenter.refreshActionsWidget(actionColumns);
    verify(item).setOpen(false);
    verify(verticalPanel).add(blankSlate);
    verify(verticalPanel, never()).add(columnManagementView);
    verify(columnManagementView, never()).renderColumns(any());
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) ArrayList(java.util.ArrayList) ColumnManagementView(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnManagementView) Label(com.google.gwt.user.client.ui.Label) GuidedDecisionTableAccordionItem(org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem) Test(org.junit.Test)

Example 2 with GuidedDecisionTableAccordionItem

use of org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem in project drools-wb by kiegroup.

the class ColumnsPagePresenterTest method testRefreshConditionsWidgetWhenConditionColumnsIsNotEmpty.

@Test
public void testRefreshConditionsWidgetWhenConditionColumnsIsNotEmpty() {
    final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
    final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
    final Label blankSlate = mock(Label.class);
    final List<CompositeColumn<? extends BaseColumn>> conditions1 = new ArrayList<CompositeColumn<? extends BaseColumn>>() {

        {
            add(compositeColumn1);
        }
    };
    final Map<String, List<BaseColumn>> conditions2 = new HashMap<String, List<BaseColumn>>() {

        {
            put("title", new ArrayList<>());
        }
    };
    doReturn(verticalPanel).when(presenter).getConditionsWidget();
    doReturn(columnManagementView).when(presenter).getConditionsPanel();
    doReturn(blankSlate).when(presenter).blankSlate();
    doReturn(item).when(accordion).getItem(CONDITION);
    doReturn(conditions2).when(presenter).groupByTitle(conditions1);
    presenter.refreshConditionsWidget(conditions1);
    verify(item, never()).setOpen(false);
    verify(verticalPanel, never()).add(blankSlate);
    verify(verticalPanel).add(columnManagementView);
    verify(columnManagementView).renderColumns(conditions2);
}
Also used : HashMap(com.google.gwt.dev.util.collect.HashMap) ColumnManagementView(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnManagementView) Label(com.google.gwt.user.client.ui.Label) ArrayList(java.util.ArrayList) GuidedDecisionTableAccordionItem(org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) List(java.util.List) ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) CompositeColumn(org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn) Test(org.junit.Test)

Example 3 with GuidedDecisionTableAccordionItem

use of org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem in project drools-wb by kiegroup.

the class ColumnsPagePresenterTest method testRefreshConditionsWidgetWhenConditionColumnsIsEmpty.

@Test
public void testRefreshConditionsWidgetWhenConditionColumnsIsEmpty() {
    final List<CompositeColumn<? extends BaseColumn>> conditions = new ArrayList<>();
    final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
    final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
    final Label blankSlate = mock(Label.class);
    doReturn(verticalPanel).when(presenter).getConditionsWidget();
    doReturn(columnManagementView).when(presenter).getConditionsPanel();
    doReturn(blankSlate).when(presenter).blankSlate();
    doReturn(item).when(accordion).getItem(CONDITION);
    presenter.refreshConditionsWidget(conditions);
    verify(item).setOpen(false);
    verify(verticalPanel).add(blankSlate);
    verify(verticalPanel, never()).add(columnManagementView);
    verify(columnManagementView, never()).renderColumns(any());
}
Also used : ArrayList(java.util.ArrayList) ColumnManagementView(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnManagementView) Label(com.google.gwt.user.client.ui.Label) GuidedDecisionTableAccordionItem(org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) CompositeColumn(org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn) Test(org.junit.Test)

Example 4 with GuidedDecisionTableAccordionItem

use of org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem in project drools-wb by kiegroup.

the class ColumnsPagePresenterTest method testRefreshActionsWidgetWhenActionColumnsIsNotEmpty.

@Test
public void testRefreshActionsWidgetWhenActionColumnsIsNotEmpty() {
    final ColumnManagementView columnManagementView = mock(ColumnManagementView.class);
    final GuidedDecisionTableAccordionItem item = mock(GuidedDecisionTableAccordionItem.class);
    final Label blankSlate = mock(Label.class);
    final ActionCol52 actionCol52 = mock(ActionCol52.class);
    final List<ActionCol52> actionColumns1 = new ArrayList<ActionCol52>() {

        {
            add(actionCol52);
        }
    };
    final Map<String, List<BaseColumn>> actionColumns2 = new HashMap<String, List<BaseColumn>>() {

        {
            put("title", new ArrayList<>());
        }
    };
    doReturn(verticalPanel).when(presenter).getActionsWidget();
    doReturn(columnManagementView).when(presenter).getActionsPanel();
    doReturn(blankSlate).when(presenter).blankSlate();
    doReturn(item).when(accordion).getItem(ACTION);
    doReturn(actionColumns2).when(presenter).groupByTitle(actionColumns1);
    presenter.refreshActionsWidget(actionColumns1);
    verify(item, never()).setOpen(false);
    verify(verticalPanel, never()).add(blankSlate);
    verify(verticalPanel).add(columnManagementView);
    verify(columnManagementView).renderColumns(actionColumns2);
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) HashMap(com.google.gwt.dev.util.collect.HashMap) ColumnManagementView(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnManagementView) Label(com.google.gwt.user.client.ui.Label) ArrayList(java.util.ArrayList) GuidedDecisionTableAccordionItem(org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem) List(java.util.List) ArrayList(java.util.ArrayList) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Aggregations

Label (com.google.gwt.user.client.ui.Label)4 ArrayList (java.util.ArrayList)4 GuidedDecisionTableAccordionItem (org.drools.workbench.screens.guided.dtable.client.editor.page.accordion.GuidedDecisionTableAccordionItem)4 ColumnManagementView (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.control.ColumnManagementView)4 Test (org.junit.Test)4 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)3 HashMap (com.google.gwt.dev.util.collect.HashMap)2 List (java.util.List)2 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)2 CompositeColumn (org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn)2 Matchers.anyString (org.mockito.Matchers.anyString)2