use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeListItem method discardNewDataType.
void discardNewDataType() {
final DataType oldDataType = discardDataTypeProperties();
view.setDataType(oldDataType);
setupListComponent();
setupSelectComponent();
setupConstraintComponent();
setupIndentationLevel();
refreshSubDataTypes();
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeListTest method testInsertBelow.
@Test
public void testInsertBelow() {
final DataType dataType = mock(DataType.class);
final DataType reference = mock(DataType.class);
final DataTypeListItem listItem = mock(DataTypeListItem.class);
doReturn(listItem).when(dataTypeList).makeListItem(dataType);
when(listItem.getDataType()).thenReturn(dataType);
dataTypeList.insertBelow(dataType, reference);
verify(view).insertBelow(listItem, reference);
verify(dataTypeList).refreshItemsByUpdatedDataTypes(singletonList(dataType));
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeListTest method testDisableEditModeForChildren.
@Test
public void testDisableEditModeForChildren() {
final DataTypeListItem dataTypeListItem = mock(DataTypeListItem.class);
final DataType dataType = mock(DataType.class);
final String uuid = "uuid";
final String innerUuid = "inner";
final String deepUuid = "deep";
final DataType notChildDataType = mock(DataType.class);
final DataTypeListItem notChildItem = mock(DataTypeListItem.class);
final DataType childDataType1 = mock(DataType.class);
final DataTypeListItem child1 = mock(DataTypeListItem.class);
final DataType childDataType2 = mock(DataType.class);
final DataTypeListItem child2 = mock(DataTypeListItem.class);
final DataType innerDataType = mock(DataType.class);
final DataTypeListItem innerDataTypeListItem = mock(DataTypeListItem.class);
final DataType deepDataType = mock(DataType.class);
final DataTypeListItem deepDataTypeListItem = mock(DataTypeListItem.class);
when(deepDataType.getUUID()).thenReturn(deepUuid);
when(deepDataType.getParentUUID()).thenReturn(innerUuid);
when(deepDataTypeListItem.getDataType()).thenReturn(deepDataType);
when(innerDataType.getUUID()).thenReturn(innerUuid);
when(innerDataType.getParentUUID()).thenReturn(uuid);
when(innerDataTypeListItem.getDataType()).thenReturn(innerDataType);
when(notChildDataType.getParentUUID()).thenReturn("other_uuid");
when(notChildItem.getDataType()).thenReturn(notChildDataType);
when(child1.getDataType()).thenReturn(childDataType1);
when(childDataType1.getParentUUID()).thenReturn(uuid);
when(child2.getDataType()).thenReturn(childDataType2);
when(childDataType2.getParentUUID()).thenReturn(uuid);
when(dataType.getUUID()).thenReturn(uuid);
when(dataTypeListItem.getDataType()).thenReturn(dataType);
final List<DataTypeListItem> list = asList(child1, notChildItem, child2, innerDataTypeListItem, deepDataTypeListItem);
doReturn(list).when(dataTypeList).getItems();
dataTypeList.disableEditModeForChildren(dataTypeListItem);
verify(child1).disableEditMode();
verify(child2).disableEditMode();
verify(innerDataTypeListItem).disableEditMode();
verify(deepDataTypeListItem).disableEditMode();
verify(notChildItem, never()).disableEditMode();
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeListTest method makeDataType.
private DataType makeDataType(final String name, final String type, final DataType... subDataTypes) {
final DataType dataType = makeDataType("default", name, TOP_LEVEL_PARENT_UUID);
when(dataType.getType()).thenReturn(type);
when(dataType.getSubDataTypes()).thenReturn(asList(subDataTypes));
return dataType;
}
use of org.kie.workbench.common.dmn.client.editors.types.common.DataType in project kie-wb-common by kiegroup.
the class DataTypeListTest method testCreateNewDataTypeFromDataObject.
@Test
public void testCreateNewDataTypeFromDataObject() {
final DataObject dataObject = mock(DataObject.class);
final DataType dataType = mock(DataType.class);
final String structure = "structure";
final String classType = "classType";
when(dataObject.getClassType()).thenReturn(classType);
when(dataTypeManager.structure()).thenReturn(structure);
when(dataTypeManager.fromNew()).thenReturn(dataTypeManager);
when(dataTypeManager.withType(structure)).thenReturn(dataTypeManager);
when(dataTypeManager.get()).thenReturn(dataType);
final DataType actual = dataTypeList.createNewDataType(dataObject);
assertEquals(dataType, actual);
verify(dataType).setName(classType);
}
Aggregations