public virtual HistoricBatch build() { HistoricBatch historicBatch = mock(typeof(HistoricBatch)); when(historicBatch.Id).thenReturn(id_Renamed); when(historicBatch.Type).thenReturn(type_Renamed); when(historicBatch.TotalJobs).thenReturn(totalJobs_Renamed); when(historicBatch.BatchJobsPerSeed).thenReturn(batchJobsPerSeed_Renamed); when(historicBatch.InvocationsPerBatchJob).thenReturn(invocationsPerBatchJob_Renamed); when(historicBatch.SeedJobDefinitionId).thenReturn(seedJobDefinitionId_Renamed); when(historicBatch.MonitorJobDefinitionId).thenReturn(monitorJobDefinitionId_Renamed); when(historicBatch.BatchJobDefinitionId).thenReturn(batchJobDefinitionId_Renamed); when(historicBatch.TenantId).thenReturn(tenantId_Renamed); when(historicBatch.CreateUserId).thenReturn(createUserId_Renamed); when(historicBatch.StartTime).thenReturn(startTime_Renamed); when(historicBatch.EndTime).thenReturn(endTime_Renamed); when(historicBatch.RemovalTime).thenReturn(removalTime_Renamed); return(historicBatch); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @After public void cleanBatch() public virtual void cleanBatch() { IList <Batch> batches = managementService.createBatchQuery().list(); if (batches.Count > 0) { foreach (Batch batch in batches) { managementService.deleteBatch(batch.Id, true); } } HistoricBatch historicBatch = historyService.createHistoricBatchQuery().singleResult(); if (historicBatch != null) { historyService.deleteHistoricBatch(historicBatch.Id); } }
public static HistoricBatchDto fromBatch(HistoricBatch historicBatch) { HistoricBatchDto dto = new HistoricBatchDto(); dto.id = historicBatch.Id; dto.type = historicBatch.Type; dto.totalJobs = historicBatch.TotalJobs; dto.batchJobsPerSeed = historicBatch.BatchJobsPerSeed; dto.invocationsPerBatchJob = historicBatch.InvocationsPerBatchJob; dto.seedJobDefinitionId = historicBatch.SeedJobDefinitionId; dto.monitorJobDefinitionId = historicBatch.MonitorJobDefinitionId; dto.batchJobDefinitionId = historicBatch.BatchJobDefinitionId; dto.tenantId = historicBatch.TenantId; dto.createUserId = historicBatch.CreateUserId; dto.startTime = historicBatch.StartTime; dto.endTime = historicBatch.EndTime; dto.removalTime = historicBatch.RemovalTime; return(dto); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testHistoricBatchCompletion() public virtual void testHistoricBatchCompletion() { ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance); Batch batch = helper.startAfterAsync("process1", 1, "user1", processDefinition.Id); helper.executeSeedJob(batch); helper.executeJobs(batch); DateTime endDate = helper.addSecondsToClock(12); // when helper.executeMonitorJob(batch); // then the historic batch has an end time set HistoricBatch historicBatch = helper.getHistoricBatch(batch); assertNotNull(historicBatch); assertEquals(endDate, historicBatch.EndTime); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testHistoricBatchCreation() public virtual void testHistoricBatchCreation() { // when Batch batch = helper.migrateProcessInstancesAsync(10); // then a historic batch was created HistoricBatch historicBatch = helper.getHistoricBatch(batch); assertNotNull(historicBatch); assertEquals(batch.Id, historicBatch.Id); assertEquals(batch.Type, historicBatch.Type); assertEquals(batch.TotalJobs, historicBatch.TotalJobs); assertEquals(batch.BatchJobsPerSeed, historicBatch.BatchJobsPerSeed); assertEquals(batch.InvocationsPerBatchJob, historicBatch.InvocationsPerBatchJob); assertEquals(batch.SeedJobDefinitionId, historicBatch.SeedJobDefinitionId); assertEquals(batch.MonitorJobDefinitionId, historicBatch.MonitorJobDefinitionId); assertEquals(batch.BatchJobDefinitionId, historicBatch.BatchJobDefinitionId); assertEquals(START_DATE, historicBatch.StartTime); assertNull(historicBatch.EndTime); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBatchByState() public virtual void testBatchByState() { // given Batch batch1 = helper.migrateProcessInstancesAsync(1); Batch batch2 = helper.migrateProcessInstancesAsync(1); helper.completeBatch(batch1); // when HistoricBatch historicBatch = historyService.createHistoricBatchQuery().completed(true).singleResult(); // then assertEquals(batch1.Id, historicBatch.Id); // when historicBatch = historyService.createHistoricBatchQuery().completed(false).singleResult(); // then assertEquals(batch2.Id, historicBatch.Id); }
protected internal virtual void assertScenario() { if (authRule.assertScenario(Scenario)) { Batch batch = engineRule.ManagementService.createBatchQuery().singleResult(); assertEquals("userId", batch.CreateUserId); if (testHelper.HistoryLevelFull) { assertThat(engineRule.HistoryService.createUserOperationLogQuery().entityType(EntityTypes.PROCESS_INSTANCE).count(), @is(BATCH_OPERATIONS)); HistoricBatch historicBatch = engineRule.HistoryService.createHistoricBatchQuery().list().get(0); assertEquals("userId", historicBatch.CreateUserId); } if (authRule.scenarioSucceeded()) { assertThat(runtimeService.createProcessInstanceQuery().count(), @is(0L)); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeleteHistoricBatch() public virtual void testDeleteHistoricBatch() { ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance); Batch batch = helper.startTransitionAsync("process1", 1, "seq", processDefinition.Id); helper.executeSeedJob(batch); helper.executeJobs(batch); helper.executeMonitorJob(batch); // when HistoricBatch historicBatch = helper.getHistoricBatch(batch); rule.HistoryService.deleteHistoricBatch(historicBatch.Id); // then the historic batch was removed and all job logs assertNull(helper.getHistoricBatch(batch)); assertTrue(helper.getHistoricSeedJobLog(batch).Count == 0); assertTrue(helper.getHistoricMonitorJobLog(batch).Count == 0); assertTrue(helper.getHistoricBatchJobLog(batch).Count == 0); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testHistoricBatchCreation() public virtual void testHistoricBatchCreation() { // when ProcessDefinition processDefinition = testRule.deployAndGetDefinition(instance); Batch batch = helper.startAfterAsync("process1", 10, "user1", processDefinition.Id); // then a historic batch was created HistoricBatch historicBatch = helper.getHistoricBatch(batch); assertNotNull(historicBatch); assertEquals(batch.Id, historicBatch.Id); assertEquals(batch.Type, historicBatch.Type); assertEquals(batch.TotalJobs, historicBatch.TotalJobs); assertEquals(batch.BatchJobsPerSeed, historicBatch.BatchJobsPerSeed); assertEquals(batch.InvocationsPerBatchJob, historicBatch.InvocationsPerBatchJob); assertEquals(batch.SeedJobDefinitionId, historicBatch.SeedJobDefinitionId); assertEquals(batch.MonitorJobDefinitionId, historicBatch.MonitorJobDefinitionId); assertEquals(batch.BatchJobDefinitionId, historicBatch.BatchJobDefinitionId); assertEquals(START_DATE, historicBatch.StartTime); assertNull(historicBatch.EndTime); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testCleanupHistoricIncident() public virtual void testCleanupHistoricIncident() { initBatchOperationHistoryTimeToLive(DEFAULT_TTL_DAYS); ClockUtil.CurrentTime = DateUtils.addDays(DateTime.Now, -11); BatchEntity batch = (BatchEntity)createFailingMigrationBatch(); migrationHelper.executeSeedJob(batch); IList <Job> list = managementService.createJobQuery().list(); foreach (Job job in list) { if (((JobEntity)job).JobHandlerType.Equals("instance-migration")) { managementService.setJobRetries(job.Id, 1); } } migrationHelper.executeJobs(batch); IList <string> byteArrayIds = findExceptionByteArrayIds(); ClockUtil.CurrentTime = DateUtils.addDays(DateTime.Now, -10); managementService.deleteBatch(batch.Id, false); ClockUtil.CurrentTime = DateTime.Now; // given HistoricBatch historicBatch = historyService.createHistoricBatchQuery().singleResult(); string batchId = historicBatch.Id; // when runHistoryCleanup(); assertEquals(0, historyService.createHistoricBatchQuery().count()); assertEquals(0, historyService.createHistoricJobLogQuery().jobDefinitionConfiguration(batchId).count()); assertEquals(0, historyService.createHistoricIncidentQuery().count()); verifyByteArraysWereRemoved(byteArrayIds.ToArray()); }