[jbpm-commits] JBoss JBPM SVN: r2053 - in jbpm3/trunk/modules: jpdl/core/src/main/java/org/jbpm/ant and 9 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Sun Aug 31 08:29:32 EDT 2008


Author: alex.guizar at jboss.com
Date: 2008-08-31 08:29:31 -0400 (Sun, 31 Aug 2008)
New Revision: 2053

Added:
   jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/ant/
   jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/ant/DeployProcessTaskTest.java
   jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/
   jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/badprocess.zip
   jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/build.xml
   jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/classloadingprocess.zip
   jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/timerprocess.zip
   jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/.gpd.timerprocess.xml
   jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerprocess.xml
Removed:
   jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerOnTimer.jpdl.xml
Modified:
   jbpm3/trunk/modules/console/src/main/java/org/jbpm/web/ProcessUploadServlet.java
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/ant/DeployProcessTask.java
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/db/hibernate/HibernateHelper.java
   jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java
   jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TimerOnTimerDbTest.java
Log:
[JBPM-522] process upload servlet and deploy process ant task mark the jbpm context for rollback in case of exception
test case for ant task checks single and multiple process deployment, both valid and invalid
hibernate helper logs a warning instead of throwing an exception in case hibernate.properties is specified but not present

Modified: jbpm3/trunk/modules/console/src/main/java/org/jbpm/web/ProcessUploadServlet.java
===================================================================
--- jbpm3/trunk/modules/console/src/main/java/org/jbpm/web/ProcessUploadServlet.java	2008-08-29 15:01:00 UTC (rev 2052)
+++ jbpm3/trunk/modules/console/src/main/java/org/jbpm/web/ProcessUploadServlet.java	2008-08-31 12:29:31 UTC (rev 2053)
@@ -22,7 +22,6 @@
 package org.jbpm.web;
 
 import java.io.IOException;
-import java.util.Iterator;
 import java.util.List;
 import java.util.zip.ZipInputStream;
 import org.apache.commons.fileupload.DiskFileUpload;
@@ -33,6 +32,7 @@
 import org.jbpm.JbpmContext;
 import org.jbpm.graph.def.ProcessDefinition;
 
