Tabnine Logo
DeploymentQuery
Code IndexAdd Tabnine to your IDE (free)

How to use
DeploymentQuery
in
org.camunda.bpm.engine.repository

Best Java code snippets using org.camunda.bpm.engine.repository.DeploymentQuery (Showing top 20 results out of 315)

origin: camunda/camunda-bpm-platform

public 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());
}
origin: camunda/camunda-bpm-platform

query.deploymentId(id);
query.deploymentName(name);
query.deploymentNameLike(nameLike);
query.deploymentSource(null);
query.deploymentSource(source);
query.deploymentBefore(before);
query.deploymentAfter(after);
query.tenantIdIn(tenantIds.toArray(new String[tenantIds.size()]));
query.withoutTenantId();
query.includeDeploymentsWithoutTenantId();
origin: camunda/camunda-bpm-platform

public DeploymentDto getDeployment() {
 RepositoryService repositoryService = getProcessEngine().getRepositoryService();
 Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
 if (deployment == null) {
  throw new InvalidRequestException(Status.NOT_FOUND, "Deployment with id '" + deploymentId + "' does not exist");
 }
 return DeploymentDto.fromDeployment(deployment);
}
origin: camunda/camunda-bpm-platform

public void testQueryAuthenticatedTenant() {
 identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
 DeploymentQuery query = repositoryService.createDeploymentQuery();
 assertThat(query.count(), is(2L));
 assertThat(query.tenantIdIn(TENANT_ONE).count(), is(1L));
 assertThat(query.tenantIdIn(TENANT_TWO).count(), is(0L));
 assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeDeploymentsWithoutTenantId().count(), is(2L));
}
origin: camunda/camunda-bpm-platform

public void testQueryByInvalidNameLike() {
 DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentNameLike("invalid");
 assertNull(query.singleResult());
 assertEquals(0, query.list().size());
 assertEquals(0, query.count());
 try {
  repositoryService.createDeploymentQuery().deploymentNameLike(null);
  fail();
 } catch (ProcessEngineException e) {}
}
origin: camunda/camunda-bpm-platform

public void testQueryBySource() {
 DeploymentQuery query = repositoryService
   .createDeploymentQuery()
   .deploymentSource(ProcessApplicationDeployment.PROCESS_APPLICATION_DEPLOYMENT_SOURCE);
 assertEquals(1, query.list().size());
 assertEquals(1, query.count());
}
origin: camunda/camunda-bpm-platform

@Test
public void testAdditionalParameters() {
 Map<String, String> queryParameters = getCompleteQueryParameters();
 given().queryParams(queryParameters)
  .expect().statusCode(Status.OK.getStatusCode())
  .when().get(DEPLOYMENT_QUERY_URL);
 // assert query invocation
 verify(mockedQuery).deploymentName(queryParameters.get("name"));
 verify(mockedQuery).deploymentNameLike(queryParameters.get("nameLike"));
 verify(mockedQuery).deploymentId(queryParameters.get("id"));
 verify(mockedQuery).deploymentSource(queryParameters.get("source"));
 verify(mockedQuery).list();
}
origin: camunda/camunda-bpm-platform

public void testQueryByDeploymentId() {
 DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentId(deploymentOneId);
 assertNotNull(query.singleResult());
 assertEquals(1, query.list().size());
 assertEquals(1, query.count());
}
origin: camunda/camunda-bpm-platform

@Test
public void testDeployProcessArchive() {
 Assert.assertNotNull(ProgrammaticBeanLookup.lookup(ProcessEngine.class));
 // no deployment has been constructed
 Assert.assertEquals(0, repositoryService.createDeploymentQuery().deploymentName("pa").count());
}
origin: camunda/camunda-bpm-platform

public void testDefaultDeploymentSource() {
 String key = "process";
 BpmnModelInstance model = Bpmn.createExecutableProcess(key).done();
 DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
 Deployment deployment = repositoryService
   .createDeployment(processApplication.getReference())
   .name("first-deployment-with-a-source")
   .addModelInstance("process.bpmn", model)
   .deploy();
 assertEquals(ProcessApplicationDeployment.PROCESS_APPLICATION_DEPLOYMENT_SOURCE, deploymentQuery.deploymentName("first-deployment-with-a-source").singleResult().getSource());
 deleteDeployments(deployment);
}
origin: camunda/camunda-bpm-platform

