Author: bdaw
Date: 2008-01-22 10:33:59 -0500 (Tue, 22 Jan 2008)
New Revision: 9559
Added:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeader.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeaders.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpRequest.java
Modified:
modules/test/trunk/remote/pom.xml
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPHandler.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoGetCommand.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoMethodCommand.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoPostCommand.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokeMethodResponse.java
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokePostResponse.java
modules/test/trunk/tooling/examples/maven2/pom.xml
Log:
Remove JBoss Unit dependency on portal common module
Modified: modules/test/trunk/remote/pom.xml
===================================================================
--- modules/test/trunk/remote/pom.xml 2008-01-22 15:18:20 UTC (rev 9558)
+++ modules/test/trunk/remote/pom.xml 2008-01-22 15:33:59 UTC (rev 9559)
@@ -22,10 +22,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.jboss.portal.common</groupId>
- <artifactId>common-common</artifactId>
- </dependency>
- <dependency>
<groupId>apache-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</dependency>
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java 2008-01-22
15:18:20 UTC (rev 9558)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java 2008-01-22
15:33:59 UTC (rev 9559)
@@ -35,9 +35,9 @@
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.apache.log4j.Logger;
-import org.jboss.portal.common.http.HttpRequest;
-import org.jboss.portal.common.http.HttpHeaders;
-import org.jboss.portal.common.http.HttpHeader;
+import org.jboss.unit.remote.http.HttpRequest;
+import org.jboss.unit.remote.http.HttpHeaders;
+import org.jboss.unit.remote.http.HttpHeader;
import org.jboss.portal.test.framework.server.Node;
import org.jboss.unit.remote.driver.handler.http.command.DoMethodCommand;
import org.jboss.unit.remote.driver.handler.http.command.DoPostCommand;
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPHandler.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPHandler.java 2008-01-22
15:18:20 UTC (rev 9558)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/HTTPHandler.java 2008-01-22
15:33:59 UTC (rev 9559)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http;
-import org.jboss.portal.common.http.HttpRequest;
+import org.jboss.unit.remote.http.HttpRequest;
import org.jboss.unit.remote.driver.RemoteDriverResponseContext;
import org.jboss.unit.remote.driver.RemoteDriverCommandContext;
import org.jboss.unit.remote.driver.ProtocolHandler;
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoGetCommand.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoGetCommand.java 2008-01-22
15:18:20 UTC (rev 9558)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoGetCommand.java 2008-01-22
15:33:59 UTC (rev 9559)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http.command;
-import org.jboss.portal.common.http.HttpHeaders;
+import org.jboss.unit.remote.http.HttpHeaders;
import java.net.URI;
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoMethodCommand.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoMethodCommand.java 2008-01-22
15:18:20 UTC (rev 9558)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoMethodCommand.java 2008-01-22
15:33:59 UTC (rev 9559)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http.command;
-import org.jboss.portal.common.http.HttpHeaders;
+import org.jboss.unit.remote.http.HttpHeaders;
import java.net.URI;
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoPostCommand.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoPostCommand.java 2008-01-22
15:18:20 UTC (rev 9558)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/command/DoPostCommand.java 2008-01-22
15:33:59 UTC (rev 9559)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http.command;
-import org.jboss.portal.common.http.HttpRequest;
+import org.jboss.unit.remote.http.HttpRequest;
import java.net.URI;
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokeMethodResponse.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokeMethodResponse.java 2008-01-22
15:18:20 UTC (rev 9558)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokeMethodResponse.java 2008-01-22
15:33:59 UTC (rev 9559)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http.response;
-import org.jboss.portal.common.http.HttpHeaders;
-import org.jboss.portal.common.http.HttpHeader;
+import org.jboss.unit.remote.http.HttpHeaders;
+import org.jboss.unit.remote.http.HttpHeader;
import java.net.URI;
import java.net.URISyntaxException;
Modified:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokePostResponse.java
===================================================================
---
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokePostResponse.java 2008-01-22
15:18:20 UTC (rev 9558)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/driver/handler/http/response/InvokePostResponse.java 2008-01-22
15:33:59 UTC (rev 9559)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.remote.driver.handler.http.response;
-import org.jboss.portal.common.http.HttpRequest;
+import org.jboss.unit.remote.http.HttpRequest;
import java.net.URI;
Added: modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeader.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeader.java
(rev 0)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeader.java 2008-01-22
15:33:59 UTC (rev 9559)
@@ -0,0 +1,243 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.jboss.unit.remote.http;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * Modelize an http header structure.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+public class HttpHeader implements Serializable
+{
+
+ /** . */
+ private String name;
+
+ /** . */
+ private List elements = new ArrayList();
+
+ public HttpHeader(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Element addElement(String name)
+ {
+ return addElement(new Element(name));
+ }
+
+ public Element addElement(String name, String value)
+ {
+ return addElement(new Element(name, value));
+ }
+
+ public Element addElement(Element element)
+ {
+ if (element == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ elements.add(element);
+ return element;
+ }
+
+ public Element getElement()
+ {
+ if (elements.size() > 0)
+ {
+ return (Element)elements.get(0);
+ }
+ return null;
+ }
+
+ public Iterator elements()
+ {
+ return elements.iterator();
+ }
+
+ /** An element of an header */
+ public static class Element implements Serializable
+ {
+ /** The mandatory name. */
+ private String name;
+
+ /** The optional value. */
+ private String value;
+
+ /** The params. */
+ private List params;
+
+ public Element(String name)
+ {
+ this(name, null);
+ }
+
+ public Element(String name, String value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.name = name;
+ this.value = value;
+ this.params = new ArrayList();
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public Param addParam(String name)
+ {
+ return addParam(new Param(name));
+ }
+
+ public Param addParam(String name, String value)
+ {
+ return addParam(new Param(name, value));
+ }
+
+ public Param addParam(Param param)
+ {
+ if (param == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ params.add(param);
+ return param;
+ }
+
+ /**
+ * Return the first param of this element or null.
+ *
+ * @return the first param
+ */
+ public Param getParam()
+ {
+ if (params.size() > 0)
+ {
+ return (Param)params.get(0);
+ }
+ return null;
+ }
+
+ /**
+ * Returns an iterator over the params.
+ *
+ * @return a param iterator
+ */
+ public Iterator params()
+ {
+ return params.iterator();
+ }
+
+ /** A param of an element. */
+ public static class Param implements Serializable
+ {
+ /** The mandatory name. */
+ private String name;
+
+ /** The optional value. */
+ private String value;
+
+ public Param(String name)
+ {
+ this(name, null);
+ }
+
+ public Param(String name, String value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+ }
+ }
+
+ public String getValue()
+ {
+ StringBuffer buffer = new StringBuffer();
+ for (Iterator j = elements(); j.hasNext();)
+ {
+ HttpHeader.Element elt = (HttpHeader.Element)j.next();
+ buffer.append(elt.getName());
+ if (elt.getValue() != null)
+ {
+ buffer.append("=").append(elt.getValue());
+ }
+ for (Iterator k = elt.params(); k.hasNext();)
+ {
+ HttpHeader.Element.Param param = (HttpHeader.Element.Param)k.next();
+ buffer.append(";").append(param.getName());
+ if (param.getValue() != null)
+ {
+ buffer.append("=").append(param.getValue());
+ }
+ }
+ if (j.hasNext())
+ {
+ buffer.append(",");
+ }
+ }
+ return buffer.toString();
+ }
+
+ public String toString()
+ {
+ return name + ": " + getValue();
+ }
+}
+
Added:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeaders.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeaders.java
(rev 0)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpHeaders.java 2008-01-22
15:33:59 UTC (rev 9559)
@@ -0,0 +1,90 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.jboss.unit.remote.http;
+import org.jboss.unit.remote.http.*;
+import org.jboss.unit.remote.http.HttpHeader;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+public class HttpHeaders implements Serializable
+{
+
+ /** . */
+ private List headers = new ArrayList();
+
+ public HttpHeader addHeader(String name)
+ {
+ return addHeader(new HttpHeader(name));
+ }
+
+ public HttpHeader addHeader(HttpHeader header)
+ {
+ if (header == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ headers.add(header);
+ return header;
+ }
+
+ public HttpHeader getHeader(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ for (Iterator i = headers.iterator(); i.hasNext();)
+ {
+ HttpHeader header = (HttpHeader)i.next();
+ if (header.getName().equals(name))
+ {
+ return header;
+ }
+ }
+ return null;
+ }
+
+ public Iterator headers()
+ {
+ return headers.iterator();
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+ for (Iterator i = headers.iterator(); i.hasNext();)
+ {
+ HttpHeader header = (HttpHeader)i.next();
+ buffer.append(header.toString());
+ buffer.append("\n");
+ }
+ return buffer.toString();
+ }
+}
Added:
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpRequest.java
===================================================================
--- modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpRequest.java
(rev 0)
+++
modules/test/trunk/remote/src/main/java/org/jboss/unit/remote/http/HttpRequest.java 2008-01-22
15:33:59 UTC (rev 9559)
@@ -0,0 +1,112 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2006, Red Hat Middleware, LLC, 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.jboss.unit.remote.http;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Just used to define the request body.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+public class HttpRequest implements Serializable
+{
+
+ public abstract static class Body implements Serializable
+ {
+ }
+
+ public static class Raw extends Body
+ {
+
+ /** . */
+ private byte[] bytes;
+
+ public byte[] getBytes()
+ {
+ return bytes;
+ }
+
+ public void setBytes(byte[] bytes)
+ {
+ this.bytes = bytes;
+ }
+ }
+
+ public static class Form extends Body
+ {
+
+ /** . */
+ private Map parameters = new HashMap();
+
+ public void addParameter(String name, String[] values)
+ {
+ if (name == null)
+ {
+ throw new IllegalStateException();
+ }
+ if (values == null)
+ {
+ throw new IllegalStateException();
+ }
+ for (int i = 0; i < values.length; i++)
+ {
+ String value = values[i];
+ if (value == null)
+ {
+ throw new IllegalStateException();
+ }
+ }
+ parameters.put(name, values.clone());
+ }
+
+ public void removeParameter(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalStateException();
+ }
+ parameters.remove(name);
+ }
+
+ public Set getParameterNames()
+ {
+ return Collections.unmodifiableSet(parameters.keySet());
+ }
+
+ public String[] getParameterValues(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalStateException();
+ }
+ String[] values = (String[])parameters.get(name);
+ return (String[])values.clone();
+ }
+ }
+}
Modified: modules/test/trunk/tooling/examples/maven2/pom.xml
===================================================================
--- modules/test/trunk/tooling/examples/maven2/pom.xml 2008-01-22 15:18:20 UTC (rev 9558)
+++ modules/test/trunk/tooling/examples/maven2/pom.xml 2008-01-22 15:33:59 UTC (rev 9559)
@@ -50,9 +50,12 @@
</executions>
<configuration>
- <jpda>true</jpda>
- <!--<jpdaPort>9000</jpdaPort>
- <jpdaSuspend>true</jpdaSuspend>-->
+ <!--Uncomment if needed-->
+ <!--<jpda>false</jpda>-->
+ <!--<jpdaPort>9000</jpdaPort>-->
+ <!--<jpdaSuspend>true</jpdaSuspend>-->
+ <!--<failOnError>false</failOnError>-->
+ <!--<assertions>true</assertions>-->
<testsuites>
<testsuite>