Search in sources :

Example 1 with DeploymentQuery

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);
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) Deployment(org.camunda.bpm.engine.repository.Deployment)

Example 2 with DeploymentQuery

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;
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery)

Example 3 with DeploymentQuery

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);
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery)

Example 4 with DeploymentQuery

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);
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery)

Example 5 with DeploymentQuery

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());
}
Also used : DeploymentQuery(org.camunda.bpm.engine.repository.DeploymentQuery) Deployment(org.camunda.bpm.engine.repository.Deployment)

Aggregations

DeploymentQuery (org.camunda.bpm.engine.repository.DeploymentQuery)58 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)13 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)13 Deployment (org.camunda.bpm.engine.repository.Deployment)11 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)8 Test (org.junit.Test)7 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)5 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4