use of org.camunda.bpm.application.ProcessApplicationInfo in project camunda-bpm-platform by camunda.
the class ApplicationContextPathUtil method getApplicationPathForDeployment.
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);
}
}
use of org.camunda.bpm.application.ProcessApplicationInfo in project camunda-bpm-platform by camunda.
the class InjectionUtil method resolveInjections.
public static Object[] resolveInjections(DeploymentOperation operationContext, Method lifecycleMethod) {
final Type[] parameterTypes = lifecycleMethod.getGenericParameterTypes();
final List<Object> parameters = new ArrayList<Object>();
for (Type parameterType : parameterTypes) {
boolean injectionResolved = false;
if (parameterType instanceof Class) {
Class<?> parameterClass = (Class<?>) parameterType;
// support injection of the default process engine
if (ProcessEngine.class.isAssignableFrom(parameterClass)) {
parameters.add(getDefaultProcessEngine(operationContext));
injectionResolved = true;
} else // support injection of the ProcessApplicationInfo
if (ProcessApplicationInfo.class.isAssignableFrom(parameterClass)) {
parameters.add(getProcessApplicationInfo(operationContext));
injectionResolved = true;
}
} else if (parameterType instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) parameterType;
Type[] actualTypeArguments = parameterizedType.getActualTypeArguments();
// support injection of List<ProcessEngine>
if (actualTypeArguments.length == 1 && ProcessEngine.class.isAssignableFrom((Class<?>) actualTypeArguments[0])) {
parameters.add(getProcessEngines(operationContext));
injectionResolved = true;
}
}
if (!injectionResolved) {
throw LOG.unsuppoertedParameterType(parameterType);
}
}
return parameters.toArray();
}
use of org.camunda.bpm.application.ProcessApplicationInfo in project camunda-bpm-platform by camunda.
the class ProcessApplicationServiceTest method testProcessApplicationsDeployed.
@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());
}
}
use of org.camunda.bpm.application.ProcessApplicationInfo in project camunda-bpm-platform by camunda.
the class TestWarDeploymentResumePreviousOnDeploymentName method testDeployProcessArchive.
@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));
}
use of org.camunda.bpm.application.ProcessApplicationInfo in project camunda-bpm-platform by camunda.
the class TestWarDeploymentResumePreviousOnProcessDefinitionKey method testDeployProcessArchive.
@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));
}
Aggregations