use of org.camunda.bpm.ProcessApplicationService in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method setUpRuntimeData.
@Before
public void setUpRuntimeData() {
taskServiceMock = mock(TaskService.class);
when(processEngine.getTaskService()).thenReturn(taskServiceMock);
mockTask = MockProvider.createMockTask();
mockQuery = mock(TaskQuery.class);
when(mockQuery.initializeFormKeys()).thenReturn(mockQuery);
when(mockQuery.taskId(anyString())).thenReturn(mockQuery);
when(mockQuery.singleResult()).thenReturn(mockTask);
when(taskServiceMock.createTaskQuery()).thenReturn(mockQuery);
List<IdentityLink> identityLinks = new ArrayList<IdentityLink>();
mockAssigneeIdentityLink = MockProvider.createMockUserAssigneeIdentityLink();
identityLinks.add(mockAssigneeIdentityLink);
mockOwnerIdentityLink = MockProvider.createMockUserOwnerIdentityLink();
identityLinks.add(mockOwnerIdentityLink);
mockCandidateGroupIdentityLink = MockProvider.createMockCandidateGroupIdentityLink();
identityLinks.add(mockCandidateGroupIdentityLink);
mockCandidateGroup2IdentityLink = MockProvider.createAnotherMockCandidateGroupIdentityLink();
identityLinks.add(mockCandidateGroup2IdentityLink);
when(taskServiceMock.getIdentityLinksForTask(EXAMPLE_TASK_ID)).thenReturn(identityLinks);
mockTaskComment = MockProvider.createMockTaskComment();
when(taskServiceMock.getTaskComment(EXAMPLE_TASK_ID, EXAMPLE_TASK_COMMENT_ID)).thenReturn(mockTaskComment);
mockTaskComments = MockProvider.createMockTaskComments();
when(taskServiceMock.getTaskComments(EXAMPLE_TASK_ID)).thenReturn(mockTaskComments);
when(taskServiceMock.createComment(EXAMPLE_TASK_ID, null, EXAMPLE_TASK_COMMENT_FULL_MESSAGE)).thenReturn(mockTaskComment);
mockTaskAttachment = MockProvider.createMockTaskAttachment();
when(taskServiceMock.getTaskAttachment(EXAMPLE_TASK_ID, EXAMPLE_TASK_ATTACHMENT_ID)).thenReturn(mockTaskAttachment);
mockTaskAttachments = MockProvider.createMockTaskAttachments();
when(taskServiceMock.getTaskAttachments(EXAMPLE_TASK_ID)).thenReturn(mockTaskAttachments);
when(taskServiceMock.createAttachment(anyString(), anyString(), anyString(), anyString(), anyString(), anyString())).thenReturn(mockTaskAttachment);
when(taskServiceMock.createAttachment(anyString(), anyString(), anyString(), anyString(), anyString(), any(InputStream.class))).thenReturn(mockTaskAttachment);
when(taskServiceMock.getTaskAttachmentContent(EXAMPLE_TASK_ID, EXAMPLE_TASK_ATTACHMENT_ID)).thenReturn(new ByteArrayInputStream(createMockByteData()));
formServiceMock = mock(FormService.class);
when(processEngine.getFormService()).thenReturn(formServiceMock);
TaskFormData mockFormData = MockProvider.createMockTaskFormData();
when(formServiceMock.getTaskFormData(anyString())).thenReturn(mockFormData);
VariableMap variablesMock = MockProvider.createMockFormVariables();
when(formServiceMock.getTaskFormVariables(eq(EXAMPLE_TASK_ID), Matchers.<Collection<String>>any(), anyBoolean())).thenReturn(variablesMock);
repositoryServiceMock = mock(RepositoryService.class);
when(processEngine.getRepositoryService()).thenReturn(repositoryServiceMock);
ProcessDefinition mockDefinition = MockProvider.createMockDefinition();
when(repositoryServiceMock.getProcessDefinition(MockProvider.EXAMPLE_PROCESS_DEFINITION_ID)).thenReturn(mockDefinition);
managementServiceMock = mock(ManagementService.class);
when(processEngine.getManagementService()).thenReturn(managementServiceMock);
when(managementServiceMock.getProcessApplicationForDeployment(MockProvider.EXAMPLE_DEPLOYMENT_ID)).thenReturn(MockProvider.EXAMPLE_PROCESS_APPLICATION_NAME);
when(managementServiceMock.getHistoryLevel()).thenReturn(ProcessEngineConfigurationImpl.HISTORYLEVEL_FULL);
HistoryService historyServiceMock = mock(HistoryService.class);
when(processEngine.getHistoryService()).thenReturn(historyServiceMock);
historicTaskInstanceQueryMock = mock(HistoricTaskInstanceQuery.class);
when(historyServiceMock.createHistoricTaskInstanceQuery()).thenReturn(historicTaskInstanceQueryMock);
when(historicTaskInstanceQueryMock.taskId(eq(EXAMPLE_TASK_ID))).thenReturn(historicTaskInstanceQueryMock);
HistoricTaskInstance historicTaskInstanceMock = createMockHistoricTaskInstance();
when(historicTaskInstanceQueryMock.singleResult()).thenReturn(historicTaskInstanceMock);
// replace the runtime container delegate & process application service with a mock
ProcessApplicationService processApplicationService = mock(ProcessApplicationService.class);
ProcessApplicationInfo appMock = MockProvider.createMockProcessApplicationInfo();
when(processApplicationService.getProcessApplicationInfo(MockProvider.EXAMPLE_PROCESS_APPLICATION_NAME)).thenReturn(appMock);
RuntimeContainerDelegate delegate = mock(RuntimeContainerDelegate.class);
when(delegate.getProcessApplicationService()).thenReturn(processApplicationService);
RuntimeContainerDelegate.INSTANCE.set(delegate);
}
use of org.camunda.bpm.ProcessApplicationService in project camunda-bpm-platform by camunda.
the class TestWarDeploymentResumePrevious method testDeployProcessArchive.
@Test
@OperateOnDeployment(value = PA2)
public void testDeployProcessArchive() {
Assert.assertNotNull(processEngine);
RepositoryService repositoryService = processEngine.getRepositoryService();
long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").count();
Assert.assertEquals(2, count);
// validate registrations:
ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames();
boolean resumedRegistrationFound = false;
for (String paName : processApplicationNames) {
ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName);
List<ProcessApplicationDeploymentInfo> deploymentInfo = processApplicationInfo.getDeploymentInfo();
if (deploymentInfo.size() == 2) {
if (resumedRegistrationFound) {
Assert.fail("Cannot have two registrations");
}
resumedRegistrationFound = true;
}
}
Assert.assertTrue("Previous version of the deployment was not resumed", resumedRegistrationFound);
}
use of org.camunda.bpm.ProcessApplicationService in project camunda-bpm-platform by camunda.
the class TestWarDeploymentIsDeployChangedOnly method testDeployProcessArchive.
@Test
@OperateOnDeployment(value = PA2)
public void testDeployProcessArchive() {
Assert.assertNotNull(processEngine);
RepositoryService repositoryService = processEngine.getRepositoryService();
long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").count();
Assert.assertEquals(1, count);
// validate registrations:
ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames();
boolean resumedRegistrationFound = false;
for (String paName : processApplicationNames) {
ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName);
List<ProcessApplicationDeploymentInfo> deploymentInfo = processApplicationInfo.getDeploymentInfo();
if (deploymentInfo.size() == 2) {
if (resumedRegistrationFound) {
Assert.fail("Cannot have two registrations");
}
resumedRegistrationFound = true;
}
}
Assert.assertTrue("Previous version of the deployment was not resumed", resumedRegistrationFound);
}
use of org.camunda.bpm.ProcessApplicationService in project camunda-bpm-platform by camunda.
the class TestWarDeploymentResumePreviousOff method testDeployProcessArchive.
@Test
@OperateOnDeployment(value = PA2)
public void testDeployProcessArchive() {
Assert.assertNotNull(processEngine);
RepositoryService repositoryService = processEngine.getRepositoryService();
long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").count();
Assert.assertEquals(2, count);
// validate registrations:
ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames();
for (String paName : processApplicationNames) {
ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName);
List<ProcessApplicationDeploymentInfo> deploymentInfo = processApplicationInfo.getDeploymentInfo();
if (deploymentInfo.size() == 2) {
Assert.fail("Previous version of the deployment must not be resumed");
}
}
}
use of org.camunda.bpm.ProcessApplicationService in project camunda-bpm-platform by camunda.
the class SpringServletPALifecycleTest method test.
@Test
public void test() {
ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
Assert.assertNotNull(processApplicationService.getProcessApplicationInfo("pa"));
}
Aggregations