use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTuple in project drools-wb by kiegroup.
the class AbstractDMODataManagementStrategyTest method setup.
@Before
public void setup() {
super.setup();
factTypes = new ArrayList<>();
visibleFactsLocal = new TreeMap<>();
hiddenFactsLocal = new TreeMap<>();
factModelTupleLocal = new FactModelTuple(visibleFactsLocal, hiddenFactsLocal);
factModelTreeHolderlocal = new AbstractDataManagementStrategy.ResultHolder();
factModelTreeHolderlocal.setFactModelTuple(factModelTupleLocal);
abstractDMODataManagementStrategySpy = spy(new AbstractDMODataManagementStrategy() {
@Override
public void manageScenarioSimulationModelContent(ObservablePath currentPath, ScenarioSimulationModelContent toManage) {
}
@Override
public boolean isADataType(String value) {
return false;
}
@Override
protected String getFQCNByFactName(String factName) {
return FULL_CLASS_NAME;
}
@Override
protected String getParametricFieldType(String factName, String propertyName) {
return PARAMETRIC_FIELD_TYPE;
}
@Override
protected List<String> getFactTypes() {
return factTypes;
}
@Override
protected void getSuperType(String factType, Callback<String> callback) {
// Do Nothing
}
@Override
protected boolean skipPopulateTestTools() {
return false;
}
@Override
protected void manageDataObjects(List<String> dataObjectsTypes, Map<String, String> superTypeMap, TestToolsView.Presenter testToolsPresenter, int expectedElements, SortedMap<String, FactModelTree> dataObjectsFieldsMap, ScenarioSimulationContext context, List<String> simpleJavaTypes, GridWidget gridWidget) {
}
{
this.model = modelLocal;
this.factModelTreeHolder = factModelTreeHolderlocal;
}
});
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTuple in project drools-wb by kiegroup.
the class BusinessCentralDMODataManagementStrategyTest method populateTestToolsWithFactTuple.
@Test
public void populateTestToolsWithFactTuple() {
final FactModelTuple factModelTupleMock = mock(FactModelTuple.class);
factModelTreeHolderlocal.setFactModelTuple(factModelTupleMock);
doNothing().when(businessCentralDmoDataManagementStrategySpy).storeData(eq(factModelTupleMock), eq(testToolsPresenterMock), eq(scenarioSimulationContextLocal), eq(GridWidget.SIMULATION));
businessCentralDmoDataManagementStrategySpy.populateTestTools(testToolsPresenterMock, scenarioSimulationContextLocal, GridWidget.SIMULATION);
verify(businessCentralDmoDataManagementStrategySpy, times(1)).storeData(eq(factModelTupleMock), eq(testToolsPresenterMock), eq(scenarioSimulationContextLocal), eq(GridWidget.SIMULATION));
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTuple in project drools-wb by kiegroup.
the class BusinessCentralDMODataManagementStrategyTest method setup.
@Before
public void setup() {
super.setup();
factModelTupleLocal = new FactModelTuple(new TreeMap<>(), new TreeMap<>());
factModelTreeHolderlocal = new BusinessCentralDMODataManagementStrategy.ResultHolder();
factModelTreeHolderlocal.setFactModelTuple(factModelTupleLocal);
when(oracleMock.getFQCNByFactName(TestProperties.FACT_NAME)).thenReturn(TestProperties.FULL_CLASS_NAME);
when(oracleFactoryMock.makeAsyncPackageDataModelOracle(observablePathMock, modelLocal, content.getDataModel())).thenReturn(oracleMock);
this.businessCentralDmoDataManagementStrategySpy = spy(new BusinessCentralDMODataManagementStrategy(oracleFactoryMock) {
{
this.oracle = oracleMock;
this.factModelTreeHolder = factModelTreeHolderlocal;
}
});
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTuple in project drools-wb by kiegroup.
the class DMNSimulationSettingsCreationStrategyTest method createBackground.
@Test
public void createBackground() throws Exception {
FactModelTuple factModelTuple = getFactModelTuple();
final Path pathMock = mock(Path.class);
final String dmnFilePath = "test";
final Background retrieved = dmnSimulationCreationStrategy.createBackground(pathMock, dmnFilePath);
assertNotNull(retrieved);
verify(dmnTypeServiceMock, never()).initializeNameAndNamespace(any(Settings.class), eq(pathMock), eq(dmnFilePath));
assertFalse(retrieved.getScesimModelDescriptor().getUnmodifiableFactMappings().stream().anyMatch(elem -> OTHER.equals(elem.getExpressionIdentifier().getType())));
assertTrue(retrieved.getScesimModelDescriptor().getUnmodifiableFactMappings().stream().allMatch(elem -> GIVEN.equals(elem.getExpressionIdentifier().getType())));
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTuple in project drools-wb by kiegroup.
the class DMNSimulationSettingsCreationStrategyTest method getFactModelTuple.
private FactModelTuple getFactModelTuple(boolean hasInput, boolean hasOutput) throws IOException {
SortedMap<String, FactModelTree> visibleFacts = new TreeMap<>();
SortedMap<String, FactModelTree> hiddenFacts = new TreeMap<>();
if (hasInput) {
for (InputDataNode input : dmnModelLocal.getInputs()) {
DMNType type = input.getType();
visibleFacts.put(input.getName(), createFactModelTree(input.getName(), input.getName(), type, hiddenFacts, FactModelTree.Type.INPUT));
}
}
if (hasOutput) {
for (DecisionNode decision : dmnModelLocal.getDecisions()) {
DMNType type = decision.getResultType();
visibleFacts.put(decision.getName(), createFactModelTree(decision.getName(), decision.getName(), type, hiddenFacts, DECISION));
}
}
return new FactModelTuple(visibleFacts, hiddenFacts);
}
Aggregations