Search in sources :

Example 31 with ProcessApplicationReference

use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.

the class RedeploymentRegistrationTest method registrationFoundFromLatestDeployment.

@Test
public void registrationFoundFromLatestDeployment() {
    // given
    ProcessApplicationReference reference1 = processApplication.getReference();
    Deployment deployment1 = repositoryService.createDeployment(reference1).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
    // when
    ProcessApplicationReference reference2 = processApplication.getReference();
    Deployment deployment2 = repositoryService.createDeployment(reference2).name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
    String definitionId = getLatestDefinitionIdByKey(definitionKey1);
    // then
    assertEquals(reference2, getProcessApplicationForDefinition(definitionId));
    assertEquals(reference2, getProcessApplicationForDeployment(deployment2.getId()));
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 32 with ProcessApplicationReference

use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.

the class RedeploymentRegistrationTest method decisionRequirementsDefinitionTestProvider.

protected static TestProvider decisionRequirementsDefinitionTestProvider() {
    return new TestProvider() {

        @Override
        public Command<ProcessApplicationReference> createGetProcessApplicationCommand(final String definitionId) {
            return new Command<ProcessApplicationReference>() {

                public ProcessApplicationReference execute(CommandContext commandContext) {
                    ProcessEngineConfigurationImpl configuration = commandContext.getProcessEngineConfiguration();
                    DeploymentCache deploymentCache = configuration.getDeploymentCache();
                    DecisionRequirementsDefinitionEntity definition = deploymentCache.findDeployedDecisionRequirementsDefinitionById(definitionId);
                    return ProcessApplicationContextUtil.getTargetProcessApplication(definition);
                }
            };
        }

        @Override
        public String getLatestDefinitionIdByKey(RepositoryService repositoryService, String key) {
            return repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionKey(key).latestVersion().singleResult().getId();
        }
    };
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) CommandContext(org.camunda.bpm.engine.impl.interceptor.CommandContext) Command(org.camunda.bpm.engine.impl.interceptor.Command) DeploymentCache(org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache) ProcessEngineConfigurationImpl(org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl) DecisionRequirementsDefinitionEntity(org.camunda.bpm.engine.impl.dmn.entity.repository.DecisionRequirementsDefinitionEntity) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 33 with ProcessApplicationReference

use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.

the class RedeploymentRegistrationTest method registrationFoundFromDifferentDeployments.

@Test
public void registrationFoundFromDifferentDeployments() {
    // given
    // first deployment
    ProcessApplicationReference reference1 = processApplication.getReference();
    Deployment deployment1 = repositoryService.createDeployment(reference1).name(DEPLOYMENT_NAME + "-1").addClasspathResource(resource1).deploy();
    // second deployment
    ProcessApplicationReference reference2 = processApplication.getReference();
    repositoryService.createDeployment(reference2).name(DEPLOYMENT_NAME + "-2").addClasspathResource(resource2).deploy();
    // when
    repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
    String firstDefinitionId = getLatestDefinitionIdByKey(definitionKey1);
    String secondDefinitionId = getLatestDefinitionIdByKey(definitionKey2);
    // then
    assertEquals(reference1, getProcessApplicationForDefinition(firstDefinitionId));
    assertEquals(reference2, getProcessApplicationForDefinition(secondDefinitionId));
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 34 with ProcessApplicationReference

use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.

the class RedeploymentRegistrationTest method registrationFoundFromPreviousDefinition.

@Test
public void registrationFoundFromPreviousDefinition() {
    // given
    ProcessApplicationReference reference = processApplication.getReference();
    Deployment deployment1 = repositoryService.createDeployment(reference).name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
    // when
    Deployment deployment2 = repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
    String definitionId = getLatestDefinitionIdByKey(definitionKey1);
    // then
    assertEquals(reference, getProcessApplicationForDefinition(definitionId));
    // and the reference is not cached
    assertNull(getProcessApplicationForDeployment(deployment2.getId()));
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Example 35 with ProcessApplicationReference

use of org.camunda.bpm.application.ProcessApplicationReference in project camunda-bpm-platform by camunda.

the class RedeploymentRegistrationTest method registrationFoundFromSameDeployment.

@Test
public void registrationFoundFromSameDeployment() {
    // given
    // first deployment
    ProcessApplicationReference reference1 = processApplication.getReference();
    Deployment deployment1 = repositoryService.createDeployment(reference1).name(DEPLOYMENT_NAME).addClasspathResource(resource1).addClasspathResource(resource2).deploy();
    // second deployment
    repositoryService.createDeployment().name(DEPLOYMENT_NAME).addClasspathResource(resource1).deploy();
    repositoryService.createDeployment().name(DEPLOYMENT_NAME).addClasspathResource(resource2).deploy();
    // when
    repositoryService.createDeployment().name(DEPLOYMENT_NAME).addDeploymentResources(deployment1.getId()).deploy();
    String firstDefinitionId = getLatestDefinitionIdByKey(definitionKey1);
    String secondDefinitionId = getLatestDefinitionIdByKey(definitionKey1);
    // then
    assertEquals(reference1, getProcessApplicationForDefinition(firstDefinitionId));
    assertEquals(reference1, getProcessApplicationForDefinition(secondDefinitionId));
}
Also used : ProcessApplicationReference(org.camunda.bpm.application.ProcessApplicationReference) Deployment(org.camunda.bpm.engine.repository.Deployment) Test(org.junit.Test)

Aggregations

ProcessApplicationReference (org.camunda.bpm.application.ProcessApplicationReference)39 Deployment (org.camunda.bpm.engine.repository.Deployment)10 Test (org.junit.Test)10 ProcessApplicationUnavailableException (org.camunda.bpm.application.ProcessApplicationUnavailableException)7 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)7 EmbeddedProcessApplication (org.camunda.bpm.application.impl.EmbeddedProcessApplication)6 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)5 ProcessApplicationInterface (org.camunda.bpm.application.ProcessApplicationInterface)4 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4 RepositoryService (org.camunda.bpm.engine.RepositoryService)4 Command (org.camunda.bpm.engine.impl.interceptor.Command)4 DeploymentCache (org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache)4 InvocationContext (org.camunda.bpm.application.InvocationContext)3 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)3 ProcessApplicationManager (org.camunda.bpm.engine.impl.application.ProcessApplicationManager)2 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)2 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Callable (java.util.concurrent.Callable)1