aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2012-05-02 12:53:07 +0200
committerJiri Vanek <[email protected]>2012-05-02 12:53:07 +0200
commite4c39211e39e630a47d0394a69529f9dbcd4d37c (patch)
tree55e09f2b03d452970581038923bd30c83bc0980e /tests
parentc2a298870319ea43a406a068dab2f6afc02bef90 (diff)
Added bug annotation forr testing engine
Diffstat (limited to 'tests')
-rw-r--r--tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java3
-rw-r--r--tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java2
-rw-r--r--tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java10
-rw-r--r--tests/junit-runner/JunitLikeXmlOutputListener.java146
-rw-r--r--tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/Bug.java32
-rw-r--r--tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/NeedsDisplay.java18
-rw-r--r--tests/report-styles/jreport.xsl13
7 files changed, 220 insertions, 4 deletions
diff --git a/tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java b/tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java
index c2baa62..095d87d 100644
--- a/tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java
+++ b/tests/jnlp_tests/simple/CheckServices/testcases/CheckServicesTests.java
@@ -36,12 +36,15 @@ exception statement from your version.
*/
import net.sourceforge.jnlp.ServerAccess;
+import net.sourceforge.jnlp.annotations.Bug;
import org.junit.Assert;
import org.junit.Test;
+@Bug(id="http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-February/017153.html")
public class CheckServicesTests {
private static ServerAccess server = new ServerAccess();
+
@Test
public void CheckServices() throws Exception {
System.out.println("connecting CheckServices request");
diff --git a/tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java b/tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java
index f7bd7ba..f691b17 100644
--- a/tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java
+++ b/tests/jnlp_tests/simple/ManifestedJar1/testcases/ManifestedJar1Test.java
@@ -36,10 +36,12 @@ exception statement from your version.
*/
import net.sourceforge.jnlp.ServerAccess;
+import net.sourceforge.jnlp.annotations.Bug;
import org.junit.Assert;
import org.junit.Test;
+@Bug(id="http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-February/017435.html")
public class ManifestedJar1Test {
private static ServerAccess server = new ServerAccess();
diff --git a/tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java b/tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java
index d386079..392f20c 100644
--- a/tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java
+++ b/tests/jnlp_tests/simple/Spaces can be everywhere/testcases/SpacesCanBeEverywhereTests.java
@@ -39,14 +39,17 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
import net.sourceforge.jnlp.ServerAccess;
+import net.sourceforge.jnlp.annotations.Bug;
import org.junit.Assert;
import org.junit.Test;
+@Bug(id={"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016127.html","PR804","PR811"})
public class SpacesCanBeEverywhereTests {
private static ServerAccess server = new ServerAccess();
+ @Bug(id={"PR811","http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-October/016144.html"})
@Test
public void SpacesCanBeEverywhereRemoteTests1() throws Exception {
System.out.println("connecting SpacesCanBeEverywhereRemoteTests1 request");
@@ -62,6 +65,7 @@ public class SpacesCanBeEverywhereTests {
Assert.assertEquals((Integer) 0, pr.returnValue);
}
+ @Bug(id="PR811")
@Test
public void SpacesCanBeEverywhereRemoteTests2() throws Exception {
System.out.println("connecting SpacesCanBeEverywhereRemoteTests2 request");
@@ -77,6 +81,7 @@ public class SpacesCanBeEverywhereTests {
Assert.assertEquals((Integer) 0, pr.returnValue);
}
+ @Bug(id="PR811")
@Test
public void SpacesCanBeEverywhereRemoteTests3() throws Exception {
System.out.println("connecting SpacesCanBeEverywhereRemoteTests3 request");
@@ -93,7 +98,8 @@ public class SpacesCanBeEverywhereTests {
}
- @Test
+ @Bug(id="PR804")
+ @Test
public void SpacesCanBeEverywhereLocalTests1() throws Exception {
System.out.println("connecting SpacesCanBeEverywhereLocalTests1 request");
System.err.println("connecting SpacesCanBeEverywhereLocalTests1 request");
@@ -112,6 +118,7 @@ public class SpacesCanBeEverywhereTests {
Assert.assertEquals((Integer) 0, pr.returnValue);
}
+ @Bug(id="PR804")
@Test
public void SpacesCanBeEverywhereLocalTests2() throws Exception {
System.out.println("connecting SpacesCanBeEverywhereLocalTests2 request");
@@ -131,6 +138,7 @@ public class SpacesCanBeEverywhereTests {
Assert.assertEquals((Integer) 0, pr.returnValue);
}
+ @Bug(id="PR804")
@Test
public void SpacesCanBeEverywhereLocalTests3() throws Exception {
System.out.println("connecting SpacesCanBeEverywhereLocalTests3 request");
diff --git a/tests/junit-runner/JunitLikeXmlOutputListener.java b/tests/junit-runner/JunitLikeXmlOutputListener.java
index 5bd2df6..c21eb1b 100644
--- a/tests/junit-runner/JunitLikeXmlOutputListener.java
+++ b/tests/junit-runner/JunitLikeXmlOutputListener.java
@@ -12,6 +12,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
+import java.lang.reflect.Method;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Date;
@@ -19,6 +20,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import net.sourceforge.jnlp.annotations.Bug;
import org.junit.internal.JUnitSystem;
@@ -41,6 +43,8 @@ public class JunitLikeXmlOutputListener extends RunListener {
private static final String ROOT = "testsuite";
private static final String DATE_ELEMENT = "date";
private static final String TEST_ELEMENT = "testcase";
+ private static final String BUGS = "bugs";
+ private static final String BUG = "bug";
private static final String TEST_NAME_ATTRIBUTE = "name";
private static final String TEST_TIME_ATTRIBUTE = "time";
private static final String TEST_ERROR_ELEMENT = "error";
@@ -63,6 +67,7 @@ public class JunitLikeXmlOutputListener extends RunListener {
private class ClassCounter {
+ Class c;
int total;
int failed;
int passed;
@@ -94,7 +99,10 @@ public class JunitLikeXmlOutputListener extends RunListener {
attString.append(" ");
Set<Entry<String, String>> entries = atts.entrySet();
for (Entry<String, String> entry : entries) {
- attString.append(entry.getKey()).append("=\"").append(attributize(entry.getValue())).append("\"");
+ String k=entry.getKey();
+ String v= entry.getValue();
+ if (v==null)v="null";
+ attString.append(k).append("=\"").append(attributize(v)).append("\"");
attString.append(" ");
}
}
@@ -164,13 +172,35 @@ public class JunitLikeXmlOutputListener extends RunListener {
writeElement(TEST_ERROR_ELEMENT, testFailed.getTrace(), errorAtts);
}
-
+ try {
+ Class q = description.getTestClass();
+ String qs=description.getMethodName();
+ if (qs.contains(" - ")) qs=qs.replaceAll(" - .*", "");
+ Method qm = q.getMethod(qs);
+ Bug b = qm.getAnnotation(Bug.class);
+ if (b != null) {
+ openElement(BUGS);
+ String[] s = b.id();
+ for (String string : s) {
+ String ss[]=createBug(string);
+ Map<String, String> visibleNameAtt=new HashMap<String, String>(1);
+ visibleNameAtt.put("visibleName", ss[0]);
+ openElement(BUG,visibleNameAtt);
+ writer.write(ss[1]);
+ closeElement(BUG);
+ }
+ closeElement(BUGS);
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
closeElement(TEST_ELEMENT);
writer.flush();
ClassCounter cc = classStats.get(description.getClassName());
if (cc == null) {
cc = new ClassCounter();
+ cc.c=description.getTestClass();
classStats.put(description.getClassName(), cc);
}
cc.total++;
@@ -211,7 +241,27 @@ public class JunitLikeXmlOutputListener extends RunListener {
writeElement(SUMMARY_FAILED_ELEMENT, String.valueOf(entry.getValue().failed));
writeElement(SUMMARY_IGNORED_ELEMENT, String.valueOf(entry.getValue().total - entry.getValue().failed - entry.getValue().passed));
writeElement(SUMMARY_TOTAL_ELEMENT, String.valueOf(entry.getValue().total));
-
+ try {
+ Bug b = null;
+ if (entry.getValue().c != null) {
+ b = (Bug) entry.getValue().c.getAnnotation(Bug.class);
+ }
+ if (b != null) {
+ openElement(BUGS);
+ String[] s = b.id();
+ for (String string : s) {
+ String ss[]=createBug(string);
+ Map<String, String> visibleNameAtt=new HashMap<String, String>(1);
+ visibleNameAtt.put("visibleName", ss[0]);
+ openElement(BUG,visibleNameAtt);
+ writer.write(ss[1]);
+ closeElement(BUG);
+ }
+ closeElement(BUGS);
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
closeElement(TEST_CLASS_ELEMENT);
}
closeElement(CLASSES_ELEMENT);
@@ -222,4 +272,94 @@ public class JunitLikeXmlOutputListener extends RunListener {
writer.close();
}
+
+
+ /**
+ * When declare for suite class or for Test-marked method,
+ * should be interpreted by report generating tool to links.
+ * Known shortcuts are
+ * SX - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=X
+ * PRX - http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=X
+ * RHX - https://bugzilla.redhat.com/show_bug.cgi?id=X
+ * DX - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=X
+ * GX - http://bugs.gentoo.org/show_bug.cgi?id=X
+ * CAX - http://server.complang.tuwien.ac.at/cgi-bin/bugzilla/show_bug.cgi?id=X
+ * LPX - https://bugs.launchpad.net/bugs/X
+ *
+ * http://mail.openjdk.java.net/pipermail/distro-pkg-dev/
+ * and http://mail.openjdk.java.net/pipermail/ are proceed differently
+ *
+ * You just put eg @Bug(id="RH12345",id="http:/my.bukpage.com/terribleNew")
+ * and RH12345 will be transalated as
+ * <a href="https://bugzilla.redhat.com/show_bug.cgi?id=123456">123456<a> or
+ * similar, the url will be inclueded as is. Both added to proper tests or suites
+ *
+ * @return Strng[2]{nameToBeShown, hrefValue}
+ */
+ public static String[] createBug(String string) {
+ String[] r = {"ex", string};
+ String[] prefixes = {
+ "S",
+ "PR",
+ "RH",
+ "D",
+ "G",
+ "CA",
+ "LP",};
+ String[] urls = {
+ "http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=",
+ "http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=",
+ "https://bugzilla.redhat.com/show_bug.cgi?id=",
+ "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=",
+ "http://bugs.gentoo.org/show_bug.cgi?id=",
+ "http://server.complang.tuwien.ac.at/cgi-bin/bugzilla/show_bug.cgi?id",
+ "https://bugs.launchpad.net/bugs/",};
+
+ for (int i = 0; i < urls.length; i++) {
+ if (string.startsWith(prefixes[i])) {
+ r[0] = string;
+ r[1] = urls[i] + string.substring(prefixes[i].length());
+ return r;
+ }
+
+ }
+
+ String distro = "http://mail.openjdk.java.net/pipermail/distro-pkg-dev/";
+ String openjdk = "http://mail.openjdk.java.net/pipermail/";
+ if (string.startsWith(distro)){
+ r[0]="distro-pkg";
+ return r;
+ }
+ if (string.startsWith(openjdk)){
+ r[0]="openjdk";
+ return r;
+ }
+ return r;
+
+ }
+
+ public static void main(String[] args){
+ String[] q=createBug("PR608");
+ System.out.println(q[0]+" : "+q[1]);
+ q=createBug("S4854");
+ System.out.println(q[0]+" : "+q[1]);
+ q=createBug("RH649423");
+ System.out.println(q[0]+" : "+q[1]);
+ q=createBug("D464");
+ System.out.println(q[0]+" : "+q[1]);
+ q=createBug("G6554");
+ System.out.println(q[0]+" : "+q[1]);
+ q=createBug("CA1654");
+ System.out.println(q[0]+" : "+q[1]);
+ q=createBug("LP5445");
+ System.out.println(q[0]+" : "+q[1]);
+
+ q=createBug("http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2011-November/016178.html");
+ System.out.println(q[0]+" : "+q[1]);
+ q=createBug("http://mail.openjdk.java.net/pipermail/awt-dev/2012-March/002324.html");
+ System.out.println(q[0]+" : "+q[1]);
+
+ q=createBug("http://lists.fedoraproject.org/pipermail/chinese/2012-January/008868.html");
+ System.out.println(q[0]+" : "+q[1]);
+ }
}
diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/Bug.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/Bug.java
new file mode 100644
index 0000000..ac157d9
--- /dev/null
+++ b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/Bug.java
@@ -0,0 +1,32 @@
+package net.sourceforge.jnlp.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * When declare for suite class or for Test-marked method,
+ * should be interpreted by report generating tool to links.
+ * Known shortcuts are
+ * SX - http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=X
+ * PRX - http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=X
+ * RHX - https://bugzilla.redhat.com/show_bug.cgi?id=X
+ * DX - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=X
+ * GX - http://bugs.gentoo.org/show_bug.cgi?id=X
+ * CAX - http://server.complang.tuwien.ac.at/cgi-bin/bugzilla/show_bug.cgi?id=X
+ * LPX - https://bugs.launchpad.net/bugs/X
+ *
+ * http://mail.openjdk.java.net/pipermail/distro-pkg-dev/
+ * and http://mail.openjdk.java.net/pipermail/ are proceed differently
+ * You just put eg @Bug(id="RH12345",id="http:/my.bukpage.com/terribleNew")
+ * and RH12345 will be transalated as
+ * <a href="https://bugzilla.redhat.com/show_bug.cgi?id=123456">123456<a> or
+ * similar, the url will be inclueded as is. Both added to proper tests or suites
+ *
+ */
+@Target({ElementType.METHOD,ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Bug {
+ public String[] id();
+}
diff --git a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/NeedsDisplay.java b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/NeedsDisplay.java
new file mode 100644
index 0000000..e8b9d49
--- /dev/null
+++ b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/annotations/NeedsDisplay.java
@@ -0,0 +1,18 @@
+
+package net.sourceforge.jnlp.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This annotation should be declared for each test which requires DISPALY defined.
+ * If no display is defined, then those test will not be run
+ *
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface NeedsDisplay {
+
+}
diff --git a/tests/report-styles/jreport.xsl b/tests/report-styles/jreport.xsl
index c3025af..5ac9841 100644
--- a/tests/report-styles/jreport.xsl
+++ b/tests/report-styles/jreport.xsl
@@ -102,6 +102,12 @@ exception statement from your version.
</xsl:attribute><xsl:value-of select="@name"/>
(<xsl:value-of select="@time"/>ms):
</a>
+ <xsl:for-each select="bugs/bug">
+ <a>
+ <xsl:attribute name="href"><xsl:value-of select="normalize-space(.)"/></xsl:attribute>
+ <xsl:value-of select="@visibleName"/>
+ </a>;
+ </xsl:for-each>
</div>
<blockquote>
<div class="tablee">
@@ -166,6 +172,13 @@ exception statement from your version.
<xsl:text disable-output-escaping="no"> - </xsl:text>
<div class="method">
<xsl:value-of select="@name"/>
+ <xsl:for-each select="bugs/bug">
+ <xsl:text disable-output-escaping="no"> - </xsl:text>
+ <a>
+ <xsl:attribute name="href"><xsl:value-of select="normalize-space(.)"/></xsl:attribute>
+ <xsl:value-of select="@visibleName"/>
+ </a>
+ </xsl:for-each>
</div>
</div>
<div class="result">