//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testDeployAndGetCaseDefinition() throws Exception public virtual void testDeployAndGetCaseDefinition() { // given case model //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.cmmn.CmmnModelInstance modelInstance = createCmmnModelInstance(); CmmnModelInstance modelInstance = createCmmnModelInstance(); // when case model is deployed DeploymentWithDefinitions deployment = repositoryService.createDeployment().addModelInstance("foo.cmmn", modelInstance).deployWithResult(); deploymentIds.Add(deployment.Id); // then deployment contains deployed case definition IList <CaseDefinition> deployedCaseDefinitions = deployment.DeployedCaseDefinitions; assertEquals(1, deployedCaseDefinitions.Count); assertNull(deployment.DeployedProcessDefinitions); assertNull(deployment.DeployedDecisionDefinitions); assertNull(deployment.DeployedDecisionRequirementsDefinitions); // and persisted case definition is equal to deployed case definition CaseDefinition persistedCaseDefinition = repositoryService.createCaseDefinitionQuery().caseDefinitionResourceName("foo.cmmn").singleResult(); assertEquals(persistedCaseDefinition.Id, deployedCaseDefinitions[0].Id); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testDeployAndGetProcessDefinition() throws Exception public virtual void testDeployAndGetProcessDefinition() { // given process model //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance modelInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess("foo").startEvent().userTask().endEvent().done(); BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("foo").startEvent().userTask().endEvent().done(); // when process model is deployed DeploymentWithDefinitions deployment = repositoryService.createDeployment().addModelInstance("foo.bpmn", modelInstance).deployWithResult(); deploymentIds.Add(deployment.Id); // then deployment contains deployed process definitions IList <ProcessDefinition> deployedProcessDefinitions = deployment.DeployedProcessDefinitions; assertEquals(1, deployedProcessDefinitions.Count); assertNull(deployment.DeployedCaseDefinitions); assertNull(deployment.DeployedDecisionDefinitions); assertNull(deployment.DeployedDecisionRequirementsDefinitions); // and persisted process definition is equal to deployed process definition ProcessDefinition persistedProcDef = repositoryService.createProcessDefinitionQuery().processDefinitionResourceName("foo.bpmn").singleResult(); assertEquals(persistedProcDef.Id, deployedProcessDefinitions[0].Id); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testStartInstanceAfterDeleteLatestProcessVersionByIds() public virtual void testStartInstanceAfterDeleteLatestProcessVersionByIds() { // given a deployed process testRule.deploy(SINGLE_MESSAGE_START_EVENT_XML); // deploy second version of the process DeploymentWithDefinitions deployment = testRule.deploy(SINGLE_MESSAGE_START_EVENT_XML); ProcessDefinition processDefinition = deployment.DeployedProcessDefinitions[0]; // delete it repositoryService.deleteProcessDefinitions().byIds(processDefinition.Id).delete(); // when ProcessInstance processInstance = runtimeService.startProcessInstanceByMessage("newInvoiceMessage"); // then assertFalse(processInstance.Ended); Task task = taskService.createTaskQuery().singleResult(); assertNotNull(task); taskService.complete(task.Id); ProcessInstance completedInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.Id).singleResult(); if (completedInstance != null) { throw new AssertionFailedError("Expected finished process instance '" + completedInstance + "' but it was still in the db"); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeployAndGetDRDDefinition() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testDeployAndGetDRDDefinition() { // when decision requirement graph is deployed DeploymentWithDefinitions deployment = testRule.deploy(DRD_SCORE_RESOURCE); // then deployment contains definitions IList <DecisionDefinition> deployedDecisionDefinitions = deployment.DeployedDecisionDefinitions; assertEquals(2, deployedDecisionDefinitions.Count); IList <DecisionRequirementsDefinition> deployedDecisionRequirementsDefinitions = deployment.DeployedDecisionRequirementsDefinitions; assertEquals(1, deployedDecisionRequirementsDefinitions.Count); assertNull(deployment.DeployedProcessDefinitions); assertNull(deployment.DeployedCaseDefinitions); // and persisted definitions are equal to deployed definitions DecisionRequirementsDefinition persistedDecisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().decisionRequirementsDefinitionResourceName(DRD_SCORE_RESOURCE).singleResult(); assertEquals(persistedDecisionRequirementsDefinition.Id, deployedDecisionRequirementsDefinitions[0].Id); IList <DecisionDefinition> persistedDecisionDefinitions = repositoryService.createDecisionDefinitionQuery().decisionDefinitionResourceName(DRD_SCORE_RESOURCE).list(); assertEquals(deployedDecisionDefinitions.Count, persistedDecisionDefinitions.Count); }
public virtual DeploymentDto redeploy(UriInfo uriInfo, RedeploymentDto redeployment) { DeploymentWithDefinitions deployment = null; try { deployment = tryToRedeploy(redeployment); } catch (NotFoundException e) { throw createInvalidRequestException("redeploy", Status.NOT_FOUND, e); } catch (NotValidException e) { throw createInvalidRequestException("redeploy", Status.BAD_REQUEST, e); } DeploymentWithDefinitionsDto deploymentDto = DeploymentWithDefinitionsDto.fromDeployment(deployment); URI uri = uriInfo.BaseUriBuilder.path(relativeRootResourcePath).path(org.camunda.bpm.engine.rest.DeploymentRestService_Fields.PATH).path(deployment.Id).build(); // GET / deploymentDto.addReflexiveLink(uri, HttpMethod.GET, "self"); return(deploymentDto); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDifferentStates() public virtual void testDifferentStates() { DeploymentWithDefinitions deployment = testRule.deploy(instance); ProcessDefinition definition = deployment.DeployedProcessDefinitions[0]; IList <string> processInstanceIds = helper.startInstances("process1", 1); Task task = rule.TaskService.createTaskQuery().singleResult(); rule.TaskService.complete(task.Id); IList <string> anotherProcessInstanceIds = helper.startInstances("process1", 1); ((IList <string>)processInstanceIds).AddRange(anotherProcessInstanceIds); runtimeService.createModification(definition.Id).startBeforeActivity("user3").processInstanceIds(processInstanceIds).execute(); ActivityInstance updatedTree = null; string processInstanceId = processInstanceIds[0]; updatedTree = runtimeService.getActivityInstance(processInstanceId); assertNotNull(updatedTree); assertEquals(processInstanceId, updatedTree.ProcessInstanceId); assertThat(updatedTree).hasStructure(describeActivityInstanceTree(definition.Id).activity("user2").activity("user3").done()); processInstanceId = processInstanceIds[1]; updatedTree = runtimeService.getActivityInstance(processInstanceId); assertNotNull(updatedTree); assertEquals(processInstanceId, updatedTree.ProcessInstanceId); assertThat(updatedTree).hasStructure(describeActivityInstanceTree(definition.Id).activity("user1").activity("user3").done()); }
public virtual DeploymentWithDefinitions deploy(DeploymentBuilder deploymentBuilder) { DeploymentWithDefinitions deployment = deploymentBuilder.deployWithResult(); processEngineRule.manageDeployment(deployment); return(deployment); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeployDecisionDefinitionWithEmptyHistoryTimeToLive() public virtual void testDeployDecisionDefinitionWithEmptyHistoryTimeToLive() { DeploymentWithDefinitions deployment = testRule.deploy("org/camunda/bpm/engine/test/dmn/deployment/DecisionDefinitionDeployerTest.testDecisionDefinitionWithEmptyHistoryTimeToLive.dmn11.xml"); // then IList <DecisionDefinition> deployedDecisionDefinitions = deployment.DeployedDecisionDefinitions; assertEquals(deployedDecisionDefinitions.Count, 1); int?historyTimeToLive = deployedDecisionDefinitions[0].HistoryTimeToLive; assertNull(historyTimeToLive); }
public static DeploymentWithDefinitionsDto fromDeployment(DeploymentWithDefinitions deployment) { DeploymentWithDefinitionsDto dto = new DeploymentWithDefinitionsDto(); dto.id = deployment.Id; dto.name = deployment.Name; dto.source = deployment.Source; dto.deploymentTime = deployment.DeploymentTime; dto.tenantId = deployment.TenantId; initDeployedResourceLists(deployment, dto); return(dto); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPointToItselfBySubmittingStartForm() public virtual void shouldPointToItselfBySubmittingStartForm() { // given DeploymentWithDefinitions deployment = testRule.deploy(CALLED_PROCESS); string processDefinitionId = deployment.DeployedProcessDefinitions[0].Id; IDictionary <string, object> properties = new Dictionary <string, object>(); // when ProcessInstance processInstance = formService.submitStartForm(processDefinitionId, properties); // assume assertThat(processInstance.RootProcessInstanceId, notNullValue()); // then assertThat(processInstance.RootProcessInstanceId, @is(processInstance.ProcessInstanceId)); }
private static void initDeployedResourceLists(DeploymentWithDefinitions deployment, DeploymentWithDefinitionsDto dto) { IList <ProcessDefinition> deployedProcessDefinitions = deployment.DeployedProcessDefinitions; if (deployedProcessDefinitions != null) { dto.deployedProcessDefinitions = new Dictionary <string, ProcessDefinitionDto>(); foreach (ProcessDefinition processDefinition in deployedProcessDefinitions) { dto.deployedProcessDefinitions[processDefinition.Id] = ProcessDefinitionDto.fromProcessDefinition(processDefinition); } } IList <CaseDefinition> deployedCaseDefinitions = deployment.DeployedCaseDefinitions; if (deployedCaseDefinitions != null) { dto.deployedCaseDefinitions = new Dictionary <string, CaseDefinitionDto>(); foreach (CaseDefinition caseDefinition in deployedCaseDefinitions) { dto.deployedCaseDefinitions[caseDefinition.Id] = CaseDefinitionDto.fromCaseDefinition(caseDefinition); } } IList <DecisionDefinition> deployedDecisionDefinitions = deployment.DeployedDecisionDefinitions; if (deployedDecisionDefinitions != null) { dto.deployedDecisionDefinitions = new Dictionary <string, DecisionDefinitionDto>(); foreach (DecisionDefinition decisionDefinition in deployedDecisionDefinitions) { dto.deployedDecisionDefinitions[decisionDefinition.Id] = DecisionDefinitionDto.fromDecisionDefinition(decisionDefinition); } } IList <DecisionRequirementsDefinition> deployedDecisionRequirementsDefinitions = deployment.DeployedDecisionRequirementsDefinitions; if (deployedDecisionRequirementsDefinitions != null) { dto.deployedDecisionRequirementsDefinitions = new Dictionary <string, DecisionRequirementsDefinitionDto>(); foreach (DecisionRequirementsDefinition drd in deployedDecisionRequirementsDefinitions) { dto.deployedDecisionRequirementsDefinitions[drd.Id] = DecisionRequirementsDefinitionDto.fromDecisionRequirementsDefinition(drd); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testDeployNonExecutableProcess() throws Exception public virtual void testDeployNonExecutableProcess() { // given non executable process definition //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance modelInstance = org.camunda.bpm.model.bpmn.Bpmn.createProcess("foo").startEvent().userTask().endEvent().done(); BpmnModelInstance modelInstance = Bpmn.createProcess("foo").startEvent().userTask().endEvent().done(); // when process model is deployed DeploymentWithDefinitions deployment = repositoryService.createDeployment().addModelInstance("foo.bpmn", modelInstance).deployWithResult(); deploymentIds.Add(deployment.Id); // then deployment contains no deployed process definition assertNull(deployment.DeployedProcessDefinitions); // and there exist no persisted process definitions assertNull(repositoryService.createProcessDefinitionQuery().processDefinitionResourceName("foo.bpmn").singleResult()); }
public virtual void testStartInstanceAfterDeleteLatestProcessVersionByIds() { // given a deployed process // deploy second version of the process DeploymentWithDefinitions deployment = testRule.deploy(SINGLE_CONDITIONAL_XML); ProcessDefinition processDefinition = deployment.DeployedProcessDefinitions[0]; // delete it repositoryService.deleteProcessDefinitions().byIds(processDefinition.Id).delete(); // when IList <ProcessInstance> conditionInstances = runtimeService.createConditionEvaluation().setVariable("foo", 1).evaluateStartConditions(); // then assertEquals(1, conditionInstances.Count); assertNotNull(conditionInstances[0]); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void createModificationWithNotMatchingProcessDefinitionId() public virtual void createModificationWithNotMatchingProcessDefinitionId() { DeploymentWithDefinitions deployment = testRule.deploy(instance); deployment.DeployedProcessDefinitions[0]; IList <string> processInstanceIds = helper.startInstances("process1", 2); try { runtimeService.createModification("foo").cancelAllForActivity("activityId").processInstanceIds(processInstanceIds).execute(); fail("Should not succed"); } catch (ProcessEngineException e) { assertThat(e.Message, containsString("processDefinition is null")); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testStartBeforeAndCancelAll() public virtual void testStartBeforeAndCancelAll() { DeploymentWithDefinitions deployment = testRule.deploy(instance); ProcessDefinition definition = deployment.DeployedProcessDefinitions[0]; IList <string> processInstanceIds = helper.startInstances("process1", 2); runtimeService.createModification(definition.Id).cancelAllForActivity("user1").startBeforeActivity("user2").processInstanceIds(processInstanceIds).execute(); foreach (string processInstanceId in processInstanceIds) { ActivityInstance updatedTree = runtimeService.getActivityInstance(processInstanceId); assertNotNull(updatedTree); assertEquals(processInstanceId, updatedTree.ProcessInstanceId); assertThat(updatedTree).hasStructure(describeActivityInstanceTree(definition.Id).activity("user2").done()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeployAndGetDecisionDefinition() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testDeployAndGetDecisionDefinition() { // given decision model DmnModelInstance dmnModelInstance = createDmnModelInstance(); // when decision model is deployed DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().addModelInstance("foo.dmn", dmnModelInstance); DeploymentWithDefinitions deployment = testRule.deploy(deploymentBuilder); // then deployment contains definition IList <DecisionDefinition> deployedDecisionDefinitions = deployment.DeployedDecisionDefinitions; assertEquals(1, deployedDecisionDefinitions.Count); assertNull(deployment.DeployedDecisionRequirementsDefinitions); assertNull(deployment.DeployedProcessDefinitions); assertNull(deployment.DeployedCaseDefinitions); // and persisted definition are equal to deployed definition DecisionDefinition persistedDecisionDef = repositoryService.createDecisionDefinitionQuery().decisionDefinitionResourceName("foo.dmn").singleResult(); assertEquals(persistedDecisionDef.Id, deployedDecisionDefinitions[0].Id); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testDeployEmptyCaseDefinition() throws Exception public virtual void testDeployEmptyCaseDefinition() { // given empty case model //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.cmmn.CmmnModelInstance modelInstance = org.camunda.bpm.model.cmmn.Cmmn.createEmptyModel(); CmmnModelInstance modelInstance = Cmmn.createEmptyModel(); org.camunda.bpm.model.cmmn.instance.Definitions definitions = modelInstance.newInstance(typeof(org.camunda.bpm.model.cmmn.instance.Definitions)); definitions.TargetNamespace = "http://camunda.org/examples"; modelInstance.Definitions = definitions; // when case model is deployed DeploymentWithDefinitions deployment = repositoryService.createDeployment().addModelInstance("foo.cmmn", modelInstance).deployWithResult(); deploymentIds.Add(deployment.Id); // then no case definition is deployed assertNull(deployment.DeployedCaseDefinitions); // and there exist not persisted case definition assertNull(repositoryService.createCaseDefinitionQuery().caseDefinitionResourceName("foo.cmmn").singleResult()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeployEmptyDecisionDefinition() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: public virtual void testDeployEmptyDecisionDefinition() { // given empty decision model DmnModelInstance modelInstance = Dmn.createEmptyModel(); Definitions definitions = modelInstance.newInstance(typeof(Definitions)); definitions.Id = DmnModelConstants.DMN_ELEMENT_DEFINITIONS; definitions.Name = DmnModelConstants.DMN_ELEMENT_DEFINITIONS; definitions.Namespace = DmnModelConstants.CAMUNDA_NS; modelInstance.Definitions = definitions; // when decision model is deployed DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().addModelInstance("foo.dmn", modelInstance); DeploymentWithDefinitions deployment = testRule.deploy(deploymentBuilder); // then deployment contains no definitions assertNull(deployment.DeployedDecisionDefinitions); assertNull(deployment.DeployedDecisionRequirementsDefinitions); // and there are no persisted definitions assertNull(repositoryService.createDecisionDefinitionQuery().decisionDefinitionResourceName("foo.dmn").singleResult()); }
public virtual DeploymentWithDefinitionsDto createDeployment(UriInfo uriInfo, MultipartFormData payload) { DeploymentBuilder deploymentBuilder = extractDeploymentInformation(payload); if (deploymentBuilder.ResourceNames.Count > 0) { DeploymentWithDefinitions deployment = deploymentBuilder.deployWithResult(); DeploymentWithDefinitionsDto deploymentDto = DeploymentWithDefinitionsDto.fromDeployment(deployment); URI uri = uriInfo.BaseUriBuilder.path(relativeRootResourcePath).path(org.camunda.bpm.engine.rest.DeploymentRestService_Fields.PATH).path(deployment.Id).build(); // GET deploymentDto.addReflexiveLink(uri, HttpMethod.GET, "self"); return(deploymentDto); } else { throw new InvalidRequestException(Status.BAD_REQUEST, "No deployment resources contained in the form upload."); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testThrowErrorOnDeleteAndCatchOnUserTaskShouldNotTriggerPropagation() public virtual void testThrowErrorOnDeleteAndCatchOnUserTaskShouldNotTriggerPropagation() { // given BpmnModelInstance model = createModelThrowErrorInListenerAndCatchOnUserTask([email protected]_Fields.EVENTNAME_DELETE); DeploymentWithDefinitions deployment = testRule.deploy(model); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process"); // when try { runtimeService.deleteProcessInstance(processInstance.Id, "invoke delete listener"); } catch (Exception e) { // then assertTrue(e.Message.contains("business error")); assertEquals(1, ThrowBPMNErrorListener.INVOCATIONS); assertEquals(0, DeleteListener.INVOCATIONS); } // cleanup engineRule.RepositoryService.deleteDeployment(deployment.Id, true, true); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testDeleteHistoricIncidentByProcDefId() public virtual void testDeleteHistoricIncidentByProcDefId() { // given deployment = repositoryService.createDeployment().addModelInstance("process.bpmn", FAILING_SERVICE_TASK_MODEL).deployWithResult(); string processDefinitionId = deployment.DeployedProcessDefinitions[0].Id; runtimeService.startProcessInstanceById(processDefinitionId); executeAvailableJobs(); if (eventTypes != null) { HistoricIncident historicIncident = historyService.createHistoricIncidentQuery().singleResult(); assertNotNull(historicIncident); } // when repositoryService.deleteProcessDefinitions().byKey(PROCESS_DEFINITION_KEY).cascade().delete(); // then IList <HistoricIncident> incidents = historyService.createHistoricIncidentQuery().list(); assertEquals(0, incidents.Count); }
public ProcessApplicationDeploymentImpl(DeploymentWithDefinitions deployment, ProcessApplicationRegistration registration) { this.deployment = deployment; this.registration = registration; }