Search in sources :

Example 11 with WorkItemDefinition

use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition in project kie-wb-common by kiegroup.

the class WorkItemDefinitionClientParserTest method testMissingDisplayName.

@Test
public void testMissingDisplayName() {
    String widFile = loadTestFile(MISSING_DISPLAY_NAME_WID_FILE);
    List<WorkItemDefinition> defs = WorkItemDefinitionClientParser.parse(widFile);
    assertEquals(1, defs.size());
    WorkItemDefinition wid = defs.get(0);
    assertEquals("Email", wid.getName());
    assertEquals("", wid.getDisplayName());
    assertEquals("defaultemailicon.gif", wid.getIconDefinition().getUri());
    assertEquals(BPMNCategories.CUSTOM_TASKS, wid.getCategory());
    assertEquals("Some documentation", wid.getDocumentation());
    assertTrue(wid.getResults().isEmpty());
    assertEquals(EMAIL_WID_EXTRACTED_PARAMETERS, wid.getParameters());
}
Also used : WorkItemDefinition(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition) Test(org.junit.Test)

Example 12 with WorkItemDefinition

use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition in project kie-wb-common by kiegroup.

the class CustomTaskShapeViewHandlerTest method testHandleIconDefinitionNull.

@Test
@SuppressWarnings("unchecked")
public void testHandleIconDefinitionNull() {
    final WorkItemDefinition wid = mock(WorkItemDefinition.class);
    when(wid.getIconDefinition()).thenReturn(null);
    when(registry.get(eq(WID_ID))).thenReturn(wid);
    checkIconLoad(WorkItemDefinitionClientUtils.getDefaultIconData());
}
Also used : WorkItemDefinition(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition) Test(org.junit.Test)

Example 13 with WorkItemDefinition

use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition in project kie-wb-common by kiegroup.

the class CustomTaskShapeViewHandlerTest method testHandleIconDataNull.

@Test
@SuppressWarnings("unchecked")
public void testHandleIconDataNull() {
    final WorkItemDefinition wid = mock(WorkItemDefinition.class);
    final IconDefinition iconDef = mock(IconDefinition.class);
    when(iconDef.getIconData()).thenReturn(null);
    when(wid.getIconDefinition()).thenReturn(iconDef);
    when(registry.get(eq(WID_ID))).thenReturn(wid);
    checkIconLoad(WorkItemDefinitionClientUtils.getDefaultIconData());
}
Also used : WorkItemDefinition(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition) IconDefinition(org.kie.workbench.common.stunner.bpmn.workitem.IconDefinition) Test(org.junit.Test)

Example 14 with WorkItemDefinition

use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition in project kie-wb-common by kiegroup.

the class WorkItemDefinitionParser method emptyWid.

public static WorkItemDefinition emptyWid() {
    WorkItemDefinition wid = new WorkItemDefinition();
    wid.setIconDefinition(new IconDefinition());
    wid.getIconDefinition().setUri("");
    wid.setUri("");
    wid.setName("");
    wid.setCategory("");
    wid.setDescription("");
    wid.setDocumentation("");
    wid.setDisplayName("");
    wid.setResults("");
    wid.setDefaultHandler("");
    wid.setDependencies(new Dependencies(Collections.emptyList()));
    wid.setParameters("");
    return wid;
}
Also used : WorkItemDefinition(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition) Dependencies(org.guvnor.common.services.project.model.Dependencies) IconDefinition(org.kie.workbench.common.stunner.bpmn.workitem.IconDefinition)

Example 15 with WorkItemDefinition

use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition in project kie-wb-common by kiegroup.

the class WorkItemDefinitionRemoteDeployService method deploy.

void deploy(final Metadata metadata, final String url, final String names) {
    if (null != url && url.trim().length() > 0) {
        final Collection<WorkItemDefinition> items = remoteLookupService.execute(WorkItemDefinitionRemoteRequest.build(url, names));
        final List<Asset> assets = items.stream().flatMap(this::toAssets).collect(Collectors.toList());
        if (!assets.isEmpty()) {
            // Deploy into file system.
            backendFileSystemManager.deploy(resources.resolveResourcesPath(metadata), new Assets(assets), DEPLOY_MESSAGE + url);
            // Install into current KIE runtime.
            projectInstaller.install(items, metadata);
        }
    }
}
Also used : WorkItemDefinition(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition) Assets(org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Assets) Asset(org.kie.workbench.common.stunner.core.backend.service.BackendFileSystemManager.Asset)

Aggregations

WorkItemDefinition (org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition)33 Test (org.junit.Test)18 IconDefinition (org.kie.workbench.common.stunner.bpmn.workitem.IconDefinition)5 Collection (java.util.Collection)4 Dependencies (org.guvnor.common.services.project.model.Dependencies)4 WorkItemDefinitionRegistry (org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionRegistry)4 Map (java.util.Map)3 Consumer (java.util.function.Consumer)3 Function (java.util.function.Function)3 Inject (javax.inject.Inject)3 BPMNDiagramImpl (org.kie.workbench.common.stunner.bpmn.definition.BPMNDiagramImpl)3 Lane (org.kie.workbench.common.stunner.bpmn.definition.Lane)3 NoneTask (org.kie.workbench.common.stunner.bpmn.definition.NoneTask)3 SequenceFlow (org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow)3 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 HashMap (java.util.HashMap)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 Predicate (java.util.function.Predicate)2