@Deployment(resources = {"org/camunda/bpm/engine/test/bpmn/event/message/MessageStartEventTest.testDeployStartAndIntermediateEventWithSameMessageDifferentProcesses2.bpmn"})
public void testDeployStartAndIntermediateEventWithSameMessageDifferentProcessesFirstIntermediateEvent() {
 ProcessInstance pi = null;
 try {
  runtimeService.startProcessInstanceByKey("Process_2");
  pi = runtimeService.createProcessInstanceQuery().singleResult();
  assertThat(pi.isEnded(), is(false));
  String deploymentId = repositoryService
    .createDeployment()
    .addClasspathResource(
      "org/camunda/bpm/engine/test/bpmn/event/message/MessageStartEventTest.testDeployStartAndIntermediateEventWithSameMessageDifferentProcesses.bpmn")
    .name("deployment2").deploy().getId();
  assertThat(repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult(), is(notNullValue()));
 } finally {
  // clean db:
  runtimeService.deleteProcessInstance(pi.getId(), "failure");
  List<org.camunda.bpm.engine.repository.Deployment> deployments = repositoryService.createDeploymentQuery().list();
  for (org.camunda.bpm.engine.repository.Deployment d : deployments) {
   repositoryService.deleteDeployment(d.getId(), true);
  }
  // Workaround for #CAM-4250: remove process definition of failed
  // deployment from deployment cache
  processEngineConfiguration.getDeploymentCache().getProcessDefinitionCache().clear();
 }
}
origin: camunda/camunda-bpm-platform

public void testQueryNoCriteria() {
 DeploymentQuery query = repositoryService.createDeploymentQuery();
 assertEquals(2, query.list().size());
 assertEquals(2, query.count());
 try {
  query.singleResult();
  fail();
 } catch (ProcessEngineException e) {}
}
origin: camunda/camunda-bpm-platform

public void testQuerySortingAsc() {
 // exclude deployments without tenant id because of database-specific ordering
 List<Deployment> deployments = repositoryService.createDeploymentQuery()
   .tenantIdIn(TENANT_ONE, TENANT_TWO)
   .orderByTenantId()
   .asc()
   .list();
 assertThat(deployments.size(), is(2));
 assertThat(deployments.get(0).getTenantId(), is(TENANT_ONE));
 assertThat(deployments.get(1).getTenantId(), is(TENANT_TWO));
}
origin: camunda/camunda-bpm-platform

public void testQuerySortingDesc() {
 // exclude deployments without tenant id because of database-specific ordering
 List<Deployment> deployments = repositoryService.createDeploymentQuery()
   .tenantIdIn(TENANT_ONE, TENANT_TWO)
   .orderByTenantId()
   .desc()
   .list();
 assertThat(deployments.size(), is(2));
 assertThat(deployments.get(0).getTenantId(), is(TENANT_TWO));
 assertThat(deployments.get(1).getTenantId(), is(TENANT_ONE));
}
origin: camunda/camunda-bpm-platform

@Override
protected void tearDown() throws Exception {
 for(Deployment deployment : repositoryService.createDeploymentQuery().list()) {
  repositoryService.deleteDeployment(deployment.getId(), true);
 }
}
origin: camunda/camunda-bpm-platform

public void testQueryDeploymentBetween() throws Exception {
 Date later = DateTimeUtil.now().plus(10 * 3600).toDate();
 Date earlier = DateTimeUtil.now().minus(10 * 3600).toDate();
 long count = repositoryService
   .createDeploymentQuery()
   .deploymentAfter(earlier)
   .deploymentBefore(later).count();
 assertEquals(2, count);
 count = repositoryService
  .createDeploymentQuery()
  .deploymentAfter(later)
  .deploymentBefore(later)
  .count();
 assertEquals(0, count);
 count = repositoryService
  .createDeploymentQuery()
  .deploymentAfter(earlier)
  .deploymentBefore(earlier)
  .count();
 assertEquals(0, count);
 count = repositoryService
   .createDeploymentQuery()
   .deploymentAfter(later)
   .deploymentBefore(earlier)
   .count();
 assertEquals(0, count);
}
origin: camunda/camunda-bpm-platform

