Search in sources :

Example 6 with Overview

use of org.guvnor.common.services.shared.metadata.model.Overview in project drools-wb by kiegroup.

the class GuidedDecisionTableModellerPresenterTest method makeDecisionTableContent.

private GuidedDecisionTableEditorContent makeDecisionTableContent() {
    final GuidedDecisionTable52 model = mock(GuidedDecisionTable52.class);
    final PackageDataModelOracleBaselinePayload dmoBaseline = mock(PackageDataModelOracleBaselinePayload.class);
    final Set<PortableWorkDefinition> workItemDefinitions = Collections.emptySet();
    final Overview overview = mock(Overview.class);
    final GuidedDecisionTableEditorContent dtContent = new GuidedDecisionTableEditorContent(model, workItemDefinitions, overview, dmoBaseline);
    return dtContent;
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) PackageDataModelOracleBaselinePayload(org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload) PortableWorkDefinition(org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) Overview(org.guvnor.common.services.shared.metadata.model.Overview)

Example 7 with Overview

use of org.guvnor.common.services.shared.metadata.model.Overview 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));
}
Also used : AsyncPackageDataModelOracle(org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle) Path(org.uberfire.backend.vfs.Path) PlaceRequest(org.uberfire.mvp.PlaceRequest) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) GuidedDecisionTableEditorContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent) Overview(org.guvnor.common.services.shared.metadata.model.Overview) Layer(com.ait.lienzo.client.core.shape.Layer) PackageDataModelOracleBaselinePayload(org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload) PortableWorkDefinition(org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition)

Example 8 with Overview

use of org.guvnor.common.services.shared.metadata.model.Overview in project drools-wb by kiegroup.

the class GuidedDecisionTableEditorPresenterTest method testGetMetadataSupplier.

@Test
public void testGetMetadataSupplier() {
    final GuidedDecisionTableView.Presenter document = mock(GuidedDecisionTableView.Presenter.class);
    final Overview overview = mock(Overview.class);
    final Metadata expectedMetadata = mock(Metadata.class);
    doReturn(document).when(presenter).getActiveDocument();
    doReturn(overview).when(document).getOverview();
    doReturn(expectedMetadata).when(overview).getMetadata();
    final Metadata actualMetadata = presenter.getMetadataSupplier().get();
    assertEquals(expectedMetadata, actualMetadata);
}
Also used : Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) Overview(org.guvnor.common.services.shared.metadata.model.Overview) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) Test(org.junit.Test)

Example 9 with Overview

use of org.guvnor.common.services.shared.metadata.model.Overview in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorPresenterTest method testOnDecisionTableSelectedWhenPresenterIsNotNull.

@Test
public void testOnDecisionTableSelectedWhenPresenterIsNotNull() {
    final GuidedDecisionTableView.Presenter dtPresenter = mock(GuidedDecisionTableView.Presenter.class);
    final Overview overview = mock(Overview.class);
    final AsyncPackageDataModelOracle oracle = mock(AsyncPackageDataModelOracle.class);
    final GuidedDecisionTable52 model = new GuidedDecisionTable52();
    final GuidedDecisionTablePresenter.Access access = new GuidedDecisionTablePresenter.Access();
    final DecisionTableSelectedEvent event = new DecisionTableSelectedEvent(dtPresenter);
    final ObservablePath path = mock(ObservablePath.class);
    doNothing().when(presenter).initialiseKieEditorTabs(dtPresenter, overview, oracle, model.getImports(), false);
    doNothing().when(presenter).initialiseEditorTabsWhenNoDocuments();
    doReturn(true).when(modeller).isDecisionTableAvailable(dtPresenter);
    doReturn(Optional.of(dtPresenter)).when(modeller).getActiveDecisionTable();
    doReturn(overview).when(dtPresenter).getOverview();
    doReturn(oracle).when(dtPresenter).getDataModelOracle();
    doReturn(model).when(dtPresenter).getModel();
    doReturn(access).when(dtPresenter).getAccess();
    doReturn(path).when(dtPresenter).getLatestPath();
    presenter.registerDocument(dtPresenter);
    presenter.onDecisionTableSelected(event);
    verify(presenter, never()).initialiseEditorTabsWhenNoDocuments();
    verify(presenter).addColumnsTab();
    verify(presenter).enableColumnsTab(dtPresenter);
}
Also used : AsyncPackageDataModelOracle(org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) GuidedDecisionTablePresenter(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTablePresenter) Overview(org.guvnor.common.services.shared.metadata.model.Overview) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) ObservablePath(org.uberfire.backend.vfs.ObservablePath) DecisionTableSelectedEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent) Test(org.junit.Test)

