private ActivityInstance complete(ActivityInstance ai, String context, Map<String, ?> data) { WorkflowService ws = sf.getWorkflowService(); if (ai.getState() != ActivityInstanceState.Application) { ai = ws.activate(ai.getOID()); } ai = ws.complete(ai.getOID(), context, data); return ai; }
@SuppressWarnings("unchecked") private List<ActivityInstance> getWorklist(EvaluationPolicy... policies) { WorkflowService ws = sf.getWorkflowService(); WorklistQuery query = WorklistQuery.findCompleteWorklist(); if (policies != null) { for (EvaluationPolicy policy : policies) { query.setPolicy(policy); } } Worklist worklist = ws.getWorklist(query); return worklist.getCumulatedItems(); }
@SuppressWarnings("unchecked") private List<ActivityInstance> getWorklist(ProcessInstance pi, EvaluationPolicy... policies) { WorkflowService ws = sf.getWorkflowService(); WorklistQuery query = WorklistQuery.findCompleteWorklist(); if (policies != null) { for (EvaluationPolicy policy : policies) { query.setPolicy(policy); } } query.getFilter().add(new ProcessInstanceFilter(pi.getOID(), false)); Worklist worklist = ws.getWorklist(query); return worklist.getCumulatedItems(); }
/** * Instantiates a new razor server, its services, and starts the scheduler. This can be replaced * by a dynamic handler manager but has the benefit of simplicity. */ public RazorServer() { super(); SERVICES.put(Service.ACCOUNT, AccountService.getInstance()); SERVICES.put(Service.ALERT, AlertService.getInstance()); SERVICES.put(Service.ASSET, AssetService.getInstance()); SERVICES.put(Service.ATTRIBUTE, AttributeService.getInstance()); SERVICES.put(Service.AUDIT, AuditService.getInstance()); SERVICES.put(Service.CONTRACT, ContractService.getInstance()); SERVICES.put(Service.FINANCE, FinanceService.getInstance()); SERVICES.put(Service.JOURNAL, JournalService.getInstance()); SERVICES.put(Service.IMAGE, ImageService.getInstance()); SERVICES.put(Service.IMAGETEXT, ImageTextService.getInstance()); SERVICES.put(Service.LICENSE, LicenseService.getInstance()); SERVICES.put(Service.LOCATION, LocationService.getInstance()); SERVICES.put(Service.MAIL, MailService.getInstance()); SERVICES.put(Service.MONITOR, MonitorService.getInstance()); SERVICES.put(Service.PARTNER, PartnerService.getInstance()); SERVICES.put(Service.PARTY, PartyService.getInstance()); SERVICES.put(Service.PRICE, PriceService.getInstance()); SERVICES.put(Service.PRODUCT, ProductService.getInstance()); SERVICES.put(Service.RATE, RateService.getInstance()); SERVICES.put(Service.REPORT, ReportService.getInstance()); SERVICES.put(Service.RESERVATION, ReservationService.getInstance()); SERVICES.put(Service.SESSION, SessionService.getInstance()); SERVICES.put(Service.SMS, SmsService.getInstance()); SERVICES.put(Service.TASK, TaskService.getInstance()); SERVICES.put(Service.TAX, TaxService.getInstance()); SERVICES.put(Service.TEXT, TextService.getInstance()); SERVICES.put(Service.WORKFLOW, WorkflowService.getInstance()); // startScheduler(); // PartnerService.startSchedulers(); }
@Override public List<ServiceTestInvocation> getTestInvocations() throws Exception { List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); // getWorkflow WorkflowService service = new TestWorkflowService("clusterName"); Method m = service .getClass() .getMethod("getWorkflow", String.class, HttpHeaders.class, UriInfo.class, String.class); Object[] args = new Object[] {null, getHttpHeaders(), getUriInfo(), "jobId"}; listInvocations.add(new ServiceTestInvocation(Request.Type.GET, service, m, args, null)); // getWorkflows service = new TestWorkflowService("clusterName"); m = service .getClass() .getMethod("getWorkflows", String.class, HttpHeaders.class, UriInfo.class); args = new Object[] {null, getHttpHeaders(), getUriInfo()}; listInvocations.add(new ServiceTestInvocation(Request.Type.GET, service, m, args, null)); return listInvocations; }
@Test public void testListWorkflows() { workflowService.listWorkflows(DUMMY_ID, null, null); verify(workflowRevisionService, times(1)).listWorkflows(DUMMY_ID, Optional.empty(), null, null); }
@Test public void testGetWorkflowMetadata() { workflowService.getWorkflowMetadata(DUMMY_ID, DUMMY_ID, Optional.empty()); verify(workflowRevisionService, times(1)) .getWorkflow(DUMMY_ID, DUMMY_ID, Optional.empty(), Optional.empty()); }
@Test public void testCreateWorkflow() { workflowService.createWorkflow(DUMMY_ID, null); verify(workflowRevisionService, times(1)) .createWorkflowRevision(DUMMY_ID, Optional.empty(), null); }