private string prepareHistoricBatches(int batchesCount) { DateTime startDate = ClockUtil.CurrentTime; ClockUtil.CurrentTime = DateUtils.addDays(startDate, daysInThePast); IList <Batch> list = new List <Batch>(); for (int i = 0; i < batchesCount; i++) { list.Add(helper.migrateProcessInstancesAsync(1)); } Batch batch1 = list[0]; string batchType = batch1.Type; helper.executeSeedJob(batch1); helper.executeJobs(batch1); ClockUtil.CurrentTime = DateUtils.addDays(startDate, batch1EndTime); helper.executeMonitorJob(batch1); Batch batch2 = list[1]; helper.executeSeedJob(batch2); helper.executeJobs(batch2); ClockUtil.CurrentTime = DateUtils.addDays(startDate, batch2EndTime); helper.executeMonitorJob(batch2); ClockUtil.CurrentTime = DateTime.Now; return(batchType); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBatchQueryResult() public virtual void testBatchQueryResult() { DateTime startDate = new DateTime(10000L); DateTime endDate = new DateTime(40000L); // given ClockUtil.CurrentTime = startDate; Batch batch = helper.migrateProcessInstancesAsync(1); helper.executeSeedJob(batch); helper.executeJobs(batch); ClockUtil.CurrentTime = endDate; helper.executeMonitorJob(batch); // when HistoricBatch resultBatch = historyService.createHistoricBatchQuery().singleResult(); // then Assert.assertNotNull(resultBatch); assertEquals(batch.Id, resultBatch.Id); assertEquals(batch.BatchJobDefinitionId, resultBatch.BatchJobDefinitionId); assertEquals(batch.MonitorJobDefinitionId, resultBatch.MonitorJobDefinitionId); assertEquals(batch.SeedJobDefinitionId, resultBatch.SeedJobDefinitionId); assertEquals(batch.TenantId, resultBatch.TenantId); assertEquals(batch.Type, resultBatch.Type); assertEquals(batch.BatchJobsPerSeed, resultBatch.BatchJobsPerSeed); assertEquals(batch.InvocationsPerBatchJob, resultBatch.InvocationsPerBatchJob); assertEquals(batch.TotalJobs, resultBatch.TotalJobs); assertEquals(startDate, resultBatch.StartTime); assertEquals(endDate, resultBatch.EndTime); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeleteHistoricIncidentByBatchId() public virtual void testDeleteHistoricIncidentByBatchId() { // given initBatchOperationHistoryTimeToLive(); 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); ClockUtil.CurrentTime = DateUtils.addDays(DateTime.Now, -10); managementService.deleteBatch(batch.Id, false); ClockUtil.CurrentTime = DateTime.Now; // assume if (eventTypes != null) { HistoricIncident historicIncident = historyService.createHistoricIncidentQuery().singleResult(); assertNotNull(historicIncident); } // when historyService.cleanUpHistoryAsync(true); foreach (Job job in historyService.findHistoryCleanupJobs()) { managementService.executeJob(job.Id); } // then IList <HistoricIncident> incidents = historyService.createHistoricIncidentQuery().list(); assertEquals(0, incidents.Count); }
//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()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testBatchJobsTenantId() public virtual void testBatchJobsTenantId() { // given Batch batch = batchHelper.migrateProcessInstanceAsync(tenant1Definition, tenant1Definition); // then Job seedJob = batchHelper.getSeedJob(batch); Assert.assertEquals(TENANT_ONE, seedJob.TenantId); batchHelper.executeSeedJob(batch); IList <Job> migrationJob = batchHelper.getExecutionJobs(batch); Assert.assertEquals(TENANT_ONE, migrationJob[0].TenantId); Job monitorJob = batchHelper.getMonitorJob(batch); Assert.assertEquals(TENANT_ONE, monitorJob.TenantId); }