public 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));
}
origin: camunda/camunda-bpm-platform

private DeploymentQuery setUpMockDeploymentQuery(List<Deployment> mockedDeployments) {
 DeploymentQuery sampleDeploymentQuery = mock(DeploymentQuery.class);
 when(sampleDeploymentQuery.list()).thenReturn(mockedDeployments);
 when(sampleDeploymentQuery.count()).thenReturn((long) mockedDeployments.size());
 when(processEngine.getRepositoryService().createDeploymentQuery()).thenReturn(sampleDeploymentQuery);
 return sampleDeploymentQuery;
}
origin: camunda/camunda-bpm-platform

@Test
public void testDeploymentTenantIdIncludeDefinitionsWithoutTenantid() {
 List<Deployment> mockDeployments = Arrays.asList(
   MockProvider.createMockDeployment(null),
   MockProvider.createMockDeployment(MockProvider.EXAMPLE_TENANT_ID));
 mockedQuery = setUpMockDeploymentQuery(mockDeployments);
 Response response = given()
  .queryParam("tenantIdIn", MockProvider.EXAMPLE_TENANT_ID)
  .queryParam("includeDeploymentsWithoutTenantId", true)
 .then().expect()
  .statusCode(Status.OK.getStatusCode())
 .when()
  .get(DEPLOYMENT_QUERY_URL);
 verify(mockedQuery).tenantIdIn(MockProvider.EXAMPLE_TENANT_ID);
 verify(mockedQuery).includeDeploymentsWithoutTenantId();
 verify(mockedQuery).list();
 String content = response.asString();
 List<String> definitions = from(content).getList("");
 assertThat(definitions).hasSize(2);
 String returnedTenantId1 = from(content).getString("[0].tenantId");
 String returnedTenantId2 = from(content).getString("[1].tenantId");
 assertThat(returnedTenantId1).isEqualTo(null);
 assertThat(returnedTenantId2).isEqualTo(MockProvider.EXAMPLE_TENANT_ID);
}
origin: camunda/camunda-bpm-platform

public 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));
}
org.camunda.bpm.engine.repositoryDeploymentQuery

Javadoc

Allows programmatic querying of Deployments. Note that it is impossible to retrieve the deployment resources through the results of this operation, since that would cause a huge transfer of (possibly) unneeded bytes over the wire. To retrieve the actual bytes of a deployment resource use the operations on the RepositoryService#getDeploymentResourceNames(String)and RepositoryService#getResourceAsStream(String,String)

Most used methods

  • list
  • singleResult
  • count
  • deploymentId
    Only select deployments with the given deployment id.
  • deploymentName
    Only select deployments with the given name.
  • deploymentAfter
    Only select deployments deployed after the given date
  • deploymentBefore
    Only select deployments deployed before the given date
  • deploymentNameLike
    Only select deployments with a name like the given string.
  • deploymentSource
    If the given source is null, then deployments are returned where source is equal to null. Otherwise
  • includeDeploymentsWithoutTenantId
    Select deployments which have no tenant id. Can be used in combination with #tenantIdIn(String...).
  • orderByDeploymentId
    Order by deployment id (needs to be followed by #asc() or #desc()).
  • orderByDeploymentName
    Order by deployment name (needs to be followed by #asc() or #desc()).
  • orderByDeploymentId,
  • orderByDeploymentName,
  • orderByDeploymentTime,
  • orderByTenantId,
  • tenantIdIn,
  • withoutTenantId,
  • listPage,
  • asc,
  • desc,
  • orderByDeploymenTime

Popular in Java

  • Parsing JSON documents to java classes using gson
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getContentResolver (Context)
  • getSharedPreferences (Context)
  • Menu (java.awt)
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • JPanel (javax.swing)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now