use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class EventNotificationTest method testMultiInstanceEventsAfterExternalTrigger.
@Test
@Deployment
public void testMultiInstanceEventsAfterExternalTrigger() {
runtimeService.startProcessInstanceByKey("process");
TestEventListener listenerBean = getBeanInstance(TestEventListener.class);
listenerBean.reset();
List<Task> tasks = taskService.createTaskQuery().list();
assertEquals(3, tasks.size());
for (Task task : tasks) {
taskService.complete(task.getId());
}
// 6: three user task instances (complete + end)
// 1: one mi body instance (end)
// 1: one sequence flow instance (take)
// 2: one end event instance (start + end)
// = 5
Set<BusinessProcessEvent> eventsReceived = listenerBean.getEventsReceived();
assertThat(eventsReceived.size(), is(10));
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class EventNotificationTest method testMultiInstanceEvents.
@Test
@Deployment
public void testMultiInstanceEvents() {
TestEventListener listenerBean = getBeanInstance(TestEventListener.class);
listenerBean.reset();
assertThat(listenerBean.getEventsReceived().size(), is(0));
runtimeService.startProcessInstanceByKey("process1");
waitForJobExecutorToProcessAllJobs(TimeUnit.SECONDS.toMillis(5L), 500L);
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
// 2: start event (start + end)
// 1: transition to first mi activity
// 2: first mi body (start + end)
// 4: two instances of the inner activity (start + end)
// 1: transition to second mi activity
// 2: second mi body (start + end)
// 4: two instances of the inner activity (start + end)
// 1: transition to the user task
// 2: user task (start + task create event)
// = 19
assertThat(listenerBean.getEventsReceived().size(), is(19));
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class EventNotificationTest method testReceiveAll.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/cdi/test/impl/event/EventNotificationTest.process1.bpmn20.xml" })
public void testReceiveAll() {
TestEventListener listenerBean = getBeanInstance(TestEventListener.class);
listenerBean.reset();
// assert that the bean has received 0 events
assertEquals(0, listenerBean.getEventsReceived().size());
runtimeService.startProcessInstanceByKey("process1");
// complete user task
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId());
assertEquals(16, listenerBean.getEventsReceived().size());
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceSerializationTest method testListJsonProperty.
@Deployment(resources = { "org/camunda/spin/plugin/DecisionSingleOutput.dmn11.xml" })
public void testListJsonProperty() {
JsonListSerializable<String> list = new JsonListSerializable<String>();
list.addElement("foo");
ObjectValue objectValue = Variables.objectValue(list).serializationDataFormat(DataFormats.JSON_DATAFORMAT_NAME).create();
VariableMap variables = Variables.createVariables().putValueTyped("input1", objectValue);
decisionService.evaluateDecisionTableByKey("testDecision", variables);
HistoricDecisionInstance testDecision = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey("testDecision").includeInputs().includeOutputs().singleResult();
assertNotNull(testDecision);
List<HistoricDecisionInputInstance> inputs = testDecision.getInputs();
assertEquals(1, inputs.size());
HistoricDecisionInputInstance inputInstance = inputs.get(0);
assertEquals(list.getListProperty(), inputInstance.getValue());
List<HistoricDecisionOutputInstance> outputs = testDecision.getOutputs();
assertEquals(1, outputs.size());
HistoricDecisionOutputInstance outputInstance = outputs.get(0);
assertEquals(list.getListProperty(), outputInstance.getValue());
}
use of org.camunda.bpm.engine.test.Deployment in project camunda-bpm-platform by camunda.
the class HistoricVariableJsonSerializationTest method testSelectHistoricSerializedValuesUpdate.
@Deployment(resources = ONE_TASK_PROCESS)
public void testSelectHistoricSerializedValuesUpdate() throws JSONException {
ProcessInstance instance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
JsonSerializable bean = new JsonSerializable("a String", 42, false);
runtimeService.setVariable(instance.getId(), "simpleBean", objectValue(bean).serializationDataFormat(JSON_FORMAT_NAME));
if (ProcessEngineConfiguration.HISTORY_FULL.equals(processEngineConfiguration.getHistory())) {
HistoricVariableUpdate historicUpdate = (HistoricVariableUpdate) historyService.createHistoricDetailQuery().variableUpdates().singleResult();
assertNotNull(historicUpdate.getValue());
assertNull(historicUpdate.getErrorMessage());
assertEquals(ValueType.OBJECT.getName(), historicUpdate.getTypeName());
assertEquals(ValueType.OBJECT.getName(), historicUpdate.getVariableTypeName());
JsonSerializable historyValue = (JsonSerializable) historicUpdate.getValue();
assertEquals(bean.getStringProperty(), historyValue.getStringProperty());
assertEquals(bean.getIntProperty(), historyValue.getIntProperty());
assertEquals(bean.getBooleanProperty(), historyValue.getBooleanProperty());
ObjectValue typedValue = (ObjectValue) historicUpdate.getTypedValue();
assertEquals(JSON_FORMAT_NAME, typedValue.getSerializationDataFormat());
JSONAssert.assertEquals(bean.toExpectedJsonString(), new String(typedValue.getValueSerialized()), true);
assertEquals(JsonSerializable.class.getName(), typedValue.getObjectTypeName());
}
}
Aggregations