use of org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testOnRefreshConditionsPanelEvent.
@Test
public void testOnRefreshConditionsPanelEvent() {
final RefreshConditionsPanelEvent event = mock(RefreshConditionsPanelEvent.class);
final GuidedDecisionTableView.Presenter eventPresenter = mock(GuidedDecisionTableView.Presenter.class);
final List<CompositeColumn<? extends BaseColumn>> columns = new ArrayList<>();
doReturn(eventPresenter).when(event).getPresenter();
doReturn(columns).when(event).getColumns();
doNothing().when(presenter).refreshConditionsWidget(any());
doNothing().when(presenter).refreshColumnsNoteInfo(any());
presenter.onRefreshConditionsPanelEvent(event);
verify(presenter).refreshConditionsWidget(columns);
verify(presenter).refreshColumnsNoteInfo(eventPresenter);
}
use of org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefresh.
@Test
public void testRefresh() {
final GuidedDecisionTable52 guidedDecisionTable52 = mock(GuidedDecisionTable52.class);
doReturn(Optional.of(guidedDecisionTable52)).when(presenter).getGuidedDecisionTable52();
doNothing().when(presenter).refreshAttributeWidget(any());
doNothing().when(presenter).refreshMetaDataWidget(any());
doNothing().when(presenter).refreshConditionsWidget(any());
doNothing().when(presenter).refreshActionsWidget(any());
final List<AttributeCol52> attributeCol52s = new ArrayList<>();
final List<MetadataCol52> metadataCol52s = new ArrayList<>();
final List<CompositeColumn<? extends BaseColumn>> compositeColumns = new ArrayList<>();
final List<ActionCol52> actionCol52s = new ArrayList<>();
doReturn(attributeCol52s).when(guidedDecisionTable52).getAttributeCols();
doReturn(metadataCol52s).when(guidedDecisionTable52).getAttributeCols();
doReturn(compositeColumns).when(guidedDecisionTable52).getAttributeCols();
doReturn(actionCol52s).when(guidedDecisionTable52).getAttributeCols();
presenter.refresh();
verify(presenter).refreshAttributeWidget(attributeCol52s);
verify(presenter).refreshMetaDataWidget(metadataCol52s);
verify(presenter).refreshConditionsWidget(compositeColumns);
verify(presenter).refreshActionsWidget(actionCol52s);
}
use of org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testGroupByTitle.
@Test
public void testGroupByTitle() {
final List<CompositeColumn<? extends BaseColumn>> conditions = new ArrayList<CompositeColumn<? extends BaseColumn>>() {
{
add(compositeColumn1);
add(compositeColumn2);
add(compositeColumn3);
}
};
final String title1 = "title1";
final String title2 = "title2";
doReturn(title1).when(compositeColumn1).getHeader();
doReturn(title2).when(compositeColumn2).getHeader();
doReturn(title1).when(compositeColumn3).getHeader();
final Map<String, List<BaseColumn>> columnGroups = presenter.groupByTitle(conditions);
final List<BaseColumn> actualTitle1List = columnGroups.get(title1);
final List<BaseColumn> actualTitle2List = columnGroups.get(title2);
final ArrayList<CompositeColumn<? extends BaseColumn>> expectedTitle1List = new ArrayList<CompositeColumn<? extends BaseColumn>>() {
{
add(compositeColumn1);
add(compositeColumn3);
}
};
final ArrayList<CompositeColumn<? extends BaseColumn>> expectedTitle2List = new ArrayList<CompositeColumn<? extends BaseColumn>>() {
{
add(compositeColumn2);
}
};
assertEquals(2, columnGroups.size());
assertEquals(actualTitle1List, expectedTitle1List);
assertEquals(actualTitle2List, expectedTitle2List);
}
use of org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn in project drools-wb by kiegroup.
the class ActionSetFactPluginTest method mockPatterns.
private void mockPatterns() {
final GuidedDecisionTable52 model = mock(GuidedDecisionTable52.class);
final List<CompositeColumn<?>> patterns = Collections.singletonList(fakePattern());
final List<ActionCol52> actions = Arrays.asList(fakeActionCol(), fakeActionCol());
when(model.getConditions()).thenReturn(patterns);
when(model.getActionCols()).thenReturn(actions);
when(presenter.getModel()).thenReturn(model);
}
use of org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn in project drools-wb by kiegroup.
the class GridWidgetColumnFactoryImplTest method columnResizingListenerSetup_ActionSetFieldColumn.
@Test
public void columnResizingListenerSetup_ActionSetFieldColumn() {
final Pattern52 pattern = mock(Pattern52.class);
final ActionSetFieldCol52 column = new ActionSetFieldCol52();
column.setFactField("MyField");
column.setHeader("MyColumn");
column.setBoundName("$f");
when(model.getConditions()).thenReturn(new ArrayList<CompositeColumn<? extends BaseColumn>>() {
{
add(pattern);
}
});
when(pattern.getFactType()).thenReturn("MyFact");
when(pattern.getBoundName()).thenReturn("$f");
when(pattern.isBound()).thenReturn(true);
when(oracle.getFieldType("MyFact", "MyField")).thenReturn(DataType.TYPE_STRING);
final GridColumn<?> uiColumn = factory.convertColumn(column, access, gridWidget);
assertTrue(uiColumn instanceof BaseUiColumn);
assertEquals((int) uiColumn.getWidth(), column.getWidth());
uiColumn.setWidth(200.0);
assertEquals(200, column.getWidth());
}
Aggregations