Author: bdaw
Date: 2007-10-08 09:03:29 -0400 (Mon, 08 Oct 2007)
New Revision: 8558
Modified:
modules/test/trunk/tooling/build.xml
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/bobo/BoboTest1.java
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ExcludeTask.java
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/IncludeTask.java
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsTask.java
Log:
rename attributes and make 'id' exclusive
Modified: modules/test/trunk/tooling/build.xml
===================================================================
--- modules/test/trunk/tooling/build.xml 2007-10-08 12:12:52 UTC (rev 8557)
+++ modules/test/trunk/tooling/build.xml 2007-10-08 13:03:29 UTC (rev 8558)
@@ -216,20 +216,20 @@
<jboss-unit>
<tests
config="/home/bdaw/Workshop/JBoss/portal/modules/test/trunk/tooling/output/resources/test/bobo-tests.xml">
- <include names="testOne,otherTestOne"/>
- <exclude namePatterns="test.*"/>
+ <include ids="testOne,otherTestOne"/>
</tests>
<tests config="./output/resources/test/bobo-tests.xml">
- <include namePatterns="other.*,test.*"/>
+ <!-- no include tag means invoke all -->
+ <!-- but you can still exclude some tests -->
<exclude id="otherTestTwo"/>
</tests>
<tests config="./output/resources/test/bobo-tests.xml">
<!-- invoke all -->
- <include names="testOne"/>
- <include names="otherTestOne"/>
- <exclude namePatterns="test.*"/>
+ <include id="testOne"/>
+ <include id="otherTestOne"/>
+ <exclude ids="testOne,testTwo"/>
</tests>
<tests config="output/resources/test/bobo-tests.xml">
@@ -237,6 +237,17 @@
<include id="testOne"/>
<include id="otherTestTwo"/>
</tests>
+
+ <tests config="output/resources/test/bobo-tests.xml">
+ <include keywords="simpleTag"/>
+ </tests>
+
+
+ <tests config="output/resources/test/bobo-tests.xml">
+ <!-- this one should fail as attribute 'id' is exclusive -->
+ <include id="otherTestOne" ids="testOne,testTwo"
keywords="lola,lolo,loli"/>
+ </tests>
+
<classpath>
Modified:
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/bobo/BoboTest1.java
===================================================================
---
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/bobo/BoboTest1.java 2007-10-08
12:12:52 UTC (rev 8557)
+++
modules/test/trunk/tooling/src/main/org/jboss/test/unit/tooling/bobo/BoboTest1.java 2007-10-08
13:03:29 UTC (rev 8558)
@@ -23,6 +23,7 @@
package org.jboss.test.unit.tooling.bobo;
import org.jboss.unit.api.pojo.annotations.Test;
+import org.jboss.unit.api.pojo.annotations.Tag;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
@@ -31,12 +32,14 @@
public class BoboTest1
{
@Test(name = "testOne")
+ @Tag("simpleTag")
public void test1()
{
System.out.println("Executed testOne");
}
@Test(name = "testTwo")
+ @Tag("simpleTag")
public void test2()
{
System.out.println("Executed testTwo");
@@ -44,12 +47,14 @@
}
@Test(name = "otherTestOne")
+ @Tag({"simpleTag", "anotherTag"})
public void test3()
{
System.out.println("Executed otherTestOne");
}
@Test(name = "otherTestTwo")
+ @Tag("simpleTag")
public void test4()
{
System.out.println("Executed otherTestTwo");
Modified: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ExcludeTask.java
===================================================================
---
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ExcludeTask.java 2007-10-08
12:12:52 UTC (rev 8557)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/ExcludeTask.java 2007-10-08
13:03:29 UTC (rev 8558)
@@ -22,8 +22,6 @@
package org.jboss.unit.tooling.ant;
-import org.apache.tools.ant.Task;
-
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
* @version $Revision: 0.1 $
@@ -32,9 +30,9 @@
{
private String id;
- private String names;
+ private String ids;
- private String namePatterns;
+ private String idPatterns;
private String keywords;
@@ -53,25 +51,25 @@
this.id = id;
}
- public String getNames()
+ public String getIds()
{
- return names;
+ return ids;
}
- public void setNames(String names)
+ public void setIds(String ids)
{
- this.names = names;
+ this.ids = ids;
}
- public String getNamePatterns()
+ public String getIdPatterns()
{
- return namePatterns;
+ return idPatterns;
}
- public void setNamePatterns(String namePatterns)
- {
- this.namePatterns = namePatterns;
- }
+// public void setIdPatterns(String idPatterns)
+// {
+// this.idPatterns = idPatterns;
+// }
public String getKeywords()
{
Modified: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/IncludeTask.java
===================================================================
---
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/IncludeTask.java 2007-10-08
12:12:52 UTC (rev 8557)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/IncludeTask.java 2007-10-08
13:03:29 UTC (rev 8558)
@@ -22,8 +22,6 @@
package org.jboss.unit.tooling.ant;
-import org.apache.tools.ant.Task;
-
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
* @version $Revision: 0.1 $
@@ -32,9 +30,9 @@
{
private String id;
- private String names;
+ private String ids;
- private String namePatterns;
+ private String idPatterns;
private String keywords;
@@ -53,25 +51,25 @@
this.id = id;
}
- public String getNames()
+ public String getIds()
{
- return names;
+ return ids;
}
- public void setNames(String names)
+ public void setIds(String ids)
{
- this.names = names;
+ this.ids = ids;
}
- public String getNamePatterns()
+ public String getIdPatterns()
{
- return namePatterns;
+ return idPatterns;
}
- public void setNamePatterns(String namePatterns)
- {
- this.namePatterns = namePatterns;
- }
+// public void setIdPatterns(String idPatterns)
+// {
+// this.idPatterns = idPatterns;
+// }
public String getKeywords()
{
Modified: modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsTask.java
===================================================================
---
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsTask.java 2007-10-08
12:12:52 UTC (rev 8557)
+++
modules/test/trunk/tooling/src/main/org/jboss/unit/tooling/ant/TestsTask.java 2007-10-08
13:03:29 UTC (rev 8558)
@@ -29,16 +29,11 @@
import org.apache.tools.ant.taskdefs.Java;
import org.jboss.unit.tooling.IncludeTestFilter;
import org.jboss.unit.tooling.ExcludeTestFilter;
-import org.jboss.unit.tooling.MainTestFilter;
-import org.jboss.unit.tooling.MainBuilder;
import org.jboss.unit.tooling.Main;
-import org.jboss.unit.tooling.InfoTestFilter;
-import org.jboss.unit.runner.TestFilter;
import java.util.List;
import java.util.LinkedList;
import java.util.Set;
-import java.util.HashSet;
/**
* @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
@@ -144,17 +139,25 @@
for (IncludeTask include : includes)
{
- if (include.getNames() != null)
+ //Check attributes consistency
+
+ if (include.getId() != null && (include.getIds() != null ||
include.getKeywords() != null))
{
- includeFilter.addUnparsedNames(include.getNames());
+ throw new IllegalStateException("The use of attribute 'id' in
<include> tag should be exclusive");
}
+
+
+ if (include.getIds() != null)
+ {
+ includeFilter.addUnparsedNames(include.getIds());
+ }
if (include.getKeywords() != null)
{
includeFilter.addUnparsedKeywords(include.getKeywords());
}
- if (include.getNamePatterns() != null)
+ if (include.getIdPatterns() != null)
{
- includeFilter.addUnparsedNamePatterns(include.getNamePatterns());
+ includeFilter.addUnparsedNamePatterns(include.getIdPatterns());
}
if (include.getId() != null)
{
@@ -182,17 +185,23 @@
for (ExcludeTask exclude : excludes)
{
- if (exclude.getNames() != null)
+
+ if (exclude.getId() != null && (exclude.getIds() != null ||
exclude.getKeywords() != null))
{
- excludeFilter.addUnparsedNames(exclude.getNames());
+ throw new IllegalStateException("The use of attribute 'id' in
<exclude> tag should be exclusive");
}
+
+ if (exclude.getIds() != null)
+ {
+ excludeFilter.addUnparsedNames(exclude.getIds());
+ }
if (exclude.getKeywords() != null)
{
excludeFilter.addUnparsedKeywords(exclude.getKeywords());
}
- if (exclude.getNamePatterns() != null)
+ if (exclude.getIdPatterns() != null)
{
- excludeFilter.addUnparsedNamePatterns(exclude.getNamePatterns());
+ excludeFilter.addUnparsedNamePatterns(exclude.getIdPatterns());
}
if (exclude.getId() != null)
{