Search in sources :

Example 51 with Decision

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

the class QNameConverterTest method testToWidgetValueWhenDMNDiagramDoesNotDefinesNameSpaces.

@Test
public void testToWidgetValueWhenDMNDiagramDoesNotDefinesNameSpaces() {
    converter.setDMNModel(new Decision());
    final String encoding = converter.toWidgetValue(new QName(org.kie.dmn.model.v1_1.KieDMNModelInstrumentedBase.URI_DMN, "unknown", DMNModelInstrumentedBase.Namespace.DMN.getPrefix()));
    assertEquals(ENCODED_DMN_UNKNOWN, encoding);
}
Also used : QName(org.kie.workbench.common.dmn.api.property.dmn.QName) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 52 with Decision

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

the class QNameConverterTest method testToWidgetValueWhenDMNDiagramDefinesNameSpaces.

@Test
public void testToWidgetValueWhenDMNDiagramDefinesNameSpaces() {
    final Definitions definitions = new Definitions();
    definitions.getNsContext().put(DMNModelInstrumentedBase.Namespace.FEEL.getPrefix(), DMNModelInstrumentedBase.Namespace.FEEL.getUri());
    final Decision decision = new Decision();
    decision.setParent(definitions);
    converter.setDMNModel(decision);
    final String encoding = converter.toWidgetValue(BuiltInType.DATE.asQName());
    assertEquals(ENCODED_FEEL_DATE, encoding);
}
Also used : Definitions(org.kie.workbench.common.dmn.api.definition.model.Definitions) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 53 with Decision

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

the class DMNElementsSynchronizerTest method testSynchronizeSpecializedProperties_DecisionNode.

@Test
public void testSynchronizeSpecializedProperties_DecisionNode() {
    doNothing().when(synchronizer).synchronizeDecisionNode(any(Decision.class), any(Decision.class));
    final Decision from = mock(Decision.class);
    final Decision to = mock(Decision.class);
    synchronizer.synchronizeSpecializedProperties(from, to);
    verify(synchronizer).synchronizeDecisionNode(from, to);
}
Also used : Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 54 with Decision

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

the class DMNElementsSynchronizerTest method testUpdateText.

@Test
public void testUpdateText() {
    final Decision from = mock(Decision.class);
    final Node to = mock(Node.class);
    final Name name = mock(Name.class);
    final String nameValue = "the name";
    when(name.getValue()).thenReturn(nameValue);
    when(from.getName()).thenReturn(name);
    synchronizer.updateText(from, to);
    verify(nodeTextSetter).setText(nameValue, to);
}
Also used : Node(org.kie.workbench.common.stunner.core.graph.Node) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Example 55 with Decision

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

the class DMNElementsSynchronizerTest method testSynchronizeDecisionNodeNode.

@Test
public void testSynchronizeDecisionNodeNode() {
    final Decision from = mock(Decision.class);
    final Decision to = mock(Decision.class);
    final Question question = mock(Question.class);
    final AllowedAnswers allowedAnswers = mock(AllowedAnswers.class);
    final Expression expression = mock(Expression.class);
    final InformationItemPrimary variable = mock(InformationItemPrimary.class);
    when(from.getQuestion()).thenReturn(question);
    when(from.getAllowedAnswers()).thenReturn(allowedAnswers);
    when(from.getExpression()).thenReturn(expression);
    when(from.getVariable()).thenReturn(variable);
    synchronizer.synchronizeDecisionNode(from, to);
    verify(to).setQuestion(question);
    verify(to).setAllowedAnswers(allowedAnswers);
    verify(to).setExpression(expression);
    verify(to).setVariable(variable);
}
Also used : InformationItemPrimary(org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary) Expression(org.kie.workbench.common.dmn.api.definition.model.Expression) Question(org.kie.workbench.common.dmn.api.property.dmn.Question) AllowedAnswers(org.kie.workbench.common.dmn.api.property.dmn.AllowedAnswers) 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