[jboss-svn-commits] JBoss Portal SVN: r5518 - in trunk: common/src/main/org/jboss/portal/common/test common/src/main/org/jboss/portal/common/test/junit test/src/main/org/jboss/portal/test/framework/embedded

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Oct 30 17:58:05 EST 2006


Author: julien at jboss.com
Date: 2006-10-30 17:57:57 -0500 (Mon, 30 Oct 2006)
New Revision: 5518

Modified:
   trunk/common/src/main/org/jboss/portal/common/test/TestParametrization.java
   trunk/common/src/main/org/jboss/portal/common/test/junit/JUnitAdapter.java
   trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
Log:
improve the test case name in the reports with the test case parametrization

Modified: trunk/common/src/main/org/jboss/portal/common/test/TestParametrization.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/test/TestParametrization.java	2006-10-30 22:14:12 UTC (rev 5517)
+++ trunk/common/src/main/org/jboss/portal/common/test/TestParametrization.java	2006-10-30 22:57:57 UTC (rev 5518)
@@ -71,6 +71,11 @@
       }
    }
 
+   public boolean isEmpty()
+   {
+      return parameterValues.isEmpty();
+   }
+
    public Object getParameterValue(String parameterName)
    {
       if (parameterName == null)
@@ -80,6 +85,19 @@
       return parameterValues.get(parameterName);
    }
 
+   public String toString()
+   {
+      StringBuffer tmp = new StringBuffer();
+      for (Iterator i = parameterValues.entrySet().iterator();i.hasNext();)
+      {
+         Map.Entry entry = (Map.Entry)i.next();
+         String parameterName = (String)entry.getKey();
+         TestParameterValue value = (TestParameterValue)entry.getValue();
+         tmp.append(parameterName).append('=').append(value.get()).append(i.hasNext() ? "," : "");
+      }
+      return tmp.toString();
+   }
+
    /**
     * Build a collection of parametrization that satisfies the parameters exposed by the test
     * meta information and the parameter provided by the map.

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-10-30 22:14:12 UTC (rev 5517)
+++ trunk/common/src/main/org/jboss/portal/common/test/junit/JUnitAdapter.java	2006-10-30 22:57:57 UTC (rev 5518)
@@ -105,7 +105,8 @@
             for (Iterator i = contexts.iterator();i.hasNext();)
             {
                final TestParametrization parametrization = (TestParametrization)i.next();
-               TestCase tc = new TestCase(testInfo.getName())
+               String name = parametrization.isEmpty() ?  testInfo.getName() : testInfo.getName() + "_" + parametrization;
+               TestCase tc = new TestCase(name)
                {
                   public void runBare() throws Throwable
                   {

Modified: trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java
===================================================================
--- trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java	2006-10-30 22:14:12 UTC (rev 5517)
+++ trunk/test/src/main/org/jboss/portal/test/framework/embedded/DataSourceSupport.java	2006-10-30 22:57:57 UTC (rev 5518)
@@ -249,6 +249,11 @@
          return password;
       }
 
+      public String toString()
+      {
+         return "Datasource[" + displayName + "]";
+      }
+
       public static MultiValuedTestParameterValue fromXML2(URL url) throws Exception
       {
          Config[] configs = fromXML(url);




More information about the jboss-svn-commits mailing list