Package org.activiti.engine.repository

Examples of org.activiti.engine.repository.Deployment


  protected void deployProcess(BpmnModel bpmnModel)  {
    byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
    ProcessEngineConfiguration configuration = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
    ProcessEngine processEngine = configuration.buildProcessEngine();
    try {
      Deployment deployment = processEngine.getRepositoryService().createDeployment().name("test").addString("test.bpmn20.xml", new String(xml)).deploy();
      processEngine.getRepositoryService().deleteDeployment(deployment.getId());
    } finally {
      processEngine.close();
    }
  }
View Full Code Here


      .addClasspathResource("org/activiti/upgrade/test/VerifyProcessDefinitionDescriptionTest.bpmn20.xml")
      .deploy();
   
    // SuspendAndActivateFunctionalityTest
    // Deploy test process, and start a few process instances
    Deployment deployment = processEngine.getRepositoryService().createDeployment()
      .name(Activiti_5_10_DataGenerator.class.getName())
      .addClasspathResource("org/activiti/upgrade/test/SuspendAndActivateUpgradeTest.bpmn20.xml")
      .deploy();
   
    ProcessDefinition processDefinition = processEngine.getRepositoryService().createProcessDefinitionQuery()
            .deploymentId(deployment.getId())
            .singleResult();
   
    for (int i=0; i<NR_OF_INSTANCES_FOR_SUSPENSION; i++) {
      processEngine.getRuntimeService().startProcessInstanceById(processDefinition.getId());
    }
View Full Code Here

    String wffn = wfn+"20.xml"; // workaround for http://forums.activiti.org/en/viewtopic.php?f=8&t=3745&start=10
        DeploymentBuilder db = repoSvc
                 .createDeployment()
                 .addInputStream(wffn,this.getClass().getResourceAsStream(wfn));
   
        Deployment d = db.deploy();
        ProcessDefinition pDef = repoSvc
                                 .createProcessDefinitionQuery()
                                 .deploymentId(d.getId())
                                 .singleResult();

        ProcessInstance proc = rtSvc.startProcessInstanceById(pDef.getId());
       
        String procId = proc.getId();
View Full Code Here

    String wffn = wfn+"20.xml"; // workaround for http://forums.activiti.org/en/viewtopic.php?f=8&t=3745&start=10
        DeploymentBuilder db = repoSvc
                 .createDeployment()
                 .addInputStream(wffn,this.getClass().getResourceAsStream(wfn));
   
        Deployment d = db.deploy();
        ProcessDefinition pDef = repoSvc
                                 .createProcessDefinitionQuery()
                                 .deploymentId(d.getId())
                                 .singleResult();

        ProcessInstance proc = rtSvc.startProcessInstanceById(pDef.getId());
       
        String procId = proc.getId();
View Full Code Here

       
        RepositoryService repoSvc = activitiRule.getRepositoryService();
        DeploymentBuilder db = repoSvc
                               .createDeployment()
                               .addInputStream(wffn,this.getClass().getResourceAsStream(wffn));
        Deployment d = db.deploy();
        ProcessDefinition pDef = repoSvc
                                 .createProcessDefinitionQuery()
                                 .deploymentId(d.getId())
                                 .singleResult();
       
        String pn = wfn+"."+pDef.getKey()+".png";
        File tpf = new File("target/"+pn);
       
        InputStream ds = repoSvc.getResourceAsStream(d.getId(),"/"+wfd+"/"+pn);
        OutputStream os = new FileOutputStream(tpf);
        IOUtils.copy(ds,os);
        os.close();
       
        FileAssert.assertBinaryEquals(new File("src/test/resources/baseline/"+pn),tpf);
View Full Code Here

    }
    return items;
  }

  public Item loadSingleResult(String id) {
    Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(id).singleResult();
    if(deployment != null) {
      return deploymentFilter.createItem(deployment);
    }
    return null;
  }
View Full Code Here

* @author Tom Baeyens
*/
public class DeploymentPersistenceTest extends PluggableActivitiTestCase {

  public void testDeploymentPersistence() {
    Deployment deployment = repositoryService
      .createDeployment()
      .name("strings")
      .addString("org/activiti/test/HelloWorld.string", "hello world")
      .addString("org/activiti/test/TheAnswer.string", "42")
      .deploy();
   
    List<Deployment> deployments = repositoryService.createDeploymentQuery().list();
    assertEquals(1, deployments.size());
    deployment = deployments.get(0);
   
    assertEquals("strings", deployment.getName());
    assertNotNull(deployment.getDeploymentTime());
   
    String deploymentId = deployment.getId();
    List<String> resourceNames = repositoryService.getDeploymentResourceNames(deploymentId);
    Set<String> expectedResourceNames = new HashSet<String>();
    expectedResourceNames.add("org/activiti/test/HelloWorld.string");
    expectedResourceNames.add("org/activiti/test/TheAnswer.string");
    assertEquals(expectedResourceNames, new HashSet<String>(resourceNames));
View Full Code Here

      fail();
    } catch (ActivitiException e) {}
  }
 
  public void testQueryByMessageSubscription() {
    Deployment deployment = repositoryService.createDeployment()
      .addClasspathResource("org/activiti/engine/test/api/repository/processWithNewBookingMessage.bpmn20.xml")
      .addClasspathResource("org/activiti/engine/test/api/repository/processWithNewInvoiceMessage.bpmn20.xml")
    .deploy();
   
    assertEquals(1,repositoryService.createProcessDefinitionQuery()
      .messageEventSubscriptionName("newInvoiceMessage")
      .count());
   
    assertEquals(1,repositoryService.createProcessDefinitionQuery()
      .messageEventSubscriptionName("newBookingMessage")
      .count());
   
    assertEquals(0,repositoryService.createProcessDefinitionQuery()
      .messageEventSubscriptionName("bogus")
      .count());
   
    repositoryService.deleteDeployment(deployment.getId());
  }
View Full Code Here

   
    if(deploymentId == null) {
      throw new ActivitiException("No deployment id provided");
    }

    Deployment deployment = ActivitiUtil.getRepositoryService().createDeploymentQuery().deploymentId(deploymentId).singleResult();
    List<String> resourceList = ActivitiUtil.getRepositoryService().getDeploymentResourceNames(deploymentId);

    ObjectNode responseJSON = new ObjectMapper().createObjectNode();
    responseJSON.put("id", deployment.getId());
    responseJSON.put("name", deployment.getName());
    responseJSON.put("deploymentTime", RequestUtil.dateToString(deployment.getDeploymentTime()));
    responseJSON.put("category", deployment.getCategory());
   
    ArrayNode resourceArray = new ObjectMapper().createArrayNode();
   
    for (String resourceName : resourceList) {
      resourceArray.add(resourceName);
View Full Code Here

        deploymentBuilder.addZipInputStream(new ZipInputStream(uploadItem.getInputStream()));
      } else {
        throw new ActivitiException("File must be of type .bpmn20.xml, .bpmn, .bar or .zip");
      }
      deploymentBuilder.name(fileName);
      Deployment deployment = deploymentBuilder.deploy();
      return new DeploymentResponse(deployment);
     
    } catch (Exception e) {
      throw new ActivitiException(e.getMessage(), e);
    }
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.