[jbpm-commits] JBoss JBPM SVN: r4264 - in jbpm4/trunk/modules/enterprise: scripts and 10 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Mar 17 08:10:20 EDT 2009
Author: heiko.braun at jboss.com
Date: 2009-03-17 08:10:20 -0400 (Tue, 17 Mar 2009)
New Revision: 4264
Added:
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/Base64Coder.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestCase.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestServlet.java
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/HTTP.java
jbpm4/trunk/modules/enterprise/src/test/resources/command/
jbpm4/trunk/modules/enterprise/src/test/resources/command/META-INF/
jbpm4/trunk/modules/enterprise/src/test/resources/command/META-INF/application.xml
jbpm4/trunk/modules/enterprise/src/test/resources/command/WEB-INF/
jbpm4/trunk/modules/enterprise/src/test/resources/command/WEB-INF/jboss-web.xml
jbpm4/trunk/modules/enterprise/src/test/resources/command/WEB-INF/web.xml
jbpm4/trunk/modules/enterprise/src/test/resources/deployer/
jbpm4/trunk/modules/enterprise/src/test/resources/deployer/META-INF/
jbpm4/trunk/modules/enterprise/src/test/resources/deployer/META-INF/process.jpdl.xml
jbpm4/trunk/modules/enterprise/src/test/resources/deployer/WEB-INF/
jbpm4/trunk/modules/enterprise/src/test/resources/deployer/WEB-INF/web.xml
Removed:
jbpm4/trunk/modules/enterprise/src/test/resources/META-INF/
jbpm4/trunk/modules/enterprise/src/test/resources/WEB-INF/
Modified:
jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml
jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml
jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestHelper.java
Log:
Added deployer test case that verifies the AS installation
Modified: jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml
===================================================================
--- jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml 2009-03-17 11:58:31 UTC (rev 4263)
+++ jbpm4/trunk/modules/enterprise/jbpm4-enterprise.iml 2009-03-17 12:10:20 UTC (rev 4264)
@@ -5,9 +5,7 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
- <sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
- <sourceFolder url="file://$MODULE_DIR$/src/test/resources" isTestSource="true" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
Modified: jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml 2009-03-17 11:58:31 UTC (rev 4263)
+++ jbpm4/trunk/modules/enterprise/scripts/antrun-test-jars.xml 2009-03-17 12:10:20 UTC (rev 4264)
@@ -16,8 +16,9 @@
<mkdir dir="${build.dir}/test-libs"/>
- <war destfile="${build.dir}/test-libs/jbpm-enterprise-test.war" webxml="${test.resources.dir}/WEB-INF/web.xml">
- <webinf dir="${test.resources.dir}/WEB-INF">
+ <war destfile="${build.dir}/test-libs/jbpm-enterprise-test.war"
+ webxml="${test.resources.dir}/command/WEB-INF/web.xml">
+ <webinf dir="${test.resources.dir}/command/WEB-INF">
<exclude name="web.xml" />
</webinf>
<lib dir="${build.dir}/test-dependencies">
@@ -32,12 +33,13 @@
</war>
<jar destfile="${build.dir}/test-libs/jbpm-enterprise-test.jar">
- <fileset dir="${build.dir}/test-classes">
+ <fileset dir="${build.dir}/test-classes">
<include name="org/jbpm/enterprise/internal/custom/*" />
</fileset>
</jar>
- <ear destfile="${build.dir}/test-libs/jbpm-enterprise-test.ear" appxml="${test.resources.dir}/META-INF/application.xml">
+ <ear destfile="${build.dir}/test-libs/jbpm-enterprise-test.ear"
+ appxml="${test.resources.dir}/command/META-INF/application.xml">
<!-- build artifact -->
<fileset dir="${build.dir}" includes="${build.finalName}.jar" />
<!-- test modules -->
@@ -48,6 +50,25 @@
<!-- Please add alphabetically -->
- </target>
+ <jar destfile="${build.dir}/test-libs/jbpm-deployer-test.jar">
+ <fileset dir="${build.dir}/test-classes">
+ <include name="org/jbpm/test/deployer/*" />
+ </fileset>
+ <fileset dir="${build.dir}/test-classes/deployer">
+ <include name="META-INF/*" />
+ </fileset>
+ </jar>
+ <war destfile="${build.dir}/test-libs/jbpm-deployer-test.war"
+ webxml="${test.resources.dir}/deployer/WEB-INF/web.xml">
+ <webinf dir="${test.resources.dir}/deployer/WEB-INF">
+ <exclude name="web.xml" />
+ </webinf>
+ <classes dir="${build.dir}/test-classes">
+ <include name="org/jbpm/test/deployer/DeployerTestServlet.class" />
+ </classes>
+ </war>
+
+ </target>
+
</project>
\ No newline at end of file
Added: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/Base64Coder.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/Base64Coder.java (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/Base64Coder.java 2009-03-17 12:10:20 UTC (rev 4264)
@@ -0,0 +1,147 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.deployer;
+
+/**
+ * A Base64 Encoder/Decoder.
+ */
+class Base64Coder
+{
+
+ // Mapping table from 6-bit nibbles to Base64 characters.
+ private static char[] map1 = new char[64];
+ static {
+ int i=0;
+ for (char c='A'; c<='Z'; c++) map1[i++] = c;
+ for (char c='a'; c<='z'; c++) map1[i++] = c;
+ for (char c='0'; c<='9'; c++) map1[i++] = c;
+ map1[i++] = '+'; map1[i++] = '/'; }
+
+ // Mapping table from Base64 characters to 6-bit nibbles.
+ private static byte[] map2 = new byte[128];
+ static {
+ for (int i=0; i<map2.length; i++) map2[i] = -1;
+ for (int i=0; i<64; i++) map2[map1[i]] = (byte)i; }
+
+ /**
+ * Encodes a string into Base64 format.
+ * No blanks or line breaks are inserted.
+ * @param s a String to be encoded.
+ * @return A String with the Base64 encoded data.
+ */
+ public static String encodeString (String s) {
+ return new String(encode(s.getBytes())); }
+
+ /**
+ * Encodes a byte array into Base64 format.
+ * No blanks or line breaks are inserted.
+ * @param in an array containing the data bytes to be encoded.
+ * @return A character array with the Base64 encoded data.
+ */
+ public static char[] encode (byte[] in) {
+ return encode(in,in.length); }
+
+ /**
+ * Encodes a byte array into Base64 format.
+ * No blanks or line breaks are inserted.
+ * @param in an array containing the data bytes to be encoded.
+ * @param iLen number of bytes to process in <code>in</code>.
+ * @return A character array with the Base64 encoded data.
+ */
+ public static char[] encode (byte[] in, int iLen) {
+ int oDataLen = (iLen*4+2)/3; // output length without padding
+ int oLen = ((iLen+2)/3)*4; // output length including padding
+ char[] out = new char[oLen];
+ int ip = 0;
+ int op = 0;
+ while (ip < iLen) {
+ int i0 = in[ip++] & 0xff;
+ int i1 = ip < iLen ? in[ip++] & 0xff : 0;
+ int i2 = ip < iLen ? in[ip++] & 0xff : 0;
+ int o0 = i0 >>> 2;
+ int o1 = ((i0 & 3) << 4) | (i1 >>> 4);
+ int o2 = ((i1 & 0xf) << 2) | (i2 >>> 6);
+ int o3 = i2 & 0x3F;
+ out[op++] = map1[o0];
+ out[op++] = map1[o1];
+ out[op] = op < oDataLen ? map1[o2] : '='; op++;
+ out[op] = op < oDataLen ? map1[o3] : '='; op++; }
+ return out; }
+
+ /**
+ * Decodes a string from Base64 format.
+ * @param s a Base64 String to be decoded.
+ * @return A String containing the decoded data.
+ * @throws IllegalArgumentException if the input is not valid Base64 encoded data.
+ */
+ public static String decodeString (String s) {
+ return new String(decode(s)); }
+
+ /**
+ * Decodes a byte array from Base64 format.
+ * @param s a Base64 String to be decoded.
+ * @return An array containing the decoded data bytes.
+ * @throws IllegalArgumentException if the input is not valid Base64 encoded data.
+ */
+ public static byte[] decode (String s) {
+ return decode(s.toCharArray()); }
+
+ /**
+ * Decodes a byte array from Base64 format.
+ * No blanks or line breaks are allowed within the Base64 encoded data.
+ * @param in a character array containing the Base64 encoded data.
+ * @return An array containing the decoded data bytes.
+ * @throws IllegalArgumentException if the input is not valid Base64 encoded data.
+ */
+ public static byte[] decode (char[] in) {
+ int iLen = in.length;
+ if (iLen%4 != 0) throw new IllegalArgumentException ("Length of Base64 encoded input string is not a multiple of 4.");
+ while (iLen > 0 && in[iLen-1] == '=') iLen--;
+ int oLen = (iLen*3) / 4;
+ byte[] out = new byte[oLen];
+ int ip = 0;
+ int op = 0;
+ while (ip < iLen) {
+ int i0 = in[ip++];
+ int i1 = in[ip++];
+ int i2 = ip < iLen ? in[ip++] : 'A';
+ int i3 = ip < iLen ? in[ip++] : 'A';
+ if (i0 > 127 || i1 > 127 || i2 > 127 || i3 > 127)
+ throw new IllegalArgumentException ("Illegal character in Base64 encoded data.");
+ int b0 = map2[i0];
+ int b1 = map2[i1];
+ int b2 = map2[i2];
+ int b3 = map2[i3];
+ if (b0 < 0 || b1 < 0 || b2 < 0 || b3 < 0)
+ throw new IllegalArgumentException ("Illegal character in Base64 encoded data.");
+ int o0 = ( b0 <<2) | (b1>>>4);
+ int o1 = ((b1 & 0xf)<<4) | (b2>>>2);
+ int o2 = ((b2 & 3)<<6) | b3;
+ out[op++] = (byte)o0;
+ if (op<oLen) out[op++] = (byte)o1;
+ if (op<oLen) out[op++] = (byte)o2; }
+ return out; }
+
+ // Dummy constructor.
+ private Base64Coder() {}
+
+} // end class Base64Coder
Added: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestCase.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestCase.java (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestCase.java 2009-03-17 12:10:20 UTC (rev 4264)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.deployer;
+
+import junit.framework.TestCase;
+import org.jbpm.test.enterprise.IntegrationTestHelper;
+
+/**
+ * Verify that the deployer is installed correctly.
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DeployerTestCase extends TestCase
+{
+
+ IntegrationTestHelper testHelper = new IntegrationTestHelper();
+
+ private static final String TEST_WAR = "jbpm-deployer-test.war";
+ private static final String TEST_JAR = "jbpm-deployer-test.jar";
+
+ protected void setUp() throws Exception
+ {
+ testHelper.deploy(new String[]{TEST_WAR, TEST_JAR});
+ }
+
+ protected void tearDown() throws Exception
+ {
+ testHelper.undeploy(new String[]{TEST_WAR, TEST_JAR}, true);
+ }
+
+ public void testDeploymentExists()
+ {
+ String response =
+ HTTP.get("http://"+System.getProperty("jboss.bind.address")+":8080/jbpm-deployer-test", null);
+
+ assertEquals("OK", response);
+ }
+
+
+}
Added: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestServlet.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestServlet.java (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/DeployerTestServlet.java 2009-03-17 12:10:20 UTC (rev 4264)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.deployer;
+
+import org.jbpm.ProcessEngine;
+import org.jbpm.ProcessService;
+import org.jbpm.ProcessDefinition;
+
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletException;
+import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
+import javax.transaction.SystemException;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DeployerTestServlet extends HttpServlet
+{
+ private static final String JBPM_DEPLOYER_TEST_V5 = "JBPM-Deployer-Test_V5";
+
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException
+ {
+
+ UserTransaction tx = null;
+
+ try
+ {
+ InitialContext ctx = new InitialContext();
+ tx = (UserTransaction)ctx.lookup("UserTransaction");
+
+ tx.begin();
+
+ ProcessEngine processEngine = (ProcessEngine)ctx.lookup("java:/ProcessEngine");
+ ProcessService processService = processEngine.getProcessService();
+
+ ProcessDefinition def =
+ processService.findLatestProcessDefinitionByKey(JBPM_DEPLOYER_TEST_V5);
+
+ tx.commit();
+
+ String resultMsg = JBPM_DEPLOYER_TEST_V5 + " is not deployed";
+ if(def!=null)
+ resultMsg = "OK";
+
+ PrintWriter printWriter = resp.getWriter();
+ printWriter.write(resultMsg);
+ printWriter.flush();
+ }
+ catch (Throwable t)
+ {
+ if(tx!=null)
+ {
+ try
+ {
+ tx.rollback();
+ }
+ catch (SystemException e1) {}
+ }
+ throw new ServletException("Test failed", t);
+ }
+ }
+}
Added: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/HTTP.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/HTTP.java (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/deployer/HTTP.java 2009-03-17 12:10:20 UTC (rev 4264)
@@ -0,0 +1,207 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.deployer;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.UUID;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class HTTP
+{
+ public static String post(String urlString, InputStream inputStream, String[] credentials)
+ throws Exception
+ {
+
+ HttpURLConnection conn = null;
+ BufferedReader br = null;
+ DataOutputStream dos = null;
+ DataInputStream inStream = null;
+
+ InputStream is = null;
+ OutputStream os = null;
+ boolean ret = false;
+ String StrMessage = "";
+
+
+ String lineEnd = "\r\n";
+ String twoHyphens = "--";
+ String boundary = "*****";
+
+
+ int bytesRead, bytesAvailable, bufferSize;
+
+ byte[] buffer;
+
+ int maxBufferSize = 1*1024*1024;
+
+ String responseFromServer = "";
+
+ try
+ {
+ //------------------ CLIENT REQUEST
+
+ // open a URL connection to the Servlet
+
+ URL url = new URL(urlString);
+
+
+ // Open a HTTP connection to the URL
+
+ conn = (HttpURLConnection) url.openConnection();
+
+ if(credentials!=null)
+ applyCredentials(credentials, conn);
+
+ // Allow Inputs
+ conn.setDoInput(true);
+
+ // Allow Outputs
+ conn.setDoOutput(true);
+
+ // Don't use a cached copy.
+ conn.setUseCaches(false);
+
+ // Use a post method.
+ conn.setRequestMethod("POST");
+
+ conn.setRequestProperty("Connection", "Keep-Alive");
+
+ conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary);
+
+ dos = new DataOutputStream( conn.getOutputStream() );
+
+ dos.writeBytes(twoHyphens + boundary + lineEnd);
+ dos.writeBytes("Content-Disposition: form-data; name=\"upload\";"
+ + " filename=\"" + UUID.randomUUID().toString() +"\"" + lineEnd);
+ dos.writeBytes(lineEnd);
+
+ // create a buffer of maximum size
+ bytesAvailable = inputStream.available();
+ bufferSize = Math.min(bytesAvailable, maxBufferSize);
+ buffer = new byte[bufferSize];
+
+ // read file and write it into form...
+ bytesRead = inputStream.read(buffer, 0, bufferSize);
+
+ while (bytesRead > 0)
+ {
+ dos.write(buffer, 0, bufferSize);
+ bytesAvailable = inputStream.available();
+ bufferSize = Math.min(bytesAvailable, maxBufferSize);
+ bytesRead = inputStream.read(buffer, 0, bufferSize);
+ }
+
+ // send multipart form data necesssary after file data...
+
+ dos.writeBytes(lineEnd);
+ dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
+
+ // close streams
+
+ inputStream.close();
+ dos.flush();
+ dos.close();
+
+ }
+ catch (MalformedURLException ex)
+ {
+ throw ex;
+ }
+
+ catch (IOException ioe)
+ {
+ throw ioe;
+ }
+
+
+ //------------------ read the SERVER RESPONSE
+
+ StringBuffer sb = new StringBuffer();
+
+ try
+ {
+ inStream = new DataInputStream ( conn.getInputStream() );
+ String str;
+ while (( str = inStream.readLine()) != null)
+ {
+ sb.append(str).append("");
+ }
+ inStream.close();
+
+ }
+ catch (IOException ioex)
+ {
+ System.out.println("From (ServerResponse): "+ioex);
+
+ }
+
+
+ return sb.toString();
+
+ }
+
+ private static void applyCredentials(String[] credentials, HttpURLConnection conn)
+ {
+ String userPassword = credentials[0]+":"+credentials[1];
+ String encoding = new String(Base64Coder.encode (userPassword.getBytes()));
+ conn.setRequestProperty ("Authorization", "Basic " + encoding);
+ }
+
+ public static String get(String urlString, String[] credentials)
+ {
+ StringBuffer sb = new StringBuffer();
+ try
+ {
+ URL url = new URL(urlString);
+ HttpURLConnection conn = (HttpURLConnection) url.openConnection();
+ if(credentials!=null)
+ applyCredentials(credentials, conn);
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ String str;
+
+
+ while ((str = in.readLine()) != null)
+ {
+ sb.append(str);
+ }
+
+ in.close();
+ }
+ catch (MalformedURLException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+
+ return sb.toString();
+ }
+}
+
Modified: jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestHelper.java
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestHelper.java 2009-03-17 11:58:31 UTC (rev 4263)
+++ jbpm4/trunk/modules/enterprise/src/test/java/org/jbpm/test/enterprise/IntegrationTestHelper.java 2009-03-17 12:10:20 UTC (rev 4264)
@@ -47,6 +47,13 @@
private static MBeanServerConnection server;
private String integrationTarget;
+ public void deploy(String[] archives) throws Exception {
+ for(String archive : archives)
+ {
+ deploy(archive);
+ }
+ }
+
public void deploy(String archive) throws Exception {
URL url = getTestArchiveFile(archive).toURI().toURL();
deploy(url);
@@ -56,8 +63,36 @@
getDeployer().deploy(archive);
}
+ public void undeploy(String[] archives, boolean delete) throws Exception
+ {
+ for(String archive : archives)
+ {
+ undeploy(archive, delete);
+ }
+ }
+
+ public void undeploy(String[] archives) throws Exception
+ {
+ for(String archive : archives)
+ {
+ undeploy(archive);
+ }
+ }
+
public void undeploy(String archive) throws Exception {
- URL url = getTestArchiveFile(archive).toURI().toURL();
+ undeploy(archive, false);
+ }
+
+ public void undeploy(String archive, boolean deleteArchive) throws Exception {
+ File testArchiveFile = getTestArchiveFile(archive);
+ URL url = testArchiveFile.toURI().toURL();
+
+ if(deleteArchive)
+ {
+ // if not deleted the JBPMDeployer retains the process definition ;)
+ testArchiveFile.delete();
+ }
+
undeploy(url);
}
Added: jbpm4/trunk/modules/enterprise/src/test/resources/command/META-INF/application.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/command/META-INF/application.xml (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/command/META-INF/application.xml 2009-03-17 12:10:20 UTC (rev 4264)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<application version="5"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee">
+
+ <display-name>JBoss jBPM enterprise beans</display-name>
+
+ <module>
+ <web>
+ <web-uri>jbpm-enterprise-test.war</web-uri>
+ <context-root>/jbpm-enterprise-test</context-root>
+ </web>
+ </module>
+ <library-directory>lib</library-directory>
+
+</application>
Added: jbpm4/trunk/modules/enterprise/src/test/resources/command/WEB-INF/jboss-web.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/command/WEB-INF/jboss-web.xml (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/command/WEB-INF/jboss-web.xml 2009-03-17 12:10:20 UTC (rev 4264)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd" >
+<jboss-web>
+
+ <!--resource-ref>
+ <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
+ <jndi-name>java:ConnectionFactory</jndi-name>
+ </resource-ref-->
+
+</jboss-web>
Added: jbpm4/trunk/modules/enterprise/src/test/resources/command/WEB-INF/web.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/command/WEB-INF/web.xml (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/command/WEB-INF/web.xml 2009-03-17 12:10:20 UTC (rev 4264)
@@ -0,0 +1,43 @@
+<?xml version="1.0"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <servlet>
+ <servlet-name>ServletRedirector</servlet-name>
+ <servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ServletRedirector</servlet-name>
+ <url-pattern>/ServletRedirector</url-pattern>
+ </servlet-mapping>
+
+ <!--ejb-local-ref>
+ <ejb-ref-name>ejb/LocalCommandExecutor</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local-home>org.jbpm.enterprise.internal.ejb.LocalCommandExecutorHome</local-home>
+ <local>org.jbpm.enterprise.internal.ejb.LocalCommandExecutor</local>
+ <ejb-link>CommandExecutor</ejb-link>
+ </ejb-local-ref>
+
+ <ejb-local-ref>
+ <ejb-ref-name>ejb/LocalTimer</ejb-ref-name>
+ <ejb-ref-type>Entity</ejb-ref-type>
+ <local-home>org.jbpm.enterprise.internal.ejb.LocalTimerHome</local-home>
+ <local>org.jbpm.enterprise.internal.ejb.LocalTimer</local>
+ <ejb-link>Timer</ejb-link>
+ </ejb-local-ref>
+
+ <resource-ref>
+ <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
+ <res-type>javax.jms.ConnectionFactory</res-type>
+ <res-auth>Container</res-auth>
+ <res-sharing-scope>Shareable</res-sharing-scope>
+ </resource-ref>
+
+ <message-destination-ref>
+ <message-destination-ref-name>jms/CommandQueue</message-destination-ref-name>
+ <message-destination-type>javax.jms.Queue</message-destination-type>
+ <message-destination-usage>Produces</message-destination-usage>
+ <message-destination-link>CommandQueue</message-destination-link>
+ </message-destination-ref-->
+</web-app>
Added: jbpm4/trunk/modules/enterprise/src/test/resources/deployer/META-INF/process.jpdl.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/deployer/META-INF/process.jpdl.xml (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/deployer/META-INF/process.jpdl.xml 2009-03-17 12:10:20 UTC (rev 4264)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="JBPM-Deployer-Test"
+ xmlns="http://jbpm.org/4/jpdl"
+ version="5" key="JBPM-Deployer-Test_V5">
+ <start g="64,202,48,48" name="start1">
+ <transition g="-52,-18" name="to state1" to="state1"/>
+ </start>
+ <end g="430,199,48,48" name="end1"/>
+ <state g="227,203,92,52" name="state1">
+ <transition g="-46,-18" name="first transition" to="end1"/>
+ </state>
+</process>
\ No newline at end of file
Added: jbpm4/trunk/modules/enterprise/src/test/resources/deployer/WEB-INF/web.xml
===================================================================
--- jbpm4/trunk/modules/enterprise/src/test/resources/deployer/WEB-INF/web.xml (rev 0)
+++ jbpm4/trunk/modules/enterprise/src/test/resources/deployer/WEB-INF/web.xml 2009-03-17 12:10:20 UTC (rev 4264)
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+ <servlet>
+ <servlet-name>DeployerTestServlet</servlet-name>
+ <servlet-class>org.jbpm.test.deployer.DeployerTestServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>DeployerTestServlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+
+</web-app>
More information about the jbpm-commits
mailing list