Search in sources :

Example 26 with Settings

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

the class AbstractDMNTest method init.

protected void init() {
    settingsLocal = new Settings();
    settingsLocal.setType(ScenarioSimulationModel.Type.DMN);
    inputDataNodes = new HashSet<>();
    simpleTypeNoCollection = getSimpleNoCollection();
    InputDataNode inputDataNodeSimpleNoCollection = getInputDataNode(simpleTypeNoCollection, SIMPLE_INPUT_DATA_NAME_NO_COLLECTION);
    inputDataNodes.add(inputDataNodeSimpleNoCollection);
    simpleTypeSimpleCollectionOfSimple = getSimpleCollection();
    InputDataNode inputDataNodeSimpleCollectionOfSimple = getInputDataNode(simpleTypeSimpleCollectionOfSimple, SIMPLE_INPUT_DATA_NAME_SIMPLE_COLLECTION_OF_SIMPLE);
    inputDataNodes.add(inputDataNodeSimpleCollectionOfSimple);
    compositeTypeNoCollection = getSingleCompositeWithSimpleCollection();
    simpleTypeSimpleCollectionOfComposite = getSimpleCollection(compositeTypeNoCollection);
    InputDataNode inputDataNodeSimpleCollectionOfComposite = getInputDataNode(simpleTypeSimpleCollectionOfComposite, SIMPLE_INPUT_DATA_NAME_SIMPLE_COLLECTION_OF_COMPOSITE);
    inputDataNodes.add(inputDataNodeSimpleCollectionOfComposite);
    compositeTypeCollection = getCompositeCollection();
    InputDataNode inputDataNodeCompositeCollection = getInputDataNode(compositeTypeCollection, COMPOSITE_INPUT_DATA_NAME_COLLECTION);
    inputDataNodes.add(inputDataNodeCompositeCollection);
    decisionNodes = new HashSet<>();
    DecisionNode decisionNodeSimpleNoCollection = getDecisionNode(simpleTypeNoCollection, SIMPLE_DECISION_DATA_NAME);
    decisionNodes.add(decisionNodeSimpleNoCollection);
    DecisionNode decisionNodeCompositeNoCollection = getDecisionNode(compositeTypeNoCollection, COMPOSITE_DECISION_DATA_NAME);
    decisionNodes.add(decisionNodeCompositeNoCollection);
    setDmnModelLocal("dmn-list.dmn", NAMESPACE, MODEL_NAME);
}
Also used : InputDataNode(org.kie.dmn.api.core.ast.InputDataNode) DecisionNode(org.kie.dmn.api.core.ast.DecisionNode) Settings(org.drools.scenariosimulation.api.model.Settings)

Example 27 with Settings

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

the class ScenarioSimulationBuilderTest method createSettings.

@Test
public void createSettings() throws Exception {
    Settings settingsRetrieved = scenarioSimulationBuilder.createSettings(contextMock, ScenarioSimulationModel.Type.RULE, VALUE);
    assertNotNull(settingsRetrieved);
    assertEquals(ruleSettingsMock, settingsRetrieved);
    settingsRetrieved = scenarioSimulationBuilder.createSettings(contextMock, ScenarioSimulationModel.Type.DMN, VALUE);
    assertNotNull(settingsRetrieved);
    assertEquals(dmnSettingsMock, settingsRetrieved);
}
Also used : Settings(org.drools.scenariosimulation.api.model.Settings) Test(org.junit.Test)

Example 28 with Settings

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

the class ScenarioSimulationEventHandlerTest method onUpdateSettingDataEventNoChangedValue.

@Test
public void onUpdateSettingDataEventNoChangedValue() {
    Predicate<Settings> predicateMock = mock(Predicate.class);
    when(predicateMock.test(eq(settingsLocal))).thenReturn(false);
    Consumer<Settings> consumerMock = mock(Consumer.class);
    UpdateSettingsDataEvent event = new UpdateSettingsDataEvent(consumerMock, predicateMock);
    scenarioSimulationEventHandler.onEvent(event);
    verify(predicateMock, times(1)).test(eq(settingsLocal));
    verify(scenarioSimulationEventHandler, never()).commonExecution(isA(UpdateSettingsDataCommand.class), eq(false));
    verify(scenarioSimulationEditorPresenterMock, never()).unpublishTestResultsAlerts();
}
Also used : UpdateSettingsDataCommand(org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.UpdateSettingsDataCommand) UpdateSettingsDataEvent(org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent) Settings(org.drools.scenariosimulation.api.model.Settings) Test(org.junit.Test) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)

Example 29 with Settings

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

the class UpdateSettingsDataCommandTest method setRestorableStatus.

@Test
public void setRestorableStatus() {
    Settings clonedStatus = commandSpy.setRestorableStatusPreExecution(scenarioSimulationContextLocal);
    assertNotNull(clonedStatus);
}
Also used : Settings(org.drools.scenariosimulation.api.model.Settings) AbstractScenarioSimulationTest(org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest) Test(org.junit.Test)

Aggregations

Settings (org.drools.scenariosimulation.api.model.Settings)29 Test (org.junit.Test)11 Before (org.junit.Before)10 Simulation (org.drools.scenariosimulation.api.model.Simulation)9 Background (org.drools.scenariosimulation.api.model.Background)7 Path (org.uberfire.backend.vfs.Path)6 AbstractScenarioSimulationTest (org.drools.workbench.screens.scenariosimulation.client.AbstractScenarioSimulationTest)4 ScenarioSimulationModel (org.drools.scenariosimulation.api.model.ScenarioSimulationModel)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Map (java.util.Map)2 ExpressionIdentifier (org.drools.scenariosimulation.api.model.ExpressionIdentifier)2 FactMapping (org.drools.scenariosimulation.api.model.FactMapping)2 Scenario (org.drools.scenariosimulation.api.model.Scenario)2 ScenarioWithIndex (org.drools.scenariosimulation.api.model.ScenarioWithIndex)2 ScenarioRunnerData (org.drools.scenariosimulation.backend.runner.model.ScenarioRunnerData)2 ScenarioSimulationViolation (org.drools.workbench.screens.scenariosimulation.client.commands.ScenarioSimulationViolation)2 UpdateSettingsDataCommand (org.drools.workbench.screens.scenariosimulation.client.commands.actualcommands.UpdateSettingsDataCommand)2 UpdateSettingsDataEvent (org.drools.workbench.screens.scenariosimulation.client.events.UpdateSettingsDataEvent)2 TestResultMessage (org.guvnor.common.services.shared.test.TestResultMessage)2