Java Code Examples for org.camunda.bpm.BpmPlatform#getProcessApplicationService()

The following examples show how to use org.camunda.bpm.BpmPlatform#getProcessApplicationService() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApplicationContextPathUtil.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public static String getApplicationPathForDeployment(ProcessEngine engine, String deploymentId) {

    // get the name of the process application that made the deployment
    String processApplicationName = null;
    IdentityService identityService = engine.getIdentityService();
    Authentication currentAuthentication = identityService.getCurrentAuthentication();
    try {
      identityService.clearAuthentication();
      processApplicationName = engine.getManagementService().getProcessApplicationForDeployment(deploymentId);
    } finally {
      identityService.setAuthentication(currentAuthentication);
    }

    if (processApplicationName == null) {
      // no a process application deployment
      return null;
    } else {
      ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
      ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(processApplicationName);
      return processApplicationInfo.getProperties().get(ProcessApplicationInfo.PROP_SERVLET_CONTEXT_PATH);
    }
  }
 
Example 2
Source File: TestWarDeploymentResumePreviousOff.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@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");
    }
  }

}
 
Example 3
Source File: ProcessApplicationDeployerIntegrationTest.java    From camunda-bpm-platform-osgi with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 10000L)
public void shouldBeAbleToDeploy() throws InterruptedException {
  String processApplicationName = "yo!";
  // It could take a second to register the process application
  Set<String> processApplicationNames = null;
  ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
  do {
    Thread.sleep(500L);
    processApplicationNames = processApplicationService.getProcessApplicationNames();
  } while (processApplicationNames.isEmpty());
  assertThat(processApplicationNames, hasItem(processApplicationName));
}
 
Example 4
Source File: ProcessApplicationDeployerWithScanEmbeddedJarIntegrationTest.java    From camunda-bpm-platform-osgi with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 10000L)
public void shouldBeAbleToDeploy() throws InterruptedException {
  String processApplicationName = "yo!";
  // It could take a second to register the process application
  Set<String> processApplicationNames = null;
  ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
  do {
    Thread.sleep(500L);
    processApplicationNames = processApplicationService.getProcessApplicationNames();
  } while (processApplicationNames.isEmpty());
  assertThat(processApplicationNames, hasItem(processApplicationName));
}
 
Example 5
Source File: ProcessApplicationDeployerWithScanIntegrationTest.java    From camunda-bpm-platform-osgi with Apache License 2.0 5 votes vote down vote up
@Test(timeout = 20000L)
public void shouldBeAbleToDeploy() throws InterruptedException {
  String processApplicationName = "yo!";
  // It could take a second to register the process application
  Set<String> processApplicationNames = null;
  ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
  do {
    Thread.sleep(500L);
    processApplicationNames = processApplicationService.getProcessApplicationNames();
  } while (processApplicationNames.isEmpty());
  assertThat(processApplicationNames, hasItem(processApplicationName));
}
 
Example 6
Source File: TestWarDeploymentIsDeployChangedOnly.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@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);

}
 
Example 7
Source File: TestWarDeploymentResumePreviousOnProcessDefinitionKey.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@OperateOnDeployment(value=PA2)
public void testDeployProcessArchive() {
  assertThat(processEngine, is(notNullValue()));
  RepositoryService repositoryService = processEngine.getRepositoryService();
  long count = repositoryService.createProcessDefinitionQuery()
    .processDefinitionKey("testDeployProcessArchive")
    .count();

  assertThat(count, is(2L));

  // validate registrations:
  ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
  Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames();
  // we have two PAs, one from the first deployment and one from the second and only one (the second) is allowed to have two deployments
  boolean resumedRegistrationFound = false;
  for (String paName : processApplicationNames) {
    ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName);
    List<ProcessApplicationDeploymentInfo> deploymentInfo = processApplicationInfo.getDeploymentInfo();
    if(deploymentInfo.size() == 2) {
      if(resumedRegistrationFound) {
        fail("Cannot have two registrations");
      }
      resumedRegistrationFound = true;
    }
  }
  assertThat("Previous version of the deployment was not resumed", resumedRegistrationFound, is(true));
}
 
Example 8
Source File: TestWarDeploymentResumePrevious.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@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);

}
 
Example 9
Source File: TestWarDeploymentResumePreviousOnDeploymentName.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@OperateOnDeployment(value = PA2)
public void testDeployProcessArchive() {
  assertThat(processEngine, is(notNullValue()));
  RepositoryService repositoryService = processEngine.getRepositoryService();
  //since we have two processes deployed for PA2 we gotta check that both are present
  long count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testDeployProcessArchive").count();

  assertThat(count, is(1L));

  count = repositoryService.createProcessDefinitionQuery().processDefinitionKey("testProcess").count();
  
  assertThat(count, is(1L));
  
  // validate registrations:
  ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
  Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames();
  // we have two PAs, one from the first deployment and one from the second
  // and only one (the second) is allowed to have two deployments
  boolean resumedRegistrationFound = false;
  for (String paName : processApplicationNames) {
    ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(paName);
    List<ProcessApplicationDeploymentInfo> deploymentInfo = processApplicationInfo.getDeploymentInfo();
    if (deploymentInfo.size() == 2) {
      if (resumedRegistrationFound) {
        fail("Cannot have two registrations");
      }
      resumedRegistrationFound = true;
    }
  }
  assertThat("Previous version of the deployment was not resumed", resumedRegistrationFound, is(true));
}
 
Example 10
Source File: ProcessApplicationServiceObjectFactory.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception {
  return BpmPlatform.getProcessApplicationService();
}
 
Example 11
Source File: SpringServletPALifecycleTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Test
public void test() {
  ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
  Assert.assertNotNull(processApplicationService.getProcessApplicationInfo("pa"));
}
 
Example 12
Source File: ProcessApplicationServiceTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Test
@OperateOnDeployment("test1")
public void testProcessApplicationsDeployed() {
  
  ProcessApplicationService processApplicationService = BpmPlatform.getProcessApplicationService();
  
  Set<String> processApplicationNames = processApplicationService.getProcessApplicationNames();

  // check if the new applications are deployed with allowed names
  processApplicationNames.retainAll(Arrays.asList(new String [] {"test1", "test2", "/test1", "/test2"}));

  Assert.assertEquals(2, processApplicationNames.size());

  for (String appName : processApplicationNames) {
    ProcessApplicationInfo processApplicationInfo = processApplicationService.getProcessApplicationInfo(appName);
    
    Assert.assertNotNull(processApplicationInfo);
    Assert.assertNotNull(processApplicationInfo.getName());
    Assert.assertEquals(1, processApplicationInfo.getDeploymentInfo().size());      
  }
  
}