//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testLogCreationAsync() public virtual void testLogCreationAsync() { // given ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance); rule.IdentityService.AuthenticatedUserId = "userId"; ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("process1"); ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("process1"); runtimeService.deleteProcessInstance(processInstance1.Id, "test"); runtimeService.deleteProcessInstance(processInstance2.Id, "test"); // when runtimeService.restartProcessInstances(processDefinition.Id).startAfterActivity("user1").processInstanceIds(processInstance1.Id, processInstance2.Id).executeAsync(); rule.IdentityService.clearAuthentication(); // then IList <UserOperationLogEntry> opLogEntries = rule.HistoryService.createUserOperationLogQuery().operationType("RestartProcessInstance").list(); Assert.assertEquals(2, opLogEntries.Count); IDictionary <string, UserOperationLogEntry> entries = asMap(opLogEntries); UserOperationLogEntry asyncEntry = entries["async"]; Assert.assertNotNull(asyncEntry); Assert.assertEquals("ProcessInstance", asyncEntry.EntityType); Assert.assertEquals("RestartProcessInstance", asyncEntry.OperationType); Assert.assertEquals(processDefinition.Id, asyncEntry.ProcessDefinitionId); Assert.assertEquals(processDefinition.Key, asyncEntry.ProcessDefinitionKey); Assert.assertNull(asyncEntry.ProcessInstanceId); Assert.assertNull(asyncEntry.OrgValue); Assert.assertEquals("true", asyncEntry.NewValue); Assert.assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, asyncEntry.Category); UserOperationLogEntry numInstancesEntry = entries["nrOfInstances"]; Assert.assertNotNull(numInstancesEntry); Assert.assertEquals("ProcessInstance", numInstancesEntry.EntityType); Assert.assertEquals("RestartProcessInstance", numInstancesEntry.OperationType); Assert.assertEquals(processDefinition.Id, numInstancesEntry.ProcessDefinitionId); Assert.assertEquals(processDefinition.Key, numInstancesEntry.ProcessDefinitionKey); Assert.assertNull(numInstancesEntry.ProcessInstanceId); Assert.assertNull(numInstancesEntry.OrgValue); Assert.assertEquals("2", numInstancesEntry.NewValue); Assert.assertEquals(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.CATEGORY_OPERATOR, numInstancesEntry.Category); Assert.assertEquals(asyncEntry.OperationId, numInstancesEntry.OperationId); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUpRuntimeData() public virtual void setUpRuntimeData() { runtimeServiceMock = mock(typeof(RuntimeService)); when(processEngine.RuntimeService).thenReturn(runtimeServiceMock); historyServiceMock = mock(typeof(HistoryService)); when(processEngine.HistoryService).thenReturn(historyServiceMock); builderMock = mock(typeof(RestartProcessInstanceBuilder)); when(builderMock.startAfterActivity(anyString())).thenReturn(builderMock); when(builderMock.startBeforeActivity(anyString())).thenReturn(builderMock); when(builderMock.startTransition(anyString())).thenReturn(builderMock); when(builderMock.processInstanceIds(anyListOf(typeof(string)))).thenReturn(builderMock); when(builderMock.historicProcessInstanceQuery(any(typeof(HistoricProcessInstanceQuery)))).thenReturn(builderMock); when(builderMock.skipCustomListeners()).thenReturn(builderMock); when(builderMock.skipIoMappings()).thenReturn(builderMock); when(builderMock.initialSetOfVariables()).thenReturn(builderMock); when(builderMock.withoutBusinessKey()).thenReturn(builderMock); Batch batchMock = createMockBatch(); when(builderMock.executeAsync()).thenReturn(batchMock); when(runtimeServiceMock.restartProcessInstances(anyString())).thenReturn(builderMock); }
private RestartProcessInstanceBuilder createRestartProcessInstanceBuilder(RestartProcessInstanceDto restartProcessInstanceDto) { RuntimeService runtimeService = engine.RuntimeService; RestartProcessInstanceBuilder builder = runtimeService.restartProcessInstances(processDefinitionId); if (restartProcessInstanceDto.ProcessInstanceIds != null) { builder.processInstanceIds(restartProcessInstanceDto.ProcessInstanceIds); } if (restartProcessInstanceDto.HistoricProcessInstanceQuery != null) { builder.historicProcessInstanceQuery(restartProcessInstanceDto.HistoricProcessInstanceQuery.toQuery(engine)); } if (restartProcessInstanceDto.InitialVariables) { builder.initialSetOfVariables(); } if (restartProcessInstanceDto.WithoutBusinessKey) { builder.withoutBusinessKey(); } if (restartProcessInstanceDto.SkipCustomListeners) { builder.skipCustomListeners(); } if (restartProcessInstanceDto.SkipIoMappings) { builder.skipIoMappings(); } restartProcessInstanceDto.applyTo(builder, engine, objectMapper); return(builder); }