use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class AbstractDMODataManagementStrategyTest method getFactModelTree.
@Test
public void getFactModelTree() {
Map<String, FactModelTree.PropertyTypeName> simpleProperties = getSimplePropertiesInner();
final ModelField[] modelFields = getModelFieldsInner(simpleProperties);
final FactModelTree retrieved = abstractDMODataManagementStrategySpy.getFactModelTree(FACT_NAME, Collections.emptyMap(), modelFields);
assertNotNull(retrieved);
assertEquals(FACT_NAME, retrieved.getFactName());
assertEquals(FULL_PACKAGE, retrieved.getFullPackage());
assertFalse(retrieved.getSimpleProperties().isEmpty());
retrieved.getSimpleProperties().entrySet().forEach(entry -> {
assertFalse(entry.getValue().getBaseTypeName().isPresent());
assertEquals(entry.getValue().getTypeName(), entry.getValue().getPropertyTypeNameToVisualize());
});
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class TestToolsPresenterTest method setup.
@Before
public void setup() {
super.setup();
final String firstKey = dataObjectFactTreeMap.firstKey();
final FactModelTree factModelTree = dataObjectFactTreeMap.get(firstKey);
final String firstPropertyKey = (String) new ArrayList(factModelTree.getSimpleProperties().keySet()).get(0);
final FactModelTree.PropertyTypeName firstPropertyClass = factModelTree.getSimpleProperties().get(firstPropertyKey);
when(selectedListGroupItemViewMock.getActualClassName()).thenReturn(firstKey);
when(selectedFieldItemViewMock.getFullPath()).thenReturn(Arrays.asList(firstKey));
when(selectedFieldItemViewMock.getFieldName()).thenReturn(firstPropertyKey);
when(selectedFieldItemViewMock.getClassName()).thenReturn(firstPropertyClass.getTypeName());
when(listGroupItemPresenterMock.getDivElement(FACT_NAME, FACT_MODEL_TREE)).thenReturn(divItemContainerMock);
this.testToolsPresenterSpy = spy(new TestToolsPresenter(testToolsViewMock, listGroupItemPresenterMock) {
{
this.dataObjectFieldsMap = dataObjectFactTreeMap;
this.simpleJavaTypeFieldsMap = simpleJavaTypeTreeMap;
this.instanceFieldsMap = instanceFactTreeMap;
this.simpleJavaInstanceFieldsMap = simpleJavaInstanceFactTreeMap;
this.eventBus = eventBusMock;
}
});
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class TestToolsPresenterTest method updateInstanceIsAssignedStatus_Present.
@Test
public void updateInstanceIsAssignedStatus_Present() {
String instance = "CHECK_INSTANCE";
FactModelTree factModel = new FactModelTree(instance, FACT_PACKAGE, getMockSimpleProperties(), new HashMap<>());
dataObjectFactTreeMap.put(instance, factModel);
testToolsPresenterSpy.updateInstanceIsAssignedStatus(instance);
verify(listGroupItemPresenterMock, times(1)).setInstanceAssigned(eq(instance), eq(true));
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class AbstractSelectedColumnCommandTest method navigateComplexObject3Levels.
protected void navigateComplexObject3Levels() {
FactModelTree book = new FactModelTree("Book", "com.Book", new HashMap<>(), new HashMap<>());
book.addExpandableProperty("author", "Author");
FactModelTree author = new FactModelTree("Author", "com.Author", new HashMap<>(), new HashMap<>());
author.addExpandableProperty("firstBook", "Book");
SortedMap<String, FactModelTree> sortedMap = spy(new TreeMap<>());
sortedMap.put("Book", book);
sortedMap.put("Author", author);
List<String> elements = Arrays.asList("Book", "author", "firstBook", "topics");
FactModelTree target = ((AbstractSelectedColumnCommand) commandSpy).navigateComplexObject(book, elements, sortedMap);
assertEquals(target, book);
verify(sortedMap, times(1)).get("Author");
}
use of org.drools.workbench.screens.scenariosimulation.model.typedescriptor.FactModelTree in project drools-wb by kiegroup.
the class AbstractSelectedColumnCommandTest method navigateComplexObject.
/* This test is usable ONLY by <code>SetPropertyCommandTest</code> subclass */
protected void navigateComplexObject() {
FactModelTree book = new FactModelTree("Book", "com.Book", new HashMap<>(), new HashMap<>());
book.addExpandableProperty("author", "Author");
FactModelTree author = new FactModelTree("Author", "com.Author", new HashMap<>(), new HashMap<>());
SortedMap<String, FactModelTree> sortedMap = spy(new TreeMap<>());
sortedMap.put("Book", book);
sortedMap.put("Author", author);
List<String> elements = Arrays.asList("Book", "author", "currentlyPrinted");
FactModelTree target = ((AbstractSelectedColumnCommand) commandSpy).navigateComplexObject(book, elements, sortedMap);
assertEquals(target, author);
verify(sortedMap, times(1)).get("Author");
}
Aggregations