Author: julien(a)jboss.com
Date: 2007-10-10 18:05:10 -0400 (Wed, 10 Oct 2007)
New Revision: 8593
Added:
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/generic/TestDef.java
Removed:
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/TestDef.java
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/model/ModelTests.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/generic/GenericTestSuiteDef.java
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f2.xml
Log:
added test case for test ref id in generic test
Modified:
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/model/ModelTests.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/model/ModelTests.java 2007-10-10
21:56:06 UTC (rev 8592)
+++
modules/test/trunk/unit/src/main/org/jboss/test/unit/runner/model/ModelTests.java 2007-10-10
22:05:10 UTC (rev 8593)
@@ -27,6 +27,7 @@
import org.jboss.unit.runner.model.ParameterValueDef;
import org.jboss.unit.runner.model.ParametersDef;
import org.jboss.unit.runner.model.TestSuiteDef;
+import org.jboss.unit.runner.model.generic.TestDef;
import org.jboss.unit.runner.model.generic.GenericTestSuiteDef;
import org.jboss.unit.runner.model.composite.CompositeTestSuiteDef;
import org.jboss.unit.runner.model.pojo.POJOTestSuiteDef;
@@ -34,10 +35,12 @@
import org.jboss.unit.runner.model.pojo.TestCaseDef;
import static org.jboss.unit.util.CollectionTools.list;
import static org.jboss.unit.util.CollectionTools.set;
+import org.jboss.unit.TestId;
import org.xml.sax.InputSource;
import java.io.InputStream;
import java.util.Iterator;
+import java.util.List;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -82,6 +85,14 @@
//
ParametersDef parameters = assertNotNull(generic.getParameters());
assertEquals(set("red"), parameters.getNames());
+
+ //
+ List<TestDef> tests = assertNotNull(generic.getTests());
+ assertEquals(2, tests.size());
+ TestDef foo = assertNotNull(tests.get(0));
+ assertEquals(new TestId("foo"), foo.getRefId());
+ TestDef fooBar = assertNotNull(tests.get(1));
+ assertEquals(new TestId("foo", "bar"), fooBar.getRefId());
}
private static void buildFromXML1()
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-10
21:56:06 UTC (rev 8592)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/ModelBuilder.java 2007-10-10
22:05:10 UTC (rev 8593)
@@ -34,6 +34,7 @@
import org.jboss.unit.runner.model.pojo.TestCaseDef;
import org.jboss.unit.runner.model.composite.CompositeTestSuiteDef;
import org.jboss.unit.runner.model.generic.GenericTestSuiteDef;
+import org.jboss.unit.runner.model.generic.TestDef;
import org.jboss.unit.TestIdFormat;
import org.jboss.unit.TestId;
import org.xml.sax.InputSource;
Deleted: modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/TestDef.java
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/TestDef.java 2007-10-10
21:56:06 UTC (rev 8592)
+++ modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/TestDef.java 2007-10-10
22:05:10 UTC (rev 8593)
@@ -1,63 +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.model;
-
-import org.jboss.unit.TestId;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class TestDef
-{
-
- /** . */
- private TestId refId;
-
- /** . */
- private ParametersDef parameters = new ParametersDef();
-
- public TestDef(TestId refId)
- {
- if (refId == null)
- {
- throw new IllegalArgumentException("No null ref id accepted");
- }
- this.refId = refId;
- }
-
- public TestId getRefId()
- {
- return refId;
- }
-
- public ParametersDef getParameters()
- {
- return parameters;
- }
-
- public void setParameters(ParametersDef parameters)
- {
- this.parameters = parameters;
- }
-}
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/generic/GenericTestSuiteDef.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/generic/GenericTestSuiteDef.java 2007-10-10
21:56:06 UTC (rev 8592)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/generic/GenericTestSuiteDef.java 2007-10-10
22:05:10 UTC (rev 8593)
@@ -24,13 +24,12 @@
import org.jboss.unit.runner.model.TestSuiteDef;
import org.jboss.unit.runner.model.BuilderException;
-import org.jboss.unit.runner.model.TestDef;
+import org.jboss.unit.runner.model.generic.TestDef;
import org.jboss.unit.runner.TestRunner;
import org.jboss.unit.runner.impl.generic.GenericTestRunner;
import java.util.List;
import java.util.ArrayList;
-import java.util.Collection;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -69,7 +68,7 @@
tests.add(test);
}
- public Collection<TestDef> getTests()
+ public List<TestDef> getTests()
{
return tests;
}
Copied: modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/generic/TestDef.java
(from rev 8592,
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/TestDef.java)
===================================================================
--- modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/generic/TestDef.java
(rev 0)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/runner/model/generic/TestDef.java 2007-10-10
22:05:10 UTC (rev 8593)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * 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.model.generic;
+
+import org.jboss.unit.TestId;
+import org.jboss.unit.runner.model.ParametersDef;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TestDef
+{
+
+ /** . */
+ private TestId refId;
+
+ /** . */
+ private ParametersDef parameters = new ParametersDef();
+
+ public TestDef(TestId refId)
+ {
+ if (refId == null)
+ {
+ throw new IllegalArgumentException("No null ref id accepted");
+ }
+ this.refId = refId;
+ }
+
+ public TestId getRefId()
+ {
+ return refId;
+ }
+
+ public ParametersDef getParameters()
+ {
+ return parameters;
+ }
+
+ public void setParameters(ParametersDef parameters)
+ {
+ this.parameters = parameters;
+ }
+}
Modified:
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f2.xml
===================================================================
---
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f2.xml 2007-10-10
21:56:06 UTC (rev 8592)
+++
modules/test/trunk/unit/src/resources/test/org/jboss/test/unit/runner/model/f2.xml 2007-10-10
22:05:10 UTC (rev 8593)
@@ -6,5 +6,7 @@
<generic>
<class name="foo_generic"/>
<parameter name="red" value="blue"/>
+ <test refid="foo"/>
+ <test refid="foo.bar"/>
</generic>
</jboss-unit>