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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations