Search in sources :

Example 11 with DefaultImport

use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport in project kie-wb-common by kiegroup.

the class RootProcessConverterTest method testImports.

@Test
public void testImports() {
    DiagramSet diagramSet = createDiagramSet();
    Imports imports = diagramSet.getImports();
    assertNotNull(imports);
    ImportsValue importsValue = imports.getValue();
    assertNotNull(importsValue);
    List<DefaultImport> defaultImports = importsValue.getDefaultImports();
    assertNotNull(defaultImports);
    assertFalse(defaultImports.isEmpty());
    DefaultImport defaultImport = defaultImports.get(0);
    assertNotNull(defaultImport);
    assertEquals(getClass().getName(), defaultImport.getClassName());
}
Also used : DefaultImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport) DiagramSet(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet) ImportsValue(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue) Imports(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.Imports) Test(org.junit.Test)

Example 12 with DefaultImport

use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport in project kie-wb-common by kiegroup.

the class DiagramSetTest method testSetImports.

@Test
public void testSetImports() {
    DefaultImport defaultImport = new DefaultImport("className");
    WSDLImport wsdlImport = new WSDLImport("location", "namespace");
    ImportsValue importsValue = new ImportsValue();
    importsValue.addImport(defaultImport);
    importsValue.addImport(wsdlImport);
    Imports imports = new Imports(importsValue);
    DiagramSet diagramSet = new DiagramSet();
    diagramSet.setImports(imports);
    assertEquals(imports, diagramSet.getImports());
}
Also used : DefaultImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport) ImportsValue(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue) Imports(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.Imports) WSDLImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.WSDLImport) Test(org.junit.Test)

Example 13 with DefaultImport

use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport in project kie-wb-common by kiegroup.

the class DiagramSetTest method testEquals.

@Test
public void testEquals() {
    DiagramSet a = new DiagramSet();
    DiagramSet b = new DiagramSet();
    assertEquals(a, b);
    DefaultImport defaultImport = new DefaultImport("className");
    WSDLImport wsdlImport = new WSDLImport("location", "namespace");
    ImportsValue importsValue = new ImportsValue();
    importsValue.addImport(defaultImport);
    importsValue.addImport(wsdlImport);
    DiagramSet c = new DiagramSet();
    c.setImports(new Imports(importsValue));
    DiagramSet d = new DiagramSet();
    assertNotEquals(c, d);
}
Also used : DefaultImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport) ImportsValue(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue) Imports(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.Imports) WSDLImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.WSDLImport) Test(org.junit.Test)

Example 14 with DefaultImport

use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport in project kie-wb-common by kiegroup.

the class ProcessPropertyReaderTest method getDefaultImports.

@Test
public void getDefaultImports() {
    final String CLASS_NAME = "className";
    final int QTY = 10;
    List<DefaultImport> defaultImports = new ArrayList<>();
    for (int i = 0; i < QTY; i++) {
        defaultImports.add(new DefaultImport(CLASS_NAME + i));
    }
    CustomElement.defaultImports.of(process).set(defaultImports);
    List<DefaultImport> result = tested.getDefaultImports();
    assertEquals(QTY, result.size());
    for (int i = 0; i < result.size(); i++) {
        assertEquals(CLASS_NAME + i, result.get(i).getClassName());
    }
}
Also used : DefaultImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 15 with DefaultImport

use of org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport in project kie-wb-common by kiegroup.

the class DefaultImportListItemWidgetViewTest method initListItem.

@Test
public void initListItem() {
    DefaultImport defaultImport = tested.getModel();
    defaultImport.setClassName(null);
    tested.initListItem();
    defaultImport = tested.getModel();
    defaultImport.setClassName("");
    tested.initListItem();
    defaultImport = tested.getModel();
    defaultImport.setClassName("randomValue");
    Map<String, String> map = new HashMap<>();
    map.put("randomValue", "randomValue");
    map.put("Boolean", "Boolean");
    when(parent.getDataTypes()).thenReturn(map);
    tested.initListItem();
    defaultImport = tested.getModel();
    defaultImport.setClassName("Boolean");
    tested.initListItem();
    verify(defaultClassNames, times(2)).setValue(null);
    verify(defaultClassNames, times(1)).setValue("Boolean");
    verify(defaultClassNames, times(1)).setValue("randomValue");
    verify(classNamesComboBox, times(4)).setShowCustomValues(true);
    verify(classNamesComboBox, times(4)).setListBoxValues(any(ListBoxValues.class));
    verify(classNamesComboBox, times(4)).init(tested, true, defaultClassNames, customClassName, false, true, CUSTOM_PROMPT, ENTER_TYPE_PROMPT);
}
Also used : DefaultImport(org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport) HashMap(java.util.HashMap) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ListBoxValues(org.kie.workbench.common.stunner.bpmn.client.forms.util.ListBoxValues) Test(org.junit.Test)

Aggregations

DefaultImport (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.DefaultImport)20 Test (org.junit.Test)14 ImportsValue (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.ImportsValue)8 WSDLImport (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.WSDLImport)6 Imports (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.imports.Imports)5 ArrayList (java.util.ArrayList)3 Before (org.junit.Before)3 ImportType (org.jboss.drools.ImportType)2 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)2 DiagramSet (org.kie.workbench.common.stunner.bpmn.definition.property.diagram.DiagramSet)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 HashMap (java.util.HashMap)1 TreeMap (java.util.TreeMap)1 BaseElement (org.eclipse.bpmn2.BaseElement)1 Definitions (org.eclipse.bpmn2.Definitions)1 BPMNDiagram (org.eclipse.bpmn2.di.BPMNDiagram)1 EStructuralFeatureImpl (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl)1 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)1 ValueListBox (org.gwtbootstrap3.client.ui.ValueListBox)1 TypedFactoryManager (org.kie.workbench.common.stunner.bpmn.backend.converters.TypedFactoryManager)1