Example 10 with Overview

use of org.guvnor.common.services.shared.metadata.model.Overview in project drools-wb by kiegroup.

the class GuidedDecisionTableGraphEditorPresenterTest method testLoadDocumentGraphEmptyModel.

@Test
public void testLoadDocumentGraphEmptyModel() throws Exception {
    final ObservablePath documentPath = mock(ObservablePath.class);
    final Overview overview = mock(Overview.class);
    final GuidedDecisionTableEditorGraphModel graphModel = mock(GuidedDecisionTableEditorGraphModel.class);
    final GuidedDecisionTableEditorGraphContent graphContent = mock(GuidedDecisionTableEditorGraphContent.class);
    when(documentPath.getFileName()).thenReturn("GDT");
    when(versionRecordManager.getCurrentPath()).thenReturn(documentPath);
    when(dtGraphService.loadContent(documentPath)).thenReturn(graphContent);
    when(versionRecordManager.getPathToLatest()).thenReturn(documentPath);
    when(graphContent.getOverview()).thenReturn(overview);
    when(graphContent.getModel()).thenReturn(graphModel);
    presenter.loadDocumentGraph(documentPath);
    verify(view).showLoading();
    verify(view).hideBusyIndicator();
    verify(view).refreshTitle(startsWith("GDT"));
    // initialise when no documents
    verify(editMenuItem).setEnabled(false);
    verify(viewMenuItem).setEnabled(false);
    verify(insertMenuItem).setEnabled(false);
    verify(radarMenuItem).setEnabled(false);
    verify(kieEditorWrapperView).clear();
    verify(kieEditorWrapperView).addMainEditorPage(view);
    verify(kieEditorWrapperView).addOverviewPage(eq(overviewWidget), any(com.google.gwt.user.client.Command.class));
    verify(overviewWidget).setContent(overview, documentPath);
}
Also used : GuidedDecisionTableEditorGraphModel(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel) GuidedDecisionTableEditorGraphContent(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphContent) ParameterizedCommand(org.uberfire.mvp.ParameterizedCommand) Command(org.uberfire.mvp.Command) Overview(org.guvnor.common.services.shared.metadata.model.Overview) ObservablePath(org.uberfire.backend.vfs.ObservablePath) Test(org.junit.Test)

Aggregations

Overview (org.guvnor.common.services.shared.metadata.model.Overview)20 Test (org.junit.Test)11 Path (org.uberfire.backend.vfs.Path)11 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)8 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)8 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)8 GuidedDecisionTableEditorContent (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorContent)7 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)6 PackageDataModelOracle (org.kie.soup.project.datamodel.oracle.PackageDataModelOracle)6 ObservablePath (org.uberfire.backend.vfs.ObservablePath)6 Set (java.util.Set)5 PortableWorkDefinition (org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition)5 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)5 ResourceOpenedEvent (org.uberfire.workbench.events.ResourceOpenedEvent)5 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 PostConstruct (javax.annotation.PostConstruct)3 ApplicationScoped (javax.enterprise.context.ApplicationScoped)3 Event (javax.enterprise.event.Event)3