use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools-wb by kiegroup.
the class ScenarioTestEditorServiceImplTest method loadBrokenScenarioNullPackage.
@Test
public void loadBrokenScenarioNullPackage() throws Exception {
when(moduleService.resolvePackage(path)).thenReturn(null);
final Scenario load = testEditorService.load(path);
assertNotNull(load);
assertNull(load.getPackageName());
assertNotNull(load.getImports());
}
use of org.drools.workbench.models.testscenarios.shared.Scenario 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);
}
use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools-wb by kiegroup.
the class FixtureLayoutTest method testDeleteExecutionTraceButtonSomeExecutionTraceRenderedAlready.
@Test
public void testDeleteExecutionTraceButtonSomeExecutionTraceRenderedAlready() throws Exception {
final Scenario scenario = mock(Scenario.class);
final ExecutionTrace executionTrace = mock(ExecutionTrace.class);
final ScenarioParentWidget parentWidgetToRender = mock(ScenarioParentWidget.class);
testedLayout.addDeleteExecutionTraceButtonIfNotNull(scenario, executionTrace, parentWidgetToRender);
verify(testedLayout).setWidget(eq(0), eq(0), eq(deleteExecutionTraceButton));
verify(deleteExecutionTraceButton).init(scenario, executionTrace, parentWidgetToRender);
}
use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools-wb by kiegroup.
the class ScenarioUtilsTest method testFindExecutionTraceDefault.
@Test
public void testFindExecutionTraceDefault() throws Exception {
final Scenario scenario = new Scenario();
Assert.assertNotNull(ScenarioUtils.findExecutionTrace(scenario));
}
use of org.drools.workbench.models.testscenarios.shared.Scenario in project drools-wb by kiegroup.
the class TestScenarioFactory method makeTestScenarioWithVerifyFact.
public static Scenario makeTestScenarioWithVerifyFact(final String packageName, final Collection<Import> imports, final String name) {
final Scenario model = new Scenario();
model.getImports().getImports().addAll(imports);
model.setPackageName(packageName);
model.setName(name);
model.getFixtures().add(new FactData("Applicant", "$a", new ArrayList<Field>() {
{
add(new FieldData("age", "33"));
}
}, false));
model.getFixtures().add(new VerifyFact("Mortgage", new ArrayList<VerifyField>() {
{
add(new VerifyField("amount", "10000", "=="));
}
}, true));
return model;
}
Aggregations