use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.
the class ScenarioEditorPresenterTest method testRunScenario.
@Test
public void testRunScenario() throws Exception {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
when(versionRecordManager.getCurrentPath()).thenReturn(path);
editor.onStartup(path, placeRequest);
reset(view);
editor.onRunScenario();
InOrder inOrder = inOrder(view);
inOrder.verify(view).showBusyIndicator(TestScenarioConstants.INSTANCE.BuildingAndRunningScenario());
inOrder.verify(view).showResults();
inOrder.verify(view).hideBusyIndicator();
verify(settingsPage).refresh(view, path, scenario);
verify(auditPage).showFiredRulesAuditLog(Collections.emptySet());
verify(auditPage).showFiredRules(notNull(ExecutionTrace.class));
}
use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.
the class ScenarioEditorPresenterTest method testRunScenarioAndSave.
@Test
public void testRunScenarioAndSave() throws Exception {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
when(versionRecordManager.getCurrentPath()).thenReturn(path);
editor.onStartup(path, placeRequest);
reset(view);
reset(importsWidget);
editor.onRunScenario();
// Make sure imports are updated
verify(importsWidget).setContent(any(AsyncPackageDataModelOracle.class), eq(scenarioRunResult.getImports()), anyBoolean());
editor.save("Commit message");
verify(service).save(any(Path.class), scenarioArgumentCaptor.capture(), any(Metadata.class), anyString());
assertEquals(scenarioRunResult, scenarioArgumentCaptor.getValue());
}
use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.
the class ScenarioEditorPresenterTest method testEmptyScenario.
@Test
public void testEmptyScenario() throws Exception {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
when(versionRecordManager.getCurrentPath()).thenReturn(path);
editor.onStartup(path, placeRequest);
verify(view).renderFixtures(eq(path), any(AsyncPackageDataModelOracle.class), eq(scenario));
}
use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.
the class GuidedDecisionTableModellerPresenterTest method refreshingDecisionTableRetainsExistingLocation.
@Test
public void refreshingDecisionTableRetainsExistingLocation() {
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable();
final GuidedDecisionTableEditorContent dtContent = makeDecisionTableContent();
final GuidedDecisionTableView dtView = dtPresenter.getView();
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final Point2D dtLocation = new Point2D(100, 100);
when(dtView.getLocation()).thenReturn(dtLocation);
final ArgumentCaptor<Command> afterRemovalCommandCaptor = ArgumentCaptor.forClass(Command.class);
presenter.refreshDecisionTable(dtPresenter, path, placeRequest, dtContent, false);
verify(dtView, times(1)).getLocation();
verify(view, times(1)).removeDecisionTable(eq(dtView), afterRemovalCommandCaptor.capture());
final Command afterRemovalCommand = afterRemovalCommandCaptor.getValue();
assertNotNull(afterRemovalCommand);
afterRemovalCommand.execute();
verify(dtView, times(1)).setLocation(eq(dtLocation));
}
use of org.uberfire.mvp.PlaceRequest in project drools-wb by kiegroup.
the class BaseGuidedDecisionTableEditorPresenterTest method checkMayCloseWithCleanDecisionTable.
@Test
public void checkMayCloseWithCleanDecisionTable() {
final ObservablePath path = mock(ObservablePath.class);
final PlaceRequest placeRequest = mock(PlaceRequest.class);
final GuidedDecisionTableEditorContent content = makeDecisionTableContent();
final GuidedDecisionTableView.Presenter dtPresenter = makeDecisionTable(path, path, placeRequest, content);
when(dtPresenter.getOriginalHashCode()).thenReturn(0);
when(modeller.getAvailableDecisionTables()).thenReturn(new HashSet<GuidedDecisionTableView.Presenter>() {
{
add(dtPresenter);
}
});
assertTrue(presenter.mayClose());
}
Aggregations