Search in sources :

Example 1 with Deployment

use of org.activiti.engine.repository.Deployment in project Activiti by Activiti.

the class RestResponseFactory method createDeploymentResponseList.

public List<DeploymentResponse> createDeploymentResponseList(List<Deployment> deployments) {
    RestUrlBuilder urlBuilder = createUrlBuilder();
    List<DeploymentResponse> responseList = new ArrayList<DeploymentResponse>();
    for (Deployment instance : deployments) {
        responseList.add(createDeploymentResponse(instance, urlBuilder));
    }
    return responseList;
}
Also used : ArrayList(java.util.ArrayList) DeploymentResponse(org.activiti.rest.service.api.repository.DeploymentResponse) Deployment(org.activiti.engine.repository.Deployment)

Example 2 with Deployment

use of org.activiti.engine.repository.Deployment in project Activiti by Activiti.

the class MuleVMTest method send.

@Test
public void send() throws Exception {
    Assert.assertTrue(muleContext.isStarted());
    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    RepositoryService repositoryService = processEngine.getRepositoryService();
    Deployment deployment = repositoryService.createDeployment().addClasspathResource("org/activiti/mule/testVM.bpmn20.xml").deploy();
    RuntimeService runtimeService = processEngine.getRuntimeService();
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("muleProcess");
    Assert.assertFalse(processInstance.isEnded());
    Object result = runtimeService.getVariable(processInstance.getProcessInstanceId(), "theVariable");
    Assert.assertEquals(30, result);
    runtimeService.deleteProcessInstance(processInstance.getId(), "test");
    processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
    repositoryService.deleteDeployment(deployment.getId());
    assertAndEnsureCleanDb(processEngine);
    ProcessEngines.destroy();
}
Also used : RuntimeService(org.activiti.engine.RuntimeService) Deployment(org.activiti.engine.repository.Deployment) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) ProcessEngine(org.activiti.engine.ProcessEngine) RepositoryService(org.activiti.engine.RepositoryService) Test(org.junit.Test)

Example 3 with Deployment

use of org.activiti.engine.repository.Deployment in project Activiti by Activiti.

the class BlueprintBasicTest method exportedServices.

@Test
public void exportedServices() throws Exception {
    assertNotNull(processEngine);
    assertNotNull(repositoryService);
    // wait for deployment to be done
    Thread.sleep(5000);
    Deployment deployment = repositoryService.createDeploymentQuery().singleResult();
    assertEquals("org.activiti.osgi.example", deployment.getName());
    ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
    assertEquals("osgiProcess", processDefinition.getKey());
}
Also used : Deployment(org.activiti.engine.repository.Deployment) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) Test(org.junit.Test)

Example 4 with Deployment

use of org.activiti.engine.repository.Deployment in project Activiti by Activiti.

the class SerializableVariablesDiabledTest method removeUsers.

@After
public void removeUsers() {
    identityService.deleteMembership(testUserId, testGroupId);
    identityService.deleteGroup(testGroupId);
    identityService.deleteUser(testUserId);
    for (Deployment deployment : repositoryService.createDeploymentQuery().list()) {
        repositoryService.deleteDeployment(deployment.getId(), true);
    }
}
Also used : Deployment(org.activiti.engine.repository.Deployment) After(org.junit.After)

Example 5 with Deployment

use of org.activiti.engine.repository.Deployment in project Activiti by Activiti.

the class ProcessDefinitionCollectionResourceTest method testGetProcessDefinitions.

/**
  * Test getting process definitions.
  * GET repository/process-definitions
  */
