Search in sources :

Example 1 with AsyncPackageDataModelOracleFactory

use of org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracleFactory in project drools-wb by kiegroup.

the class ScenarioEditorPresenterTest method setUp.

@Before
public void setUp() throws Exception {
    final AsyncPackageDataModelOracleFactory modelOracleFactory = mock(AsyncPackageDataModelOracleFactory.class);
    fakeService = new CallerMock<>(service);
    editor = spy(new ScenarioEditorPresenter(view, user, importsWidget, fakeService, new CallerMock<>(testService), new TestScenarioResourceType(new Others()), modelOracleFactory, settingsPage, auditPage) {

        {
            kieView = ScenarioEditorPresenterTest.this.kieView;
            versionRecordManager = ScenarioEditorPresenterTest.this.versionRecordManager;
            overviewWidget = ScenarioEditorPresenterTest.this.overviewWidget;
            notification = makeNotificationEvent();
            fileMenuBuilder = ScenarioEditorPresenterTest.this.fileMenuBuilder;
            projectController = ScenarioEditorPresenterTest.this.projectController;
            workbenchContext = ScenarioEditorPresenterTest.this.workbenchContext;
            versionRecordManager = ScenarioEditorPresenterTest.this.versionRecordManager;
            alertsButtonMenuItemBuilder = ScenarioEditorPresenterTest.this.alertsButtonMenuItemBuilder;
        }

        @Override
        protected Command getSaveAndRename() {
            return mock(Command.class);
        }
    });
    scenarioRunResult = new Scenario();
    scenario = new Scenario();
    overview = new Overview();
    when(user.getIdentifier()).thenReturn("userName");
    when(workbenchContext.getActiveOrganizationalUnit()).thenReturn(Optional.empty());
    when(workbenchContext.getActiveWorkspaceProject()).thenReturn(Optional.empty());
    final TestScenarioModelContent testScenarioModelContent = new TestScenarioModelContent(scenario, overview, "org.test", new PackageDataModelOracleBaselinePayload());
    when(service.loadContent(any(Path.class))).thenReturn(testScenarioModelContent);
    final TestScenarioResult result = new TestScenarioResult(scenarioRunResult, Collections.EMPTY_SET);
    when(service.runScenario(eq("userName"), any(Path.class), eq(scenario))).thenReturn(result);
    final AsyncPackageDataModelOracle dmo = mock(AsyncPackageDataModelOracle.class);
    when(modelOracleFactory.makeAsyncPackageDataModelOracle(any(Path.class), any(HasImports.class), any(PackageDataModelOracleBaselinePayload.class))).thenReturn(dmo);
    when(alertsButtonMenuItemBuilder.build()).thenReturn(alertsButtonMenuItem);
}
Also used : ObservablePath(org.uberfire.backend.vfs.ObservablePath) Path(org.uberfire.backend.vfs.Path) AsyncPackageDataModelOracle(org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle) Others(org.uberfire.workbench.category.Others) TestScenarioModelContent(org.drools.workbench.screens.testscenario.model.TestScenarioModelContent) TestScenarioResourceType(org.drools.workbench.screens.testscenario.client.type.TestScenarioResourceType) Overview(org.guvnor.common.services.shared.metadata.model.Overview) TestScenarioResult(org.drools.workbench.screens.testscenario.model.TestScenarioResult) Scenario(org.drools.workbench.models.testscenarios.shared.Scenario) AsyncPackageDataModelOracleFactory(org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracleFactory) PackageDataModelOracleBaselinePayload(org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload) HasImports(org.kie.soup.project.datamodel.imports.HasImports) Before(org.junit.Before)

Aggregations

Scenario (org.drools.workbench.models.testscenarios.shared.Scenario)1 TestScenarioResourceType (org.drools.workbench.screens.testscenario.client.type.TestScenarioResourceType)1 TestScenarioModelContent (org.drools.workbench.screens.testscenario.model.TestScenarioModelContent)1 TestScenarioResult (org.drools.workbench.screens.testscenario.model.TestScenarioResult)1 Overview (org.guvnor.common.services.shared.metadata.model.Overview)1 Before (org.junit.Before)1 HasImports (org.kie.soup.project.datamodel.imports.HasImports)1 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)1 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)1 AsyncPackageDataModelOracleFactory (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracleFactory)1 ObservablePath (org.uberfire.backend.vfs.ObservablePath)1 Path (org.uberfire.backend.vfs.Path)1 Others (org.uberfire.workbench.category.Others)1