use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class MscRuntimeContainerDelegate method unregisterProcessEngine.
@SuppressWarnings("unchecked")
public void unregisterProcessEngine(ProcessEngine processEngine) {
if (processEngine == null) {
throw new ProcessEngineException("Cannot unregister process engine with Msc Runtime Container: process engine is 'null'");
}
ServiceName serviceName = ServiceNames.forManagedProcessEngine(processEngine.getName());
// remove the service asynchronously
ServiceController<ProcessEngine> service = (ServiceController<ProcessEngine>) serviceContainer.getService(serviceName);
if (service != null && service.getService() instanceof MscManagedProcessEngine) {
service.setMode(Mode.REMOVE);
}
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class ProcessApplicationStartService method getInjections.
protected Object[] getInjections(Method lifecycleMethod) {
final Type[] parameterTypes = lifecycleMethod.getGenericParameterTypes();
final List<Object> parameters = new ArrayList<Object>();
for (Type parameterType : parameterTypes) {
boolean injectionResolved = false;
if (parameterType instanceof Class) {
Class<?> parameterClass = (Class<?>) parameterType;
// support injection of the default process engine
if (ProcessEngine.class.isAssignableFrom(parameterClass)) {
parameters.add(defaultProcessEngineInjector.getValue());
injectionResolved = true;
} else // support injection of the ProcessApplicationInfo
if (ProcessApplicationInfo.class.isAssignableFrom(parameterClass)) {
parameters.add(processApplicationInfo);
injectionResolved = true;
}
} else if (parameterType instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) parameterType;
Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
// support injection of List<ProcessEngine>
if (actualTypeArguments.length == 1 && ProcessEngine.class.isAssignableFrom((Class<?>) actualTypeArguments[0])) {
parameters.add(new ArrayList<ProcessEngine>(referencedProcessEngines));
injectionResolved = true;
}
}
if (!injectionResolved) {
throw new ProcessEngineException("Unsupported parametertype " + parameterType);
}
}
return parameters.toArray();
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class ManagedProcessEngineMetadata method validate.
/**
* validates the configuration and throws {@link ProcessEngineException}
* if the configuration is invalid.
*/
public void validate() {
StringBuilder validationErrorBuilder = new StringBuilder("Process engine configuration is invalid: \n");
boolean isValid = true;
if (datasourceJndiName == null || datasourceJndiName.isEmpty()) {
isValid = false;
validationErrorBuilder.append(" property 'datasource' cannot be null \n");
}
if (engineName == null || engineName.isEmpty()) {
isValid = false;
validationErrorBuilder.append(" property 'engineName' cannot be null \n");
}
for (int i = 0; i < pluginConfigurations.size(); i++) {
ProcessEnginePluginXml pluginConfiguration = pluginConfigurations.get(i);
if (pluginConfiguration.getPluginClass() == null || pluginConfiguration.getPluginClass().isEmpty()) {
isValid = false;
validationErrorBuilder.append(" property 'class' in plugin[" + i + "] cannot be null \n");
}
}
if (!isValid) {
throw new ProcessEngineException(validationErrorBuilder.toString());
}
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class TaskVariableRestResourceInteractionTest method testDeleteVariableForNonExistingTaskId.
@Test
public void testDeleteVariableForNonExistingTaskId() {
String variableKey = "aVariableKey";
doThrow(new ProcessEngineException("Cannot find task with id " + NON_EXISTING_ID)).when(taskServiceMock).removeVariable(eq(NON_EXISTING_ID), eq(variableKey));
given().pathParam("id", NON_EXISTING_ID).pathParam("varId", variableKey).header("accept", MediaType.APPLICATION_JSON).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON).body("type", is(RestException.class.getSimpleName())).body("message", is("Cannot delete task variable " + variableKey + ": Cannot find task with id " + NON_EXISTING_ID)).when().delete(SINGLE_TASK_DELETE_SINGLE_VARIABLE_URL);
}
use of org.camunda.bpm.engine.ProcessEngineException in project camunda-bpm-platform by camunda.
the class TaskVariableRestResourceInteractionTest method testPutVariableForNonExistingTaskId.
@Test
public void testPutVariableForNonExistingTaskId() {
String variableKey = "aVariableKey";
String variableValue = "aVariableValue";
Map<String, Object> variableJson = VariablesBuilder.getVariableValueMap(variableValue);
doThrow(new ProcessEngineException("Cannot find task with id " + NON_EXISTING_ID)).when(taskServiceMock).setVariable(eq(NON_EXISTING_ID), eq(variableKey), any());
given().pathParam("id", NON_EXISTING_ID).pathParam("varId", variableKey).contentType(ContentType.JSON).body(variableJson).header("accept", MediaType.APPLICATION_JSON).then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).body("type", is(RestException.class.getSimpleName())).body("message", is("Cannot put task variable " + variableKey + ": Cannot find task with id " + NON_EXISTING_ID)).when().put(SINGLE_TASK_PUT_SINGLE_VARIABLE_URL);
}
Aggregations