public void testGetProcessDefinitions() throws Exception {
    try {
        Deployment firstDeployment = repositoryService.createDeployment().name("Deployment 1").addClasspathResource("org/activiti/rest/service/api/repository/oneTaskProcess.bpmn20.xml").deploy();
        Deployment secondDeployment = repositoryService.createDeployment().name("Deployment 2").addClasspathResource("org/activiti/rest/service/api/repository/oneTaskProcess.bpmn20.xml").addClasspathResource("org/activiti/rest/service/api/repository/twoTaskProcess.bpmn20.xml").deploy();
        Deployment thirdDeployment = repositoryService.createDeployment().name("Deployment 3").addClasspathResource("org/activiti/rest/service/api/repository/oneTaskProcessWithDi.bpmn20.xml").deploy();
        ProcessDefinition oneTaskProcess = repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").deploymentId(firstDeployment.getId()).singleResult();
        ProcessDefinition latestOneTaskProcess = repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").deploymentId(secondDeployment.getId()).singleResult();
        ProcessDefinition twoTaskprocess = repositoryService.createProcessDefinitionQuery().processDefinitionKey("twoTaskProcess").deploymentId(secondDeployment.getId()).singleResult();
        ProcessDefinition oneTaskWithDiProcess = repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcessWithDi").deploymentId(thirdDeployment.getId()).singleResult();
        // Test parameterless call
        String baseUrl = RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_DEFINITION_COLLECTION);
        assertResultsPresentInDataResponse(baseUrl, oneTaskProcess.getId(), twoTaskprocess.getId(), latestOneTaskProcess.getId(), oneTaskWithDiProcess.getId());
        // Verify ACT-2141 Persistent isGraphicalNotation flag for process definitions
        CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + baseUrl), HttpStatus.SC_OK);
        JsonNode dataNode = objectMapper.readTree(response.getEntity().getContent()).get("data");
        closeResponse(response);
        for (int i = 0; i < dataNode.size(); i++) {
            JsonNode processDefinitionJson = dataNode.get(i);
            String key = processDefinitionJson.get("key").asText();
            JsonNode graphicalNotationNode = processDefinitionJson.get("graphicalNotationDefined");
            if (key.equals("oneTaskProcessWithDi")) {
                assertTrue(graphicalNotationNode.asBoolean());
            } else {
                assertFalse(graphicalNotationNode.asBoolean());
            }
        }
        // Verify
        // Test name filtering
        String url = baseUrl + "?name=" + encode("The Two Task Process");
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId());
        // Test nameLike filtering
        url = baseUrl + "?nameLike=" + encode("The Two%");
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId());
        // Test key filtering
        url = baseUrl + "?key=twoTaskProcess";
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId());
        // Test returning multiple versions for the same key
        url = baseUrl + "?key=oneTaskProcess";
        assertResultsPresentInDataResponse(url, oneTaskProcess.getId(), latestOneTaskProcess.getId());
        // Test keyLike filtering
        url = baseUrl + "?keyLike=" + encode("two%");
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId());
        // Test category filtering
        url = baseUrl + "?category=TwoTaskCategory";
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId());
        // Test categoryLike filtering
        url = baseUrl + "?categoryLike=" + encode("Two%");
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId());
        // Test categoryNotEquals filtering
        url = baseUrl + "?categoryNotEquals=OneTaskCategory";
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId(), oneTaskWithDiProcess.getId());
        // Test resourceName filtering
        url = baseUrl + "?resourceName=org/activiti/rest/service/api/repository/twoTaskProcess.bpmn20.xml";
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId());
        // Test resourceNameLike filtering
        url = baseUrl + "?resourceNameLike=" + encode("%twoTaskProcess%");
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId());
        // Test version filtering
        url = baseUrl + "?version=2";
        assertResultsPresentInDataResponse(url, latestOneTaskProcess.getId());
        // Test latest filtering
        url = baseUrl + "?latest=true";
        assertResultsPresentInDataResponse(url, latestOneTaskProcess.getId(), twoTaskprocess.getId(), oneTaskWithDiProcess.getId());
        url = baseUrl + "?latest=false";
        assertResultsPresentInDataResponse(baseUrl, oneTaskProcess.getId(), twoTaskprocess.getId(), latestOneTaskProcess.getId(), oneTaskWithDiProcess.getId());
        // Test deploymentId
        url = baseUrl + "?deploymentId=" + secondDeployment.getId();
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId(), latestOneTaskProcess.getId());
        // Test startableByUser
        url = baseUrl + "?startableByUser=kermit";
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId());
        // Test suspended
        repositoryService.suspendProcessDefinitionById(twoTaskprocess.getId());
        url = baseUrl + "?suspended=true";
        assertResultsPresentInDataResponse(url, twoTaskprocess.getId());
        url = baseUrl + "?suspended=false";
        assertResultsPresentInDataResponse(url, latestOneTaskProcess.getId(), oneTaskProcess.getId(), oneTaskWithDiProcess.getId());
    } finally {
        // Always cleanup any created deployments, even if the test failed
        List<Deployment> deployments = repositoryService.createDeploymentQuery().list();
        for (Deployment deployment : deployments) {
            repositoryService.deleteDeployment(deployment.getId(), true);
        }
    }
}
Also used : HttpGet(org.apache.http.client.methods.HttpGet) CloseableHttpResponse(org.apache.http.client.methods.CloseableHttpResponse) Deployment(org.activiti.engine.repository.Deployment) ProcessDefinition(org.activiti.engine.repository.ProcessDefinition) JsonNode(com.fasterxml.jackson.databind.JsonNode)

Aggregations

Deployment (org.activiti.engine.repository.Deployment)96 ArrayList (java.util.ArrayList)11 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)11 ProcessEngine (org.activiti.engine.ProcessEngine)10 RepositoryService (org.activiti.engine.RepositoryService)10 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)10 JsonNode (com.fasterxml.jackson.databind.JsonNode)9 BpmnModel (org.activiti.bpmn.model.BpmnModel)9 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)9 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)9 ByteArrayInputStream (java.io.ByteArrayInputStream)8 DeploymentQuery (org.activiti.engine.repository.DeploymentQuery)8 Test (org.junit.Test)8 ActivitiException (org.activiti.engine.ActivitiException)7 Test (org.junit.jupiter.api.Test)7 HttpGet (org.apache.http.client.methods.HttpGet)6 BPMNDeployment (org.wso2.carbon.bpmn.core.mgt.model.BPMNDeployment)6 InputStream (java.io.InputStream)5 HashSet (java.util.HashSet)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)5