use of org.kie.workbench.common.dmn.api.definition.HasTypeRef in project kie-wb-common by kiegroup.
the class RelationTest method testGetHasTypeRefs.
@Test
public void testGetHasTypeRefs() {
final InformationItem column1 = mock(InformationItem.class);
final InformationItem column2 = mock(InformationItem.class);
final List<InformationItem> column = asList(column1, column2);
final org.kie.workbench.common.dmn.api.definition.model.List row1 = mock(org.kie.workbench.common.dmn.api.definition.model.List.class);
final org.kie.workbench.common.dmn.api.definition.model.List row2 = mock(org.kie.workbench.common.dmn.api.definition.model.List.class);
final List<org.kie.workbench.common.dmn.api.definition.model.List> row = asList(row1, row2);
final HasTypeRef hasTypeRef1 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef2 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef3 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef4 = mock(HasTypeRef.class);
doReturn(column).when(relation).getColumn();
doReturn(row).when(relation).getRow();
when(column1.getHasTypeRefs()).thenReturn(asList(hasTypeRef1));
when(column2.getHasTypeRefs()).thenReturn(asList(hasTypeRef2));
when(row1.getHasTypeRefs()).thenReturn(asList(hasTypeRef3));
when(row2.getHasTypeRefs()).thenReturn(asList(hasTypeRef4));
final List<HasTypeRef> actualHasTypeRefs = relation.getHasTypeRefs();
final List<HasTypeRef> expectedHasTypeRefs = asList(relation, hasTypeRef1, hasTypeRef2, hasTypeRef3, hasTypeRef4);
assertEquals(expectedHasTypeRefs, actualHasTypeRefs);
}
use of org.kie.workbench.common.dmn.api.definition.HasTypeRef in project kie-wb-common by kiegroup.
the class InformationItemCellInformationItemTest method testHasNameAndDataTypeCellGetHasTypeRefs.
@Test
public void testHasNameAndDataTypeCellGetHasTypeRefs() {
final InformationItem informationItem = mock(InformationItem.class);
final HasNameAndDataTypeCell hasNameAndDataTypeCell = HasNameAndDataTypeCell.wrap(informationItem);
final HasTypeRef hasTypeRef1 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef2 = mock(HasTypeRef.class);
final List<HasTypeRef> expectedHasTypeRefs = asList(hasTypeRef1, hasTypeRef2);
when(informationItem.getHasTypeRefs()).thenReturn(expectedHasTypeRefs);
final List<HasTypeRef> actualHasTypeRefs = hasNameAndDataTypeCell.getHasTypeRefs();
assertEquals(expectedHasTypeRefs, actualHasTypeRefs);
}
use of org.kie.workbench.common.dmn.api.definition.HasTypeRef in project kie-wb-common by kiegroup.
the class PropertiesPanelNotifier method notifyExpressions.
void notifyExpressions(final Node node, final Object definition) {
if (definition instanceof HasExpression) {
final HasExpression hasExpression = asHasExpression(definition);
final List<HasTypeRef> hasTypeRefs = getNotNullHasTypeRefs(hasExpression.getExpression());
for (final HasTypeRef hasTypeRef : hasTypeRefs) {
notifyOutdatedElement(node, hasTypeRef);
}
}
}
use of org.kie.workbench.common.dmn.api.definition.HasTypeRef in project kie-wb-common by kiegroup.
the class InputClauseTest method testGetHasTypeRefs.
@Test
public void testGetHasTypeRefs() {
final InputClauseLiteralExpression literalExpression = mock(InputClauseLiteralExpression.class);
final HasTypeRef hasTypeRef1 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef2 = mock(HasTypeRef.class);
doReturn(literalExpression).when(inputClause).getInputExpression();
when(literalExpression.getHasTypeRefs()).thenReturn(asList(hasTypeRef1, hasTypeRef2));
final List<HasTypeRef> actualHasTypeRefs = inputClause.getHasTypeRefs();
final List<HasTypeRef> expectedHasTypeRefs = asList(hasTypeRef1, hasTypeRef2);
assertEquals(expectedHasTypeRefs, actualHasTypeRefs);
}
use of org.kie.workbench.common.dmn.api.definition.HasTypeRef in project kie-wb-common by kiegroup.
the class HasTypeRefHelperTest method testGetFlatHasTypeRefsFromExpressions.
@Test
public void testGetFlatHasTypeRefsFromExpressions() {
final Expression expression1 = mock(Expression.class);
final Expression expression2 = mock(Expression.class);
final DMNModelInstrumentedBase parent = mock(DMNModelInstrumentedBase.class);
final HasExpression hasExpression1 = HasExpression.wrap(parent, expression1);
final HasExpression hasExpression2 = HasExpression.wrap(parent, expression2);
final List<HasExpression> hasExpressions = asList(hasExpression1, hasExpression2);
final HasTypeRef hasTypeRef1 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef2 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef3 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef4 = mock(HasTypeRef.class);
final List<HasTypeRef> typeRefList1 = asList(hasTypeRef1, hasTypeRef2);
final List<HasTypeRef> typeRefList2 = asList(hasTypeRef3, hasTypeRef4);
when(expression1.getHasTypeRefs()).thenReturn(typeRefList1);
when(expression2.getHasTypeRefs()).thenReturn(typeRefList2);
final List<HasTypeRef> actual = HasTypeRefHelper.getFlatHasTypeRefsFromExpressions(hasExpressions);
final List<HasTypeRef> expected = asList(hasTypeRef1, hasTypeRef2, hasTypeRef3, hasTypeRef4);
assertEquals(expected, actual);
}
Aggregations