use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class DecisionComponentFilterTest method testQueryFilteredByDrgElementAndTermNoResult.
@Test
public void testQueryFilteredByDrgElementAndTermNoResult() {
final DecisionComponentsItem item1 = item("Can Drive?", new Decision());
final DecisionComponentsItem item2 = item("Is Allowed?", new Decision());
final DecisionComponentsItem item3 = item("Age", new InputData());
final DecisionComponentsItem item4 = item("Name", new InputData());
final Stream<DecisionComponentsItem> stream = Stream.of(item1, item2, item3, item4);
filter.setTerm("?");
filter.setDrgElement("InputData");
final Stream<DecisionComponentsItem> query = filter.query(stream);
final List<DecisionComponentsItem> actualResult = query.collect(Collectors.toList());
final List<DecisionComponentsItem> expectedResult = emptyList();
assertEquals(expectedResult, actualResult);
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class DecisionComponentFilterTest method testQueryFilteredByDrgElementAndTermMultipleResults.
@Test
public void testQueryFilteredByDrgElementAndTermMultipleResults() {
final DecisionComponentsItem item1 = item("Can Drive?", new Decision());
final DecisionComponentsItem item2 = item("Is Allowed?", new Decision());
final DecisionComponentsItem item3 = item("Age", new InputData());
final DecisionComponentsItem item4 = item("Name", new InputData());
final Stream<DecisionComponentsItem> stream = Stream.of(item1, item2, item3, item4);
filter.setTerm("e");
filter.setDrgElement("InputData");
final Stream<DecisionComponentsItem> query = filter.query(stream);
final List<DecisionComponentsItem> actualResult = query.collect(Collectors.toList());
final List<DecisionComponentsItem> expectedResult = asList(item3, item4);
assertEquals(expectedResult, actualResult);
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class DecisionComponentFilterTest method testQueryFilteredByDrgElementAndTerm.
@Test
public void testQueryFilteredByDrgElementAndTerm() {
final DecisionComponentsItem item1 = item("Can Drive?", new Decision());
final DecisionComponentsItem item2 = item("Is Allowed?", new Decision());
final DecisionComponentsItem item3 = item("Age", new InputData());
final DecisionComponentsItem item4 = item("Name", new InputData());
final Stream<DecisionComponentsItem> stream = Stream.of(item1, item2, item3, item4);
filter.setTerm("is");
filter.setDrgElement("Decision");
final Stream<DecisionComponentsItem> query = filter.query(stream);
final List<DecisionComponentsItem> actualResult = query.collect(Collectors.toList());
final List<DecisionComponentsItem> expectedResult = singletonList(item2);
assertEquals(expectedResult, actualResult);
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class DecisionComponentFilterTest method testQueryFilteredByDrgElement.
@Test
public void testQueryFilteredByDrgElement() {
final DecisionComponentsItem item1 = item("Can Drive?", new Decision());
final DecisionComponentsItem item2 = item("Is Allowed?", new Decision());
final DecisionComponentsItem item3 = item("Age", new InputData());
final DecisionComponentsItem item4 = item("Name", new InputData());
final Stream<DecisionComponentsItem> stream = Stream.of(item1, item2, item3, item4);
filter.setDrgElement("Decision");
final Stream<DecisionComponentsItem> query = filter.query(stream);
final List<DecisionComponentsItem> actualResult = query.collect(Collectors.toList());
final List<DecisionComponentsItem> expectedResult = asList(item1, item2);
assertEquals(expectedResult, actualResult);
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class DefaultValueUtilitiesTest method testUpdateNewNodeName_KnowledgeSource.
@Test
public void testUpdateNewNodeName_KnowledgeSource() {
// Add some existing nodes to ensure naming is not affected by existing content
graph.addNode(makeMockNode(new BusinessKnowledgeModel()));
graph.addNode(makeMockNode(new Decision()));
graph.addNode(makeMockNode(new InputData()));
graph.addNode(makeMockNode(new TextAnnotation()));
final KnowledgeSource knowledgeSource1 = new KnowledgeSource();
final KnowledgeSource knowledgeSource2 = new KnowledgeSource();
final KnowledgeSource knowledgeSource3 = new KnowledgeSource();
final KnowledgeSource knowledgeSource4 = new KnowledgeSource();
assertUpdateNewNodeName(knowledgeSource1, knowledgeSource2, (knowledgeSource) -> knowledgeSource.getName().getValue(), () -> KnowledgeSource.class.getSimpleName() + "-1", () -> KnowledgeSource.class.getSimpleName() + "-2");
// Update existing names manually and add two more
knowledgeSource1.getName().setValue("knowledgeSource");
knowledgeSource2.getName().setValue(KnowledgeSource.class.getSimpleName() + "-5");
assertUpdateNewNodeName(knowledgeSource3, knowledgeSource4, (knowledgeSource) -> knowledgeSource.getName().getValue(), () -> KnowledgeSource.class.getSimpleName() + "-6", () -> KnowledgeSource.class.getSimpleName() + "-7");
}
Aggregations