public virtual void testNotNullAndNullDeploymentSourceShouldDeployNewVersion() { // given string key = "process"; string name = "my-deployment"; BpmnModelInstance model = Bpmn.createExecutableProcess(key).done(); ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().processDefinitionKey(key); DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery().deploymentName(name); // when ProcessApplicationDeployment deployment1 = repositoryService.createDeployment(processApplication.Reference).name(name).source("my-source1").addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy(); assertEquals(1, processDefinitionQuery.count()); assertEquals(1, deploymentQuery.count()); ProcessApplicationDeployment deployment2 = repositoryService.createDeployment(processApplication.Reference).name(name).source(null).addModelInstance("process.bpmn", model).enableDuplicateFiltering(true).deploy(); // then assertEquals(2, processDefinitionQuery.count()); assertEquals(2, deploymentQuery.count()); deleteDeployments(deployment1, deployment2); }
public Task <Resources <Deployment> > Latest(DeploymentQuery queryObj) { queryObj = queryObj ?? new DeploymentQuery(); queryObj.LatestDeployment = true; return(AllDeployments(queryObj)); }
public async Task <IEnumerable <Deployment> > GetDeploymentsAsync(CancellationToken cancellationToken, IDateRange <DateTimeOffset> scheduledDateRange = null, IDateRange <DateTimeOffset> completedDateRange = null) { var query = DeploymentQuery; if (scheduledDateRange == null && completedDateRange == null) { query = DeploymentQuery.Where(deployment => !deployment.Completed.HasValue); return(await query.ToArrayAsync(cancellationToken)); } if (scheduledDateRange != null) { query = DeploymentQuery.Where(deployment => deployment.Scheduled.HasValue && deployment.Scheduled >= scheduledDateRange.Start && deployment.Scheduled <= scheduledDateRange.End); } if (completedDateRange != null) { query = DeploymentQuery.Where(deployment => deployment.Completed.HasValue && deployment.Completed >= completedDateRange.Start && deployment.Completed <= completedDateRange.End); } return(await query.ToArrayAsync(cancellationToken)); }
public void AllDeployments_获取所有部署流程() { Exception ex = Record.Exception(() => { DeploymentQuery query = new DeploymentQuery(); query.TenantId = ctx.TenantId; query.Pageable = new Pageable { PageNo = 1, PageSize = 100, Sort = new Sort(new Sort.Order[] { new Sort.Order { Property = "name", Direction = Sort.Direction.ASC } }) }; Resources <Deployment> list = client.AllDeployments(query).Result; if (list.TotalCount > 0) { Assert.True(list.List.Count() <= list.TotalCount); } Assert.True(list.List.Count() <= 100); Assert.DoesNotContain(list.List, x => x.TenantId != ctx.TenantId); }); Assert.Null(ex); }
public virtual IList <DeploymentDto> getDeployments(UriInfo uriInfo, int?firstResult, int?maxResults) { DeploymentQueryDto queryDto = new DeploymentQueryDto(ObjectMapper, uriInfo.QueryParameters); ProcessEngine engine = ProcessEngine; DeploymentQuery query = queryDto.toQuery(engine); IList <Deployment> matchingDeployments; if (firstResult != null || maxResults != null) { matchingDeployments = executePaginatedQuery(query, firstResult, maxResults); } else { matchingDeployments = query.list(); } IList <DeploymentDto> deployments = new List <DeploymentDto>(); foreach (Deployment deployment in matchingDeployments) { DeploymentDto def = DeploymentDto.fromDeployment(deployment); deployments.Add(def); } return(deployments); }
public virtual void testQueryBySource() { DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentSource(org.camunda.bpm.engine.repository.ProcessApplicationDeployment_Fields.PROCESS_APPLICATION_DEPLOYMENT_SOURCE); assertEquals(1, query.list().size()); assertEquals(1, query.count()); }
public virtual void testQueryByNullSource() { DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentSource(null); assertEquals(1, query.list().size()); assertEquals(1, query.count()); }
public virtual void testQueryByInvalidSource() { DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentSource("invalid"); assertEquals(0, query.list().size()); assertEquals(0, query.count()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void dmnDeploymentWithDecisionLiteralExpression() public virtual void dmnDeploymentWithDecisionLiteralExpression() { string deploymentId = testRule.deploy(DMN_DECISION_LITERAL_EXPRESSION).Id; // there should be decision deployment DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery(); assertEquals(1, deploymentQuery.count()); // there should be one decision definition DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery(); assertEquals(1, query.count()); DecisionDefinition decisionDefinition = query.singleResult(); assertTrue(decisionDefinition.Id.StartsWith("decisionLiteralExpression:1:", StringComparison.Ordinal)); assertEquals("http://camunda.org/schema/1.0/dmn", decisionDefinition.Category); assertEquals("decisionLiteralExpression", decisionDefinition.Key); assertEquals("Decision with Literal Expression", decisionDefinition.Name); assertEquals(1, decisionDefinition.Version); assertEquals(DMN_DECISION_LITERAL_EXPRESSION, decisionDefinition.ResourceName); assertEquals(deploymentId, decisionDefinition.DeploymentId); assertNull(decisionDefinition.DiagramResourceName); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void dmnDeploymentWithDmnSuffix() public virtual void dmnDeploymentWithDmnSuffix() { string deploymentId = testRule.deploy(DMN_CHECK_ORDER_RESOURCE_DMN_SUFFIX).Id; // there should be one deployment DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery(); assertEquals(1, deploymentQuery.count()); // there should be one case definition DecisionDefinitionQuery query = repositoryService.createDecisionDefinitionQuery(); assertEquals(1, query.count()); DecisionDefinition decisionDefinition = query.singleResult(); assertTrue(decisionDefinition.Id.StartsWith("decision:1:", StringComparison.Ordinal)); assertEquals("http://camunda.org/schema/1.0/dmn", decisionDefinition.Category); assertEquals("CheckOrder", decisionDefinition.Name); assertEquals("decision", decisionDefinition.Key); assertEquals(1, decisionDefinition.Version); assertEquals(DMN_CHECK_ORDER_RESOURCE_DMN_SUFFIX, decisionDefinition.ResourceName); assertEquals(deploymentId, decisionDefinition.DeploymentId); assertNull(decisionDefinition.DiagramResourceName); }
public virtual void testQueryNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); DeploymentQuery query = repositoryService.createDeploymentQuery(); assertThat(query.count(), @is(1L)); }
public virtual void testAutoDeployTenantId() { createAppContext(CTX_TENANT_ID_PATH); DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery(); assertEquals(1, deploymentQuery.tenantIdIn("tenant1").count()); }
public virtual void testQueryByDeploymentId() { DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentId(deploymentOneId); assertNotNull(query.singleResult()); assertEquals(1, query.list().size()); assertEquals(1, query.count()); }
public virtual void testQueryByName() { DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentName("org/camunda/bpm/engine/test/repository/two_.bpmn20.xml"); assertNotNull(query.singleResult()); assertEquals(1, query.list().size()); assertEquals(1, query.count()); }
public Task <Resources <Deployment> > AllDeployments(DeploymentQuery queryObj) { IPage <Deployment> defs = new QueryDeploymentCmd().LoadPage(this.repositoryService, this.pageableRepositoryService, queryObj); Resources <Deployment> list = new Resources <Deployment>(defs.GetContent(), defs.GetTotalItems(), queryObj.Pageable.PageNo, queryObj.Pageable.PageSize); return(Task.FromResult(list)); }
public virtual void testAutoDeployWithoutTenantId() { createAppContext(CTX_CMMN_BPMN_TOGETHER_PATH); DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery(); assertEquals(1, deploymentQuery.withoutTenantId().count()); }
/// <seealso cref= https://app.camunda.com/jira/browse/CAM-2128 </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void testDuplicateFiltering() throws InterruptedException public virtual void testDuplicateFiltering() { deployOnTwoConcurrentThreads(createDeploymentBuilder().enableDuplicateFiltering(false), createDeploymentBuilder().enableDuplicateFiltering(false)); // ensure that although both transactions were run concurrently, only one deployment was constructed. DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery(); assertThat(deploymentQuery.count(), @is(1L)); }
private DeploymentQuery setUpMockDeploymentQuery(IList <Deployment> mockedDeployments) { DeploymentQuery sampleDeploymentQuery = mock(typeof(DeploymentQuery)); when(sampleDeploymentQuery.list()).thenReturn(mockedDeployments); when(sampleDeploymentQuery.count()).thenReturn((long)mockedDeployments.Count); when(processEngine.RepositoryService.createDeploymentQuery()).thenReturn(sampleDeploymentQuery); return(sampleDeploymentQuery); }
public virtual void testQueryDisabledTenantCheck() { processEngineConfiguration.TenantCheckEnabled = false; identityService.setAuthentication("user", null, null); DeploymentQuery query = repositoryService.createDeploymentQuery(); assertThat(query.count(), @is(3L)); }
public virtual void testQueryByTenantId() { DeploymentQuery query = repositoryService.createDeploymentQuery().tenantIdIn(TENANT_ONE); assertThat(query.count(), @is(1L)); query = repositoryService.createDeploymentQuery().tenantIdIn(TENANT_TWO); assertThat(query.count(), @is(1L)); }
private void createDeploymentMock() { Deployment mockDeployment = MockProvider.createMockDeployment(); DeploymentQuery deploymentQueryMock = mock(typeof(DeploymentQuery)); when(deploymentQueryMock.deploymentId(anyString())).thenReturn(deploymentQueryMock); when(deploymentQueryMock.singleResult()).thenReturn(mockDeployment); when(mockRepoService.createDeploymentQuery()).thenReturn(deploymentQueryMock); }
public virtual void testQueryAuthenticatedTenants() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE, TENANT_TWO)); DeploymentQuery query = repositoryService.createDeploymentQuery(); assertThat(query.count(), @is(3L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L)); assertThat(query.tenantIdIn(TENANT_TWO).count(), @is(1L)); assertThat(query.withoutTenantId().count(), @is(1L)); }
private IList <Deployment> executePaginatedQuery(DeploymentQuery query, int?firstResult, int?maxResults) { if (firstResult == null) { firstResult = 0; } if (maxResults == null) { maxResults = int.MaxValue; } return(query.listPage(firstResult, maxResults)); }
// query //////////////////////////////////////////////////////////// public virtual void testSimpleDeploymentQueryWithoutAuthorization() { // given string deploymentId = createDeployment(null); // when DeploymentQuery query = repositoryService.createDeploymentQuery(); // then verifyQueryResults(query, 0); deleteDeployment(deploymentId); }
public virtual CountResultDto getDeploymentsCount(UriInfo uriInfo) { DeploymentQueryDto queryDto = new DeploymentQueryDto(ObjectMapper, uriInfo.QueryParameters); ProcessEngine engine = ProcessEngine; DeploymentQuery query = queryDto.toQuery(engine); long count = query.count(); CountResultDto result = new CountResultDto(); result.Count = count; return(result); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void createDeploymentWithAuthenticatedTenant() public virtual void createDeploymentWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); repositoryService.createDeployment().addModelInstance("emptyProcess.bpmn", emptyProcess).tenantId(TENANT_ONE).deploy(); identityService.clearAuthentication(); DeploymentQuery query = repositoryService.createDeploymentQuery(); assertThat(query.count(), @is(1L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(1L)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void redeployForTheSameAuthenticatedTenant() public virtual void redeployForTheSameAuthenticatedTenant() { Deployment deploymentOne = repositoryService.createDeployment().addModelInstance("emptyProcess.bpmn", emptyProcess).addModelInstance("startEndProcess.bpmn", startEndProcess).tenantId(TENANT_ONE).deploy(); identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); repositoryService.createDeployment().addDeploymentResources(deploymentOne.Id).tenantId(TENANT_ONE).deploy(); DeploymentQuery query = repositoryService.createDeploymentQuery(); assertThat(query.count(), @is(2L)); assertThat(query.tenantIdIn(TENANT_ONE).count(), @is(2L)); }
/// <summary> /// 读取分页记录 /// </summary> /// <param name="repositoryService">仓储服务</param> /// <param name="pageableRepositoryService">分页仓储服务</param> /// <param name="qo">查询对象</param> /// <returns></returns> public IPage <Deployment> LoadPage(IRepositoryService repositoryService, PageableDeploymentRespositoryService pageableRepositoryService, DeploymentQuery qo) { DeploymentQueryImpl query = repositoryService.CreateDeploymentQuery() as DeploymentQueryImpl; FastCopy.Copy <DeploymentQuery, DeploymentQueryImpl>(qo, query); pageableRepositoryService.SortApplier.ApplySort(query, qo.Pageable); IPage <Deployment> defs = pageableRepositoryService.PageRetriever.LoadPage(query, qo.Pageable, pageableRepositoryService.DeploymentConverter); return(defs); }
private static async Task PrintAllDeployments() { DeploymentQuery query = new DeploymentQuery() { IncludeDeploymentsWithoutTenantId = true }; var deployments = await _client.Deployments.Query(query).List(); foreach (var d in deployments) { Console.WriteLine($"{d.Id} {d.Name} { d.DeploymentTime}"); } }
public virtual void testOverwriteDeploymentSource() { string key = "process"; BpmnModelInstance model = Bpmn.createExecutableProcess(key).done(); DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery(); Deployment deployment = repositoryService.createDeployment(processApplication.Reference).name("first-deployment-with-a-source").source("my-source").addModelInstance("process.bpmn", model).deploy(); assertEquals("my-source", deploymentQuery.deploymentName("first-deployment-with-a-source").singleResult().Source); deleteDeployments(deployment); }