Package org.activiti.engine.repository

Examples of org.activiti.engine.repository.Deployment


  * Test getting a single deployment.
  * GET repository/deployments/{deploymentId}
  */
  @org.activiti.engine.test.Deployment(resources={"org/activiti/rest/service/api/repository/oneTaskProcess.bpmn20.xml"})
  public void testGetDeployment() throws Exception {
    Deployment existingDeployment = repositoryService.createDeploymentQuery().singleResult();
    
    HttpGet httpGet = new HttpGet(SERVER_URL_PREFIX +
        RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT, existingDeployment.getId()));
    CloseableHttpResponse response = executeRequest(httpGet, HttpStatus.SC_OK);
    closeResponse(response);
   
    JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
    
    String deploymentId = responseNode.get("id").textValue();
    String name = responseNode.get("name").textValue();
    String category = responseNode.get("category").textValue();
    String deployTime = responseNode.get("deploymentTime").textValue();
    String url = responseNode.get("url").textValue();
    String tenantId = responseNode.get("tenantId").textValue();
   
    assertEquals("", tenantId);
    assertNotNull(deploymentId);
    assertEquals(existingDeployment.getId(), deploymentId);
   
    assertNotNull(name);
    assertEquals(existingDeployment.getName(), name);
   
    assertEquals(existingDeployment.getCategory(), category);
   
    assertNotNull(deployTime);
   
    assertNotNull(url);
    assertTrue(url.endsWith(RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT,deploymentId)));
View Full Code Here


   * Test deleting a single deployment.
   * DELETE repository/deployments/{deploymentId}
   */
   @org.activiti.engine.test.Deployment(resources={"org/activiti/rest/service/api/repository/oneTaskProcess.bpmn20.xml"})
   public void testDeleteDeployment() throws Exception {
     Deployment existingDeployment = repositoryService.createDeploymentQuery().singleResult();
     assertNotNull(existingDeployment);
    
     // Delete the deployment
     HttpDelete httpDelete = new HttpDelete(SERVER_URL_PREFIX +
         RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT, existingDeployment.getId()));
     CloseableHttpResponse response = executeRequest(httpDelete, HttpStatus.SC_NO_CONTENT);
     closeResponse(response);
    
     existingDeployment = repositoryService.createDeploymentQuery().singleResult();
     assertNull(existingDeployment);
View Full Code Here

  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();
  }
View Full Code Here

  @Test
  public void http() throws Exception {
    Assert.assertTrue(muleContext.isStarted());
   
    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    Deployment deployment = processEngine.getRepositoryService().createDeployment()
        .addClasspathResource("org/activiti/mule/testHttp.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(20, result);
    runtimeService.deleteProcessInstance(processInstance.getId(), "test");
    processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
    processEngine.getRepositoryService().deleteDeployment(deployment.getId());
    assertAndEnsureCleanDb(processEngine);
    ProcessEngines.destroy();
  }
View Full Code Here

  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());
  }
View Full Code Here

  @Test
  public void httpWithBasicAuth() throws Exception {
    Assert.assertTrue(muleContext.isStarted());
   
    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    Deployment deployment = processEngine.getRepositoryService().createDeployment()
         .addClasspathResource("org/activiti/mule/testHttpBasicAuth.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(10, result);
    runtimeService.deleteProcessInstance(processInstance.getId(), "test");
    processEngine.getHistoryService().deleteHistoricProcessInstance(processInstance.getId());
    processEngine.getRepositoryService().deleteDeployment(deployment.getId());
    assertAndEnsureCleanDb(processEngine);
    ProcessEngines.destroy();
  }
View Full Code Here

  }

  @ManagedOperation(description = "Deploy Process Definition")
  public void deployProcessDefinition(String resourceName, String processDefinitionFile) throws FileNotFoundException {
    DeploymentBuilder deploymentBuilder =  repositoryService.createDeployment();
    Deployment deployment = deploymentBuilder.addInputStream(resourceName, new FileInputStream(processDefinitionFile)).deploy();
  }
View Full Code Here

  * 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());
