use of org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenter_AuditLogTest method setupPresenter.
private void setupPresenter() {
dtPresenter = new GuidedDecisionTablePresenter(identity, null, null, null, null, null, refreshAttributesPanelEvent, refreshMetaDataPanelEvent, refreshConditionsPanelEvent, refreshActionsPanelEvent, refreshMenusEvent, null, null, gridWidgetColumnFactory, oracleFactory, synchronizer, beanManager, lockManager, null, null, decisionTableAnalyzerProvider, enumLoaderUtilities, pluginHandler, authorizationManager, sessionInfo) {
@Override
void initialiseLockManager() {
// Do nothing for tests
}
@Override
GuidedDecisionTableView makeView(final Set<PortableWorkDefinition> workItemDefinitions) {
return view;
}
@Override
void initialiseModels() {
// Do nothing for tests
}
};
final AsyncPackageDataModelOracle dmo = mock(AsyncPackageDataModelOracle.class);
final PackageDataModelOracleBaselinePayload dmoBaseline = mock(PackageDataModelOracleBaselinePayload.class);
final Set<PortableWorkDefinition> workItemDefinitions = Collections.emptySet();
final Overview overview = mock(Overview.class);
dtContent = new GuidedDecisionTableEditorContent(model, workItemDefinitions, overview, dmoBaseline);
when(oracleFactory.makeAsyncPackageDataModelOracle(any(Path.class), any(GuidedDecisionTable52.class), eq(dmoBaseline))).thenReturn(dmo);
dtPresenter.setContent(null, mock(PlaceRequest.class), dtContent, modellerPresenter, false);
when(view.getLayer()).thenReturn(mock(Layer.class));
}
use of org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method checkMayCloseWithCleanDecisionTable.
@Test
public void checkMayCloseWithCleanDecisionTable() {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
when(dtPresenter.getOriginalHashCode()).thenReturn(0);
when(modeller.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {
{
add(dtPresenter);
}
});
assertTrue(presenter.mayClose());
}
use of org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method checkOnDecisionTableSelectedWhenAvailableSelected.
@Test
public void checkOnDecisionTableSelectedWhenAvailableSelected() {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
final DecisionTableSelectedEvent event = new DecisionTableSelectedEvent(dtPresenter);
when(modeller.isDecisionTableAvailable(any(GuidedDecisionTableView.Presenter.class))).thenReturn(true);
when(presenter.getActiveDocument()).thenReturn(dtPresenter);
presenter.onDecisionTableSelected(event);
verify(presenter, never()).activateDocument(any(GuidedDecisionTableView.Presenter.class));
assertTrue(getMenuState(presenter.getMenus(), MenuItems.VALIDATE));
}
use of org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method checkOnDecisionTableSelectedWhenNotAvailable.
@Test
public void checkOnDecisionTableSelectedWhenNotAvailable() {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
final DecisionTableSelectedEvent event = new DecisionTableSelectedEvent(dtPresenter);
when(modeller.isDecisionTableAvailable(any(GuidedDecisionTableView.Presenter.class))).thenReturn(false);
presenter.onDecisionTableSelected(event);
verify(presenter, never()).activateDocument(any(GuidedDecisionTableView.Presenter.class));
assertTrue(getMenuState(presenter.getMenus(), MenuItems.VALIDATE));
}
use of org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method checkOnDecisionTableSelectedEventReselection.
@Test
public void checkOnDecisionTableSelectedEventReselection() {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
final DecisionTableSelectedEvent eventSelect = new DecisionTableSelectedEvent(dtPresenter);
doReturn(true).when(modeller).isDecisionTableAvailable(dtPresenter);
presenter.onStartup(path, placeRequest);
presenter.onDecisionTableSelected(eventSelect);
assertEquals(dtPresenter, presenter.getActiveDocument());
final DecisionTableSelectedEvent eventDeselect = DecisionTableSelectedEvent.NONE;
presenter.onDecisionTableSelected(eventDeselect);
assertNull(presenter.getActiveDocument());
presenter.onDecisionTableSelected(eventSelect);
assertEquals(dtPresenter, presenter.getActiveDocument());
}
Aggregations