当前位置: 首页>>代码示例>>Java>>正文


Java ProcessEngineException类代码示例

本文整理汇总了Java中org.camunda.bpm.engine.ProcessEngineException的典型用法代码示例。如果您正苦于以下问题:Java ProcessEngineException类的具体用法?Java ProcessEngineException怎么用?Java ProcessEngineException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProcessEngineException类属于org.camunda.bpm.engine包,在下文中一共展示了ProcessEngineException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: selectCompositeById

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
public LoadedCompositeEntity selectCompositeById(String compositeName, String id) {
  CompositeEntityLoader loader = compositeEntitiyLoader.get(compositeName);
  if(loader == null) {
    throw new ProcessEngineException("There is no composite loader for the composite named "+ compositeName);
  }

  if(loadedEntityCache.get(compositeName)!=null &&
      loadedEntityCache.get(compositeName).get(id)!=null){
    return loadedEntityCache.get(compositeName).get(id);
  }

  LoadedCompositeEntity composite = loader.getEntityById(this, id);
  if(composite == null) {
    return null;
  }

  if(loadedEntityCache.get(compositeName)==null){
    loadedEntityCache.put(compositeName, new HashMap<String, LoadedCompositeEntity>());
  }
  loadedEntityCache.get(compositeName).put(id, composite);

  processLoadedComposite(composite);
  return composite;
}
 
开发者ID:camunda,项目名称:camunda-engine-cassandra,代码行数:25,代码来源:CassandraPersistenceSession.java

