use of org.drools.workbench.screens.testscenario.model.TestScenarioModelContent in project drools-wb by kiegroup.
the class ScenarioTestEditorServiceImpl method constructContent.
@Override
protected TestScenarioModelContent constructContent(Path path, Overview overview) {
final Scenario scenario = load(path);
final String packageName = moduleService.resolvePackage(path).getPackageName();
final PackageDataModelOracle dataModelOracle = getDataModel(path);
final PackageDataModelOracleBaselinePayload dataModel = new PackageDataModelOracleBaselinePayload();
final Set<String> usedFullyQualifiedClassNames = getUsedFullyQualifiedClassNames(scenario, dataModelOracle);
DataModelOracleUtilities.populateDataModel(dataModelOracle, dataModel, usedFullyQualifiedClassNames);
// Signal opening to interested parties
resourceOpenedEvent.fire(new ResourceOpenedEvent(path, safeSessionInfo));
return new TestScenarioModelContent(scenario, overview, packageName, dataModel);
}
use of org.drools.workbench.screens.testscenario.model.TestScenarioModelContent in project drools-wb by kiegroup.
the class ScenarioEditorPresenterTest method setUp.
@Before
public void setUp() throws Exception {
promises = new SyncPromises();
final AsyncPackageDataModelOracleFactory modelOracleFactory = mock(AsyncPackageDataModelOracleFactory.class);
fakeService = new CallerMock<>(service);
editor = spy(new ScenarioEditorPresenter(view, user, importsWidget, fakeService, new TestScenarioResourceType(new Decision()), modelOracleFactory, settingsPage, auditPage, testRunnerReportingPanel, testReportingDocksHandler, showTestPanelEvent, hideTestPanelEvent) {
{
docks = ScenarioEditorPresenterTest.this.docks;
kieView = ScenarioEditorPresenterTest.this.kieView;
versionRecordManager = ScenarioEditorPresenterTest.this.versionRecordManager;
overviewWidget = ScenarioEditorPresenterTest.this.overviewWidget;
notification = ScenarioEditorPresenterTest.this.notificationEventMock;
fileMenuBuilder = ScenarioEditorPresenterTest.this.fileMenuBuilder;
projectController = ScenarioEditorPresenterTest.this.projectController;
workbenchContext = ScenarioEditorPresenterTest.this.workbenchContext;
versionRecordManager = ScenarioEditorPresenterTest.this.versionRecordManager;
alertsButtonMenuItemBuilder = ScenarioEditorPresenterTest.this.alertsButtonMenuItemBuilder;
perspectiveManager = ScenarioEditorPresenterTest.this.perspectiveManager;
placeManager = ScenarioEditorPresenterTest.this.placeManager;
promises = ScenarioEditorPresenterTest.this.promises;
}
@Override
protected Command getSaveAndRename() {
return mock(Command.class);
}
});
doNothing().when(editor).addDownloadMenuItem(any());
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())).thenReturn(testScenarioModelContent);
final TestScenarioResult result = new TestScenarioResult(scenarioRunResult, Collections.EMPTY_SET, mock(TestResultMessage.class));
when(service.runScenario(eq("userName"), any(), eq(scenario))).thenReturn(result);
final AsyncPackageDataModelOracle dmo = mock(AsyncPackageDataModelOracle.class);
when(modelOracleFactory.makeAsyncPackageDataModelOracle(any(), any(), any())).thenReturn(dmo);
when(alertsButtonMenuItemBuilder.build()).thenReturn(alertsButtonMenuItem);
when(perspectiveManager.getCurrentPerspective()).thenReturn(mock(PerspectiveActivity.class));
}
Aggregations