use of org.kie.dmn.model.api.dmndi.DMNShape in project drools by kiegroup.
the class UnmarshalMarshalTest method test_FontSize_sharedStyle.
@Test
public void test_FontSize_sharedStyle() throws Exception {
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "test-FontSize-sharedStyle.dmn");
Definitions definitions = MARSHALLER.unmarshal(new InputStreamReader(this.getClass().getResourceAsStream("test-FontSize-sharedStyle.dmn")));
DMNShape shape0 = (DMNShape) definitions.getDMNDI().getDMNDiagram().get(0).getDMNDiagramElement().get(0);
DMNStyle shape0sharedStyle = (DMNStyle) shape0.getDMNLabel().getSharedStyle();
assertEquals("LS_4d396200-362f-4939-830d-32d2b4c87042_0", shape0sharedStyle.getId());
assertEquals(21d, shape0sharedStyle.getFontSize(), 0.0d);
}
use of org.kie.dmn.model.api.dmndi.DMNShape in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method testGetUniqueDMNShapes.
@Test
public void testGetUniqueDMNShapes() {
final DMNMarshallerStandalone marshaller = spy(getDMNMarshaller());
final org.kie.dmn.model.api.dmndi.DMNDiagram diagram = mock(org.kie.dmn.model.api.dmndi.DMNDiagram.class);
final List<DiagramElement> elements = new ArrayList<>();
final DMNShape unique1 = mock(DMNShape.class);
when(unique1.getId()).thenReturn("unique1");
final DMNShape unique2 = mock(DMNShape.class);
when(unique2.getId()).thenReturn("unique2");
final DMNShape duplicate1 = mock(DMNShape.class);
when(duplicate1.getId()).thenReturn("duplicate");
final DMNShape duplicate2 = mock(DMNShape.class);
when(duplicate2.getId()).thenReturn("duplicate");
elements.add(unique1);
elements.add(unique2);
elements.add(duplicate1);
elements.add(duplicate2);
when(diagram.getDMNDiagramElement()).thenReturn(elements);
final List<DMNShape> actual = marshaller.getUniqueDMNShapes(diagram);
assertEquals(3, actual.size());
assertTrue(actual.contains(unique1));
assertTrue(actual.contains(unique2));
assertTrue(actual.contains(duplicate1) || actual.contains(duplicate2));
}
use of org.kie.dmn.model.api.dmndi.DMNShape in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method createDMNShape.
private DMNShape createDMNShape(final String refId) {
final DMNShape shape = mock(DMNShape.class);
final QName ref = mock(QName.class);
when(shape.getDmnElementRef()).thenReturn(ref);
when(ref.getLocalPart()).thenReturn(refId);
return shape;
}
use of org.kie.dmn.model.api.dmndi.DMNShape in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method testGetDmnElementRef.
@Test
public void testGetDmnElementRef() {
final DMNMarshallerStandalone marshaller = spy(getDMNMarshaller());
final String expected = "localPart";
final DMNShape shape = mock(DMNShape.class);
final javax.xml.namespace.QName ref = mock(javax.xml.namespace.QName.class);
when(ref.getLocalPart()).thenReturn(expected);
when(shape.getDmnElementRef()).thenReturn(ref);
final String actual = marshaller.getDmnElementRef(shape);
assertEquals(expected, actual);
}
use of org.kie.dmn.model.api.dmndi.DMNShape in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method testRemoveDrgElementsWithoutShape.
@Test
public void testRemoveDrgElementsWithoutShape() {
final String id1 = "id1";
final String id2 = "id2";
final String id3 = "id3";
final DRGElement e1 = createDRGElement(id1);
final DRGElement e2 = createDRGElement(id2);
final DRGElement e3 = createDRGElement(id3);
final List<org.kie.dmn.model.api.DRGElement> drgElements = new ArrayList<>(Arrays.asList(e1, e2, e3));
final DMNShape s1 = createDMNShape(id1);
final DMNShape s3 = createDMNShape(id3);
final List<DMNShape> dmnShapes = new ArrayList<>(Arrays.asList(s1, s3));
getDMNMarshaller().removeDrgElementsWithoutShape(drgElements, dmnShapes);
assertEquals(2, drgElements.size());
assertEquals(e1, drgElements.get(0));
assertEquals(e3, drgElements.get(1));
}
Aggregations