/** * Deletes the deployments cascading. */ private void deleteDeployments(Deployment... deployments){ for (Deployment deployment : deployments) { repositoryService.deleteDeployment(deployment.getId(), true); } }
private void deleteDeployments(List<org.camunda.bpm.engine.repository.Deployment> deploymentList) { for (org.camunda.bpm.engine.repository.Deployment deployment : deploymentList) { repositoryService.deleteDeployment(deployment.getId()); } }
@Override public void setUp() throws Exception { deploymentId = createDeployment(null, "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml", "org/camunda/bpm/engine/test/api/authorization/messageStartEventProcess.bpmn20.xml").getId(); super.setUp(); }
@After public void cleanUp() { if (deployment != null) { repositoryService.deleteDeployment(deployment.getId(), true); deployment = null; } }
protected void deployProcess(BpmnModelInstance process) { Deployment deployment = repositoryService.createDeployment() .addModelInstance("testProcess.bpmn", process) .deploy(); deploymentIds.add(deployment.getId()); }
public AuthorizationEntity[] newDeployment(Deployment deployment) { ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); IdentityService identityService = processEngineConfiguration.getIdentityService(); Authentication currentAuthentication = identityService.getCurrentAuthentication(); if (currentAuthentication != null && currentAuthentication.getUserId() != null) { String userId = currentAuthentication.getUserId(); String deploymentId = deployment.getId(); AuthorizationEntity authorization = createGrantAuthorization(userId, null, DEPLOYMENT, deploymentId, READ, DELETE); return new AuthorizationEntity[]{ authorization }; } return null; }
@Test public void getDeploymentResourceNamesWithAuthenticatedTenant() { Deployment deployment = testRule.deployForTenant(TENANT_ONE, emptyProcess); identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); List<String> deploymentResourceNames = repositoryService.getDeploymentResourceNames(deployment.getId()); assertThat(deploymentResourceNames, hasSize(1)); }
@Test public void getDeploymentResourcesWithAuthenticatedTenant() { Deployment deployment = testRule.deployForTenant(TENANT_ONE, emptyProcess); identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); List<Resource> deploymentResources = repositoryService.getDeploymentResources(deployment.getId()); assertThat(deploymentResources, hasSize(1)); }
@Test public void failToGetResourceAsStreamNoAuthenticatedTenant() { Deployment deployment = testRule.deployForTenant(TENANT_ONE, emptyProcess); Resource resource = repositoryService.getDeploymentResources(deployment.getId()).get(0); identityService.setAuthentication("user", null, null); // declare expected exception thrown.expect(ProcessEngineException.class); thrown.expectMessage("Cannot get the deployment"); repositoryService.getResourceAsStream(deployment.getId(), resource.getName()); }
protected void tearDown() throws Exception { for (org.camunda.bpm.engine.repository.Deployment deployment : repositoryService.createDeploymentQuery().list()) { repositoryService.deleteDeployment(deployment.getId(), true); } super.tearDown(); }
protected ProcessInstance deployAndStartProcess(BpmnModelInstance bpmnModelInstance, Map<String, Object> variablesMap) { deploymentId = repositoryService.createDeployment() .addModelInstance("process.bpmn", bpmnModelInstance) .deploy().getId(); String processDefinitionKey = bpmnModelInstance.getDefinitions().getRootElements().iterator().next().getId(); return runtimeService.startProcessInstanceByKey(processDefinitionKey, variablesMap); }
public void testQueryByDeploymentId() { String deploymentId = repositoryService .createDeploymentQuery() .singleResult() .getId(); CaseInstanceQuery query = caseService .createCaseInstanceQuery() .deploymentId(deploymentId); verifyQueryResults(query, 5); }
public void testEmptyCamundaOutSourceWithoutValidation() { try { processEngineConfiguration.setDisableStrictCallActivityValidation(true); String resource = TestHelper.getBpmnProcessDefinitionResource(getClass(), "testEmptyCamundaOutSourceThrowsError"); repositoryService.createDeployment().name(resource).addClasspathResource(resource).deploy(); } finally { processEngineConfiguration.setDisableStrictCallActivityValidation(false); repositoryService.deleteDeployment(repositoryService.createDeploymentQuery().singleResult().getId(), true); } }
@Before public void setup() { repositoryService = activitiRule.getRepositoryService(); deploymentId = repositoryService.createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/api/repository/diagram/" + xmlFileName) .addClasspathResource("org/camunda/bpm/engine/test/api/repository/diagram/" + imageFileName) .deploy() .getId(); processDefinitionQuery = repositoryService.createProcessDefinitionQuery(); }
public void testTimerStartEventPriorityOnActivity() { // given a timer start job org.camunda.bpm.engine.repository.Deployment deployment = repositoryService .createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/bpmn/job/JobPrioritizationBpmnConstantValueTest.testTimerStartEventPriorityOnActivity.bpmn20.xml") .deploy(); Job job = managementService.createJobQuery().singleResult(); // then the timer start job has the priority defined in the process definition assertEquals(1515, job.getPriority()); // cleanup repositoryService.deleteDeployment(deployment.getId(), true); }
public void testDeployAppWithResources() { registerProcessEngine(); TestApplicationWithResources processApplication = new TestApplicationWithResources(); processApplication.deploy(); Deployment deployment = repositoryService.createDeploymentQuery().singleResult(); assertNotNull(deployment); List<Resource> deploymentResources = repositoryService.getDeploymentResources(deployment.getId()); assertEquals(4, deploymentResources.size()); processApplication.undeploy(); assertEquals(0, repositoryService.createDeploymentQuery().count()); }
private void verifyStandardDeploymentValues(Deployment mockDeployment, JsonPath path) { String returnedId = path.get("id"); String returnedName = path.get("name"); Date returnedDeploymentTime = DateTimeUtil.parseDate(path.<String>get("deploymentTime")); assertEquals(mockDeployment.getId(), returnedId); assertEquals(mockDeployment.getName(), returnedName); assertEquals(mockDeployment.getDeploymentTime(), returnedDeploymentTime); }
public void testParseSwitchedSourceAndTargetRefsForAssociations() { repositoryService.createDeployment() .addClasspathResource("org/camunda/bpm/engine/test/bpmn/parse/BpmnParseTest.testParseSwitchedSourceAndTargetRefsForAssociations.bpmn20.xml").deploy(); assertEquals(1, repositoryService.createProcessDefinitionQuery().count()); repositoryService.deleteDeployment(repositoryService.createDeploymentQuery().singleResult().getId(), true); }
@Override @Before public void deployProcesses() { Deployment deploy = testHelper.deploy(DEFINITION_XML); sourceDefinition = engineRule.getRepositoryService() .createProcessDefinitionQuery().deploymentId(deploy.getId()).singleResult(); processInstance = engineRule.getRuntimeService().startProcessInstanceById(sourceDefinition.getId()); processInstance2 = engineRule.getRuntimeService().startProcessInstanceById(sourceDefinition.getId()); }