Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Deployment public void testGetBpmnXmlFileThroughService()
        public virtual void testGetBpmnXmlFileThroughService()
        {
            string         deploymentId        = repositoryService.createDeploymentQuery().singleResult().Id;
            IList <string> deploymentResources = repositoryService.getDeploymentResourceNames(deploymentId);

            // verify bpmn file name
            assertEquals(1, deploymentResources.Count);
            string bpmnResourceName = "org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml";

            assertEquals(bpmnResourceName, deploymentResources[0]);

            ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();

            assertEquals(bpmnResourceName, processDefinition.ResourceName);
            assertNull(processDefinition.DiagramResourceName);
            assertFalse(processDefinition.hasStartFormKey());

            ReadOnlyProcessDefinition readOnlyProcessDefinition = ((RepositoryServiceImpl)repositoryService).getDeployedProcessDefinition(processDefinition.Id);

            assertNull(readOnlyProcessDefinition.DiagramResourceName);

            // verify content
            Stream deploymentInputStream = repositoryService.getResourceAsStream(deploymentId, bpmnResourceName);
            string contentFromDeployment = readInputStreamToString(deploymentInputStream);

            assertTrue(contentFromDeployment.Length > 0);
            assertTrue(contentFromDeployment.Contains("process id=\"emptyProcess\""));

            Stream fileInputStream = ReflectUtil.getResourceAsStream("org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml");
            string contentFromFile = readInputStreamToString(fileInputStream);

            assertEquals(contentFromFile, contentFromDeployment);
        }
Пример #2
0
        public virtual void testProcessDiagramResource()
        {
            ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();

            assertEquals("org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.bpmn20.xml", processDefinition.ResourceName);
            assertTrue(processDefinition.hasStartFormKey());

            string diagramResourceName = processDefinition.DiagramResourceName;

            assertEquals("org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg", diagramResourceName);

            Stream diagramStream = repositoryService.getResourceAsStream(deploymentId, "org/camunda/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg");

            sbyte[] diagramBytes = IoUtil.readInputStream(diagramStream, "diagram stream");
            assertEquals(33343, diagramBytes.Length);
        }