Search in sources :

Example 1 with HistoricBatch

use of org.camunda.bpm.engine.batch.history.HistoricBatch in project camunda-bpm-platform by camunda.

the class HistoricBatchRestServiceInteractionTest method setUpHistoricBatchQueryMock.

@Before
public void setUpHistoricBatchQueryMock() {
    HistoricBatch historicBatchMock = MockProvider.createMockHistoricBatch();
    queryMock = mock(HistoricBatchQuery.class);
    when(queryMock.batchId(eq(MockProvider.EXAMPLE_BATCH_ID))).thenReturn(queryMock);
    when(queryMock.singleResult()).thenReturn(historicBatchMock);
    historyServiceMock = mock(HistoryService.class);
    when(historyServiceMock.createHistoricBatchQuery()).thenReturn(queryMock);
    when(processEngine.getHistoryService()).thenReturn(historyServiceMock);
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) HistoricBatchQuery(org.camunda.bpm.engine.batch.history.HistoricBatchQuery) HistoryService(org.camunda.bpm.engine.HistoryService) Before(org.junit.Before)

Example 2 with HistoricBatch

use of org.camunda.bpm.engine.batch.history.HistoricBatch in project camunda-bpm-platform by camunda.

the class MockHistoricBatchBuilder method build.

public HistoricBatch build() {
    HistoricBatch historicBatch = mock(HistoricBatch.class);
    when(historicBatch.getId()).thenReturn(id);
    when(historicBatch.getType()).thenReturn(type);
    when(historicBatch.getTotalJobs()).thenReturn(totalJobs);
    when(historicBatch.getBatchJobsPerSeed()).thenReturn(batchJobsPerSeed);
    when(historicBatch.getInvocationsPerBatchJob()).thenReturn(invocationsPerBatchJob);
    when(historicBatch.getSeedJobDefinitionId()).thenReturn(seedJobDefinitionId);
    when(historicBatch.getMonitorJobDefinitionId()).thenReturn(monitorJobDefinitionId);
    when(historicBatch.getBatchJobDefinitionId()).thenReturn(batchJobDefinitionId);
    when(historicBatch.getTenantId()).thenReturn(tenantId);
    when(historicBatch.getStartTime()).thenReturn(startTime);
    when(historicBatch.getEndTime()).thenReturn(endTime);
    return historicBatch;
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch)

Example 3 with HistoricBatch

use of org.camunda.bpm.engine.batch.history.HistoricBatch in project camunda-bpm-platform by camunda.

the class SetExternalTasksRetriesTest method cleanBatch.

@After
public void cleanBatch() {
    List<Batch> batches = managementService.createBatchQuery().list();
    if (batches.size() > 0) {
        for (Batch batch : batches) {
            managementService.deleteBatch(batch.getId(), true);
        }
    }
    HistoricBatch historicBatch = historyService.createHistoricBatchQuery().singleResult();
    if (historicBatch != null) {
        historyService.deleteHistoricBatch(historicBatch.getId());
    }
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Batch(org.camunda.bpm.engine.batch.Batch) After(org.junit.After)

Example 4 with HistoricBatch

use of org.camunda.bpm.engine.batch.history.HistoricBatch in project camunda-bpm-platform by camunda.

the class MultiTenancyHistoricBatchQueryTest method testHistoricBatchQueryFilterByTenant.

@Test
public void testHistoricBatchQueryFilterByTenant() {
    // when
    HistoricBatch returnedBatch = historyService.createHistoricBatchQuery().tenantIdIn(TENANT_ONE).singleResult();
    // then
    Assert.assertNotNull(returnedBatch);
    Assert.assertEquals(tenant1Batch.getId(), returnedBatch.getId());
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) Test(org.junit.Test)

Example 5 with HistoricBatch

use of org.camunda.bpm.engine.batch.history.HistoricBatch in project camunda-bpm-platform by camunda.

the class MultiTenancyHistoricBatchQueryTest method assertBatches.

protected void assertBatches(List<HistoricBatch> actualBatches, String... expectedIds) {
    Assert.assertEquals(expectedIds.length, actualBatches.size());
    Set<String> actualIds = new HashSet<String>();
    for (HistoricBatch batch : actualBatches) {
        actualIds.add(batch.getId());
    }
    for (String expectedId : expectedIds) {
        Assert.assertTrue(actualIds.contains(expectedId));
    }
}
Also used : HistoricBatch(org.camunda.bpm.engine.batch.history.HistoricBatch) HashSet(java.util.HashSet)

Aggregations

HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)45 Batch (org.camunda.bpm.engine.batch.Batch)34 Test (org.junit.Test)26 Date (java.util.Date)13 After (org.junit.After)12 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)4 HistoryService (org.camunda.bpm.engine.HistoryService)4 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)4 ManagementService (org.camunda.bpm.engine.ManagementService)3 CleanableHistoricBatchReportResult (org.camunda.bpm.engine.history.CleanableHistoricBatchReportResult)3 HistoricBatchQuery (org.camunda.bpm.engine.batch.history.HistoricBatchQuery)2 HashSet (java.util.HashSet)1 List (java.util.List)1 HashedMap (org.apache.commons.collections.map.HashedMap)1 BatchEntity (org.camunda.bpm.engine.impl.batch.BatchEntity)1 HistoricBatchEntity (org.camunda.bpm.engine.impl.batch.history.HistoricBatchEntity)1 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)1 HistoricBatchManager (org.camunda.bpm.engine.impl.persistence.entity.HistoricBatchManager)1 HistoricBatchDto (org.camunda.bpm.engine.rest.dto.history.batch.HistoricBatchDto)1