View Full Code Here

      // Alter time to ensure different deployTimes
      Calendar yesterday = Calendar.getInstance();
      yesterday.add(Calendar.DAY_OF_MONTH, -1);
      processEngineConfiguration.getClock().setCurrentTime(yesterday.getTime());
     
      Deployment firstDeployment = repositoryService.createDeployment().name("Deployment 1")
          .category("DEF")
          .addClasspathResource("org/activiti/rest/service/api/repository/oneTaskProcess.bpmn20.xml")
          .deploy();

      processEngineConfiguration.getClock().setCurrentTime(Calendar.getInstance().getTime());
      Deployment secondDeployment = repositoryService.createDeployment().name("Deployment 2")
              .category("ABC")
              .addClasspathResource("org/activiti/rest/service/api/repository/oneTaskProcess.bpmn20.xml")
              .tenantId("myTenant")
              .deploy();
     
      String baseUrl = RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT_COLLECTION);
      assertResultsPresentInDataResponse(baseUrl, firstDeployment.getId(), secondDeployment.getId());
     
      // Check name filtering
      String url = baseUrl + "?name=" + encode("Deployment 1");
      assertResultsPresentInDataResponse(url, firstDeployment.getId());
     
      // Check name-like filtering
      url = baseUrl + "?nameLike=" + encode("%ment 2");
      assertResultsPresentInDataResponse(url, secondDeployment.getId());
     
      // Check category filtering
      url = baseUrl +"?category=DEF";
      assertResultsPresentInDataResponse(url, firstDeployment.getId());
     
      // Check category-not-equals filtering
      url = baseUrl +"?categoryNotEquals=DEF";
      assertResultsPresentInDataResponse(url, secondDeployment.getId());
     
      // Check tenantId filtering
      url = baseUrl +"?tenantId=myTenant";
      assertResultsPresentInDataResponse(url, secondDeployment.getId());
     
      // Check tenantId filtering
      url = baseUrl +"?tenantId=unexistingTenant";
      assertResultsPresentInDataResponse(url);
     
      // Check tenantId like filtering
      url = baseUrl +"?tenantIdLike="+ encode("%enant");
      assertResultsPresentInDataResponse(url, secondDeployment.getId());
     
      // Check without tenantId filtering
      url = baseUrl +"?withoutTenantId=true";
      assertResultsPresentInDataResponse(url, firstDeployment.getId());
     
      // Check ordering by name
      CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX +
          RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT_COLLECTION) + "?sort=name&order=asc"), HttpStatus.SC_OK);
      JsonNode dataNode = objectMapper.readTree(response.getEntity().getContent()).get("data");
      closeResponse(response);
      assertEquals(2L, dataNode.size());
      assertEquals(firstDeployment.getId(), dataNode.get(0).get("id").textValue());
      assertEquals(secondDeployment.getId(), dataNode.get(1).get("id").textValue());
     
      // Check ordering by deploy time
      response = executeRequest(new HttpGet(SERVER_URL_PREFIX +
          RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT_COLLECTION) + "?sort=deployTime&order=asc"), HttpStatus.SC_OK);
      dataNode = objectMapper.readTree(response.getEntity().getContent()).get("data");
      closeResponse(response);
      assertEquals(2L, dataNode.size());
      assertEquals(firstDeployment.getId(), dataNode.get(0).get("id").textValue());
      assertEquals(secondDeployment.getId(), dataNode.get(1).get("id").textValue());
     
      // Check ordering by tenantId
      response = executeRequest(new HttpGet(SERVER_URL_PREFIX +
          RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT_COLLECTION) + "?sort=tenantId&order=desc"), HttpStatus.SC_OK);
      dataNode = objectMapper.readTree(response.getEntity().getContent()).get("data");
      closeResponse(response);
      assertEquals(2L, dataNode.size());
      assertEquals(secondDeployment.getId(), dataNode.get(0).get("id").textValue());
      assertEquals(firstDeployment.getId(), dataNode.get(1).get("id").textValue());
     
      // Check paging
      response = executeRequest(new HttpGet(SERVER_URL_PREFIX +
          RestUrls.createRelativeResourceUrl(RestUrls.URL_DEPLOYMENT_COLLECTION) + "?sort=deployTime&order=asc&start=1&size=1"), HttpStatus.SC_OK);
      JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
      closeResponse(response);
      dataNode = responseNode.get("data");
      assertEquals(1L, dataNode.size());
      assertEquals(secondDeployment.getId(), dataNode.get(0).get("id").textValue());
      assertEquals(2L, responseNode.get("total").longValue());
      assertEquals(1L, responseNode.get("start").longValue());
      assertEquals(1L, responseNode.get("size").longValue());
     
    } finally {
View Full Code Here

     
      if(tenantId != null) {
        deploymentBuilder.tenantId(tenantId);
      }
     
      Deployment deployment = deploymentBuilder.deploy();
     
      response.setStatus(HttpStatus.CREATED.value());
     
      return restResponseFactory.createDeploymentResponse(deployment, request.getRequestURL().toString().replace("/repository/deployments", ""));
     
View Full Code Here

TOP

Related Classes of org.activiti.engine.repository.Deployment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.