//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSubscriptionsWhenDeletingGroupsProcessDefinitionsByIds() public virtual void testSubscriptionsWhenDeletingGroupsProcessDefinitionsByIds() { // given string processDefId1 = testRule.deployForTenantAndGetDefinition(TENANT_ONE, PROCESS).Id; string processDefId2 = testRule.deployForTenantAndGetDefinition(TENANT_ONE, PROCESS).Id; string processDefId3 = testRule.deployForTenantAndGetDefinition(TENANT_ONE, PROCESS).Id; //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unused") String processDefId4 = testRule.deployAndGetDefinition(PROCESS).getId(); string processDefId4 = testRule.deployAndGetDefinition(PROCESS).Id; string processDefId5 = testRule.deployAndGetDefinition(PROCESS).Id; string processDefId6 = testRule.deployAndGetDefinition(PROCESS).Id; BpmnModelInstance processAnotherKey = Bpmn.createExecutableProcess("anotherKey").startEvent().conditionalEventDefinition().condition("${true}").conditionalEventDefinitionDone().userTask().endEvent().done(); string processDefId7 = testRule.deployForTenantAndGetDefinition(TENANT_ONE, processAnotherKey).Id; string processDefId8 = testRule.deployForTenantAndGetDefinition(TENANT_ONE, processAnotherKey).Id; string processDefId9 = testRule.deployForTenantAndGetDefinition(TENANT_ONE, processAnotherKey).Id; // assume assertEquals(3, runtimeService.createEventSubscriptionQuery().count()); // when repositoryService.deleteProcessDefinitions().byIds(processDefId8, processDefId5, processDefId3, processDefId9, processDefId1).delete(); // then IList <EventSubscription> list = runtimeService.createEventSubscriptionQuery().list(); assertEquals(3, list.Count); foreach (EventSubscription eventSubscription in list) { EventSubscriptionEntity eventSubscriptionEntity = (EventSubscriptionEntity)eventSubscription; if (eventSubscriptionEntity.Configuration.Equals(processDefId2)) { assertEquals(TENANT_ONE, eventSubscription.TenantId); } else if (eventSubscriptionEntity.Configuration.Equals(processDefId6)) { assertEquals(null, eventSubscription.TenantId); } else if (eventSubscriptionEntity.Configuration.Equals(processDefId7)) { assertEquals(TENANT_ONE, eventSubscription.TenantId); } else { fail("This process definition '" + eventSubscriptionEntity.Configuration + "' and the respective event subscription should not exist."); } } }
public virtual void testSignalStartEvent() { // event subscription for signal start event assertEquals(1, runtimeService.createEventSubscriptionQuery().eventType("signal").eventName("alert").count()); runtimeService.signalEventReceived("alert"); // the signal should start a new process instance assertEquals(1, taskService.createTaskQuery().count()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testMigrateEventSubscription() public virtual void testMigrateEventSubscription() { // given ProcessDefinition sourceProcessDefinition = testHelper.deployAndGetDefinition(MessageReceiveModels.MESSAGE_START_PROCESS); string sourceProcessDefinitionId = sourceProcessDefinition.Id; MigrationPlan migrationPlan = runtimeService.createMigrationPlan(sourceProcessDefinitionId, sourceProcessDefinitionId).mapEqualActivities().build(); ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcessDefinitionId); EventSubscription eventSubscription = runtimeService.createEventSubscriptionQuery().activityId("startEvent").eventName(MessageReceiveModels.MESSAGE_NAME).singleResult(); // when runtimeService.newMigration(migrationPlan).processInstanceIds(processInstance.Id).execute(); // then assertEventSubscriptionMigrated(eventSubscription, "startEvent", MessageReceiveModels.MESSAGE_NAME); testHelper.completeTask("userTask"); testHelper.assertProcessEnded(processInstance.Id); }
public virtual void testSetSerializedVariableValues() { // given ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); EventSubscription messageEventSubscription = runtimeService.createEventSubscriptionQuery().singleResult(); // when FailingJavaSerializable javaSerializable = new FailingJavaSerializable("foo"); MemoryStream baos = new MemoryStream(); (new ObjectOutputStream(baos)).writeObject(javaSerializable); string serializedObject = StringUtil.fromBytes(Base64.encodeBase64(baos.toByteArray()), engineRule.ProcessEngine); // then it is not possible to deserialize the object try { (new ObjectInputStream(new MemoryStream(baos.toByteArray()))).readObject(); } catch (Exception e) { testRule.assertTextPresent("Exception while deserializing object.", e.Message); } // but it can be set as a variable when delivering a message: //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: runtimeService.messageEventReceived("newInvoiceMessage", messageEventSubscription.ExecutionId, Variables.createVariables().putValueTyped("var", Variables.serializedObjectValue(serializedObject).objectTypeName(typeof(FailingJavaSerializable).FullName).serializationDataFormat(Variables.SerializationDataFormats.JAVA).create())); // then ObjectValue variableTyped = runtimeService.getVariableTyped(processInstance.Id, "var", false); assertNotNull(variableTyped); assertFalse(variableTyped.Deserialized); assertEquals(serializedObject, variableTyped.ValueSerialized); //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: assertEquals(typeof(FailingJavaSerializable).FullName, variableTyped.ObjectTypeName); assertEquals(Variables.SerializationDataFormats.JAVA.Name, variableTyped.SerializationDataFormat); }
public virtual void testDeploymentCreatesSubscriptions() { // given a deployed process string processDefinitionId = repositoryService.createProcessDefinitionQuery().processDefinitionKey(CONDITIONAL_EVENT_PROCESS).singleResult().Id; // when IList <EventSubscription> eventSubscriptions = runtimeService.createEventSubscriptionQuery().list(); // then assertEquals(1, eventSubscriptions.Count); EventSubscriptionEntity conditionalEventSubscription = (EventSubscriptionEntity)eventSubscriptions[0]; assertEquals(EventType.CONDITONAL.name(), conditionalEventSubscription.EventType); assertEquals(processDefinitionId, conditionalEventSubscription.Configuration); assertNull(conditionalEventSubscription.EventName); assertNull(conditionalEventSubscription.ExecutionId); assertNull(conditionalEventSubscription.ProcessInstanceId); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testUpdateProcessVersionCancelsSubscriptions() public virtual void testUpdateProcessVersionCancelsSubscriptions() { testRule.deploy(SINGLE_MESSAGE_START_EVENT_XML); IList <EventSubscription> eventSubscriptions = runtimeService.createEventSubscriptionQuery().list(); IList <ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().list(); assertEquals(1, eventSubscriptions.Count); assertEquals(1, processDefinitions.Count); // when testRule.deploy(SINGLE_MESSAGE_START_EVENT_XML); // then IList <EventSubscription> newEventSubscriptions = runtimeService.createEventSubscriptionQuery().list(); IList <ProcessDefinition> newProcessDefinitions = repositoryService.createProcessDefinitionQuery().list(); assertEquals(1, newEventSubscriptions.Count); assertEquals(2, newProcessDefinitions.Count); foreach (ProcessDefinition processDefinition in newProcessDefinitions) { if (processDefinition.Version == 1) { foreach (EventSubscription subscription in newEventSubscriptions) { EventSubscriptionEntity subscriptionEntity = (EventSubscriptionEntity)subscription; assertFalse(subscriptionEntity.Configuration.Equals(processDefinition.Id)); } } else { foreach (EventSubscription subscription in newEventSubscriptions) { EventSubscriptionEntity subscriptionEntity = (EventSubscriptionEntity)subscription; assertTrue(subscriptionEntity.Configuration.Equals(processDefinition.Id)); } } } //JAVA TO C# CONVERTER WARNING: LINQ 'SequenceEqual' is not always identical to Java AbstractList 'equals': //ORIGINAL LINE: assertFalse(eventSubscriptions.equals(newEventSubscriptions)); assertFalse(eventSubscriptions.SequenceEqual(newEventSubscriptions)); }