Search in sources :

Example 6 with WorkItemDefinition

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

the class WorkItemDefinitionParserTest method testServiceRepository.

private static void testServiceRepository() {
    System.out.println("Starting...");
    Collection<WorkItemDefinition> workItems = WorkItemDefinitionRemoteService.fetch(WorkItemDefinitionRemoteService.DEFAULT_LOOKUP_SERVICE, JBOSS_REPO, new String[] { "Email" });
    System.out.println("Completed!");
    WorkItemDefinition workItemDefinition = workItems.iterator().next();
    assertNotNull(workItemDefinition);
    assertEquals("Email", workItemDefinition.getName());
    assertEquals("Communication", workItemDefinition.getCategory());
    assertEquals("Sending emails", workItemDefinition.getDescription());
    assertEquals("Email", workItemDefinition.getDisplayName());
    assertEquals("index.html", workItemDefinition.getDocumentation());
    assertEquals("org.jbpm.process.workitem.email.EmailWorkItemHandler", workItemDefinition.getDefaultHandler());
    assertEquals("|Body:String,From:String,Subject:String,To:String|", workItemDefinition.getParameters());
    assertEquals("||", workItemDefinition.getResults());
    assertNotNull(workItemDefinition.getIconDefinition().getIconData());
}
Also used : WorkItemDefinition(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition)

Example 7 with WorkItemDefinition

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

the class WorkItemDefinitionParserTest method testEmailWorkItemDefinition.

@Test
public void testEmailWorkItemDefinition() throws Exception {
    when(dataUriProvider.apply(eq("email.gif"))).thenReturn(ICON_DATA);
    String raw = loadStream(WID_EMAIL);
    Collection<WorkItemDefinition> workItemDefinitions = WorkItemDefinitionParser.parse(raw, w -> "uri", dataUriProvider);
    assertNotNull(workItemDefinitions);
    assertEquals(1, workItemDefinitions.size());
    WorkItemDefinition workItemDefinition = workItemDefinitions.iterator().next();
    assertNotNull(workItemDefinition);
    assertEquals("Email", workItemDefinition.getName());
    assertEquals("Communication", workItemDefinition.getCategory());
    assertEquals("Sending emails", workItemDefinition.getDescription());
    assertEquals("Email", workItemDefinition.getDisplayName());
    assertEquals("index.html", workItemDefinition.getDocumentation());
    assertEquals("org.jbpm.process.workitem.email.EmailWorkItemHandler", workItemDefinition.getDefaultHandler());
    assertEquals(ICON_DATA, workItemDefinition.getIconDefinition().getIconData());
    assertEquals("|Body:String,From:String,Subject:String,To:String|", workItemDefinition.getParameters());
    assertEquals("||", workItemDefinition.getResults());
}
Also used : WorkItemDefinition(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition) Test(org.junit.Test)

Example 8 with WorkItemDefinition

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

the class WorkItemDefinitionClientParserTest method testMissingIcon.

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

Example 9 with WorkItemDefinition

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

the class WorkItemDefinitionClientParserTest method testSecondWidIsIncorrect.

@Test
public void testSecondWidIsIncorrect() {
    String widFile = loadTestFile(SECOND_WID_IS_INCORRECT_WID_FILE);
    List<WorkItemDefinition> defs = WorkItemDefinitionClientParser.parse(widFile);
    // Despite of third WID is correct, parser failed on the second one so can't proceed and only returns first one
    assertEquals(1, defs.size());
    WorkItemDefinition wid1 = defs.get(0);
    assertEquals("Email", wid1.getName());
    assertEquals("Display Email", wid1.getDisplayName());
    assertEquals("Some documentation", wid1.getDocumentation());
}
Also used : WorkItemDefinition(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition) Test(org.junit.Test)

Example 10 with WorkItemDefinition

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

the class WorkItemDefinitionClientParserTest method testQuotas.

@Test
public void testQuotas() {
    String widFile = loadTestFile(QUOTAS_WID_FILE);
    List<WorkItemDefinition> defs = WorkItemDefinitionClientParser.parse(widFile);
    assertEquals(1, defs.size());
    WorkItemDefinition wid = defs.get(0);
    assertEquals("Email", wid.getName());
    assertEquals("Display Email", wid.getDisplayName());
    assertEquals("defaultemailicon.gif", wid.getIconDefinition().getUri());
    assertEquals("new org.package.DefaultHandler()", wid.getDefaultHandler());
    assertEquals("Some \"description\"", wid.getDescription());
    assertEquals(BPMNCategories.CUSTOM_TASKS, wid.getCategory());
    assertEquals("Some \'documentation\'", wid.getDocumentation());
    assertEquals(EMAIL_WID_EXTRACTED_PARAMETERS, wid.getParameters());
    assertEquals(EMAIL_WID_RETURN_EXTRACTED_PARAMETERS, wid.getResults());
}
Also used : WorkItemDefinition(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinition) Test(org.junit.Test)

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