本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity.setStartTime方法的典型用法代码示例。如果您正苦于以下问题:Java HistoricProcessInstanceEntity.setStartTime方法的具体用法?Java HistoricProcessInstanceEntity.setStartTime怎么用?Java HistoricProcessInstanceEntity.setStartTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity
的用法示例。
在下文中一共展示了HistoricProcessInstanceEntity.setStartTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetJobsGivenOneCompletedJobAndPassingStartAndEndTimeAssertReturnCompletedJob
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGetJobsGivenOneCompletedJobAndPassingStartAndEndTimeAssertReturnCompletedJob() throws Exception
{
String namespace = "namespace";
String jobName = "jobName";
DateTime startTime = new DateTime(new Date(0123));
DateTime endTime = new DateTime(new Date(3456));
JobStatusEnum jobStatus = JobStatusEnum.COMPLETED;
Set<String> authorizedNamespaces = new HashSet<>(Arrays.asList(namespace));
when(namespaceSecurityHelper.getAuthorizedNamespaces(any())).thenReturn(authorizedNamespaces);
NamespaceEntity namespaceEntity = new NamespaceEntity();
namespaceEntity.setCode(namespace);
when(namespaceDao.getNamespaceByCd(any())).thenReturn(namespaceEntity);
List<JobDefinitionEntity> jobDefinitionEntities = new ArrayList<>();
JobDefinitionEntity jobDefinitionEntity1 = new JobDefinitionEntity();
jobDefinitionEntity1.setActivitiId(namespace + "." + jobName + ":1" + ":1");
jobDefinitionEntities.add(jobDefinitionEntity1);
when(jobDefinitionDao.getJobDefinitionsByFilter(any(Collection.class), any())).thenReturn(jobDefinitionEntities);
ProcessDefinition processDefinition = mock(ProcessDefinition.class);
when(processDefinition.getId()).thenReturn("a.b:1:1");
when(processDefinition.getKey()).thenReturn("a.b");
when(activitiService.getProcessDefinitionsByIds(any())).thenReturn(asList(processDefinition));
when(activitiService.getHistoricProcessInstancesCountByStatusAndProcessDefinitionKeys(any(), any(), any(), any())).thenReturn(1l);
List<HistoricProcessInstance> historicProcessInstances = new ArrayList<>();
HistoricProcessInstanceEntity historicProcessInstanceEntity1 = new HistoricProcessInstanceEntity();
historicProcessInstanceEntity1.setId("historicProcessInstanceEntity1.id");
historicProcessInstanceEntity1.setProcessDefinitionId("a.b:1:1");
historicProcessInstanceEntity1.setStartTime(new Date(1234));
historicProcessInstanceEntity1.setEndTime(new Date(2345));
historicProcessInstances.add(historicProcessInstanceEntity1);
when(activitiService.getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(any(), any(), any(), any())).thenReturn(historicProcessInstances);
JobSummaries getJobsResult = jobServiceImpl.getJobs(namespace, jobName, jobStatus, startTime, endTime);
List<JobSummary> jobSummaries = getJobsResult.getJobSummaries();
assertEquals(1, jobSummaries.size());
JobSummary jobSummary = jobSummaries.get(0);
assertEquals(historicProcessInstanceEntity1.getId(), jobSummary.getId());
assertEquals("a", jobSummary.getNamespace());
assertEquals("b", jobSummary.getJobName());
assertEquals(JobStatusEnum.COMPLETED, jobSummary.getStatus());
assertEquals(historicProcessInstanceEntity1.getStartTime().getTime(), jobSummary.getStartTime().toGregorianCalendar().getTimeInMillis());
assertEquals(historicProcessInstanceEntity1.getEndTime().getTime(), jobSummary.getEndTime().toGregorianCalendar().getTimeInMillis());
assertEquals(0, jobSummary.getTotalExceptions());
verify(activitiService)
.getHistoricProcessInstancesCountByStatusAndProcessDefinitionKeys(eq(JobStatusEnum.COMPLETED), any(), eq(startTime), eq(endTime));
verify(activitiService).getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(eq(JobStatusEnum.COMPLETED), any(), eq(startTime), eq(endTime));
}
示例2: testGetJobsGivenOneRunningJobAssertReturnCompletedJob
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testGetJobsGivenOneRunningJobAssertReturnCompletedJob() throws Exception
{
String namespace = "namespace";
String jobName = "jobName";
JobStatusEnum jobStatus = JobStatusEnum.RUNNING;
long expectedNumberOfExceptions = 1234l;
Set<String> authorizedNamespaces = new HashSet<>(Arrays.asList(namespace));
when(namespaceSecurityHelper.getAuthorizedNamespaces(any())).thenReturn(authorizedNamespaces);
NamespaceEntity namespaceEntity = new NamespaceEntity();
namespaceEntity.setCode(namespace);
when(namespaceDao.getNamespaceByCd(any())).thenReturn(namespaceEntity);
List<JobDefinitionEntity> jobDefinitionEntities = new ArrayList<>();
JobDefinitionEntity jobDefinitionEntity1 = new JobDefinitionEntity();
jobDefinitionEntity1.setActivitiId(namespace + "." + jobName + ":1" + ":1");
jobDefinitionEntities.add(jobDefinitionEntity1);
when(jobDefinitionDao.getJobDefinitionsByFilter(any(Collection.class), any())).thenReturn(jobDefinitionEntities);
ProcessDefinition processDefinition = mock(ProcessDefinition.class);
when(processDefinition.getId()).thenReturn("a.b:1:1");
when(processDefinition.getKey()).thenReturn("a.b");
when(activitiService.getProcessDefinitionsByIds(any())).thenReturn(asList(processDefinition));
when(activitiService.getHistoricProcessInstancesCountByStatusAndProcessDefinitionKeys(any(), any(), any(), any())).thenReturn(1l);
List<HistoricProcessInstance> historicProcessInstances = new ArrayList<>();
HistoricProcessInstanceEntity historicProcessInstanceEntity1 = new HistoricProcessInstanceEntity();
historicProcessInstanceEntity1.setId("historicProcessInstanceEntity1.id");
historicProcessInstanceEntity1.setProcessDefinitionId("a.b:1:1");
historicProcessInstanceEntity1.setStartTime(new Date(1234));
historicProcessInstances.add(historicProcessInstanceEntity1);
when(activitiService.getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(any(), any(), any(), any())).thenReturn(historicProcessInstances);
when(activitiService.getJobsWithExceptionCountByProcessInstanceId(any())).thenReturn(expectedNumberOfExceptions);
JobSummaries getJobsResult = jobServiceImpl.getJobs(namespace, jobName, jobStatus, NO_START_TIME, NO_END_TIME);
List<JobSummary> jobSummaries = getJobsResult.getJobSummaries();
assertEquals(1, jobSummaries.size());
JobSummary jobSummary = jobSummaries.get(0);
assertEquals(historicProcessInstanceEntity1.getId(), jobSummary.getId());
assertEquals("a", jobSummary.getNamespace());
assertEquals("b", jobSummary.getJobName());
assertEquals(JobStatusEnum.RUNNING, jobSummary.getStatus());
assertEquals(historicProcessInstanceEntity1.getStartTime().getTime(), jobSummary.getStartTime().toGregorianCalendar().getTimeInMillis());
assertNull(jobSummary.getEndTime());
assertEquals(expectedNumberOfExceptions, jobSummary.getTotalExceptions());
verify(activitiService).getJobsWithExceptionCountByProcessInstanceId(historicProcessInstanceEntity1.getId());
verify(activitiService).getHistoricProcessInstancesCountByStatusAndProcessDefinitionKeys(eq(JobStatusEnum.RUNNING), any(), any(), any());
verify(activitiService).getHistoricProcessInstancesByStatusAndProcessDefinitionKeys(eq(JobStatusEnum.RUNNING), any(), any(), any());
}