use of org.drools.workbench.screens.scenariosimulation.client.enums.GridWidget in project drools-wb by kiegroup.
the class ScenarioGridTest method getGridWidget.
@Test
public void getGridWidget() {
final GridWidget retrieved = scenarioGridSpy.getGridWidget();
assertNotNull(retrieved);
assertEquals(GridWidget.SIMULATION, retrieved);
verify(scenarioGridSpy.getModel(), times(1)).getGridWidget();
}
use of org.drools.workbench.screens.scenariosimulation.client.enums.GridWidget in project drools-wb by kiegroup.
the class AbstractScenarioGridCommandTest method commonUndoRedoPreExecutionDifferentGridCheckSwitch.
@Test
public void commonUndoRedoPreExecutionDifferentGridCheckSwitch() {
// Test to verify there are not new, un-managed, GridWidget
for (GridWidget gridWidget : GridWidget.values()) {
when(scenarioGridWidgetSpy.isSelected()).thenReturn(GridWidget.BACKGROUND.equals(gridWidget));
when(backgroundGridWidgetSpy.isSelected()).thenReturn(GridWidget.SIMULATION.equals(gridWidget));
commandSpy.gridWidget = gridWidget;
commandSpy.commonUndoRedoPreExecution(scenarioSimulationContextLocal);
if (GridWidget.SIMULATION.equals(gridWidget)) {
verify(scenarioSimulationEditorPresenterMock, times(1)).selectSimulationTab();
verify(scenarioGridPanelMock, times(1)).onResize();
verify(scenarioGridPanelMock, times(1)).select();
} else {
verify(scenarioSimulationEditorPresenterMock, times(1)).selectBackgroundTab();
verify(backgroundGridPanelMock, times(1)).onResize();
verify(backgroundGridPanelMock, times(1)).select();
}
}
}
use of org.drools.workbench.screens.scenariosimulation.client.enums.GridWidget in project drools-wb by kiegroup.
the class TestToolsPresenter method onModifyColumn.
@Override
public void onModifyColumn() {
if (editingColumnEnabled) {
if (selectedListGroupItemView != null) {
String className = selectedListGroupItemView.getActualClassName();
getFactModelTreeFromMaps(className).ifPresent(factModelTree -> eventBus.fireEvent(new SetPropertyHeaderEvent(gridWidget, factModelTree.getFullPackage(), factModelTree.getTypeName(), Collections.unmodifiableList(Arrays.asList(className)), factModelTree.getFullTypeName(), FactMappingValueType.EXPRESSION, factModelTree.getImportPrefix())));
} else if (selectedFieldItemView != null) {
String baseClass = selectedFieldItemView.getFullPath().get(0);
List<String> propertyNameElements = new ArrayList<>(selectedFieldItemView.getFullPath());
if (!isSimple(baseClass)) {
propertyNameElements.add(selectedFieldItemView.getFieldName());
}
getFactModelTreeFromMaps(baseClass).ifPresent(factModelTree -> eventBus.fireEvent(new SetPropertyHeaderEvent(gridWidget, factModelTree.getFullPackage(), factModelTree.getTypeName(), Collections.unmodifiableList(propertyNameElements), selectedFieldItemView.getClassName(), FactMappingValueType.NOT_EXPRESSION, factModelTree.getImportPrefix())));
}
}
}
use of org.drools.workbench.screens.scenariosimulation.client.enums.GridWidget 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.client.enums.GridWidget in project drools-wb by kiegroup.
the class ScenarioSimulationEditorPresenterTest method onImportCheckSwitch.
@Test
public void onImportCheckSwitch() {
// Test to verify there are not new, un-managed, GridWidget
String FILE_CONTENT = "FILE_CONTENT";
for (GridWidget gridWidget : GridWidget.values()) {
presenterSpy.onImport(FILE_CONTENT, gridWidget);
}
verify(scenarioSimulationEditorWrapperMock, times(1)).onImport(eq(FILE_CONTENT), isA(RemoteCallback.class), isA(ErrorCallback.class), eq(simulationMock));
verify(scenarioSimulationEditorWrapperMock, times(1)).onImport(eq(FILE_CONTENT), isA(RemoteCallback.class), isA(ErrorCallback.class), eq(backgroundMock));
}
Aggregations