3 Replies Latest reply on Jul 31, 2009 6:15 AM by jbarrez

    Process Definition Deployment using ZipInputStream

      Hi All,

      I am trying to deploy process definition file (*.jpdl.xml) by following command .

      ZipInputStream input = new ZipInputStream(new ByteArrayInputStream(bytes));
      deploymentId = repositoryService.createDeployment()
      .addResourcesFromZipInputStream(input)
      .deploy();

      after deploying the process when i try to find that process definition by using deployment Id. I does not get the process object. When i checked the database i was found entry in JBPM4_DEPLOYMENT table with deployment ID.


        • 1. Re: Process Definition Deployment using ZipInputStream
          jbarrez

          Can you pour this into a Junit test case so that we can test exactly your problem?

          • 2. Re: Process Definition Deployment using ZipInputStream

            try the code below
            ================================
            public static void main(String[] args) {
            ProcessEngine processEngine = new Configuration()
            .buildProcessEngine();
            RepositoryService repositoryService = processEngine.getRepositoryService();
            FileInputStream fip;
            try {
            fip = new FileInputStream("C:\\JBPMV4\\bin\\TestProcess.jpdl.zip");
            ZipInputStream zip = new ZipInputStream(fip);
            String deploymentDbid = repositoryService.createDeployment().addResourcesFromZipInputStream(zip).deploy();
            System.out.println("Deployment Db Id: " + deploymentDbid);
            } catch (FileNotFoundException e) {
            e.printStackTrace();
            }
            }

            • 3. Re: Process Definition Deployment using ZipInputStream
              jbarrez

              I included a test case for this in the test suite, but the test succeeds. So either I'm testing the wrong thing or you are doing something wrong:

               public void testZippedResourceDeployment() {
               FileInputStream fip = null;
               try {
              
               fip = new FileInputStream("src/test/resources/org/jbpm/test/deploy/process.zip");
               ZipInputStream zis = new ZipInputStream(fip);
              
               NewDeployment newDeployment = repositoryService.createDeployment();
               newDeployment.addResourcesFromZipInputStream(zis);
               String deployId = newDeployment.deploy();
              
               ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery()
               .deploymentId(deployId)
               .uniqueResult();
               assertNotNull(procDef);
               assertEquals("ImageTest", procDef.getName());
               repositoryService.deleteDeploymentCascade(deployId);
              
               } catch (IOException e) {
               fail(e.getMessage());
               } finally {
               if (fip != null) {
               try {
               fip.close();
               } catch (IOException e) {
               fail(e.getMessage());
               }
               }
               }
              
               }