Package org.activiti.engine

Examples of org.activiti.engine.RepositoryService


  @Rule
  public ActivitiRule activitiRule = new ActivitiRule();

  @Test
  public void startProcess() throws Exception {
    RepositoryService repositoryService = activitiRule.getRepositoryService();
    repositoryService.createDeployment().addInputStream("initiator.bpmn20.xml", new FileInputStream(filename)).deploy();
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("initiator", "henryyan");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("initiator", variableMap);
    assertNotNull(processInstance.getId());
View Full Code Here


  @Rule
  public ActivitiRule activitiRule = new ActivitiRule();

  @Test
  public void startProcess() throws Exception {
    RepositoryService repositoryService = activitiRule.getRepositoryService();
    repositoryService.createDeployment()
        .addInputStream("MultiInstanceActivitiAttrs.bpmn20.xml", new FileInputStream(filename)).deploy();
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("assigneeList", Arrays.asList("user1", "user2", "user3"));
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("MultiInstanceActivitiAttrs", variableMap);
View Full Code Here

  @Rule
  public ActivitiRule activitiRule = new ActivitiRule();

  @Test
  public void startProcess() throws Exception {
    RepositoryService repositoryService = activitiRule.getRepositoryService();
    repositoryService.createDeployment().addInputStream("shopping-only-subprocess.bpmn20.xml", new FileInputStream(filename))
        .deploy();
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("shopping-only-subprocess", variableMap);
View Full Code Here

  @Rule
  public ActivitiRule activitiRule = new ActivitiRule();

  @Test
  public void startProcess() throws Exception {
    RepositoryService repositoryService = activitiRule.getRepositoryService();
    repositoryService.createDeployment().addInputStream("DymaticTaskName.bpmn20.xml",
        new FileInputStream(filename)).deploy();
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("DymaticTaskName", variableMap);
View Full Code Here

  @Rule
  public ActivitiRule activitiRule = new ActivitiRule();

  @Test
  public void startProcess() throws Exception {
    RepositoryService repositoryService = activitiRule.getRepositoryService();
    repositoryService.createDeployment().addInputStream("ExclusiveGateway.bpmn20.xml",
        new FileInputStream(filename)).deploy();
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("type", 4);
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ExclusiveGateway", variableMap);
View Full Code Here

            return;
        }
       
        LOGGER.info("deploying all workflow engine");
       
        RepositoryService repoSvc = JenkowEngine.getEngine().getRepositoryService();
        Map<String,Date> deplTimes = new HashMap<String,Date>();
        for (Deployment depl : repoSvc.createDeploymentQuery().list()){
            //System.out.println("  depl: id="+depl.getId()+" name="+depl.getName()+" time="+depl.getDeploymentTime());
            deplTimes.put(depl.getId(),depl.getDeploymentTime());
        }
        Map<String,Date> pDefTimes = new HashMap<String,Date>();
        for (ProcessDefinition pDef : repoSvc.createProcessDefinitionQuery().latestVersion().list()){
            //System.out.println(" pDef:"+pDef+" deplId="+pDef.getDeploymentId()+" key="+pDef.getKey());
            Date t = deplTimes.get(pDef.getDeploymentId());
            if (t != null) pDefTimes.put(pDef.getKey(),t);
        }
       
View Full Code Here

    static void deployToEngine(File wff) throws FileNotFoundException{
        LOGGER.info("deploying "+wff+" to workflow engine");
       
        ProcessEngine eng = JenkowEngine.getEngine();
        RuntimeService rtSvc = eng.getRuntimeService();
        RepositoryService repoSvc = eng.getRepositoryService();

        String wfn = wff+"20.xml"; // TODO 9: workaround for http://forums.activiti.org/en/viewtopic.php?f=8&t=3745&start=10
        DeploymentBuilder db = repoSvc.createDeployment().addInputStream(wfn,new FileInputStream(wff));

        // TODO 4: We should avoid redeploying here, if workflow file of a given version(?) is already deployed?
        Deployment d = db.deploy();
        ProcessDefinition pDef = repoSvc.createProcessDefinitionQuery().deploymentId(d.getId()).singleResult();
        LOGGER.fine("deployedToEngine("+wff+") --> "+pDef);
    }
View Full Code Here

        ProcessDefinition pDef = repoSvc.createProcessDefinitionQuery().deploymentId(d.getId()).singleResult();
        LOGGER.fine("deployedToEngine("+wff+") --> "+pDef);
    }
   
    static ProcessDefinition getDeployedWf(String wfName){
        RepositoryService repoSvc = JenkowEngine.getEngine().getRepositoryService();
        if (LOGGER.isLoggable(Level.FINE)){
            LOGGER.fine("deployed process definitions:");
            for (ProcessDefinition pDef : repoSvc.createProcessDefinitionQuery().latestVersion().list()){
                LOGGER.fine("  pDef:"+pDef+" id="+pDef.getId()+" key="+pDef.getKey()+" name="+pDef.getName()+" resourceName="+pDef.getResourceName()+" version="+pDef.getVersion());
            }
        }
        ProcessDefinition pDef = repoSvc
                                 .createProcessDefinitionQuery()
                                 .processDefinitionKey(wfName)
                                 .latestVersion()
                                 .singleResult();
        LOGGER.fine("getDeployedWf("+quoted(wfName)+") --> "+pDef);
View Full Code Here

    assertEquals("This process to test JMX", pdList.get(0).get(4));
    assertEquals("This process to test JMX", pdList.get(1).get(4));
   
    //suspend the one with version == 2   
    mbsc.invoke(deploymentsBeanName, "suspendProcessDefinitionById", new String[]{pidV2}, new String[]{String.class.getName()});
    RepositoryService repositoryService = processEngine.getRepositoryService();
   
    // test if it is realy suspended and not the other one
    assertTrue(repositoryService.getProcessDefinition(pidV2).isSuspended());
    assertFalse(repositoryService.getProcessDefinition(pidV1).isSuspended());
   
    // test if it is reported as suspended and not the other one
    List<String> pd = (List<String>) mbsc.invoke(deploymentsBeanName, "getProcessDefinitionById", new String[]{pidV2}, new String[]{String.class.getName()});
    assertNotNull(pd);
    assertEquals(5, pd.size());
    assertEquals("true", pd.get(3));
   

    pd = (List<String>) mbsc.invoke(deploymentsBeanName, "getProcessDefinitionById", new String[]{pidV1}, new String[]{String.class.getName()});
    assertNotNull(pd);
    assertEquals(5, pd.size());
    assertEquals("false", pd.get(3));
   
   
    // now reactivate the same suspended process
    mbsc.invoke(deploymentsBeanName, "activatedProcessDefinitionById", new String[]{pidV2}, new String[]{String.class.getName()});

    // test if both processes are active again
    assertFalse(repositoryService.getProcessDefinition(pidV2).isSuspended());
    assertFalse(repositoryService.getProcessDefinition(pidV1).isSuspended());
   
    // test if they are properly reported as activated
   
    pd = (List<String>) mbsc.invoke(deploymentsBeanName, "getProcessDefinitionById", new String[]{pidV2}, new String[]{String.class.getName()});
    assertNotNull(pd);
    assertEquals(5, pd.size());
    assertEquals("false", pd.get(3));
   

    pd = (List<String>) mbsc.invoke(deploymentsBeanName, "getProcessDefinitionById", new String[]{pidV1}, new String[]{String.class.getName()});
    assertNotNull(pd);
    assertEquals(5, pd.size());
    assertEquals("false", pd.get(3));
   


    // now undeploy the one with version == 1
    mbsc.invoke(deploymentsBeanName, "deleteDeployment", new String[]{firstDeploymentId}, new String[]{String.class.getName()});
   
    // now there should be only one deployment and only one process definition with version 2, first check it with API
    assertEquals(1, repositoryService.createDeploymentQuery().count());
   
    assertTrue(!repositoryService.createDeploymentQuery().singleResult().getId().equals(firstDeploymentId));


    // check if it is also affected in returned results.
   
    deployments = (List<List<String>>) mbsc.getAttribute(deploymentsBeanName, "Deployments");
View Full Code Here

    final HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().
      finished().
      includeProcessVariables().
      singleResult();
    assertNotNull(historicProcessInstance);
    RepositoryService repositoryService = processEngine.getRepositoryService();
    final ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().
      processDefinitionId(historicProcessInstance.getProcessDefinitionId()).
      singleResult();
    assertEquals(SIMPLEST_PROCESS, processDefinition.getKey());

    assertEquals(1, historicProcessInstance.getProcessVariables().size());
View Full Code Here

TOP

Related Classes of org.activiti.engine.RepositoryService

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.