Author: julien(a)jboss.com
Date: 2007-10-08 16:49:44 -0400 (Mon, 08 Oct 2007)
New Revision: 8568
Added:
modules/test/trunk/unit/src/main/org/jboss/unit/runner/ParametrizationSet.java
modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit_1_0.xsd
Removed:
modules/test/trunk/unit/src/main/org/jboss/unit/runner/Parametrization.java
modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit.dtd
Modified:
modules/test/trunk/remote/build.xml
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/DeployerHandler.java
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java
modules/test/trunk/tooling/src/resources/test/bobo-tests.xml
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/ParametrizationTests.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/Constants.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ModelBuilder.java
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ParametersDef.java
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/blah/f1.xml
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f1.xml
Log:
replaced jboss-unit dtd by an xsd
Modified: modules/test/trunk/remote/build.xml
===================================================================
--- modules/test/trunk/remote/build.xml 2007-10-08 16:16:09 UTC (rev 8567)
+++ modules/test/trunk/remote/build.xml 2007-10-08 20:49:44 UTC (rev 8568)
@@ -146,21 +146,13 @@
<mkdir dir="${build.lib}"/>
-<!--
- <jar jarfile="${build.lib}/jboss-unit-lib.jar">
+ <jar jarfile="${build.lib}/jboss-unit-remote-lib.jar">
<fileset dir="${build.classes}">
<exclude name="org/jboss/test/**"/>
</fileset>
- <fileset dir="${build.resources}/jboss-unit-jar"/>
+ <fileset dir="${build.resources}/jboss-unit-remote-jar"/>
</jar>
- <jar jarfile="${build.lib}/jboss-unit-test.jar">
- <fileset dir="${build.classes}">
- <exclude name="org/jboss/unit/**"/>
- </fileset>
- </jar>
--->
-
</target>
<!-- ================================================================== -->
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java 2007-10-08
16:16:09 UTC (rev 8567)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/RemoteTestDriverClient.java 2007-10-08
20:49:44 UTC (rev 8568)
@@ -22,14 +22,14 @@
******************************************************************************/
package org.jboss.unit.remote.driver;
-import org.jboss.unit.remote.server.NodeId;
-import org.jboss.unit.remote.server.NodeManager;
-import org.jboss.unit.remote.server.Node;
import org.jboss.unit.driver.TestDriver;
import org.jboss.unit.driver.DriverCommand;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.info.TestInfo;
import org.jboss.unit.TestId;
+import org.jboss.portal.test.framework.server.NodeId;
+import org.jboss.portal.test.framework.server.Node;
+import org.jboss.portal.test.framework.server.NodeManager;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -43,9 +43,6 @@
/** . */
private NodeId initialNodeId;
- /** . */
- private String archivePath;
-
// Services
/** . */
@@ -54,9 +51,6 @@
/** . */
private ProtocolHandler protocolHandler;
- /** . */
-// private Deployer deployer;
-
public NodeId getInitialNodeId()
{
return initialNodeId;
@@ -67,16 +61,6 @@
this.initialNodeId = initialNodeId;
}
- public String getArchivePath()
- {
- return archivePath;
- }
-
- public void setArchivePath(String archivePath)
- {
- this.archivePath = archivePath;
- }
-
public NodeManager getNodeManager()
{
return nodeManager;
@@ -97,16 +81,6 @@
this.protocolHandler = protocolHandler;
}
-// public Deployer getDeployer()
-// {
-// return deployer;
-// }
-//
-// public void setDeployer(Deployer deployer)
-// {
-// this.deployer = deployer;
-// }
-
public RemoteTestDriver getServer(Node node)
{
return (RemoteTestDriver)node.lookupService(RemoteTestDriver.SERVICE_ID);
@@ -119,7 +93,7 @@
return server.getInfo();
}
- public DriverResponse invoke(TestId testId, DriverCommand command) // throws
TestDriverException
+ public DriverResponse invoke(TestId testId, DriverCommand command)
{
try
{
@@ -133,7 +107,6 @@
}
catch (Exception e)
{
-// throw new TestDriverException(e);
throw new Error(e);
}
}
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java 2007-10-08
16:16:09 UTC (rev 8567)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/TestConversation.java 2007-10-08
20:49:44 UTC (rev 8568)
@@ -25,10 +25,10 @@
import org.jboss.unit.driver.DriverResponse;
import org.jboss.unit.driver.DriverCommand;
import org.jboss.unit.driver.response.EndTestResponse;
-import org.jboss.unit.remote.server.Node;
import org.jboss.unit.remote.RequestContext;
import org.jboss.unit.remote.ResponseContext;
import org.jboss.unit.TestId;
+import org.jboss.portal.test.framework.server.Node;
import java.util.Map;
import java.util.HashMap;
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/DeployerHandler.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/DeployerHandler.java 2007-10-08
16:16:09 UTC (rev 8567)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/deployer/DeployerHandler.java 2007-10-08
20:49:44 UTC (rev 8568)
@@ -30,6 +30,7 @@
import org.jboss.unit.remote.driver.handler.deployer.response.DeployResponse;
import org.jboss.unit.driver.DriverResponse;
import org.jboss.portal.test.framework.deployment.Deployer;
+import org.jboss.portal.test.framework.server.Node;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -85,8 +86,17 @@
{
DeployResponse deploy = (DeployResponse)response;
+ Node node = testConversation.getNode();
+
//
-// deployer.deploy(archivePath, deploy.getId(), node);
+ try
+ {
+ deployer.deploy(archivePath, deploy.getId(), node);
+ }
+ catch (Exception e)
+ {
+ throw new Error(e);
+ }
//
return new RemoteDriverCommandContext(responseContext.getCommandContext());
@@ -96,8 +106,14 @@
UndeployResponse undeploy = (UndeployResponse)response;
//
-// Deployer deployer = driver.getDeployer();
-// deployer.undeploy(driver.getArchivePath(), undeploy.getId());
+ try
+ {
+ deployer.undeploy(archivePath, undeploy.getId());
+ }
+ catch (Exception e)
+ {
+ throw new Error(e);
+ }
//
return new RemoteDriverCommandContext(responseContext.getCommandContext());
Modified:
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java
===================================================================
---
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java 2007-10-08
16:16:09 UTC (rev 8567)
+++
modules/test/trunk/remote/src/main/org/jboss/unit/remote/driver/handler/http/HTTPConversation.java 2007-10-08
20:49:44 UTC (rev 8568)
@@ -38,13 +38,13 @@
import org.jboss.portal.common.http.HttpRequest;
import org.jboss.portal.common.http.HttpHeaders;
import org.jboss.portal.common.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;
import org.jboss.unit.remote.driver.handler.http.command.DoGetCommand;
import org.jboss.unit.remote.driver.TestConversation;
import org.jboss.unit.remote.driver.RemoteDriverCommandContext;
import org.jboss.unit.remote.driver.RemoteDriverResponseContext;
-import org.jboss.unit.remote.server.Node;
import org.jboss.unit.remote.ResponseContext;
import org.jboss.unit.driver.DriverCommand;
import org.jboss.unit.driver.DriverResponse;
Modified: modules/test/trunk/tooling/src/resources/test/bobo-tests.xml
===================================================================
--- modules/test/trunk/tooling/src/resources/test/bobo-tests.xml 2007-10-08 16:16:09 UTC
(rev 8567)
+++ modules/test/trunk/tooling/src/resources/test/bobo-tests.xml 2007-10-08 20:49:44 UTC
(rev 8568)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE jboss-unit PUBLIC
- "-//JBoss Portal//JBoss Unit 1.0//EN"
- "http://www.jboss.org/portal/dtd/jboss-unit.dtd">
-<jboss-unit>
+<jboss-unit
+ xmlns="urn:jboss:jboss-unit:1.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<pojo>
<test-def id="bobo">
<class name="org.jboss.test.unit.tooling.bobo.BoboTest1"/>
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/ParametrizationTests.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/ParametrizationTests.java 2007-10-08
16:16:09 UTC (rev 8567)
+++
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/ParametrizationTests.java 2007-10-08
20:49:44 UTC (rev 8568)
@@ -23,7 +23,7 @@
package org.jboss.test.unit.runner;
import static org.jboss.unit.api.Assert.assertEquals;
-import org.jboss.unit.runner.Parametrization;
+import org.jboss.unit.runner.ParametrizationSet;
import org.jboss.unit.util.CollectionTools;
import java.util.HashMap;
@@ -50,7 +50,7 @@
private static void test1()
{
Map<String,String[]> map = new HashMap<String,String[]>();
- Parametrization def = new Parametrization(map);
+ ParametrizationSet def = new ParametrizationSet(map);
//
Set<String> contraints = CollectionTools.set();
@@ -63,7 +63,7 @@
{
Map<String,String[]> map = new HashMap<String,String[]>();
map.put("a", new String[]{"b"});
- Parametrization def = new Parametrization(map);
+ ParametrizationSet def = new ParametrizationSet(map);
//
Set<String> contraints1= CollectionTools.set();
@@ -90,7 +90,7 @@
{
Map<String,String[]> map = new HashMap<String,String[]>();
map.put("a", new String[]{"b","c"});
- Parametrization def = new Parametrization(map);
+ ParametrizationSet def = new ParametrizationSet(map);
//
Set<String> contraints1= CollectionTools.set();
@@ -121,7 +121,7 @@
Map<String,String[]> map = new HashMap<String,String[]>();
map.put("a", new String[]{"b","c"});
map.put("d", new String[]{"e"});
- Parametrization def = new Parametrization(map);
+ ParametrizationSet def = new ParametrizationSet(map);
//
Set<String> contraints1= CollectionTools.set();
@@ -167,7 +167,7 @@
Map<String,String[]> map = new HashMap<String,String[]>();
map.put("a", new String[]{"b","c"});
map.put("d", new String[]{"e","f"});
- Parametrization def = new Parametrization(map);
+ ParametrizationSet def = new ParametrizationSet(map);
//
Set<String> contraints1= CollectionTools.set();
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/runner/Parametrization.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/Parametrization.java 2007-10-08
16:16:09 UTC (rev 8567)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/Parametrization.java 2007-10-08
20:49:44 UTC (rev 8568)
@@ -1,115 +0,0 @@
-/******************************************************************************
- * 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.runner;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class Parametrization implements Cloneable
-{
-
- /** . */
- private Map<String,String[]> map;
-
- public Parametrization(Map<String, String[]> map)
- {
- this.map = map;
- }
-
- public Parametrization()
- {
- this.map = new HashMap<String, String[]>();
- }
-
- public void merge(Parametrization other)
- {
- for (Map.Entry<String,String[]> entry : other.map.entrySet())
- {
- if (!map.containsKey(entry.getKey()))
- {
- map.put(entry.getKey(), entry.getValue().clone());
- }
- }
- }
-
- public Parametrization clone()
- {
- try
- {
- return (Parametrization)super.clone();
- }
- catch (CloneNotSupportedException e)
- {
- throw new Error(e);
- }
- }
-
- public List<Map<String,String>> enumerate(Set<String>
expectedParameters)
- {
- // Clone so we can modify it safely
- expectedParameters = expectedParameters != null ? new
HashSet<String>(expectedParameters) : null;
-
- //
- List<Map<String,String>> enumeration = new ArrayList<Map<String,
String>>();
-
- //
- enumeration.add(new HashMap<String, String>());
-
- //
- for (Map.Entry<String, String[]> entry : map.entrySet())
- {
- String parameterName = entry.getKey();
-
- //
- if (expectedParameters == null || expectedParameters.remove(parameterName))
- {
-
- List<Map<String,String>> tmp = new ArrayList<Map<String,
String>>();
-
- for (String occurrence : entry.getValue())
- {
- for (Map<String,String> blah : enumeration)
- {
- Map<String,String> copy = new
HashMap<String,String>(blah);
- copy.put(parameterName, occurrence);
- tmp.add(copy);
- }
- }
-
- enumeration = tmp;
- }
- }
-
- //
- return enumeration;
- }
-
-}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/runner/ParametrizationSet.java
(from rev 8565,
modules/test/trunk/unit/src/main/org/jboss/unit/runner/Parametrization.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/ParametrizationSet.java
(rev 0)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/runner/ParametrizationSet.java 2007-10-08
20:49:44 UTC (rev 8568)
@@ -0,0 +1,121 @@
+/******************************************************************************
+ * 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.runner;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ParametrizationSet implements Cloneable
+{
+
+ /** . */
+ private Map<String,String[]> map;
+
+ public ParametrizationSet(Map<String, String[]> map)
+ {
+ this.map = map;
+ }
+
+ public ParametrizationSet()
+ {
+ this.map = new HashMap<String, String[]>();
+ }
+
+ public void merge(ParametrizationSet other)
+ {
+ for (Map.Entry<String,String[]> entry : other.map.entrySet())
+ {
+ if (!map.containsKey(entry.getKey()))
+ {
+ map.put(entry.getKey(), entry.getValue().clone());
+ }
+ }
+ }
+
+ public ParametrizationSet clone()
+ {
+ try
+ {
+ return (ParametrizationSet)super.clone();
+ }
+ catch (CloneNotSupportedException e)
+ {
+ throw new Error(e);
+ }
+ }
+
+ /**
+ * Enumerate the list of parametrization generated by this set.
+ *
+ * @param expectedParameters a filter to retain a sub set of the parameters
+ * @return a list of parametrizations
+ */
+ public List<Map<String,String>> enumerate(Set<String>
expectedParameters)
+ {
+ // Clone so we can modify it safely
+ expectedParameters = expectedParameters != null ? new
HashSet<String>(expectedParameters) : null;
+
+ //
+ List<Map<String,String>> enumeration = new ArrayList<Map<String,
String>>();
+
+ //
+ enumeration.add(new HashMap<String, String>());
+
+ //
+ for (Map.Entry<String, String[]> entry : map.entrySet())
+ {
+ String parameterName = entry.getKey();
+
+ //
+ if (expectedParameters == null || expectedParameters.remove(parameterName))
+ {
+
+ List<Map<String,String>> tmp = new ArrayList<Map<String,
String>>();
+
+ for (String occurrence : entry.getValue())
+ {
+ for (Map<String,String> blah : enumeration)
+ {
+ Map<String,String> copy = new
HashMap<String,String>(blah);
+ copy.put(parameterName, occurrence);
+ tmp.add(copy);
+ }
+ }
+
+ enumeration = tmp;
+ }
+ }
+
+ //
+ return enumeration;
+ }
+
+}
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java 2007-10-08
16:16:09 UTC (rev 8567)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/runner/impl/pojo/POJOTestRunner.java 2007-10-08
20:49:44 UTC (rev 8568)
@@ -24,7 +24,7 @@
import org.jboss.unit.runner.AbstractTestRunner;
import org.jboss.unit.runner.TestFilter;
-import org.jboss.unit.runner.Parametrization;
+import org.jboss.unit.runner.ParametrizationSet;
import org.jboss.unit.runner.impl.driver.TestDriverRunner;
import org.jboss.unit.runner.event.RunnerFailureEvent;
import org.jboss.unit.runner.event.TestRunnerLifeCycleFilter;
@@ -105,8 +105,8 @@
// Create parametrization
- Parametrization parametrization =
suite.getParameters().getParametrization();
- parametrization.merge(test.getParameters().getParametrization());
+ ParametrizationSet parametrizations =
suite.getParameters().getParametrization();
+ parametrizations.merge(test.getParameters().getParametrization());
// Map<String,Iterable<String>> generator = new
HashMap<String, Iterable<String>>();
@@ -117,7 +117,7 @@
TestCaseInfo testCaseInfo =
(TestCaseInfo)testSuiteInfo.findTest(testCaseId);
- for (Map<String,String> blah :
parametrization.enumerate(testCaseInfo.getParameters().keySet()))
+ for (Map<String,String> blah :
parametrizations.enumerate(testCaseInfo.getParameters().keySet()))
{
TestDriverRunner runner = new TestDriverRunner(driver, blah,
testCaseId);
runner.addListener(lifeCycleFilter);
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/Constants.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/Constants.java 2007-10-08
16:16:09 UTC (rev 8567)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/Constants.java 2007-10-08
20:49:44 UTC (rev 8568)
@@ -31,7 +31,8 @@
public static final String JBOSS_UNIT_SYSTEM_ID =
"http://www.jboss.org/portal/dtd/jboss-unit.dtd";
- public static final String RELATIVE_RESOURCE_NAME = "jboss-unit.dtd";
+// public static final String RELATIVE_RESOURCE_NAME = "jboss-unit.dtd";
+ public static final String RELATIVE_RESOURCE_NAME = "jboss-unit_1_0.xsd";
}
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ModelBuilder.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ModelBuilder.java 2007-10-08
16:16:09 UTC (rev 8567)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ModelBuilder.java 2007-10-08
20:49:44 UTC (rev 8568)
@@ -32,9 +32,6 @@
import org.jboss.unit.runner.model.pojo.POJOTestSuiteDef;
import org.jboss.unit.runner.model.pojo.TestClassDef;
import org.jboss.unit.runner.model.pojo.TestCaseDef;
-import org.jboss.unit.runner.model.TestDef;
-import org.jboss.unit.runner.model.ParametersDef;
-import org.jboss.unit.runner.model.TestSuiteDef;
import org.jboss.unit.runner.model.composite.CompositeTestSuiteDef;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -44,6 +41,10 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.DocumentBuilder;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
import java.util.List;
import java.util.ArrayList;
import java.io.IOException;
@@ -89,9 +90,21 @@
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setValidating(true);
+
+ factory.setNamespaceAware(true);
+
+ SchemaFactory schemaFactory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ InputStream in =
ModelBuilder.class.getResourceAsStream(Constants.RELATIVE_RESOURCE_NAME);
+ StreamSource ss = new StreamSource(in);
+ Schema schema = schemaFactory.newSchema(ss);
+
+
+
+ factory.setSchema(schema);
+
+
DocumentBuilder builder = factory.newDocumentBuilder();
- builder.setEntityResolver(resolver);
+// builder.setEntityResolver(resolver);
Document doc = builder.parse(source);
//
Modified: modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ParametersDef.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ParametersDef.java 2007-10-08
16:16:09 UTC (rev 8567)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ParametersDef.java 2007-10-08
20:49:44 UTC (rev 8568)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.unit.runner.model;
-import org.jboss.unit.runner.Parametrization;
+import org.jboss.unit.runner.ParametrizationSet;
import java.util.Map;
import java.util.HashMap;
@@ -82,13 +82,13 @@
return map.keySet();
}
- public Parametrization getParametrization()
+ public ParametrizationSet getParametrization()
{
Map<String,String[]> tmp = new HashMap<String,String[]>();
for (Map.Entry<String,ParameterValueDef> entry : map.entrySet())
{
tmp.put(entry.getKey(), entry.getValue().list().toArray(new String[0]));
}
- return new Parametrization(tmp);
+ return new ParametrizationSet(tmp);
}
}
Deleted:
modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit.dtd
===================================================================
---
modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit.dtd 2007-10-08
16:16:09 UTC (rev 8567)
+++
modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit.dtd 2007-10-08
20:49:44 UTC (rev 8568)
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!--
-
-A jboss-element is a top container element.
-
--->
-<!ELEMENT jboss-unit (pojo|suite)*>
-
-<!--
-
-A suite elements define a test suite and contain nested suites.
-
--->
-<!ELEMENT suite (pojo)*>
-
-<!--
-
-The pojo element defines a test suite for plain old java objects. It contains a global
parameter set,
-a set of test definitions and a set of tests to execute.
-
--->
-<!ELEMENT pojo (parameter|test-def|test)*>
-
-<!--
-
-Defines a pojo test with a mandatory id attribute. The id attribute is used by test
elements which can refer to it.
-
--->
-<!ELEMENT test-def (class)>
-<!ATTLIST test-def id CDATA #REQUIRED>
-
-<!--
-
-Defines a tested class. A tested class can contain any number of case. If the class
element contains no case then
-all test cases returned by the class meta data will be executed. The name attribute is
the full qualified name of the class.
-
--->
-<!ELEMENT class (case)*>
-<!ATTLIST class name CDATA #REQUIRED>
-
-<!--
-
-A case element specifies a particular test case on a test class. The name attribute in
the name of the test case.
-
--->
-<!ELEMENT case (#PCDATA)>
-<!ATTLIST case name CDATA #REQUIRED>
-
-<!--
-
-A test element specifies a test to execute. It either can contain an anonymous nested
class element or it can refer
-to an existing test definition. The nested parameters are used to parameterize the test
configuration, they override
-any existing parameter defined at the pojo level.
-
--->
-<!ELEMENT test
((class,parameter*)|(parameter*,class,parameter*)|(parameter*,class)|parameter*)>
-<!ATTLIST test refid CDATA #IMPLIED>
-
-<!--
-
-A parameter element.
-
--->
-<!ELEMENT parameter (value|null)*>
-<!ATTLIST parameter
- name CDATA #REQUIRED
- value CDATA #IMPLIED>
-
-<!ELEMENT null (#PCDATA)>
-<!ELEMENT value (#PCDATA)>
-
-
Added:
modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit_1_0.xsd
===================================================================
---
modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit_1_0.xsd
(rev 0)
+++
modules/test/trunk/unit/src/resources/jboss-unit-jar/org/jboss/unit/runner/model/jboss-unit_1_0.xsd 2007-10-08
20:49:44 UTC (rev 8568)
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema
+ targetNamespace="urn:jboss:jboss-unit:1.0"
+ xmlns="urn:jboss:jboss-unit:1.0"
+
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ elementFormDefault="qualified"
+ attributeFormDefault="unqualified"
+ version="1.0">
+
+ <xsd:element
+ name="jboss-unit"
+ type="jbossUnitType">
+ <xsd:annotation><xsd:documentation>A jboss-unit is the top container
element.</xsd:documentation></xsd:annotation>
+ </xsd:element>
+
+ <xsd:complexType name="jbossUnitType">
+ <xsd:annotation><xsd:documentation>The root type is like a
suite.</xsd:documentation></xsd:annotation>
+ <xsd:complexContent>
+ <xsd:extension base="suiteType">
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+
+ <xsd:complexType name="suiteType">
+ <xsd:annotation><xsd:documentation>A suite elements define a test suite
and contain nested suites.</xsd:documentation></xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="suite" type="suiteType"
minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="pojo" type="pojoType"
minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="pojoType">
+ <xsd:annotation><xsd:documentation>The pojo element defines a test
suite for plain old java objects. It contains a global parameter set,
+ a set of test definitions and a set of tests to
execute.</xsd:documentation></xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="parameter" type="parameterType"
minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="test-def" type="pojo_testDefType"
minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="test" type="pojo_testType"
minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="pojo_testDefType">
+ <xsd:annotation><xsd:documentation>Defines a pojo test with a mandatory
id attribute. The id attribute is used by
+ test elements which can refer to
it.</xsd:documentation></xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="class" type="pojo_classType"
minOccurs="1" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="id" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="pojo_classType">
+ <xsd:annotation><xsd:documentation>Defines a tested class. A tested
class can contain any number of case.
+ If the class element contains no case then all test cases returned by the class
meta data will be executed. The
+ name attribute is the full qualified name of the class.
+</xsd:documentation></xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="case" type="pojo_caseType"
minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="pojo_caseType">
+ <xsd:annotation><xsd:documentation>A case element specifies a
particular test case on a test class. The name attribute
+ in the name of the test case.</xsd:documentation></xsd:annotation>
+ <xsd:attribute name="name" use="required"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="pojo_testType">
+ <xsd:annotation><xsd:documentation>A test element specifies a test to
execute. It either can contain an anonymous
+ nested class element or it can refer to an existing test definition. The nested
parameters are used to parameterize
+ the test configuration, they override any existing parameter defined at the pojo
level.
+</xsd:documentation></xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="parameter" type="parameterType"
minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element name="class" type="pojo_classType"
minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ <xsd:attribute name="refid" type="xsd:string"/>
+ </xsd:complexType>
+
+ <xsd:complexType name="parameterType">
+ <xsd:annotation><xsd:documentation>A parameter
element.</xsd:documentation></xsd:annotation>
+ <xsd:sequence>
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="value" type="xsd:string"/>
+ <xsd:element name="null">
+ <xsd:complexType/>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string"
use="required"/>
+ <xsd:attribute name="value" type="xsd:string"/>
+ </xsd:complexType>
+
+</xsd:schema>
\ No newline at end of file
Modified: modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/blah/f1.xml
===================================================================
--- modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/blah/f1.xml 2007-10-08
16:16:09 UTC (rev 8567)
+++ modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/blah/f1.xml 2007-10-08
20:49:44 UTC (rev 8568)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE jboss-unit PUBLIC
- "-//JBoss Portal//JBoss Unit 1.0//EN"
- "http://www.jboss.org/portal/dtd/jboss-unit.dtd">
-<jboss-unit>
+<jboss-unit
+ xmlns="urn:jboss:jboss-unit:1.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<pojo>
<test-def id="blahblah">
<class name="org.jboss.test.unit.blah.TestedClass1"/>
Modified:
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f1.xml
===================================================================
---
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f1.xml 2007-10-08
16:16:09 UTC (rev 8567)
+++
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f1.xml 2007-10-08
20:49:44 UTC (rev 8568)
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE jboss-unit PUBLIC
- "-//JBoss Portal//JBoss Unit 1.0//EN"
- "http://www.jboss.org/portal/dtd/jboss-unit.dtd">
-<jboss-unit>
+<jboss-unit
+ xmlns="urn:jboss:jboss-unit:1.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<pojo>
<parameter name="red" value="blue"/>
@@ -30,8 +30,8 @@
</test>
<test>
+ <parameter name="foo" value="bar"/>
<class name="org.foo.bar.OtherTest"/>
- <parameter name="foo" value="bar"/>
</test>
<!--