Author: julien(a)jboss.com
Date: 2007-08-22 13:21:20 -0400 (Wed, 22 Aug 2007)
New Revision: 8035
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestCase.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriver.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverClient.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommand.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommandContext.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponse.java
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponseContext.java
Modified:
modules/test/trunk/test/src/resources/generic/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml
Log:
re added previous delete classes but with correct case
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestCase.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestCase.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestCase.java 2007-08-22
17:21:20 UTC (rev 8035)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * 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.portal.test.framework.driver.http;
+
+import org.jboss.portal.test.framework.driver.DriverResponse;
+import org.jboss.portal.test.framework.driver.DriverCommand;
+import org.jboss.portal.test.framework.driver.TestDriverException;
+import org.jboss.portal.test.framework.driver.command.StartTestCommand;
+import org.jboss.portal.test.framework.driver.response.ErrorResponse;
+import org.jboss.portal.test.framework.driver.http.response.InvokeGetResponse;
+import org.jboss.portal.test.framework.driver.remote.TestContext;
+import org.jboss.portal.test.framework.driver.remote.RemoteTestCase;
+
+/**
+ * Defines an http test case working from the server side point of view.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5636 $
+ */
+public abstract class HTTPTestCase extends RemoteTestCase
+{
+
+ /** The test path. */
+ protected final String path;
+
+ public HTTPTestCase(String testCaseId, String path)
+ {
+ super(testCaseId);
+
+ //
+ this.path = path;
+ }
+
+ /**
+ * The implementation will return an <code>InvokeGetResponse</code>
response in reaction to the <code>StartTestCommand</code>.
+ * All other commands will be delegated to the
<code>execute(DriverCommand,TestContext)</code>
+ */
+ public DriverResponse invoke(String testId, DriverCommand cmd) throws
TestDriverException
+ {
+ if (cmd instanceof StartTestCommand)
+ {
+ return new InvokeGetResponse(path);
+ }
+ else
+ {
+ try
+ {
+ return execute(cmd, context);
+ }
+ catch (Exception e)
+ {
+ return new ErrorResponse(e);
+ }
+ }
+ }
+
+ public DriverResponse execute(DriverCommand driverCommand, TestContext testContext)
throws Exception
+ {
+ return new ErrorResponse("No default implementation");
+ }
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestContext.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestContext.java 2007-08-22
17:21:20 UTC (rev 8035)
@@ -0,0 +1,108 @@
+/******************************************************************************
+ * 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.portal.test.framework.driver.http;
+
+import org.jboss.portal.test.framework.driver.remote.TestContext;
+import org.jboss.portal.test.framework.driver.DriverResponse;
+import org.jboss.portal.test.framework.TestParametrization;
+
+/**
+ * The test context seen from the server side.
+ * @todo make a client side context and a server side context, basically (server side
context == client side context + services)
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5498 $
+ */
+public class HTTPTestContext extends TestContext
+{
+
+ /**
+ * Return the current test case context.
+ *
+ * @return the current test context
+ * @throws IllegalStateException if there is no current context
+ */
+ public static HTTPTestContext getCurrentContext() throws IllegalStateException
+ {
+ throw new UnsupportedOperationException("Don't use this API");
+ }
+
+ /**
+ * Return the current test case context or null if none exist.
+ *
+ * @return the current test context
+ */
+ public static HTTPTestContext peekCurrentContext()
+ {
+ throw new UnsupportedOperationException("Don't use this API");
+ }
+
+ /**
+ * Set the current context.
+ *
+ * @param newContext the test case context
+ */
+ public static void setCurrentContext(HTTPTestContext newContext)
+ {
+ throw new UnsupportedOperationException("Don't use this API");
+ }
+
+ public static boolean isCurrentRequestCount(int count) throws IllegalStateException
+ {
+ return getCurrentContext().requestCount == count;
+ }
+
+ public static int getCurrentRequestCount() throws IllegalStateException
+ {
+ return getCurrentContext().requestCount;
+ }
+
+ public static DriverResponse getCurrentResponse() throws IllegalStateException
+ {
+ HTTPTestContext ctx = getCurrentContext();
+ if (ctx != null)
+ {
+ return ctx.response;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static void setCurrentResponse(DriverResponse currentResponse) throws
IllegalStateException
+ {
+ HTTPTestContext ctx = getCurrentContext();
+ ctx.setResponse(currentResponse);
+ }
+
+ public HTTPTestContext(TestContext that)
+ {
+ super(that);
+ }
+
+ public HTTPTestContext(int requestCount, String archivePath, TestParametrization
parametrization)
+ {
+ super(requestCount, archivePath, parametrization);
+ }
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriver.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriver.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriver.java 2007-08-22
17:21:20 UTC (rev 8035)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * 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.portal.test.framework.driver.http;
+
+import org.jboss.portal.test.framework.driver.remote.RemoteTestDriver;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface HTTPTestDriver extends RemoteTestDriver
+{
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverClient.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverClient.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HTTPTestDriverClient.java 2007-08-22
17:21:20 UTC (rev 8035)
@@ -0,0 +1,39 @@
+/******************************************************************************
+ * 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.portal.test.framework.driver.http;
+
+import org.jboss.portal.test.framework.driver.remote.RemoteTestDriverClient;
+import org.jboss.portal.test.framework.driver.remote.TestConversation;
+import org.jboss.portal.test.framework.server.Node;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class HTTPTestDriverClient extends RemoteTestDriverClient
+{
+ protected TestConversation createConversation(String testId, Node node)
+ {
+ return new HTTPTestConversation(this, testId, node);
+ }
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommand.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommand.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommand.java 2007-08-22
17:21:20 UTC (rev 8035)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * 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.portal.test.framework.driver.http.command;
+
+import org.jboss.portal.test.framework.driver.DriverCommand;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class HTTPDriverCommand extends DriverCommand
+{
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommandContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommandContext.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/command/HTTPDriverCommandContext.java 2007-08-22
17:21:20 UTC (rev 8035)
@@ -0,0 +1,46 @@
+/******************************************************************************
+ * 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.portal.test.framework.driver.http.command;
+
+import org.jboss.portal.test.framework.driver.DriverCommand;
+import org.jboss.portal.test.framework.driver.remote.command.RemoteDriverCommandContext;
+import
org.jboss.portal.test.framework.driver.remote.response.RemoteDriverResponseContext;
+
+/**
+ * The context of the command invoked by the client.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class HTTPDriverCommandContext extends RemoteDriverCommandContext
+{
+ public HTTPDriverCommandContext(RemoteDriverResponseContext responseContext,
DriverCommand command)
+ {
+ super(responseContext, command);
+ }
+
+ public HTTPDriverCommandContext(DriverCommand command)
+ {
+ super(command);
+ }
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponse.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponse.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponse.java 2007-08-22
17:21:20 UTC (rev 8035)
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * 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.portal.test.framework.driver.http.response;
+
+import org.jboss.portal.test.framework.driver.DriverResponse;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class HTTPDriverResponse extends DriverResponse
+{
+}
Added:
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponseContext.java
===================================================================
---
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponseContext.java
(rev 0)
+++
modules/test/trunk/test/src/main/org/jboss/portal/test/framework/driver/http/response/HTTPDriverResponseContext.java 2007-08-22
17:21:20 UTC (rev 8035)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * 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.portal.test.framework.driver.http.response;
+
+import org.apache.commons.httpclient.HttpMethod;
+import org.jboss.portal.test.framework.driver.DriverResponse;
+import
org.jboss.portal.test.framework.driver.remote.response.RemoteDriverResponseContext;
+
+/**
+ * The context of the response received by the client.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class HTTPDriverResponseContext extends RemoteDriverResponseContext
+{
+
+ /** The http method if not null. */
+ private HttpMethod httpMethod;
+
+ public HTTPDriverResponseContext(HttpMethod httpMethod, DriverResponse response)
+ {
+ super(response);
+
+ //
+ this.httpMethod = httpMethod;
+ }
+
+ public HTTPDriverResponseContext(DriverResponse response)
+ {
+ this(null, response);
+ }
+
+ public HttpMethod getHttpMethod()
+ {
+ return httpMethod;
+ }
+}
Modified:
modules/test/trunk/test/src/resources/generic/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml
===================================================================
---
modules/test/trunk/test/src/resources/generic/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml 2007-08-22
17:18:22 UTC (rev 8034)
+++
modules/test/trunk/test/src/resources/generic/portal-test-jar/org/jboss/portal/test/framework/container/http-runner-beans.xml 2007-08-22
17:21:20 UTC (rev 8035)
@@ -46,7 +46,7 @@
<constructor>
<parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
<parameter><value>portal.test:service=TestDriverServer</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.driver.http.HttpTestDriver</value></parameter>
+
<parameter><value>org.jboss.portal.test.framework.driver.http.HTTPTestDriver</value></parameter>
</constructor>
</bean>
@@ -62,7 +62,7 @@
<constructor>
<parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
<parameter><value>portal.test:service=TestDriverServer</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.driver.http.HttpTestDriver</value></parameter>
+
<parameter><value>org.jboss.portal.test.framework.driver.http.HTTPTestDriver</value></parameter>
</constructor>
</bean>
@@ -78,7 +78,7 @@
<constructor>
<parameter><inject bean="MBeanServerFactory0"
property="server"/></parameter>
<parameter><value>portal.test:service=TestDriverServer</value></parameter>
-
<parameter><value>org.jboss.portal.test.framework.driver.http.HttpTestDriver</value></parameter>
+
<parameter><value>org.jboss.portal.test.framework.driver.http.HTTPTestDriver</value></parameter>
</constructor>
</bean>