예제 #1
0
        public virtual void TestGetBpmnXmlFileThroughService()
        {
            string         deploymentId        = repositoryService.CreateDeploymentQuery().First().Id;
            IList <string> deploymentResources = repositoryService.GetDeploymentResourceNames(deploymentId);

            // verify bpmn file name
            Assert.AreEqual(1, deploymentResources.Count);
            string bpmnResourceName = "resources/Bpmn/Deployment/BpmnDeploymentTest.TestGetBpmnXmlFileThroughService.bpmn20.xml";

            Assert.AreEqual(bpmnResourceName, deploymentResources[0]);

            IProcessDefinition processDefinition = repositoryService.CreateProcessDefinitionQuery().First();

            Assert.AreEqual(bpmnResourceName, processDefinition.ResourceName);
            Assert.IsNull(processDefinition.DiagramResourceName);
            Assert.IsFalse(processDefinition.GetHasStartFormKey());

            IReadOnlyProcessDefinition readOnlyProcessDefinition = ((RepositoryServiceImpl)repositoryService).GetDeployedProcessDefinition(processDefinition.Id);

            Assert.IsNull(readOnlyProcessDefinition.DiagramResourceName);

            // verify content
            System.IO.Stream deploymentInputStream = repositoryService.GetResourceAsStream(deploymentId, bpmnResourceName);
            string           contentFromDeployment = ReadInputStreamToString(deploymentInputStream);

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

            System.IO.Stream fileInputStream = ReflectUtil.GetResourceAsStream("resources/Bpmn/Deployment/BpmnDeploymentTest.TestGetBpmnXmlFileThroughService.bpmn20.xml");
            string           contentFromFile = ReadInputStreamToString(fileInputStream);

            Assert.AreEqual(contentFromFile, contentFromDeployment);
        }
예제 #2
0
        public virtual void TestProcessDiagramResource()
        {
            IProcessDefinition processDefinition = repositoryService.CreateProcessDefinitionQuery().First();

            Assert.AreEqual("resources/Bpmn/Deployment/BpmnDeploymentTest.TestProcessDiagramResource.bpmn20.xml".ToLower(), processDefinition.ResourceName.ToLower());
            Assert.True(processDefinition.GetHasStartFormKey());

            string diagramResourceName = processDefinition.DiagramResourceName;

            Assert.AreEqual("resources/Bpmn/Deployment/BpmnDeploymentTest.TestProcessDiagramResource.jpg".ToLower(), diagramResourceName.ToLower());

            System.IO.Stream diagramStream = repositoryService.GetResourceAsStream(DeploymentId, "resources/Bpmn/Deployment/BpmnDeploymentTest.TestProcessDiagramResource.jpg");
            byte[]           diagramBytes  = IoUtil.ReadInputStream(diagramStream, "diagram stream");
            Assert.AreEqual(33343, diagramBytes.Length);
        }