[jboss-svn-commits] JBoss Portal SVN: r5571 - in trunk: common/src/main/org/jboss/portal/common/test/driver common/src/main/org/jboss/portal/common/test/driver/command common/src/main/org/jboss/portal/common/test/junit portlet/src/main/org/jboss/portal/test/framework/portlet server/src/main/org/jboss/portal/test/framework/server/driver server/src/main/org/jboss/portal/test/server test/src/main/org/jboss/portal/test/framework/driver/http test/src/main/org/jboss/portal/test/framework/runner wsrp/src/main/org/jboss/portal/test/wsrp

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Nov 3 09:03:21 EST 2006


Author: julien at jboss.com
Date: 2006-11-03 09:03:04 -0500 (Fri, 03 Nov 2006)
New Revision: 5571

Modified:
   trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriver.java
   trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java
   trunk/common/src/main/org/jboss/portal/common/test/junit/JUnitAdapter.java
   trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java
   trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/SequenceRegistry.java
   trunk/server/src/main/org/jboss/portal/test/framework/server/driver/AbstractTest.java
   trunk/server/src/main/org/jboss/portal/test/framework/server/driver/HttpTestDriverRegistryService.java
   trunk/server/src/main/org/jboss/portal/test/server/TestRequestController.java
   trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriverClient.java
   trunk/test/src/main/org/jboss/portal/test/framework/runner/BaseRunner.java
   trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java
Log:
add the target testid in the invoke method of the testdriver instead of being part of the StartTestCommand

Modified: trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriver.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriver.java	2006-11-03 13:17:41 UTC (rev 5570)
+++ trunk/common/src/main/org/jboss/portal/common/test/driver/TestDriver.java	2006-11-03 14:03:04 UTC (rev 5571)
@@ -40,5 +40,5 @@
    /**
     * Execute a command of the testing protocol. 
     */
-   DriverResponse invoke(DriverCommand command) throws TestDriverException;
+   DriverResponse invoke(String testId, DriverCommand command) throws TestDriverException;
 }

