use of org.camunda.bpm.engine.repository.DeploymentQuery in project camunda-bpm-platform by camunda.
the class ProcessEngineRestServiceTest method createDeploymentMock.
private void createDeploymentMock() {
Deployment mockDeployment = MockProvider.createMockDeployment();
DeploymentQuery deploymentQueryMock = mock(DeploymentQuery.class);
when(deploymentQueryMock.deploymentId(anyString())).thenReturn(deploymentQueryMock);
when(deploymentQueryMock.singleResult()).thenReturn(mockDeployment);
when(mockRepoService.createDeploymentQuery()).thenReturn(deploymentQueryMock);
}
use of org.camunda.bpm.engine.repository.DeploymentQuery in project camunda-bpm-platform by camunda.
the class DeploymentRestServiceQueryTest method setUpMockDeploymentQuery.
private DeploymentQuery setUpMockDeploymentQuery(List<Deployment> mockedDeployments) {
DeploymentQuery sampleDeploymentQuery = mock(DeploymentQuery.class);
when(sampleDeploymentQuery.list()).thenReturn(mockedDeployments);
when(sampleDeploymentQuery.count()).thenReturn((long) mockedDeployments.size());
when(processEngine.getRepositoryService().createDeploymentQuery()).thenReturn(sampleDeploymentQuery);
return sampleDeploymentQuery;
}
use of org.camunda.bpm.engine.repository.DeploymentQuery in project camunda-bpm-platform by camunda.
the class DeploymentAuthorizationTest method testDeleteDeploymentWithDeletePermissionOnDeployment.
public void testDeleteDeploymentWithDeletePermissionOnDeployment() {
// given
String deploymentId = createDeployment(null);
createGrantAuthorization(DEPLOYMENT, deploymentId, userId, DELETE);
// when
repositoryService.deleteDeployment(deploymentId);
// then
disableAuthorization();
DeploymentQuery query = repositoryService.createDeploymentQuery();
verifyQueryResults(query, 0);
enableAuthorization();
deleteDeployment(deploymentId);
}
use of org.camunda.bpm.engine.repository.DeploymentQuery in project camunda-bpm-platform by camunda.
the class DeploymentAuthorizationTest method testDeploymentQueryWithReadPermissionOnAnyDeployment.
public void testDeploymentQueryWithReadPermissionOnAnyDeployment() {
// given
String deploymentId1 = createDeployment("first");
String deploymentId2 = createDeployment("second");
createGrantAuthorization(DEPLOYMENT, ANY, userId, READ);
// when
DeploymentQuery query = repositoryService.createDeploymentQuery();
// then
verifyQueryResults(query, 2);
deleteDeployment(deploymentId1);
deleteDeployment(deploymentId2);
}
use of org.camunda.bpm.engine.repository.DeploymentQuery in project camunda-bpm-platform by camunda.
the class DeploymentAuthorizationTest method testCreateDeployment.
public void testCreateDeployment() {
// given
createGrantAuthorization(DEPLOYMENT, ANY, userId, CREATE);
// when
Deployment deployment = repositoryService.createDeployment().addClasspathResource(FIRST_RESOURCE).deploy();
// then
disableAuthorization();
DeploymentQuery query = repositoryService.createDeploymentQuery();
verifyQueryResults(query, 1);
enableAuthorization();
deleteDeployment(deployment.getId());
}
Aggregations