示例2: testExecuteJobWithNoAuthenticatedTenant

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
@Test
public void testExecuteJobWithNoAuthenticatedTenant() {

  String noFailProcessInstanceId = engineRule.getRuntimeService()
    .startProcessInstanceByKey("noFail")
    .getId(); 

  String timerJobId = managementService.createJobQuery()
    .processInstanceId(noFailProcessInstanceId)
    .singleResult()
    .getId();
  
  identityService.setAuthentication("aUserId", null);

  // then
  thrown.expect(ProcessEngineException.class);
  thrown.expectMessage("Cannot update the job '" + timerJobId 
    +"' because it belongs to no authenticated tenant.");
  managementService.executeJob(timerJobId);

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:MultiTenancyJobCmdsTenantCheckTest.java

示例3: testHandleFailureNegativeLockDuration

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testHandleFailureNegativeLockDuration() {
  // given
  runtimeService.startProcessInstanceByKey("oneExternalTaskProcess");

  // when
  List<LockedExternalTask> externalTasks = externalTaskService.fetchAndLock(1, WORKER_ID)
    .topic(TOPIC_NAME, LOCK_TIME)
    .execute();

  // then
  try {
    externalTaskService.handleFailure(externalTasks.get(0).getId(), WORKER_ID, "error", 5, - LOCK_TIME);
    fail("exception expected");
  } catch (ProcessEngineException e) {
    assertTextPresent("retryDuration is not greater than or equal to 0", e.getMessage());
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:ExternalTaskServiceTest.java

示例4: testDeleteJobWithNoAuthenticatedTenant

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
@Test
public void testDeleteJobWithNoAuthenticatedTenant() {
  String timerJobId = managementService.createJobQuery()
    .processInstanceId(processInstance.getId())
    .singleResult()
    .getId();
  
  identityService.setAuthentication("aUserId", null);

  // then
  thrown.expect(ProcessEngineException.class);
  thrown.expectMessage("Cannot update the job '" + timerJobId 
    +"' because it belongs to no authenticated tenant.");

  // when
  managementService.deleteJob(timerJobId);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:MultiTenancyJobCmdsTenantCheckTest.java

示例5: testSetJavaObjectSerializedEmptySerializationDataFormat

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
@Test
@Deployment(resources = ONE_TASK_PROCESS)
public void testSetJavaObjectSerializedEmptySerializationDataFormat() throws Exception {
  ProcessInstance instance = runtimeService.startProcessInstanceByKey("oneTaskProcess");

  JavaSerializable javaSerializable = new JavaSerializable("foo");

  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  new ObjectOutputStream(baos).writeObject(javaSerializable);
  String serializedObject = StringUtil.fromBytes(Base64.encodeBase64(baos.toByteArray()), engineRule.getProcessEngine());

  thrown.expect(ProcessEngineException.class);
  thrown.expectMessage("Cannot set variable with name simpleBean. Java serialization format is prohibited");

  runtimeService.setVariable(instance.getId(), "simpleBean",
    serializedObjectValue(serializedObject)
      .objectTypeName(JavaSerializable.class.getName())
      .create());

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:JavaSerializationProhibitedTest.java

示例6: testCannotExecuteInUnregisteredPaContext

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
public void testCannotExecuteInUnregisteredPaContext() throws Exception {
  String nonExistingName = pa.getName() + pa.getName();

  try {
    ProcessApplicationContext.withProcessApplicationContext(new Callable<Void>() {

      @Override
      public Void call() throws Exception {
        getCurrentContextApplication();
        return null;
      }

    }, nonExistingName);
    fail("should not succeed");

  } catch (ProcessEngineException e) {
    assertTextPresent("A process application with name '" + nonExistingName + "' is not registered", e.getMessage());
  }

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:ProcessApplicationContextTest.java

示例7: testQueryByEventName

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
public void testQueryByEventName() {

    createExampleEventSubscriptions();

    List<EventSubscription> list = runtimeService.createEventSubscriptionQuery()
      .eventName("messageName")
      .list();
    assertEquals(2, list.size());

    list = runtimeService.createEventSubscriptionQuery()
      .eventName("messageName2")
      .list();
    assertEquals(1, list.size());

    try {
      runtimeService.createEventSubscriptionQuery().eventName(null).list();
      fail("Expected ProcessEngineException");
    } catch (ProcessEngineException e) {
    }

    cleanDb();

  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:EventSubscriptionQueryTest.java

示例8: testStandaloneTaskTransientVariable

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
public void testStandaloneTaskTransientVariable() {
  Task task = taskService.newTask();
  task.setName("gonzoTask");
  taskService.saveTask(task);

  String taskId = task.getId();

  try {
    taskService
      .setVariable(taskId, "instrument", Variables.serializedObjectValue("trumpet")
        .serializationDataFormat(Variables.SerializationDataFormats.JAVA)
        .setTransient(true)
        .create());
    fail("Exception is expected.");
  } catch (ProcessEngineException ex) {
    assertEquals("ENGINE-17007 Cannot set variable with name instrument. Java serialization format is prohibited", ex.getMessage());
  } finally {
    taskService.deleteTask(taskId, true);
  }

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:JavaSerializationTest.java

示例9: testQueryByBooleanCaseInstanceVariableValueLessThan

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
@Deployment(resources={"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"})
public void testQueryByBooleanCaseInstanceVariableValueLessThan() {
  String caseDefinitionId = getCaseDefinitionId();

  caseService
    .withCaseDefinition(caseDefinitionId)
    .setVariable("aBooleanValue", true)
    .create();

  TaskQuery query = taskService.createTaskQuery();

  try {
    query.caseInstanceVariableValueLessThan("aBooleanValue", false).list();
    fail();
  } catch (ProcessEngineException e) {}

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:TaskQueryTest.java

示例10: testQueryBySerializableVariableValueNotEquals

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
public void testQueryBySerializableVariableValueNotEquals() {
  List<String> serializable = new ArrayList<String>();
  serializable.add("one");
  serializable.add("two");
  serializable.add("three");

  caseService
    .withCaseDefinitionByKey(CASE_DEFINITION_KEY)
    .setVariable("aSerializableValue", serializable)
    .create();

  CaseInstanceQuery query = caseService.createCaseInstanceQuery();

  try {
    query.variableValueNotEquals("aSerializableValue", serializable).list();
    fail();
  } catch (ProcessEngineException e) {}
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:CaseInstanceQueryTest.java

示例11: testPutVariableForNonExistingInstance

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
@Test
public void testPutVariableForNonExistingInstance() {
  String variableKey = "aVariableKey";
  String variableValue = "aVariableValue";

  Map<String, Object> variableJson = VariablesBuilder.getVariableValueMap(variableValue);

  doThrow(new ProcessEngineException("expected exception"))
    .when(runtimeServiceMock)
    .setVariable(eq(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID), eq(variableKey), any());

  given().pathParam("id", MockProvider.EXAMPLE_PROCESS_INSTANCE_ID).pathParam("varId", variableKey)
    .contentType(ContentType.JSON).body(variableJson)
    .then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode())
    .body("type", is(RestException.class.getSimpleName()))
    .body("message", is("Cannot put process instance variable " + variableKey + ": expected exception"))
    .when().put(SINGLE_PROCESS_INSTANCE_VARIABLE_URL);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:ProcessInstanceRestServiceInteractionTest.java

示例12: addVariable

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
public void addVariable(String name, Object value, QueryOperator operator, boolean isTaskVariable, boolean isProcessInstanceVariable) {
  ensureNotNull("name", name);

  if(value == null || isBoolean(value)) {
    // Null-values and booleans can only be used in EQUALS and NOT_EQUALS
    switch(operator) {
    case GREATER_THAN:
      throw new ProcessEngineException("Booleans and null cannot be used in 'greater than' condition");
    case LESS_THAN:
      throw new ProcessEngineException("Booleans and null cannot be used in 'less than' condition");
    case GREATER_THAN_OR_EQUAL:
      throw new ProcessEngineException("Booleans and null cannot be used in 'greater than or equal' condition");
    case LESS_THAN_OR_EQUAL:
      throw new ProcessEngineException("Booleans and null cannot be used in 'less than or equal' condition");
    case LIKE:
      throw new ProcessEngineException("Booleans and null cannot be used in 'like' condition");
    default:
      break;
    }
  }
  addVariable(new TaskQueryVariableValue(name, value, operator, isTaskVariable, isProcessInstanceVariable));
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:23,代码来源:TaskQueryImpl.java

示例13: testQueryBySerializableCaseInstanceVariableValueEquals

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
public void testQueryBySerializableCaseInstanceVariableValueEquals() {
  List<String> serializable = new ArrayList<String>();
  serializable.add("one");
  serializable.add("two");
  serializable.add("three");

  caseService
    .withCaseDefinitionByKey(CASE_DEFINITION_KEY)
    .setVariable("aSerializableValue", serializable)
    .create();

  CaseExecutionQuery query = caseService.createCaseExecutionQuery();

  try {
    query.caseInstanceVariableValueEquals("aSerializableValue", serializable).list();
    fail();
  } catch (ProcessEngineException e) {}
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:CaseExecutionQueryTest.java

示例14: testVariableModificationForNonExistingTaskId

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
@Test
public void testVariableModificationForNonExistingTaskId() {
  TaskServiceImpl taskServiceMock = mockTaskServiceImpl();
  doThrow(new ProcessEngineException("Cannot find task with id " + NON_EXISTING_ID)).when(taskServiceMock).updateVariables(anyString(), any(Map.class), any(List.class));

  Map<String, Object> messageBodyJson = new HashMap<String, Object>();

  String variableKey = "aKey";
  int variableValue = 123;
  Map<String, Object> modifications = VariablesBuilder.create().variable(variableKey, variableValue).getVariables();
  messageBodyJson.put("modifications", modifications);

  given().pathParam("id", NON_EXISTING_ID).contentType(ContentType.JSON).body(messageBodyJson)
    .header("accept", MediaType.APPLICATION_JSON)
    .then().expect().statusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()).contentType(ContentType.JSON)
    .body("type", equalTo(RestException.class.getSimpleName()))
    .body("message", equalTo("Cannot modify variables for task " + NON_EXISTING_ID + ": Cannot find task with id " + NON_EXISTING_ID))
    .when().post(SINGLE_TASK_MODIFY_VARIABLES_URL);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:TaskVariableRestResourceInteractionTest.java

示例15: testQueryBySerializableCaseInstanceVariableValueEquals

import org.camunda.bpm.engine.ProcessEngineException; //导入依赖的package包/类
@Deployment(resources={"org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn"})
public void testQueryBySerializableCaseInstanceVariableValueEquals() {
  String caseDefinitionId = getCaseDefinitionId();

  List<String> serializable = new ArrayList<String>();
  serializable.add("one");
  serializable.add("two");
  serializable.add("three");

  caseService
    .withCaseDefinition(caseDefinitionId)
    .setVariable("aSerializableValue", serializable)
    .create();

  TaskQuery query = taskService.createTaskQuery();

  try {
    query.caseInstanceVariableValueEquals("aSerializableValue", serializable).list();
    fail();
  } catch (ProcessEngineException e) {}
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:TaskQueryTest.java


注:本文中的org.camunda.bpm.engine.ProcessEngineException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。