use of org.finra.herd.model.api.xml.JobStatusEnum in project herd by FINRAOS.
the class ActivitiServiceTest method testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenEndTimeNotSpecified.
@Test
public void testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenEndTimeNotSpecified() {
JobStatusEnum jobStatus = JobStatusEnum.RUNNING;
Collection<String> processDefinitionKeys = new ArrayList<>();
DateTime startTime = new DateTime();
DateTime endTime = null;
HistoricProcessInstanceQuery historicProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
when(activitiHistoryService.createHistoricProcessInstanceQuery()).thenReturn(historicProcessInstanceQuery);
when(historicProcessInstanceQuery.processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys))).thenReturn(historicProcessInstanceQuery);
when(historicProcessInstanceQuery.unfinished()).thenReturn(historicProcessInstanceQuery);
when(historicProcessInstanceQuery.startedAfter(startTime.toDate())).thenReturn(historicProcessInstanceQuery);
List<HistoricProcessInstance> expectedHistoricProcessInstances = new ArrayList<>();
when(historicProcessInstanceQuery.list()).thenReturn(expectedHistoricProcessInstances);
List<HistoricProcessInstance> actualHistoricProcessInstance = activitiService.getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(jobStatus, processDefinitionKeys, startTime, endTime);
assertSame(expectedHistoricProcessInstances, actualHistoricProcessInstance);
InOrder inOrder = inOrder(historicProcessInstanceQuery);
inOrder.verify(historicProcessInstanceQuery).processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys));
inOrder.verify(historicProcessInstanceQuery).unfinished();
inOrder.verify(historicProcessInstanceQuery).startedAfter(startTime.toDate());
inOrder.verify(historicProcessInstanceQuery).list();
inOrder.verifyNoMoreInteractions();
}
use of org.finra.herd.model.api.xml.JobStatusEnum in project herd by FINRAOS.
the class ActivitiServiceTest method testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeys.
@Test
public void testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeys() {
JobStatusEnum jobStatus = JobStatusEnum.RUNNING;
Collection<String> processDefinitionKeys = new ArrayList<>();
DateTime startTime = new DateTime();
DateTime endTime = new DateTime();
HistoricProcessInstanceQuery historicProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
when(activitiHistoryService.createHistoricProcessInstanceQuery()).thenReturn(historicProcessInstanceQuery);
when(historicProcessInstanceQuery.processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys))).thenReturn(historicProcessInstanceQuery);
when(historicProcessInstanceQuery.unfinished()).thenReturn(historicProcessInstanceQuery);
when(historicProcessInstanceQuery.startedAfter(startTime.toDate())).thenReturn(historicProcessInstanceQuery);
when(historicProcessInstanceQuery.finishedBefore(endTime.toDate())).thenReturn(historicProcessInstanceQuery);
List<HistoricProcessInstance> expectedHistoricProcessInstances = new ArrayList<>();
when(historicProcessInstanceQuery.list()).thenReturn(expectedHistoricProcessInstances);
List<HistoricProcessInstance> actualHistoricProcessInstance = activitiService.getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(jobStatus, processDefinitionKeys, startTime, endTime);
assertSame(expectedHistoricProcessInstances, actualHistoricProcessInstance);
InOrder inOrder = inOrder(historicProcessInstanceQuery);
inOrder.verify(historicProcessInstanceQuery).processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys));
inOrder.verify(historicProcessInstanceQuery).unfinished();
inOrder.verify(historicProcessInstanceQuery).startedAfter(startTime.toDate());
inOrder.verify(historicProcessInstanceQuery).finishedBefore(endTime.toDate());
inOrder.verify(historicProcessInstanceQuery).list();
inOrder.verifyNoMoreInteractions();
}
use of org.finra.herd.model.api.xml.JobStatusEnum in project herd by FINRAOS.
the class ActivitiServiceTest method testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenStartTimeNotSpecified.
@Test
public void testGetHistoricProcessInstancesByStatusAndProcessDefinitionKeysWhenStartTimeNotSpecified() {
JobStatusEnum jobStatus = JobStatusEnum.RUNNING;
Collection<String> processDefinitionKeys = new ArrayList<>();
DateTime startTime = null;
DateTime endTime = new DateTime();
HistoricProcessInstanceQuery historicProcessInstanceQuery = mock(HistoricProcessInstanceQuery.class);
when(activitiHistoryService.createHistoricProcessInstanceQuery()).thenReturn(historicProcessInstanceQuery);
when(historicProcessInstanceQuery.processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys))).thenReturn(historicProcessInstanceQuery);
when(historicProcessInstanceQuery.unfinished()).thenReturn(historicProcessInstanceQuery);
when(historicProcessInstanceQuery.finishedBefore(endTime.toDate())).thenReturn(historicProcessInstanceQuery);
List<HistoricProcessInstance> expectedHistoricProcessInstances = new ArrayList<>();
when(historicProcessInstanceQuery.list()).thenReturn(expectedHistoricProcessInstances);
List<HistoricProcessInstance> actualHistoricProcessInstance = activitiService.getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(jobStatus, processDefinitionKeys, startTime, endTime);
assertSame(expectedHistoricProcessInstances, actualHistoricProcessInstance);
InOrder inOrder = inOrder(historicProcessInstanceQuery);
inOrder.verify(historicProcessInstanceQuery).processDefinitionKeyIn(new ArrayList<>(processDefinitionKeys));
inOrder.verify(historicProcessInstanceQuery).unfinished();
inOrder.verify(historicProcessInstanceQuery).finishedBefore(endTime.toDate());
inOrder.verify(historicProcessInstanceQuery).list();
inOrder.verifyNoMoreInteractions();
}
Aggregations