Search in sources :

Example 46 with Decision

use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.

the class BaseNameAndDataTypeHeaderMetaDataTest method testSetValueWithHasNameWithoutChange.

@Test
public void testSetValueWithHasNameWithoutChange() {
    final Decision decision = new Decision();
    decision.setName(NAME);
    setup(Optional.of(decision));
    metaData.setValue(NAME);
    verify(clearValueConsumer, never()).accept(any(HasName.class));
    verify(setValueConsumer, never()).accept(any(HasName.class), any(Name.class));
}
Also used : HasName(org.kie.workbench.common.dmn.api.definition.HasName) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) HasName(org.kie.workbench.common.dmn.api.definition.HasName) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Example 47 with Decision

use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.

the class BaseNameAndDataTypeHeaderMetaDataTest method testRender.

@Test
public void testRender() {
    final QName typeRef = BuiltInType.DATE.asQName();
    final GridRenderer renderer = mock(GridRenderer.class);
    final GridRendererTheme theme = mock(GridRendererTheme.class);
    final Text tName = mock(Text.class);
    final InformationItemPrimary hasExpressionVariable = new InformationItemPrimary();
    hasExpressionVariable.setTypeRef(typeRef);
    hasExpression.setVariable(hasExpressionVariable);
    final Decision decision = new Decision();
    decision.setName(NAME);
    setup(Optional.of(decision));
    when(theme.getHeaderText()).thenReturn(tName);
    when(context.getRenderer()).thenReturn(renderer);
    when(renderer.getTheme()).thenReturn(theme);
    when(hasTypeRef.getTypeRef()).thenReturn(typeRef);
    metaData.render(context, BLOCK_WIDTH, BLOCK_HEIGHT);
    verify(tName).setText(NAME.getValue());
    verify(tName, times(2)).setListening(false);
    verify(tName, times(2)).setX(BLOCK_WIDTH / 2);
    verify(tName).setY(BLOCK_HEIGHT / 2 - SPACING);
    verify(tName).setFontStyle(FONT_STYLE_TYPE_REF);
    verify(tName).setFontSize(BaseExpressionGridTheme.FONT_SIZE - 2.0);
    verify(tName).setText("(" + typeRef.toString() + ")");
    verify(tName).setY(BLOCK_HEIGHT / 2 + SPACING);
}
Also used : InformationItemPrimary(org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) GridRendererTheme(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme) Text(com.ait.lienzo.client.core.shape.Text) GridRenderer(org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 48 with Decision

use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.

the class BaseValueAndDataTypeHeaderMetaDataTest method testAsDMNModelInstrumentedBase.

@Test
public void testAsDMNModelInstrumentedBase() {
    final Decision decision = new Decision();
    setup(Optional.empty());
    when(hasTypeRef.asDMNModelInstrumentedBase()).thenReturn(decision);
    assertThat(metaData.asDMNModelInstrumentedBase()).isEqualTo(decision);
}
Also used : Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 49 with Decision

use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.

the class BaseNameAndDataTypeHeaderMetaDataTest method testSetDisplayNameWithHasName.

@Test
public void testSetDisplayNameWithHasName() {
    final Decision decision = new Decision();
    setup(Optional.of(decision));
    metaData.setValue(NAME);
    verify(setValueConsumer).accept(eq(decision), eq(NAME));
}
Also used : Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 50 with Decision

use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.

the class BaseNameAndDataTypeHeaderMetaDataTest method testGetDisplayNameWithHasName.

@Test
public void testGetDisplayNameWithHasName() {
    final Decision decision = new Decision();
    decision.setName(NAME);
    setup(Optional.of(decision));
    assertThat(metaData.getValue()).isEqualTo(NAME);
}
Also used : Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Aggregations

Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)121 Test (org.junit.Test)79 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)39 View (org.kie.workbench.common.stunner.core.graph.content.view.View)38 InputData (org.kie.workbench.common.dmn.api.definition.model.InputData)37 Node (org.kie.workbench.common.stunner.core.graph.Node)28 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)23 Edge (org.kie.workbench.common.stunner.core.graph.Edge)23 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)22 KnowledgeSource (org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource)21 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)21 ViewImpl (org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl)20 List (java.util.List)16 TDecision (org.kie.dmn.model.v1_2.TDecision)16 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)16 DRGElement (org.kie.workbench.common.dmn.api.definition.model.DRGElement)16 TextAnnotation (org.kie.workbench.common.dmn.api.definition.model.TextAnnotation)16 ArrayList (java.util.ArrayList)15 Optional (java.util.Optional)15 DecisionService (org.kie.workbench.common.dmn.api.definition.model.DecisionService)15