use of org.activiti.api.runtime.model.impl.DeploymentImpl in project Activiti by Activiti.
the class ProcessRuntimeImplTest method should_throwActivitiUnprocessableEntryException_when_processDefinitionAppVersionDiffersFromCurrentDeploymentVersion.
@Test
public void should_throwActivitiUnprocessableEntryException_when_processDefinitionAppVersionDiffersFromCurrentDeploymentVersion() {
String processDefinitionId = "processDefinitionId";
ProcessDefinitionEntityImpl processDefinition = new ProcessDefinitionEntityImpl();
processDefinition.setId(processDefinitionId);
processDefinition.setAppVersion(1);
List<ProcessDefinition> findProcessDefinitionResult = singletonList(processDefinition);
Deployment latestDeploymentEntity = new DeploymentEntityImpl();
DeploymentImpl latestDeployment = new DeploymentImpl();
latestDeployment.setVersion(2);
given(deploymentConverter.from(latestDeploymentEntity)).willReturn(latestDeployment);
given(commandExecutor.execute(any())).willReturn(findProcessDefinitionResult).willReturn(latestDeploymentEntity).willReturn(latestDeployment);
Throwable exception = catchThrowable(() -> processRuntime.processDefinition(processDefinitionId));
assertThat(exception).isInstanceOf(UnprocessableEntityException.class).hasMessage("Process definition with the given id:'processDefinitionId' belongs to a different application version.");
}
use of org.activiti.api.runtime.model.impl.DeploymentImpl in project Activiti by Activiti.
the class ProcessRuntimeImplTest method should_throwActivitiObjectNotFoundException_when_canReadFalse.
@Test
public void should_throwActivitiObjectNotFoundException_when_canReadFalse() {
String processDefinitionId = "processDefinitionId";
String processDefinitionKey = "processDefinitionKey";
ProcessDefinitionEntityImpl processDefinition = new ProcessDefinitionEntityImpl();
processDefinition.setId(processDefinitionId);
processDefinition.setKey(processDefinitionKey);
processDefinition.setAppVersion(1);
List<ProcessDefinition> findProcessDefinitionResult = singletonList(processDefinition);
Deployment latestDeploymentEntity = new DeploymentEntityImpl();
DeploymentImpl deployment = new DeploymentImpl();
deployment.setVersion(1);
given(deploymentConverter.from(latestDeploymentEntity)).willReturn(deployment);
given(commandExecutor.execute(any())).willReturn(findProcessDefinitionResult).willReturn(latestDeploymentEntity);
given(securityPoliciesManager.canRead(processDefinitionKey)).willReturn(false);
Throwable exception = catchThrowable(() -> processRuntime.processDefinition(processDefinitionId));
assertThat(exception).isInstanceOf(ActivitiObjectNotFoundException.class).hasMessage("Unable to find process definition for the given id:'processDefinitionId'");
}
use of org.activiti.api.runtime.model.impl.DeploymentImpl in project Activiti by Activiti.
the class APIDeploymentConverter method from.
@Override
public Deployment from(org.activiti.engine.repository.Deployment internalDeployment) {
DeploymentImpl deployment = new DeploymentImpl();
deployment.setId(internalDeployment.getId());
deployment.setName(internalDeployment.getName());
deployment.setVersion(internalDeployment.getVersion());
deployment.setProjectReleaseVersion(internalDeployment.getProjectReleaseVersion());
return deployment;
}
Aggregations