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);
}
Aggregations