Modified: trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java	2006-11-03 13:17:41 UTC (rev 5570)
+++ trunk/common/src/main/org/jboss/portal/common/test/driver/command/StartTestCommand.java	2006-11-03 14:03:04 UTC (rev 5571)
@@ -35,41 +35,22 @@
 {
 
    /** . */
-   private String testId;
-
-   /** . */
    private TestParametrization parametrization;
 
    /**
-    * @param testId the test id
     * @param parametrization the test parametrization
     * @throws IllegalArgumentException if the test name or the parametrization is null
     */
-   public StartTestCommand(String testId, TestParametrization parametrization) throws IllegalArgumentException
+   public StartTestCommand(TestParametrization parametrization) throws IllegalArgumentException
    {
-      if (testId == null)
-      {
-         throw new IllegalArgumentException();
-      }
       if (parametrization == null)
       {
          throw new IllegalArgumentException();
       }
-      this.testId = testId;
       this.parametrization = parametrization;
    }
 
    /**
-    * Return the test id.
-    *
-    * @return the test id
-    */
-   public String getTestId()
-   {
-      return testId;
-   }
-
-   /**
     * Return the test parametrization.
     *
     * @return the test parametrization

Modified: trunk/common/src/main/org/jboss/portal/common/test/junit/JUnitAdapter.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/junit/JUnitAdapter.java	2006-11-03 13:17:41 UTC (rev 5570)
+++ trunk/common/src/main/org/jboss/portal/common/test/junit/JUnitAdapter.java	2006-11-03 14:03:04 UTC (rev 5571)
@@ -117,8 +117,8 @@
                   public void runBare() throws Throwable
                   {
                      String testId = testInfo.getId(info);
-                     StartTestCommand st = new StartTestCommand(testId, parametrization);
-                     DriverResponse resp = driver.invoke(st);
+                     StartTestCommand st = new StartTestCommand(parametrization);
+                     DriverResponse resp = driver.invoke(testId, st);
                      if (resp instanceof FailureResponse)
                      {
                         FailureResponse fr = (FailureResponse)resp;

Modified: trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java	2006-11-03 13:17:41 UTC (rev 5570)
+++ trunk/common/src/main/org/jboss/portal/common/test/junit/POJOJUnitTest.java	2006-11-03 14:03:04 UTC (rev 5571)
@@ -107,7 +107,7 @@
       return containerInfo;
    }
 
-   public DriverResponse invoke(DriverCommand command) throws TestDriverException
+   public DriverResponse invoke(String testId, DriverCommand command) throws TestDriverException
    {
       StartTestCommand start = (StartTestCommand)command;
 
@@ -125,7 +125,7 @@
          }
 
          // Get corresponding test info
-         TestInfo testInfo = (TestInfo)containerInfo.findItem(start.getTestId());
+         TestInfo testInfo = (TestInfo)containerInfo.findItem(testId);
 
          // Contextualize
          TestParametrization parametrization = start.getParametrization();
@@ -160,7 +160,7 @@
          }
 
          // Invoke test joinpoint
-         Method method = (Method)testMap.get(start.getTestId());
+         Method method = (Method)testMap.get(testId);
          method.invoke(test, new Object[0]);
          return new EndTestResponse();
       }

Modified: trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/SequenceRegistry.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/SequenceRegistry.java	2006-11-03 13:17:41 UTC (rev 5570)
+++ trunk/portlet/src/main/org/jboss/portal/test/framework/portlet/SequenceRegistry.java	2006-11-03 14:03:04 UTC (rev 5571)
@@ -28,7 +28,6 @@
 import org.jboss.portal.common.test.driver.DriverResponse;
 import org.jboss.portal.common.test.driver.DriverCommand;
 import org.jboss.portal.common.test.driver.TestDriverException;
-import org.jboss.portal.common.test.driver.command.StartTestCommand;
 import org.jboss.portal.test.framework.driver.http.response.InvokeGetResponse;
 import org.jboss.portal.test.framework.driver.http.HttpTestDriverServer;
 import org.jboss.portal.test.framework.driver.http.HttpTestContext;
@@ -106,11 +105,9 @@
       return container;
    }
 
-   public DriverResponse invoke(DriverCommand command) throws TestDriverException
+   public DriverResponse invoke(String testId, DriverCommand command) throws TestDriverException
    {
-      StartTestCommand start = (StartTestCommand)command;
-      String testName = start.getTestId();
-      TestInfo info = (TestInfo)getInfo().findItem(testName);
+      TestInfo info = (TestInfo)getInfo().findItem(testId);
       return new InvokeGetResponse("/test/" + info.getName());
    }
 

Modified: trunk/server/src/main/org/jboss/portal/test/framework/server/driver/AbstractTest.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/framework/server/driver/AbstractTest.java	2006-11-03 13:17:41 UTC (rev 5570)
+++ trunk/server/src/main/org/jboss/portal/test/framework/server/driver/AbstractTest.java	2006-11-03 14:03:04 UTC (rev 5571)
@@ -56,7 +56,7 @@
    /** The test info. */
    private HttpTestContext context;
 
-   public DriverResponse invoke(DriverCommand cmd) throws TestDriverException
+   public DriverResponse invoke(String testId, DriverCommand cmd) throws TestDriverException
    {
       if (cmd instanceof StartTestCommand)
       {
@@ -143,16 +143,4 @@
     *
     */
    public abstract DriverResponse execute(ServerInvocation invocation, HttpTestContext testContext);
-
-   /** Get the test id from the class name. It can be overriden. */
-   protected String createCaseTestId(Class clazz)
-   {
-      String s = clazz.getName();
-      int index = s.lastIndexOf('.');
-      if (index != -1)
-      {
-         s = s.substring(index + 1);
-      }
-      return s;
-   }
 }

Modified: trunk/server/src/main/org/jboss/portal/test/framework/server/driver/HttpTestDriverRegistryService.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/framework/server/driver/HttpTestDriverRegistryService.java	2006-11-03 13:17:41 UTC (rev 5570)
+++ trunk/server/src/main/org/jboss/portal/test/framework/server/driver/HttpTestDriverRegistryService.java	2006-11-03 14:03:04 UTC (rev 5571)
@@ -132,14 +132,10 @@
       return (TestDriver)_entries.get(currentInfo.getName());
    }
 
-   public DriverResponse invoke(DriverCommand cmd) throws TestDriverException
+   public DriverResponse invoke(String testId, DriverCommand cmd) throws TestDriverException
    {
       if (cmd instanceof StartTestCommand)
       {
-         StartTestCommand stc = (StartTestCommand)cmd;
-         String testId = stc.getTestId();
-
-         //
          TestItemInfo item = _container.findItem(testId);
          if (item == null)
          {
@@ -149,10 +145,9 @@
          // Get associated test driver
          TestDriver driver = getDriver(testId);
 
-         //
-         String testId2 = item.getId(driver.getInfo());
-         StartTestCommand cmd2 = new StartTestCommand(testId2, stc.getParametrization());
-         return driver.invoke(cmd2);
+         // Route the command to the target driver
+         String newTestId = item.getId(driver.getInfo());
+         return driver.invoke(newTestId, cmd);
       }
       else
       {

Modified: trunk/server/src/main/org/jboss/portal/test/server/TestRequestController.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/test/server/TestRequestController.java	2006-11-03 13:17:41 UTC (rev 5570)
+++ trunk/server/src/main/org/jboss/portal/test/server/TestRequestController.java	2006-11-03 14:03:04 UTC (rev 5571)
@@ -89,15 +89,14 @@
       super.destroy();
    }
 
-   public DriverResponse invoke(DriverCommand cmd) throws TestDriverException
+   public DriverResponse invoke(String testId, DriverCommand cmd) throws TestDriverException
    {
-      DriverResponse response = super.invoke(cmd);
+      DriverResponse response = super.invoke(testId, cmd);
 
       //
       if (cmd instanceof StartTestCommand)
       {
-         StartTestCommand stc = (StartTestCommand)cmd;
-         currentTestId = stc.getTestId();
+         currentTestId = testId;
       }
 
       return response;

Modified: trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriverClient.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriverClient.java	2006-11-03 13:17:41 UTC (rev 5570)
+++ trunk/test/src/main/org/jboss/portal/test/framework/driver/http/HttpTestDriverClient.java	2006-11-03 14:03:04 UTC (rev 5571)
@@ -139,25 +139,24 @@
       return server.getInfo();
    }
 
-   public DriverResponse invoke(DriverCommand cmd) throws TestDriverException
+   public DriverResponse invoke(String testId, DriverCommand cmd) throws TestDriverException
    {
       try
       {
          if (cmd instanceof StartTestCommand)
          {
-            StartTestCommand st = (StartTestCommand)cmd;
             Node node = nodeManager.getNode(initialNodeId);
 
             // Setup context
-            HttpTestContext ctx = new HttpTestContext(st.getTestId(), -1, archivePath);
-            getServer().updateContext(st.getTestId(), ctx);
+            HttpTestContext ctx = new HttpTestContext(testId, -1, archivePath);
+            getServer().updateContext(testId, ctx);
 
             //
-            DriverResponse resp = getServer().invoke(cmd);
+            DriverResponse resp = getServer().invoke(testId, cmd);
             if (resp instanceof HttpResponse)
             {
                HttpResponse httpResp = (HttpResponse)resp;
-               HttpConversation conversation = new HttpConversation(st.getTestId(), node);
+               HttpConversation conversation = new HttpConversation(testId, node);
                return conversation.handleHttpResponse(httpResp);
             }
             return resp;

Modified: trunk/test/src/main/org/jboss/portal/test/framework/runner/BaseRunner.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/runner/BaseRunner.java	2006-11-03 13:17:41 UTC (rev 5570)
+++ trunk/test/src/main/org/jboss/portal/test/framework/runner/BaseRunner.java	2006-11-03 14:03:04 UTC (rev 5571)
@@ -37,7 +37,6 @@
 import junit.framework.Test;
 import junit.framework.TestResult;
 import junit.framework.TestCase;
-import junit.framework.AssertionFailedError;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>

Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java	2006-11-03 13:17:41 UTC (rev 5570)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/WSRPBaseTest.java	2006-11-03 14:03:04 UTC (rev 5571)
@@ -233,9 +233,9 @@
       return test.getInfo();
    }
 
-   public DriverResponse invoke(DriverCommand command) throws TestDriverException
+   public DriverResponse invoke(String testId, DriverCommand command) throws TestDriverException
    {
-      return test.invoke(command);
+      return test.invoke(testId, command);
    }
 
    public void updateContext(String testId, HttpTestContext ctx)




More information about the jboss-svn-commits mailing list