[jbpm-commits] JBoss JBPM SVN: r5653 - jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Sep 17 08:05:43 EDT 2009


Author: jbarrez
Date: 2009-09-17 08:05:43 -0400 (Thu, 17 Sep 2009)
New Revision: 5653

Added:
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/DeploymentResourceTest.java
Log:
Test for deployment through zip file

Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/DeploymentResourceTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/DeploymentResourceTest.java	                        (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/DeploymentResourceTest.java	2009-09-17 12:05:43 UTC (rev 5653)
@@ -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.test.deploy;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.zip.ZipInputStream;
+
+import org.jbpm.api.NewDeployment;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * Test case for the various ways of setting a process, image, etc as input
+ * of a deployment.
+ * 
+ * @author Joram Barrez
+ */
+public class DeploymentResourceTest extends JbpmTestCase {
+
+  
+  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());
+        }
+      }
+    }
+    
+  }
+  
+}



More information about the jbpm-commits mailing list