Search in sources :

Example 1 with TContext

use of org.kie.dmn.model.v1_3.TContext in project kie-wb-common by kiegroup.

the class FunctionDefinitionPropertyConverterTest method doTestWBFromDMNWithContextEntry.

private void doTestWBFromDMNWithContextEntry(final FunctionKind kind, final String variableName, final Class<? extends IsLiteralExpression> literalExpressionClass) {
    final org.kie.dmn.model.api.FunctionDefinition dmn = new TFunctionDefinition();
    final org.kie.dmn.model.api.Context contextExpression = new TContext();
    final org.kie.dmn.model.api.ContextEntry contextEntry = new TContextEntry();
    final org.kie.dmn.model.api.InformationItem variable = new TInformationItem();
    variable.setName(variableName);
    contextEntry.setVariable(variable);
    contextEntry.setExpression(new TLiteralExpression());
    contextExpression.getContextEntry().add(contextEntry);
    dmn.setKind(kind);
    dmn.setExpression(contextExpression);
    final FunctionDefinition wb = FunctionDefinitionPropertyConverter.wbFromDMN(dmn, hasComponentWidthsConsumer);
    assertThat(wb.getExpression()).isInstanceOf(Context.class);
    assertThat(((Context) wb.getExpression()).getContextEntry().get(0).getExpression()).isInstanceOf(literalExpressionClass);
}
Also used : TContext(org.kie.dmn.model.v1_2.TContext) Context(org.kie.workbench.common.dmn.api.definition.model.Context) TFunctionDefinition(org.kie.dmn.model.v1_2.TFunctionDefinition) TContext(org.kie.dmn.model.v1_2.TContext) TLiteralExpression(org.kie.dmn.model.v1_2.TLiteralExpression) TInformationItem(org.kie.dmn.model.v1_2.TInformationItem) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition) TFunctionDefinition(org.kie.dmn.model.v1_2.TFunctionDefinition) TContextEntry(org.kie.dmn.model.v1_2.TContextEntry)

Aggregations

TContext (org.kie.dmn.model.v1_2.TContext)1 TContextEntry (org.kie.dmn.model.v1_2.TContextEntry)1 TFunctionDefinition (org.kie.dmn.model.v1_2.TFunctionDefinition)1 TInformationItem (org.kie.dmn.model.v1_2.TInformationItem)1 TLiteralExpression (org.kie.dmn.model.v1_2.TLiteralExpression)1 Context (org.kie.workbench.common.dmn.api.definition.model.Context)1 FunctionDefinition (org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition)1