use of org.kie.server.api.model.definition.ProcessDefinition in project droolsjbpm-integration by kiegroup.
the class KieCamelRemoteIntegrationTest method testGetProcessDefinition.
@Test
public void testGetProcessDefinition() {
final Map<String, Object> parameters = new HashMap<>();
parameters.put("containerId", KieServerConstants.containerId);
parameters.put("processId", KieServerConstants.processId);
final ExecutionServerCommand executionServerCommand = new ExecutionServerCommand();
executionServerCommand.setClient("process");
executionServerCommand.setOperation("getProcessDefinition");
executionServerCommand.setParameters(parameters);
final Object response = remoteExecutionService.runOnExecServer(executionServerCommand);
Assert.assertNotNull(response);
Assert.assertTrue(response instanceof ProcessDefinition);
final ProcessDefinition processDefinition = (ProcessDefinition) response;
Assert.assertEquals("Evaluation", processDefinition.getName());
Assert.assertEquals("1", processDefinition.getVersion());
}
use of org.kie.server.api.model.definition.ProcessDefinition in project droolsjbpm-integration by kiegroup.
the class ProcessServicesClientImpl method getProcessDefinition.
@Override
public ProcessDefinition getProcessDefinition(String containerId, String processId) {
if (config.isRest()) {
Map<String, Object> valuesMap = new HashMap<String, Object>();
valuesMap.put(CONTAINER_ID, containerId);
valuesMap.put(PROCESS_ID, processId);
return makeHttpGetRequestAndCreateCustomResponse(build(loadBalancer.getUrl(), PROCESS_DEF_URI + "/" + PROCESS_DEF_GET_URI, valuesMap), ProcessDefinition.class);
} else {
CommandScript script = new CommandScript(singletonList((KieServerCommand) new DescriptorCommand("DefinitionService", "getProcessDefinition", new Object[] { containerId, processId })));
ServiceResponse<ProcessDefinition> response = (ServiceResponse<ProcessDefinition>) executeJmsCommand(script, DescriptorCommand.class.getName(), "BPM", containerId).getResponses().get(0);
throwExceptionOnFailure(response);
if (shouldReturnWithNullResponse(response)) {
return null;
}
return response.getResult();
}
}
use of org.kie.server.api.model.definition.ProcessDefinition in project droolsjbpm-integration by kiegroup.
the class KieServerRouterMultiNodeTest method testFalseAggregatableMultipleResponseRouter.
@Test
public void testFalseAggregatableMultipleResponseRouter() throws Exception {
ResponseDefinitionBuilder resp1 = aResponse().withHeader(CONTENT_TYPE, MEDIA_TYPE_AGGREGATABLE_FALSE).withBody(bodyProcessDefinition1);
ResponseDefinitionBuilder resp2 = aResponse().withHeader(CONTENT_TYPE, MEDIA_TYPE_AGGREGATABLE_FALSE).withBody(bodyProcessDefinition2);
server1.stubFor(get(urlEqualTo(PROCESSES_DEFINITIONS_PATH)).willReturn(resp1));
server2.stubFor(get(urlEqualTo(PROCESSES_DEFINITIONS_PATH)).willReturn(resp2));
QueryServicesClient queries = initRouterClient();
List<ProcessDefinition> lpi = queries.findProcesses(0, 10);
assertNotNull(lpi);
assertThat(lpi).hasSize(1);
}
use of org.kie.server.api.model.definition.ProcessDefinition in project droolsjbpm-integration by kiegroup.
the class KieServerRouterMultiNodeTest method testAggregates.
private void testAggregates() {
QueryServicesClient queries = initRouterClient();
List<ProcessDefinition> lpi = queries.findProcesses(0, 10);
assertNotNull(lpi);
assertThat(lpi).hasSize(2);
List<String> names = lpi.stream().map(ni -> ni.getName()).collect(Collectors.toList());
assertThat(names).contains("Evaluation updated", "Other evaluation process");
}
Aggregations