+import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -42,66 +42,91 @@
 
 public class ProcessUploadServlet extends HttpServlet {
 
-    private static final long serialVersionUID = 1L;
+  private static final long serialVersionUID = 1L;
 
-    static JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
+  private JbpmConfiguration jbpmConfiguration;
 
-    public static final String UPLOAD_TYPE_DEFINITION = "definition";
-    public static final String UPLOAD_TYPE_ARCHIVE = "archive";
+  public void init() throws ServletException {
+    String jbpmCfgResource = getServletContext().getInitParameter("jbpm.configuration.resource");
+    jbpmConfiguration = JbpmConfiguration.getInstance(jbpmCfgResource);
+  }
 
-    public void service(HttpServletRequest request, HttpServletResponse response) throws IOException {
-        //upload from gpd has url mapping: /upload
+  protected void doGet(HttpServletRequest request, HttpServletResponse response)
+      throws ServletException, IOException {
+    log.debug("Handling status request");
+    response.getWriter().println("Process upload module is operational");
+  }
 
-        JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
-        try {
-            response.setContentType("text/html");
-            response.getWriter().println(handleRequest(request));
-        } finally {
-            jbpmContext.close();
-        }
+  protected void doPost(HttpServletRequest request, HttpServletResponse response)
+      throws ServletException, IOException {
+    log.debug("Handling upload request");
+    response.getWriter().println(handleRequest(request));
+  }
+
+  private String handleRequest(HttpServletRequest request) {
+    // check if request is multipart content
+    if (!FileUpload.isMultipartContent(request)) {
+      log.debug("Not a multipart request");
+      return "Not a multipart request";
     }
 
-    private String handleRequest(HttpServletRequest request) {
-        //check if request is multipart content
-        log.debug("Handling upload request");
-        if (!FileUpload.isMultipartContent(request)) {
-            log.debug("Not a multipart request");
-            return "Not a multipart request";
-        }
+    try {
+      DiskFileUpload fileUpload = new DiskFileUpload();
+      List itemList = fileUpload.parseRequest(request);
+      log.debug("Upload from GPD");
+      if (itemList.isEmpty()) {
+        log.debug("No process file in the request");
+        return "No process file in the request";
+      }
+      FileItem fileItem = (FileItem) itemList.get(0);
+      if (fileItem.getContentType().indexOf("application/x-zip-compressed") == -1) {
+        log.debug("Not a process archive");
+        return "Not a process archive";
+      }
+      try {
+        log.debug("Deploying process from archive " + fileItem.getName());
+        ProcessDefinition processDefinition = parseProcessArchive(fileItem);
+        deployProcessDefinition(processDefinition);
+        return "Deployed process " + processDefinition.getName() + " successfully";
+      }
+      catch (IOException e) {
+        log.debug("Failed to read process archive", e);
+        return "IOException";
+      }
+    }
+    catch (FileUploadException e) {
+      log.debug("Failed to parse HTTP request", e);
+      return "FileUploadException";
+    }
+  }
 
-        try {
-            DiskFileUpload fileUpload = new DiskFileUpload();
-            List list = fileUpload.parseRequest(request);
-            log.debug("Upload from GPD");
-            Iterator iterator = list.iterator();
-            if (!iterator.hasNext()) {
-                log.debug("No process file in the request");
-                return "No process file in the request";
-            }
-            FileItem fileItem = (FileItem) iterator.next();
-            if (fileItem.getContentType().indexOf("application/x-zip-compressed") == -1) {
-                log.debug("Not a process archive");
-                return "Not a process archive";
-            }
-            try {
-                log.debug("Deploying process archive " + fileItem.getName());
-                ZipInputStream zipInputStream = new ZipInputStream(fileItem.getInputStream());
-                JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
-                log.debug("Preparing to parse process archive");
-                ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(zipInputStream);
-                log.debug("Created a processdefinition : " + processDefinition.getName());
-                jbpmContext.deployProcessDefinition(processDefinition);
-                zipInputStream.close();
-                return "Deployed archive " + processDefinition.getName() + " successfully";
-            } catch (IOException e) {
-                log.debug("Failed to read process archive", e);
-                return "IOException";
-            }
-        } catch (FileUploadException e) {
-            log.debug("Failed to parse HTTP request", e);
-            return "FileUploadException";
-        }
+  private ProcessDefinition parseProcessArchive(FileItem fileItem) throws IOException {
+    ZipInputStream processStream = new ZipInputStream(fileItem.getInputStream());
+    try {
+      ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(processStream);
+      log.debug("Created process " + processDefinition.getName());
+      return processDefinition;
     }
+    finally {
+      processStream.close();
+    }
+  }
 
-    private static final Log log = LogFactory.getLog(ProcessUploadServlet.class);
+  private void deployProcessDefinition(ProcessDefinition processDefinition) {
+    JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+    try {
+      jbpmContext.deployProcessDefinition(processDefinition);
+      log.debug("Deployed process " + processDefinition.getName() + " successfully");
+    }
+    catch (RuntimeException e) {
+      jbpmContext.setRollbackOnly();
+      log.error("Failed to deploy process " + processDefinition.getName(), e);
+      throw e;
+    }
+    finally {
+      jbpmContext.close();
+    }
+  }
+
+  private static final Log log = LogFactory.getLog(ProcessUploadServlet.class);
 }
\ No newline at end of file

Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/ant/DeployProcessTask.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/ant/DeployProcessTask.java	2008-08-29 15:01:00 UTC (rev 2052)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/ant/DeployProcessTask.java	2008-08-31 12:29:31 UTC (rev 2053)
@@ -23,20 +23,22 @@
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.zip.ZipInputStream;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.MatchingTask;
 import org.apache.tools.ant.types.FileSet;
 import org.jbpm.JbpmConfiguration;
 import org.jbpm.JbpmContext;
 import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.jpdl.JpdlException;
 
 /**
  * ant task for deploying process archives.
@@ -46,57 +48,80 @@
   String jbpmCfg = null;
   File process = null;
   List fileSets = new ArrayList();
+  boolean failOnError = true;
 
   public void execute() throws BuildException {
-    try {
-      // get the JbpmConfiguration
-      JbpmConfiguration jbpmConfiguration = AntHelper.getJbpmConfiguration(jbpmCfg);
-      
-      // if attribute process is set, deploy that process file
-      if (process!=null) {
-        log( "deploying par "+process.getAbsolutePath()+" ..." );
-        deploy(process, jbpmConfiguration);
-      }
-      
-      // loop over all files that are specified in the filesets
-      Iterator iter = fileSets.iterator();
-      while (iter.hasNext()) {
-        FileSet fileSet = (FileSet) iter.next();
-        DirectoryScanner dirScanner = fileSet.getDirectoryScanner(getProject());
-        String[] fileSetFiles = dirScanner.getIncludedFiles();
+    // get the JbpmConfiguration
+    JbpmConfiguration jbpmConfiguration = AntHelper.getJbpmConfiguration(jbpmCfg);
+    
+    // if attribute process is set, deploy that process file
+    if (process!=null) {
+      deployProcessArchive(jbpmConfiguration, process);
+    }
+    
+    // loop over all files that are specified in the filesets
+    Iterator iter = fileSets.iterator();
+    while (iter.hasNext()) {
+      FileSet fileSet = (FileSet) iter.next();
+      DirectoryScanner dirScanner = fileSet.getDirectoryScanner(getProject());
+      File baseDir = dirScanner.getBasedir();
+      String[] includedFiles = dirScanner.getIncludedFiles();
+      List excludedFiles = Arrays.asList(dirScanner.getExcludedFiles());
 
-        for (int i = 0; i < fileSetFiles.length; i++) {
-          String fileName = fileSetFiles[i];
-          File file = new File(fileName);
-          if ( !file.isFile() ) {
-            file = new File( dirScanner.getBasedir(), fileName );
-          }
-
-          // deploy the file, specified in a fileset element
-          log( "deploying process archive "+file+" ..." );
-          deploy(file, jbpmConfiguration);
+      for (int i = 0; i < includedFiles.length; i++) {
+        String fileName = includedFiles[i];
+        if (!excludedFiles.contains(fileName)) {
+          File file = new File(baseDir, fileName);
+          deployProcessArchive(jbpmConfiguration, file);
         }
       }
+    }
+  }
 
-    } catch (Exception e) {
-      e.printStackTrace();
-      throw new BuildException( "couldn't deploy process archives : " + e.getMessage() );
+  private void deployProcessArchive(JbpmConfiguration jbpmConfiguration, File processFile) {
+    try {
+      log("deploying process from archive "+processFile.getName());
+      ProcessDefinition processDefinition = parseProcessArchive(processFile);
+      deployProcessDefinition(processDefinition, jbpmConfiguration);
     }
+    catch (IOException e) {
+      log("failed to read process archive " + processFile.getName(), e, Project.MSG_ERR);
+      throw new BuildException(e.getMessage(), e);
+    }
+    catch (JpdlException e) {
+      log("archive " + processFile.getName() + " contains invalid process", e, Project.MSG_ERR);
+      throw e;
+    }
   }
 
-  void deploy(File file, JbpmConfiguration jbpmConfiguration) throws IOException, FileNotFoundException {
-    
+  private ProcessDefinition parseProcessArchive(File processFile) throws IOException {
+    ZipInputStream processStream = new ZipInputStream(new FileInputStream(processFile));
+    try {
+      ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(processStream);
+      log("created process definition " + processDefinition.getName());
+      return processDefinition;
+    }
+    finally {
+      processStream.close();
+    }
+  }
+
+  private void deployProcessDefinition(ProcessDefinition processDefinition, JbpmConfiguration jbpmConfiguration) {
     JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
     try {
-      ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(file));
-      ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(zipInputStream);
       jbpmContext.deployProcessDefinition(processDefinition);
-      
-    } finally {
+      log("deployed process " + processDefinition.getName() + " successfully");
+    }
+    catch (RuntimeException e) {
+      jbpmContext.setRollbackOnly();
+      log("failed to deploy process " + processDefinition.getName(), e, Project.MSG_ERR);
+      throw e;
+    }
+    finally {
       jbpmContext.close();
     }
   }
-  
+
   public void addFileset(FileSet fileSet) {
     this.fileSets.add(fileSet);
   }
@@ -106,4 +131,7 @@
   public void setProcess(File process) {
     this.process = process;
   }
+  public void setFailOnError(boolean failOnError) {
+    this.failOnError = failOnError;
+  }
 }

Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java	2008-08-29 15:01:00 UTC (rev 2052)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/db/AbstractDbTestCase.java	2008-08-31 12:29:31 UTC (rev 2053)
@@ -55,24 +55,20 @@
 	protected JobExecutor jobExecutor;
 
 	public static JbpmConfiguration getDbTestJbpmConfiguration() {
-	  String configurationResource = AbstractDbTestCase.class.getClassLoader().getResource("hibernate.properties") != null
-	      ? "org/jbpm/db/jbpm.db.test.cfg.xml" : "org/jbpm/jbpm.test.cfg.xml";
-		return JbpmConfiguration.getInstance(configurationResource);
+		return JbpmConfiguration.getInstance("org/jbpm/db/jbpm.db.test.cfg.xml");
 	}
 
 	public void setUp() throws Exception {
-		super.setUp();
 		createSchema();
 		createJbpmContext();
 		initializeMembers();
 
-		log.debug("");
-		log.debug("### starting " + this.getClass().getCanonicalName() + "."
+		log.debug("### starting " + getClass().getName() + "."
 				+ getName() + " ####################################################");
 	}
 
 	public void tearDown() throws Exception {
-		log.debug("### " + this.getClass().getCanonicalName() + "." + getName()
+		log.debug("### " + getClass().getName() + "." + getName()
 				+ " done ####################################################");
 		resetMembers();
 		closeJbpmContext();

Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/db/hibernate/HibernateHelper.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/db/hibernate/HibernateHelper.java	2008-08-29 15:01:00 UTC (rev 2052)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/db/hibernate/HibernateHelper.java	2008-08-31 12:29:31 UTC (rev 2053)
@@ -88,8 +88,10 @@
       log.debug("using hibernate properties from resource '"+propertiesResource+"'");
       // load the properties
       Properties properties = loadPropertiesFromResource(propertiesResource);
-      // and overwrite the properties with the specified properties
-      configuration.setProperties(properties);
+      if (!properties.isEmpty()) {
+        // and overwrite the properties with the specified properties
+        configuration.setProperties(properties);
+      }
     }
 
     return configuration;
@@ -132,14 +134,15 @@
 
   static Properties loadPropertiesFromResource(String resource) {
     Properties properties = new Properties();
-    try {
-      InputStream inputStream = ClassLoaderUtil.getStream(resource);
-      properties.load(inputStream);
-
-    } catch (NullPointerException e) {
-      throw new JbpmException("couldn't load hibernate properties from unexisting resource '"+resource+"'", e);
-    } catch (IOException e) {
-      throw new JbpmException("couldn't load hibernate properties from resource '"+resource+"'", e);
+    InputStream inputStream = ClassLoaderUtil.getStream(resource);
+    if (inputStream != null) {
+      try {
+        properties.load(inputStream);
+      } catch (IOException e) {
+        log.warn("couldn't load hibernate properties from resource '"+resource+"'", e);
+      }
+    } else {
+      log.warn("hibernate properties resource '" + resource + "' not found");
     }
     return properties;
   }

Modified: jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java	2008-08-29 15:01:00 UTC (rev 2052)
+++ jbpm3/trunk/modules/jpdl/core/src/main/java/org/jbpm/graph/def/ProcessDefinition.java	2008-08-31 12:29:31 UTC (rev 2053)
@@ -187,19 +187,15 @@
    * parse a process definition from a process archive zip-stream.
    * @throws org.jbpm.jpdl.JpdlException if parsing reported an error.
    */
-  public static ProcessDefinition parseParZipInputStream(ZipInputStream zipInputStream) {
-    try {
-      return new ProcessArchive(zipInputStream).parseProcessDefinition();
-    } catch (IOException e) {
-      throw new JbpmException("couldn't parse process zip file zipInputStream", e);
-    }
+  public static ProcessDefinition parseParZipInputStream(ZipInputStream zipInputStream) throws IOException {
+    return new ProcessArchive(zipInputStream).parseProcessDefinition();
   }
 
   /**
    * parse a process definition from a process archive resource.
    * @throws org.jbpm.jpdl.JpdlException if parsing reported an error.
    */
-  public static ProcessDefinition parseParResource(String parResource) {
+  public static ProcessDefinition parseParResource(String parResource) throws IOException {
     return parseParZipInputStream(new ZipInputStream(ClassLoaderUtil.getStream(parResource)));
   }
 

Added: jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/ant/DeployProcessTaskTest.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/ant/DeployProcessTaskTest.java	                        (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/ant/DeployProcessTaskTest.java	2008-08-31 12:29:31 UTC (rev 2053)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.ant;
+
+import java.util.List;
+
+import org.apache.tools.ant.Main;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.ProcessDefinition;
+
+/**
+ * Test case for JBPM-522.
+ * @author Alejandro Guizar
+ */
+public class DeployProcessTaskTest extends AbstractDbTestCase {
+
+  public void testDeployProcess() {
+    runTarget("deploy.process");
+    List processDefinitions = graphSession.findAllProcessDefinitions();
+    assertEquals(1, processDefinitions.size());
+    ProcessDefinition processDefinition = (ProcessDefinition) processDefinitions.get(0);
+    assertEquals("timerProcess", processDefinition.getName());
+  }
+
+  public void testDeployBadProcess() {
+    runTarget("deploy.bad.process");
+    List processDefinitions = graphSession.findAllProcessDefinitions();
+    assertEquals(0, processDefinitions.size());
+  }
+
+  public void testDeployProcesses() {
+    runTarget("deploy.processes");
+    List processDefinitions = graphSession.findAllProcessDefinitions();
+    assertEquals(2, processDefinitions.size());
+    ProcessDefinition processDefinition = (ProcessDefinition) processDefinitions.get(0);
+    assertEquals("classLoadingProcess", processDefinition.getName());
+    processDefinition = (ProcessDefinition) processDefinitions.get(1);
+    assertEquals("timerProcess", processDefinition.getName());
+  }
+
+  public void testDeployProcessesIncludingBad() {
+    runTarget("deploy.processes.including.bad");
+    List processDefinitions = graphSession.findAllProcessDefinitions();
+    assertEquals(0, processDefinitions.size());
+  }
+
+  private static void runTarget(String target) {
+    String[] args = {
+        "-buildfile", DeployProcessTaskTest.class.getResource("build.xml").getPath(), target
+    };
+    new Main() {
+      protected void exit(int exitCode) {
+        // prevent ant from terminating the VM
+      }
+    }.startAnt(args, System.getProperties(), Thread.currentThread().getContextClassLoader());
+  }
+}

Modified: jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TimerOnTimerDbTest.java
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TimerOnTimerDbTest.java	2008-08-29 15:01:00 UTC (rev 2052)
+++ jbpm3/trunk/modules/jpdl/core/src/test/java/org/jbpm/job/executor/TimerOnTimerDbTest.java	2008-08-31 12:29:31 UTC (rev 2053)
@@ -40,10 +40,10 @@
 public class TimerOnTimerDbTest extends AbstractDbTestCase {
 
   public void testTimerOnTimer() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/job/executor/timerOnTimer.jpdl.xml");
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlResource("org/jbpm/job/executor/timerprocess.xml");
     jbpmContext.deployProcessDefinition(processDefinition);
 
-    ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("timerTest");
+    ProcessInstance processInstance = jbpmContext.newProcessInstanceForUpdate("timerProcess");
     processInstance.getContextInstance().setVariable("testCallback", new TestCallback());
     processInstance.signal();
     assertEquals("firstNode", processInstance.getRootToken().getNode().getName());

Added: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/badprocess.zip
===================================================================
(Binary files differ)


Property changes on: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/badprocess.zip
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/build.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/build.xml	                        (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/build.xml	2008-08-31 12:29:31 UTC (rev 2053)
@@ -0,0 +1,33 @@
+<project name="deploy.process" default="deploy.process">
+
+  <property name="process.dir" location="${ant.file}/.." />
+  <taskdef name="deployprocess" classname="org.jbpm.ant.DeployProcessTask" />
+
+  <target name="deploy.process">
+    <deployprocess jbpmcfg="org/jbpm/db/jbpm.db.test.cfg.xml" process="${process.dir}/timerprocess.zip" />
+  </target>
+
+  <target name="deploy.bad.process">
+    <deployprocess jbpmcfg="org/jbpm/db/jbpm.db.test.cfg.xml" process="${process.dir}/badprocess.zip" />
+  </target>
+
+  <target name="deploy.processes">
+    <deployprocess jbpmcfg="org/jbpm/db/jbpm.db.test.cfg.xml">
+      <fileset dir="${process.dir}">
+        <include name="timerprocess.zip"/>
+        <include name="classloadingprocess.zip" />
+      </fileset>
+    </deployprocess>
+  </target>
+
+  <target name="deploy.processes.including.bad">
+    <deployprocess jbpmcfg="org/jbpm/db/jbpm.db.test.cfg.xml">
+      <fileset dir="${process.dir}">
+        <include name="timerprocess.zip"/>
+        <include name="badprocess.zip"/>
+        <include name="classloadingprocess.zip" />
+      </fileset>
+    </deployprocess>
+  </target>
+
+</project>
\ No newline at end of file

Added: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/classloadingprocess.zip
===================================================================
(Binary files differ)


Property changes on: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/classloadingprocess.zip
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/timerprocess.zip
===================================================================
(Binary files differ)


Property changes on: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/ant/timerprocess.zip
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/.gpd.timerprocess.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/.gpd.timerprocess.xml	                        (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/.gpd.timerprocess.xml	2008-08-31 12:29:31 UTC (rev 2053)
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<root-container/>
\ No newline at end of file

Deleted: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerOnTimer.jpdl.xml
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerOnTimer.jpdl.xml	2008-08-29 15:01:00 UTC (rev 2052)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerOnTimer.jpdl.xml	2008-08-31 12:29:31 UTC (rev 2053)
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<process-definition name="timerTest" xmlns="urn:jbpm.org:jpdl-3.2"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="urn:jbpm.org:jpdl-3.2 http://jbpm.org/xsd/jpdl-3.2.xsd">
-
-  <event type="process-start">
-    <action expression="#{testCallback.processStart}"/>
-  </event>
-  <event type="process-end">
-    <action expression="#{testCallback.processEnd}"/>
-  </event>
-  <event type="node-enter">
-    <action expression="#{testCallback.nodeEnter}" />
-  </event>
-  <event type="node-leave">
-    <action expression="#{testCallback.nodeLeave}" />
-  </event>
-  <event type="task-create">
-    <action expression="#{testCallback.taskCreate}" />
-  </event>
-  <event type="task-end">
-    <action expression="#{testCallback.taskEnd}" />
-  </event>
-  <event type="timer-create">
-    <action expression="#{testCallback.timerCreate}" />
-  </event>
-  <event type="timer">
-    <action expression="#{testCallback.timer}"/>
-  </event>
-
-  <start-state name="start">
-    <transition name="doneStart" to="firstNode" />
-  </start-state>
-
-  <task-node name="firstNode" end-tasks="yes">
-    <task name="firstTask">
-      <assignment actor-id="admin" />
-      <timer duedate="1 second" transition="doneFirst" />
-    </task>
-    <transition name="doneFirst" to="secondNode" />
-  </task-node>
-
-  <task-node name="secondNode" end-tasks="yes">
-    <task name="secondTask">
-      <assignment actor-id="admin" />
-      <timer duedate="1 second" transition="doneSecond" />
-    </task>
-    <transition name="doneSecond" to="end" />
-  </task-node>
-
-  <end-state name="end" />
-
-</process-definition>
\ No newline at end of file

Copied: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerprocess.xml (from rev 2044, jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerOnTimer.jpdl.xml)
===================================================================
--- jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerprocess.xml	                        (rev 0)
+++ jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerprocess.xml	2008-08-31 12:29:31 UTC (rev 2053)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<process-definition name="timerProcess" xmlns="urn:jbpm.org:jpdl-3.2"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="urn:jbpm.org:jpdl-3.2 http://jbpm.org/xsd/jpdl-3.2.xsd">
+
+  <event type="process-start">
+    <action expression="#{testCallback.processStart}"/>
+  </event>
+  <event type="process-end">
+    <action expression="#{testCallback.processEnd}"/>
+  </event>
+  <event type="node-enter">
+    <action expression="#{testCallback.nodeEnter}" />
+  </event>
+  <event type="node-leave">
+    <action expression="#{testCallback.nodeLeave}" />
+  </event>
+
+  <start-state name="start">
+    <transition name="doneStart" to="firstNode" />
+  </start-state>
+
+  <task-node name="firstNode" end-tasks="yes">
+    <task name="firstTask">
+      <assignment actor-id="admin" />
+      <timer duedate="1 second" transition="doneFirst" />
+    </task>
+    <transition name="doneFirst" to="secondNode" />
+  </task-node>
+
+  <task-node name="secondNode" end-tasks="yes">
+    <task name="secondTask">
+      <assignment actor-id="admin" />
+      <timer duedate="1 second" transition="doneSecond" />
+    </task>
+    <transition name="doneSecond" to="end" />
+  </task-node>
+
+  <end-state name="end" />
+
+</process-definition>
\ No newline at end of file


Property changes on: jbpm3/trunk/modules/jpdl/core/src/test/resources/org/jbpm/job/executor/timerprocess.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + LF




More information about the jbpm-commits mailing list