use of org.kie.server.api.exception.KieServicesException in project droolsjbpm-integration by kiegroup.
the class TaskAssigningPlanningKieServerExtension method init.
/**
* Invoked by the KieServer initialization procedure for performing current extension initialization.
*/
@Override
public void init(KieServerImpl kieServer, KieServerRegistry registry) {
LOGGER.debug("Initializing " + EXTENSION_NAME + " extension.");
this.kieServer = kieServer;
this.registry = registry;
KieServerExtension jbpmExtension = registry.getServerExtension(JbpmKieServerExtension.EXTENSION_NAME);
if (jbpmExtension != null) {
String msg = String.format(UNDESIRED_EXTENSIONS_RUNNING_ERROR, JbpmKieServerExtension.EXTENSION_NAME);
LOGGER.warn(msg);
kieServer.addServerMessage(new Message(Severity.WARN, addExtensionMessagePrefix(msg)));
}
initRuntimeClient();
try {
validateAndSetSolverConfiguration();
} catch (TaskAssigningValidationException e) {
throw new KieServicesException(String.format(SOLVER_CONFIGURATION_ERROR, e.getMessage()), e);
}
try {
validateAndSetUserSystemServiceConfiguration();
} catch (TaskAssigningValidationException e) {
throw new KieServicesException(String.format(USER_SYSTEM_CONFIGURATION_ERROR, e.getMessage()), e);
}
this.executorService = Executors.newScheduledThreadPool(4);
try {
this.taskAssigningService = createTaskAssigningService(readAndValidateTaskAssigningServiceConfig());
this.services.add(taskAssigningService);
} catch (TaskAssigningValidationException e) {
throw new KieServicesException(String.format(String.format(TASK_ASSIGNING_SERVICE_CONFIGURATION_ERROR, e.getMessage()), e));
}
this.initialized = true;
}
use of org.kie.server.api.exception.KieServicesException in project droolsjbpm-integration by kiegroup.
the class JobServiceIntegrationTest method testExecutorServiceDisabling.
@Test
public void testExecutorServiceDisabling() throws Exception {
String command = "invalidCommand";
Map<String, Object> data = new HashMap<String, Object>();
data.put("businessKey", BUSINESS_KEY);
Calendar tomorrow = Calendar.getInstance();
tomorrow.add(Calendar.DATE, 1);
JobRequestInstance jobRequestInstance = new JobRequestInstance();
jobRequestInstance.setCommand(command);
jobRequestInstance.setData(data);
jobRequestInstance.setScheduledDate(tomorrow.getTime());
// Executing fist command.
try {
jobServicesClient.scheduleRequest(jobRequestInstance);
} catch (Exception e) {
assertTrue(e instanceof KieServicesException);
assertTrue(e.getMessage().contains("Invalid command type"));
}
}
use of org.kie.server.api.exception.KieServicesException in project droolsjbpm-integration by kiegroup.
the class DocumentServiceIntegrationTest method testCreateLoadDeleteDocument.
@Test
@Category(Smoke.class)
public void testCreateLoadDeleteDocument() throws Exception {
String documentId = documentClient.createDocument(document);
assertNotNull(documentId);
DocumentInstance fromServer = documentClient.getDocument(documentId);
assertEquals(documentId, fromServer.getIdentifier());
assertDocumentInstances(document, fromServer, true);
documentClient.deleteDocument(documentId);
try {
documentClient.getDocument(documentId);
fail("Document with id " + documentId + " was deleted so should not be found anymore");
} catch (KieServicesException e) {
// expected
}
}
use of org.kie.server.api.exception.KieServicesException in project droolsjbpm-integration by kiegroup.
the class DocumentServiceIntegrationTest method testDeleteDocument.
@Test
public void testDeleteDocument() throws Exception {
String documentId = documentClient.createDocument(document);
assertNotNull(documentId);
DocumentInstance fromServer = documentClient.getDocument(documentId);
assertNotNull(fromServer);
documentClient.deleteDocument(documentId);
try {
documentClient.getDocument(documentId);
fail("Document with id " + documentId + " was deleted so should not be found anymore");
} catch (KieServicesException e) {
// expected
}
}
use of org.kie.server.api.exception.KieServicesException in project droolsjbpm-integration by kiegroup.
the class ProcessInstanceMigrationIntegrationTest method testUpgradeProcessInstanceWithNodeMapping.
@Test
public void testUpgradeProcessInstanceWithNodeMapping() {
Long processInstanceId = processClient.startProcess(CONTAINER_ID, PROCESS_ID_EVALUATION);
try {
List<TaskSummary> tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10);
assertEquals(1, tasks.size());
TaskSummary task = tasks.get(0);
assertEquals("Evaluate items?", tasks.get(0).getName());
assertEquals(CONTAINER_ID, task.getContainerId());
assertEquals(PROCESS_ID_EVALUATION, task.getProcessId());
assertEquals(processInstanceId, task.getProcessInstanceId());
Map<String, String> nodeMapping = new HashMap<String, String>();
nodeMapping.put("_4E8E7545-FB70-494E-9136-2B9ABE655889", "_56FB3E50-DEDD-415B-94DD-0357C91836B9");
// migrate process instance to evaluation 2 in container 2
MigrationReportInstance report = processAdminClient.migrateProcessInstance(CONTAINER_ID, processInstanceId, CONTAINER_ID_2, PROCESS_ID_EVALUATION_2, nodeMapping);
assertNotNull(report);
assertTrue(report.isSuccessful());
// migrated to Approve user task
tasks = taskClient.findTasksAssignedAsPotentialOwner(USER_YODA, 0, 10);
assertEquals(1, tasks.size());
task = tasks.get(0);
assertEquals("Approve", task.getName());
assertEquals(CONTAINER_ID_2, task.getContainerId());
assertEquals(PROCESS_ID_EVALUATION_2, task.getProcessId());
assertEquals(processInstanceId, task.getProcessInstanceId());
} finally {
try {
processClient.getProcessInstance(CONTAINER_ID_2, processInstanceId);
processClient.abortProcessInstance(CONTAINER_ID_2, processInstanceId);
} catch (KieServicesException e) {
processClient.abortProcessInstance(CONTAINER_ID, processInstanceId);
}
}
}
Aggregations