Search in sources :

Example 21 with Deployment

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

the class SimpleSimulationRunTest method step0Check.

private void step0Check(RepositoryService repositoryService) {
    Deployment deployment;
    deployment = repositoryService.createDeploymentQuery().singleResult();
    assertNotNull(deployment);
}
Also used : Deployment(org.activiti.engine.repository.Deployment)

Example 22 with Deployment

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

the class DeploymentCacheLimitTest method testDeploymentCacheLimit.

public void testDeploymentCacheLimit() {
    // This is set in the configuration above
    int processDefinitionCacheLimit = 3;
    DefaultDeploymentCache<ProcessDefinitionEntity> processDefinitionCache = (DefaultDeploymentCache<ProcessDefinitionEntity>) processEngineConfiguration.getProcessDefinitionCache();
    assertEquals(0, processDefinitionCache.size());
    String processDefinitionTemplate = DeploymentCacheTestUtil.readTemplateFile("/org/activiti/standalone/deploy/deploymentCacheTest.bpmn20.xml");
    for (int i = 1; i <= 5; i++) {
        repositoryService.createDeployment().addString("Process " + i + ".bpmn20.xml", MessageFormat.format(processDefinitionTemplate, i)).deploy();
        if (i < processDefinitionCacheLimit) {
            assertEquals(i, processDefinitionCache.size());
        } else {
            assertEquals(processDefinitionCacheLimit, processDefinitionCache.size());
        }
    }
    // Cleanup
    for (Deployment deployment : repositoryService.createDeploymentQuery().list()) {
        repositoryService.deleteDeployment(deployment.getId(), true);
    }
}
Also used : DefaultDeploymentCache(org.activiti.engine.impl.persistence.deploy.DefaultDeploymentCache) Deployment(org.activiti.engine.repository.Deployment) ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 23 with Deployment

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

the class CustomDeploymentCacheTest method testCustomDeploymentCacheUsed.

public void testCustomDeploymentCacheUsed() {
    CustomDeploymentCache customCache = (CustomDeploymentCache) processEngineConfiguration.getProcessDefinitionCache();
    assertNull(customCache.getCachedProcessDefinition());
    String processDefinitionTemplate = DeploymentCacheTestUtil.readTemplateFile("/org/activiti/standalone/deploy/deploymentCacheTest.bpmn20.xml");
    for (int i = 1; i <= 5; i++) {
        repositoryService.createDeployment().addString("Process " + i + ".bpmn20.xml", MessageFormat.format(processDefinitionTemplate, i)).deploy();
        assertNotNull(customCache.getCachedProcessDefinition());
    }
    // Cleanup
    for (Deployment deployment : repositoryService.createDeploymentQuery().list()) {
        repositoryService.deleteDeployment(deployment.getId(), true);
    }
}
Also used : Deployment(org.activiti.engine.repository.Deployment)

Example 24 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 25 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)

Aggregations

Deployment (org.activiti.engine.repository.Deployment)66 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)12 BpmnModel (org.activiti.bpmn.model.BpmnModel)10 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)10 JsonNode (com.fasterxml.jackson.databind.JsonNode)8 ByteArrayInputStream (java.io.ByteArrayInputStream)8 ActivitiException (org.activiti.engine.ActivitiException)7 ProcessDefinition (org.activiti.engine.repository.ProcessDefinition)6 HttpGet (org.apache.http.client.methods.HttpGet)6 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 InputStream (java.io.InputStream)3 HashSet (java.util.HashSet)3 BpmnXMLConverter (org.activiti.bpmn.converter.BpmnXMLConverter)3 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)3 ProcessEngine (org.activiti.engine.ProcessEngine)3 RuntimeService (org.activiti.engine.RuntimeService)3 DeploymentBuilder (org.activiti.engine.repository.DeploymentBuilder)3 Task (org.activiti.engine.task.Task)3