本文整理了Java中org.camunda.bpm.engine.RepositoryService.getDeploymentResourceNames
方法的一些代码示例,展示了RepositoryService.getDeploymentResourceNames
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepositoryService.getDeploymentResourceNames
方法的具体详情如下:
包路径:org.camunda.bpm.engine.RepositoryService
类名称:RepositoryService
方法名:getDeploymentResourceNames
[英]Retrieves a list of deployment resource names for the given deployment, ordered alphabetically.
[中]检索给定部署的部署资源名称列表,按字母顺序排列。
代码示例来源:origin: camunda/camunda-bpm-platform
public void testFindDeploymentResourceNamesNullDeploymentId() {
try {
repositoryService.getDeploymentResourceNames(null);
fail("ProcessEngineException expected");
} catch (ProcessEngineException ae) {
assertTextPresent("deploymentId is null", ae.getMessage());
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
@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));
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testGetDeploymentResourceNamesWithReadPermissionOnAnyDeployment() {
// given
String deploymentId = createDeployment(null);
createGrantAuthorization(DEPLOYMENT, ANY, userId, READ);
// when
List<String> names = repositoryService.getDeploymentResourceNames(deploymentId);
// then
assertFalse(names.isEmpty());
assertEquals(2, names.size());
assertTrue(names.contains(FIRST_RESOURCE));
assertTrue(names.contains(SECOND_RESOURCE));
deleteDeployment(deploymentId);
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testGetDeploymentResourceNamesWithReadPermissionOnDeployment() {
// given
String deploymentId = createDeployment(null);
createGrantAuthorization(DEPLOYMENT, deploymentId, userId, READ);
// when
List<String> names = repositoryService.getDeploymentResourceNames(deploymentId);
// then
assertFalse(names.isEmpty());
assertEquals(2, names.size());
assertTrue(names.contains(FIRST_RESOURCE));
assertTrue(names.contains(SECOND_RESOURCE));
deleteDeployment(deploymentId);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void getDeploymentResourceNamesDisabledTenantCheck() {
Deployment deploymentOne = testRule.deployForTenant(TENANT_ONE, emptyProcess);
Deployment deploymentTwo = testRule.deployForTenant(TENANT_TWO, startEndProcess);
processEngineConfiguration.setTenantCheckEnabled(false);
identityService.setAuthentication("user", null, null);
List<String> deploymentResourceNames = repositoryService.getDeploymentResourceNames(deploymentOne.getId());
assertThat(deploymentResourceNames, hasSize(1));
deploymentResourceNames = repositoryService.getDeploymentResourceNames(deploymentTwo.getId());
assertThat(deploymentResourceNames, hasSize(1));
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void failToGetDeploymentResourceNamesNoAuthenticatedTenant() {
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.getDeploymentResourceNames(deployment.getId());
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testDeploymentPersistence() {
org.camunda.bpm.engine.repository.Deployment deployment = repositoryService
.createDeployment()
.name("strings")
.addString("org/camunda/bpm/engine/test/test/HelloWorld.string", "hello world")
.addString("org/camunda/bpm/engine/test/test/TheAnswer.string", "42")
.deploy();
List<org.camunda.bpm.engine.repository.Deployment> deployments
= repositoryService.createDeploymentQuery().list();
assertEquals(1, deployments.size());
deployment = deployments.get(0);
assertEquals("strings", deployment.getName());
assertNotNull(deployment.getDeploymentTime());
String deploymentId = deployment.getId();
List<String> resourceNames = repositoryService.getDeploymentResourceNames(deploymentId);
Set<String> expectedResourceNames = new HashSet<String>();
expectedResourceNames.add("org/camunda/bpm/engine/test/test/HelloWorld.string");
expectedResourceNames.add("org/camunda/bpm/engine/test/test/TheAnswer.string");
assertEquals(expectedResourceNames, new HashSet<String>(resourceNames));
InputStream resourceStream = repositoryService.getResourceAsStream(deploymentId, "org/camunda/bpm/engine/test/test/HelloWorld.string");
assertTrue(Arrays.equals("hello world".getBytes(), IoUtil.readInputStream(resourceStream, "test")));
resourceStream = repositoryService.getResourceAsStream(deploymentId, "org/camunda/bpm/engine/test/test/TheAnswer.string");
assertTrue(Arrays.equals("42".getBytes(), IoUtil.readInputStream(resourceStream, "test")));
repositoryService.deleteDeployment(deploymentId);
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testDeploySameFileTwice() {
String bpmnResourceName = "org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml";
repositoryService.createDeployment().enableDuplicateFiltering().addClasspathResource(bpmnResourceName).name("twice").deploy();
String deploymentId = repositoryService.createDeploymentQuery().singleResult().getId();
List<String> deploymentResources = repositoryService.getDeploymentResourceNames(deploymentId);
// verify bpmn file name
assertEquals(1, deploymentResources.size());
assertEquals(bpmnResourceName, deploymentResources.get(0));
repositoryService.createDeployment().enableDuplicateFiltering().addClasspathResource(bpmnResourceName).name("twice").deploy();
List<org.camunda.bpm.engine.repository.Deployment> deploymentList = repositoryService.createDeploymentQuery().list();
assertEquals(1, deploymentList.size());
repositoryService.deleteDeployment(deploymentId);
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testDeployDifferentFiles() {
String bpmnResourceName = "org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml";
repositoryService.createDeployment().enableDuplicateFiltering(false).addClasspathResource(bpmnResourceName).name("twice").deploy();
String deploymentId = repositoryService.createDeploymentQuery().singleResult().getId();
List<String> deploymentResources = repositoryService.getDeploymentResourceNames(deploymentId);
// verify bpmn file name
assertEquals(1, deploymentResources.size());
assertEquals(bpmnResourceName, deploymentResources.get(0));
bpmnResourceName = "org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.bpmn20.xml";
repositoryService.createDeployment().enableDuplicateFiltering().addClasspathResource(bpmnResourceName).name("twice").deploy();
List<org.camunda.bpm.engine.repository.Deployment> deploymentList = repositoryService.createDeploymentQuery().list();
assertEquals(2, deploymentList.size());
deleteDeployments(deploymentList);
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void testDiagramCreationDisabled() {
repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/bpmn/parse/BpmnParseTest.testParseDiagramInterchangeElements.bpmn20.xml").deploy();
// Graphical information is not yet exposed publicly, so we need to do some plumbing
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
ProcessDefinitionEntity processDefinitionEntity = commandExecutor.execute(new Command<ProcessDefinitionEntity>() {
@Override
public ProcessDefinitionEntity execute(CommandContext commandContext) {
return Context.getProcessEngineConfiguration()
.getDeploymentCache()
.findDeployedLatestProcessDefinitionByKey("myProcess");
}
});
assertNotNull(processDefinitionEntity);
assertEquals(7, processDefinitionEntity.getActivities().size());
// Check that no diagram has been created
List<String> resourceNames = repositoryService.getDeploymentResourceNames(processDefinitionEntity.getDeploymentId());
assertEquals(1, resourceNames.size());
repositoryService.deleteDeployment(repositoryService.createDeploymentQuery().singleResult().getId(), true);
}
代码示例来源:origin: camunda/camunda-bpm-platform
List<String> resourceNames = repositoryService.getDeploymentResourceNames(processDefinitionEntity.getDeploymentId());
if (processEngineConfiguration.isCreateDiagramOnDeploy()) {
assertEquals(2, resourceNames.size());
代码示例来源:origin: camunda/camunda-bpm-platform
public void testGetDeploymentResourceNamesWithoutAuthorization() {
// given
String deploymentId = createDeployment(null);
try {
// when
repositoryService.getDeploymentResourceNames(deploymentId);
fail("Exception expected: it should not be possible to retrieve deployment resource names");
} catch (AuthorizationException e) {
// then
String message = e.getMessage();
assertTextPresent(userId, message);
assertTextPresent(READ.getName(), message);
assertTextPresent(DEPLOYMENT.resourceName(), message);
}
deleteDeployment(deploymentId);
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Deployment
public void testGetBpmnXmlFileThroughService() {
String deploymentId = repositoryService.createDeploymentQuery().singleResult().getId();
List<String> deploymentResources = repositoryService.getDeploymentResourceNames(deploymentId);
// verify bpmn file name
assertEquals(1, deploymentResources.size());
String bpmnResourceName = "org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml";
assertEquals(bpmnResourceName, deploymentResources.get(0));
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
assertEquals(bpmnResourceName, processDefinition.getResourceName());
assertNull(processDefinition.getDiagramResourceName());
assertFalse(processDefinition.hasStartFormKey());
ReadOnlyProcessDefinition readOnlyProcessDefinition = ((RepositoryServiceImpl)repositoryService).getDeployedProcessDefinition(processDefinition.getId());
assertNull(readOnlyProcessDefinition.getDiagramResourceName());
// verify content
InputStream deploymentInputStream = repositoryService.getResourceAsStream(deploymentId, bpmnResourceName);
String contentFromDeployment = readInputStreamToString(deploymentInputStream);
assertTrue(contentFromDeployment.length() > 0);
assertTrue(contentFromDeployment.contains("process id=\"emptyProcess\""));
InputStream fileInputStream = ReflectUtil.getResourceAsStream("org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml");
String contentFromFile = readInputStreamToString(fileInputStream);
assertEquals(contentFromFile, contentFromDeployment);
}
代码示例来源:origin: camunda/camunda-bpm-platform
List<String> resourceNames = repositoryService.getDeploymentResourceNames(deployment.getId());
if(resourceNames.contains(DMN_RESOURCE_NAME)) {
dmnDeployment = deployment;
代码示例来源:origin: camunda/camunda-bpm-platform
List<String> resourceNames = repositoryService.getDeploymentResourceNames(deployment.getId());
if(resourceNames.contains(DMN_RESOURCE_NAME)) {
dmnDeployment = deployment;
代码示例来源:origin: camunda/camunda-bpm-platform
public void testPartialChangesDeployAll() {
BpmnModelInstance model1 = Bpmn.createExecutableProcess("process1").done();
BpmnModelInstance model2 = Bpmn.createExecutableProcess("process2").done();
org.camunda.bpm.engine.repository.Deployment deployment1 = repositoryService.createDeployment()
.enableDuplicateFiltering()
.addModelInstance("process1.bpmn20.xml", model1)
.addModelInstance("process2.bpmn20.xml", model2)
.name("twice")
.deploy();
List<String> deploymentResources = repositoryService.getDeploymentResourceNames(deployment1.getId());
assertEquals(2, deploymentResources.size());
BpmnModelInstance changedModel2 = Bpmn.createExecutableProcess("process2").startEvent().done();
org.camunda.bpm.engine.repository.Deployment deployment2 = repositoryService.createDeployment()
.enableDuplicateFiltering()
.addModelInstance("process1.bpmn20.xml", model1)
.addModelInstance("process2.bpmn20.xml", changedModel2)
.name("twice")
.deploy();
List<org.camunda.bpm.engine.repository.Deployment> deploymentList = repositoryService.createDeploymentQuery().list();
assertEquals(2, deploymentList.size());
// there should be new versions of both processes
assertEquals(2, repositoryService.createProcessDefinitionQuery().processDefinitionKey("process1").count());
assertEquals(2, repositoryService.createProcessDefinitionQuery().processDefinitionKey("process2").count());
repositoryService.deleteDeployment(deployment1.getId());
repositoryService.deleteDeployment(deployment2.getId());
}
代码示例来源:origin: org.camunda.bpm/camunda-engine
@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));
}
代码示例来源:origin: org.camunda.bpm/camunda-engine
public void testFindDeploymentResourceNamesNullDeploymentId() {
try {
repositoryService.getDeploymentResourceNames(null);
fail("ProcessEngineException expected");
} catch (ProcessEngineException ae) {
assertTextPresent("deploymentId is null", ae.getMessage());
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
.deploy();
List<String> deploymentResources = repositoryService.getDeploymentResourceNames(deployment1.getId());
assertEquals(2, deploymentResources.size());
代码示例来源:origin: org.camunda.bpm/camunda-engine
@Test
public void failToGetDeploymentResourceNamesNoAuthenticatedTenant() {
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.getDeploymentResourceNames(deployment.getId());
}
内容来源于网络,如有侵权,请联系作者删除!