org.camunda.bpm.engine.RepositoryService.getDeploymentResources()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.9k)|赞(0)|评价(0)|浏览(88)

本文整理了Java中org.camunda.bpm.engine.RepositoryService.getDeploymentResources方法的一些代码示例,展示了RepositoryService.getDeploymentResources的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepositoryService.getDeploymentResources方法的具体详情如下:
包路径:org.camunda.bpm.engine.RepositoryService
类名称:RepositoryService
方法名:getDeploymentResources

RepositoryService.getDeploymentResources介绍

[英]Retrieves a list of deployment resources for the given deployment, ordered alphabetically by name.
[中]检索给定部署的部署资源列表,按名称的字母顺序排列。

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

public List<DeploymentResourceDto> getDeploymentResources() {
 List<Resource> resources = engine.getRepositoryService().getDeploymentResources(deploymentId);
 List<DeploymentResourceDto> deploymentResources = new ArrayList<DeploymentResourceDto>();
 for (Resource resource : resources) {
  deploymentResources.add(DeploymentResourceDto.fromResources(resource));
 }
 if (!deploymentResources.isEmpty()) {
  return deploymentResources;
 }
 else {
  throw new InvalidRequestException(Status.NOT_FOUND,
   "Deployment resources for deployment id '" + deploymentId + "' do not exist.");
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

public List<DeploymentResourceDto> getDeploymentResources() {
 List<Resource> resources = engine.getRepositoryService().getDeploymentResources(deploymentId);
 List<DeploymentResourceDto> deploymentResources = new ArrayList<DeploymentResourceDto>();
 for (Resource resource : resources) {
  deploymentResources.add(DeploymentResourceDto.fromResources(resource));
 }
 if (!deploymentResources.isEmpty()) {
  return deploymentResources;
 }
 else {
  throw new InvalidRequestException(Status.NOT_FOUND,
   "Deployment resources for deployment id '" + deploymentId + "' do not exist.");
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected Resource getResourceByName(String deploymentId, String resourceName) {
 List<Resource> resources = repositoryService.getDeploymentResources(deploymentId);
 for (Resource resource : resources) {
  if (resource.getName().equals(resourceName)) {
   return resource;
  }
 }
 return null;
}

代码示例来源:origin: camunda/camunda-bpm-platform

protected void checkResource(Date expectedDate, String deploymentId) {
 List<Resource> deploymentResources = repositoryService.getDeploymentResources(deploymentId);
 assertEquals(1, deploymentResources.size());
 ResourceEntity resource = (ResourceEntity) deploymentResources.get(0);
 checkEntity(expectedDate, resource);
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testGetDeploymentResourcesWithReadPermissionOnDeployment() {
 // given
 String deploymentId = createDeployment(null);
 createGrantAuthorization(DEPLOYMENT, deploymentId, userId, READ);
 // when
 List<Resource> resources = repositoryService.getDeploymentResources(deploymentId);
 // then
 assertFalse(resources.isEmpty());
 assertEquals(2, resources.size());
 deleteDeployment(deploymentId);
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testGetDeploymentResourcesWithReadPermissionOnAnyDeployment() {
 // given
 String deploymentId = createDeployment(null);
 createGrantAuthorization(DEPLOYMENT, ANY, userId, READ);
 // when
 List<Resource> resources = repositoryService.getDeploymentResources(deploymentId);
 // then
 assertFalse(resources.isEmpty());
 assertEquals(2, resources.size());
 deleteDeployment(deploymentId);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@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));
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testFindDeploymentResourcesNullDeploymentId() {
 try {
  repositoryService.getDeploymentResources(null);
  fail("ProcessEngineException expected");
 }
 catch (ProcessEngineException e) {
  assertTextPresent("deploymentId is null", e.getMessage());
 }
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void getDeploymentResourcesDisabledTenantCheck() {
 Deployment deploymentOne = testRule.deployForTenant(TENANT_ONE, emptyProcess);
 Deployment deploymentTwo = testRule.deployForTenant(TENANT_TWO, startEndProcess);
 processEngineConfiguration.setTenantCheckEnabled(false);
 identityService.setAuthentication("user", null, null);
 List<Resource> deploymentResources = repositoryService.getDeploymentResources(deploymentOne.getId());
 assertThat(deploymentResources, hasSize(1));
 deploymentResources = repositoryService.getDeploymentResources(deploymentTwo.getId());
 assertThat(deploymentResources, hasSize(1));
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void testGetDeploymentResourcesThrowsAuthorizationException() {
 String message = "expected exception";
 when(mockRepositoryService.getDeploymentResources(EXAMPLE_DEPLOYMENT_ID)).thenThrow(new AuthorizationException(message));
 given()
  .pathParam("id", EXAMPLE_DEPLOYMENT_ID)
 .then().expect()
  .statusCode(Status.FORBIDDEN.getStatusCode())
  .body("type", is(AuthorizationException.class.getSimpleName()))
  .body("message", is(message))
 .when().get(RESOURCES_URL);
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void getResourceAsStreamWithAuthenticatedTenant() {
 Deployment deployment = testRule.deployForTenant(TENANT_ONE, emptyProcess);
 Resource resource = repositoryService.getDeploymentResources(deployment.getId()).get(0);
 identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
 InputStream inputStream = repositoryService.getResourceAsStream(deployment.getId(), resource.getName());
 assertThat(inputStream, notNullValue());
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void getResourceAsStreamByIdWithAuthenticatedTenant() {
 Deployment deployment = testRule.deployForTenant(TENANT_ONE, emptyProcess);
 Resource resource = repositoryService.getDeploymentResources(deployment.getId()).get(0);
 identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
 InputStream inputStream = repositoryService.getResourceAsStreamById(deployment.getId(), resource.getId());
 assertThat(inputStream, notNullValue());
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Deployment(resources = {"org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml"})
public void testDeploymentIdOfResource() {
 String deploymentId = repositoryService.createDeploymentQuery().singleResult().getId();
 List<Resource> resources = repositoryService.getDeploymentResources(deploymentId);
 assertEquals(1, resources.size());
 Resource resource = resources.get(0);
 assertEquals(deploymentId, resource.getDeploymentId());
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void getResourceAsStreamByIdDisabledTenantCheck() {
 Deployment deploymentOne = testRule.deployForTenant(TENANT_ONE, emptyProcess);
 Deployment deploymentTwo = testRule.deployForTenant(TENANT_TWO, startEndProcess);
 Resource resourceOne = repositoryService.getDeploymentResources(deploymentOne.getId()).get(0);
 Resource resourceTwo = repositoryService.getDeploymentResources(deploymentTwo.getId()).get(0);
 processEngineConfiguration.setTenantCheckEnabled(false);
 identityService.setAuthentication("user", null, null);
 InputStream inputStream = repositoryService.getResourceAsStreamById(deploymentOne.getId(), resourceOne.getId());
 assertThat(inputStream, notNullValue());
 inputStream = repositoryService.getResourceAsStreamById(deploymentTwo.getId(), resourceTwo.getId());
 assertThat(inputStream, notNullValue());
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void getResourceAsStreamDisabledTenantCheck() {
 Deployment deploymentOne = testRule.deployForTenant(TENANT_ONE, emptyProcess);
 Deployment deploymentTwo = testRule.deployForTenant(TENANT_TWO, startEndProcess);
 Resource resourceOne = repositoryService.getDeploymentResources(deploymentOne.getId()).get(0);
 Resource resourceTwo = repositoryService.getDeploymentResources(deploymentTwo.getId()).get(0);
 processEngineConfiguration.setTenantCheckEnabled(false);
 identityService.setAuthentication("user", null, null);
 InputStream inputStream = repositoryService.getResourceAsStream(deploymentOne.getId(), resourceOne.getName());
 assertThat(inputStream, notNullValue());
 inputStream = repositoryService.getResourceAsStream(deploymentTwo.getId(), resourceTwo.getName());
 assertThat(inputStream, notNullValue());
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void failToGetDeploymentResourcesNoAuthenticatedTenant() {
 Deployment deployment = testRule.deployForTenant(TENANT_ONE, emptyProcess);
 identityService.setAuthentication("user", null, null);
 // declare expected exception
 thrown.expect(ProcessEngineException.class);
 thrown.expectMessage("Cannot get the deployment");
 repositoryService.getDeploymentResources(deployment.getId());
}

代码示例来源:origin: camunda/camunda-bpm-platform

@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());
}

代码示例来源:origin: camunda/camunda-bpm-platform

@Test
public void failToGetResourceAsStreamByIdNoAuthenticatedTenant() {
 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.getResourceAsStreamById(deployment.getId(), resource.getId());
}

代码示例来源:origin: camunda/camunda-bpm-platform

public void testDeployAppWithAdditionalResourceSuffixes() {
 registerProcessEngine();
 TestApplicationWithAdditionalResourceSuffixes processApplication = new TestApplicationWithAdditionalResourceSuffixes();
 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());
}

代码示例来源:origin: camunda/camunda-bpm-platform

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());
}

相关文章

微信公众号

最新文章

更多

RepositoryService类方法