Search in sources :

Example 1 with ScenarioSimulationModel

use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools-wb by kiegroup.

the class ScenarioSimulationContextTest method getScenarioSimulationModel.

@Test
public void getScenarioSimulationModel() {
    ScenarioSimulationModel model = scenarioSimulationContextLocal.getScenarioSimulationModel();
    assertSame(scenarioSimulationModelMock, model);
}
Also used : ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest) Test(org.junit.Test)

Example 2 with ScenarioSimulationModel

use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools-wb by kiegroup.

the class ScenarioSimulationEditorBusinessCentralWrapper method save.

@Override
protected void save(final String commitMessage) {
    synchronizeColumnsDimension(scenarioSimulationEditorPresenter.getContext().getScenarioGridPanelByGridWidget(GridWidget.SIMULATION), scenarioSimulationEditorPresenter.getContext().getScenarioGridPanelByGridWidget(GridWidget.BACKGROUND));
    final ScenarioSimulationModel model = scenarioSimulationEditorPresenter.getModel();
    RemoteCallback<Path> saveSuccessCallback = getSaveSuccessCallback(scenarioSimulationEditorPresenter.getJsonModel(model).hashCode());
    service.call(saveSuccessCallback, new HasBusyIndicatorDefaultErrorCallback(scenarioSimulationEditorPresenter.getView())).save(versionRecordManager.getCurrentPath(), model, metadata, commitMessage);
}
Also used : ObservablePath(org.uberfire.backend.vfs.ObservablePath) Path(org.uberfire.backend.vfs.Path) ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(org.drools.workbench.screens.scenariosimulation.client.handlers.ScenarioSimulationHasBusyIndicatorDefaultErrorCallback) HasBusyIndicatorDefaultErrorCallback(org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback) ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel)

Example 3 with ScenarioSimulationModel

use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools-wb by kiegroup.

the class NewScenarioSimulationHandler method create.

@Override
public void create(final Package pkg, final String baseFileName, final NewResourcePresenter presenter) {
    if (!sourceTypeSelector.validate()) {
        return;
    }
    final ScenarioSimulationModel.Type selectedType = sourceTypeSelector.getSelectedType();
    String value;
    switch(selectedType) {
        case DMN:
            value = uploadWidget.getSelectedPath();
            break;
        case RULE:
        default:
            value = null;
    }
    busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Saving());
    CustomBusyPopup.showMessage(CommonConstants.INSTANCE.Saving());
    scenarioSimulationService.call(getSuccessCallback(presenter), new ScenarioSimulationHasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).create(pkg.getPackageTestResourcesPath(), buildFileName(baseFileName, resourceType), new ScenarioSimulationModel(), "", selectedType, value);
}
Also used : ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel)

Example 4 with ScenarioSimulationModel

use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools-wb by kiegroup.

the class ScenarioSimulationServiceImplTest method save.

@Test
public void save() {
    final Path returnPath = service.save(this.path, new ScenarioSimulationModel(), new Metadata(), "Commit comment");
    assertNotNull(returnPath);
    verify(ioServiceMock).write(any(org.uberfire.java.nio.file.Path.class), anyString(), anyMap(), any());
}
Also used : Path(org.uberfire.backend.vfs.Path) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel) Test(org.junit.Test)

Example 5 with ScenarioSimulationModel

use of org.drools.scenariosimulation.api.model.ScenarioSimulationModel in project drools-wb by kiegroup.

the class ScenarioSimulationServiceImplTest method createDMNScenario.

@Test
public void createDMNScenario() {
    doReturn(false).when(ioServiceMock).exists(any());
    ScenarioSimulationModel model = new ScenarioSimulationModel();
    assertNull(model.getSimulation());
    assertNull(model.getBackground());
    assertNull(model.getSettings());
    final Path returnPath = service.create(this.path, "test.scesim", model, "Commit comment", Type.DMN, "test");
    assertNotNull(returnPath);
    assertNotNull(model.getSimulation());
    assertNotNull(model.getBackground());
    assertNotNull(model.getSettings());
    verify(ioServiceMock, times(2)).write(any(org.uberfire.java.nio.file.Path.class), anyString(), any());
}
Also used : Path(org.uberfire.backend.vfs.Path) ScenarioSimulationModel(org.drools.scenariosimulation.api.model.ScenarioSimulationModel) Test(org.junit.Test)

Aggregations

ScenarioSimulationModel (org.drools.scenariosimulation.api.model.ScenarioSimulationModel)24 Test (org.junit.Test)12 Path (org.uberfire.backend.vfs.Path)5 Settings (org.drools.scenariosimulation.api.model.Settings)3 Simulation (org.drools.scenariosimulation.api.model.Simulation)3 ScenarioRunnerDTO (org.drools.scenariosimulation.backend.runner.model.ScenarioRunnerDTO)2 ImpossibleToFindDMNException (org.drools.scenariosimulation.backend.util.ImpossibleToFindDMNException)2 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)2 ObservablePath (org.uberfire.backend.vfs.ObservablePath)2 FileAlreadyExistsException (org.uberfire.java.nio.file.FileAlreadyExistsException)2 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Scanner (java.util.Scanner)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1