/// <summary> /// Requires no additional DELETE_HISTORY authorization => consistent with deleteDeployment /// </summary> //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeleteBatchCascade() public virtual void testDeleteBatchCascade() { // given ProcessInstance processInstance = engineRule.RuntimeService.startProcessInstanceById(migrationPlan.SourceProcessDefinitionId); batch = engineRule.RuntimeService.newMigration(migrationPlan).processInstanceIds(Arrays.asList(processInstance.Id)).executeAsync(); // when authRule.init(scenario).withUser("userId").bindResource("batchId", batch.Id).start(); cascade = true; engineRule.ManagementService.deleteBatch(batch.Id, cascade); // then if (authRule.assertScenario(scenario)) { Assert.assertEquals(0, engineRule.ManagementService.createBatchQuery().count()); Assert.assertEquals(0, engineRule.HistoryService.createHistoricBatchQuery().count()); UserOperationLogQuery query = engineRule.HistoryService.createUserOperationLogQuery(); IList <UserOperationLogEntry> userOperationLogEntries = query.operationType(OPERATION_TYPE_DELETE).batchId(batch.Id).list(); assertEquals(1, userOperationLogEntries.Count); UserOperationLogEntry entry = userOperationLogEntries[0]; assertEquals("cascadeToHistory", entry.Property); assertEquals("true", entry.NewValue); assertEquals(CATEGORY_OPERATOR, entry.Category); // Ensure that HistoricBatch deletion is not logged IList <UserOperationLogEntry> userOperationLogHistoricEntries = query.operationType(OPERATION_TYPE_DELETE_HISTORY).batchId(batch.Id).list(); assertEquals(0, userOperationLogHistoricEntries.Count); } }
public virtual void testKeepOpLogEntriesOnUndeployment() { // given startTestProcess(); // an op log entry directly related to the process instance is created taskService.resolveTask(task.Id); // and an op log entry with indirect reference to the process instance is created runtimeService.suspendProcessInstanceByProcessDefinitionId(processDefinition.Id); // when // the deployment is deleted with cascade repositoryService.deleteDeployment(deploymentId, true); // then UserOperationLogQuery query = historyService.createUserOperationLogQuery(); assertEquals(4, query.count()); assertEquals(1, query.operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_CREATE).count()); assertEquals(1, query.operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_SUSPEND).count()); assertEquals(1, query.operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_RESOLVE).count()); assertEquals(1, query.operationType(org.camunda.bpm.engine.history.UserOperationLogEntry_Fields.OPERATION_TYPE_DELETE).count()); }