/hg/icedtea-web: Added and applied Remote annotation, added Remo...
jvanek at icedtea.classpath.org
jvanek at icedtea.classpath.org
Thu Dec 20 08:11:58 PST 2012
changeset 18ee1b8417d8 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=18ee1b8417d8
author: Jiri Vanek <jvanek at redhat.com>
date: Thu Dec 20 17:10:38 2012 +0100
Added and applied Remote annotation, added Remote tests.
diffstat:
ChangeLog | 18 +
tests/junit-runner/JunitLikeXmlOutputListener.java | 21 +-
tests/junit-runner/LessVerboseTextListener.java | 38 +-
tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java | 9 +
tests/report-styles/jreport.xsl | 10 +
tests/reproducers/custom/remote/srcs/Makefile | 5 +
tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java | 231 ++++++++++
tests/reproducers/custom/remote/testcases/RemoteApplicationTests.java | 144 ++++++
tests/test-extensions/net/sourceforge/jnlp/annotations/Remote.java | 52 ++
9 files changed, 513 insertions(+), 15 deletions(-)
diffs (truncated from 716 to 500 lines):
diff -r 892cc7f39358 -r 18ee1b8417d8 ChangeLog
--- a/ChangeLog Tue Dec 18 16:15:01 2012 +0100
+++ b/ChangeLog Thu Dec 20 17:10:38 2012 +0100
@@ -1,3 +1,21 @@
+2012-12-18 Jiri Vanek <jvanek at redhat.com>
+
+ Added and applied Remote annotation, added Remote tests:
+ * tests/report-styles/jreport.xsl: and
+ * tests/junit-runner/JunitLikeXmlOutputListener: and
+ * tests/junit-runner/LessVerboseTextListener.java: added handling of
+ Remote annotation
+ * tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java:
+ Tests downloading from classpath.org marked.
+ * tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java:
+ new file, handling url and evaluations of remote reproducers
+ * tests/reproducers/custom/remote/testcases/RemoteApplicationTests.java:
+ launcher for remote tests.
+ * tests/test-extensions/net/sourceforge/jnlp/annotations/Remote.java:
+ Implementation of Remote annotation
+
+
+
2012-12-18 Jiri Vanek <jvanek at redhat.com>
Cleaned unit-tests:
diff -r 892cc7f39358 -r 18ee1b8417d8 tests/junit-runner/JunitLikeXmlOutputListener.java
--- a/tests/junit-runner/JunitLikeXmlOutputListener.java Tue Dec 18 16:15:01 2012 +0100
+++ b/tests/junit-runner/JunitLikeXmlOutputListener.java Thu Dec 20 17:10:38 2012 +0100
@@ -23,6 +23,7 @@
import java.util.concurrent.TimeUnit;
import net.sourceforge.jnlp.annotations.Bug;
import net.sourceforge.jnlp.annotations.KnownToFail;
+import net.sourceforge.jnlp.annotations.Remote;
import org.junit.internal.JUnitSystem;
@@ -49,6 +50,7 @@
private static final String BUGS = "bugs";
private static final String BUG = "bug";
private static final String K2F = "known-to-fail";
+ private static final String REMOTE = "remote";
private static final String TEST_NAME_ATTRIBUTE = "name";
private static final String TEST_TIME_ATTRIBUTE = "time";
private static final String TEST_IGNORED_ATTRIBUTE = "ignored";
@@ -172,6 +174,7 @@
double testTimeSeconds = ((double) testTime) / 1000d;
testDone(description, testTime, testTimeSeconds, false);
}
+
private void testDone(Description description, long testTime, double testTimeSeconds, boolean ignored) throws Exception {
Class testClass = null;
@@ -197,16 +200,14 @@
if (ignored){
testcaseAtts.put(TEST_IGNORED_ATTRIBUTE, Boolean.TRUE.toString());
}
- KnownToFail k2f=null;
- try {
- if (testClass != null && testMethod != null) {
- k2f = testMethod.getAnnotation(KnownToFail.class);
- if (k2f != null) {
- testcaseAtts.put(K2F, Boolean.TRUE.toString());
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace();
+ KnownToFail k2f = LessVerboseTextListener.getAnnotation(testClass, testMethod.getName(), KnownToFail.class);
+ Remote remote = LessVerboseTextListener.getAnnotation(testClass, testMethod.getName(), Remote.class);
+ if (k2f != null) {
+ testcaseAtts.put(K2F, Boolean.TRUE.toString());
+ }
+ if (remote != null) {
+ testcaseAtts.put(REMOTE, Boolean.TRUE.toString());
+
}
openElement(TEST_ELEMENT, testcaseAtts);
if (testFailed != null) {
diff -r 892cc7f39358 -r 18ee1b8417d8 tests/junit-runner/LessVerboseTextListener.java
--- a/tests/junit-runner/LessVerboseTextListener.java Tue Dec 18 16:15:01 2012 +0100
+++ b/tests/junit-runner/LessVerboseTextListener.java Thu Dec 20 17:10:38 2012 +0100
@@ -6,8 +6,10 @@
* http://www.eclipse.org/legal/cpl-v10.html
*/
import java.io.PrintStream;
+import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import net.sourceforge.jnlp.annotations.KnownToFail;
+import net.sourceforge.jnlp.annotations.Remote;
import org.junit.internal.JUnitSystem;
import org.junit.runner.Description;
@@ -37,6 +39,7 @@
public void testIgnored(Description description) throws Exception {
writer.println("Ignored: " + description.getClassName() + "." + description.getMethodName());
printK2F(writer, null, description);
+ printRemote(writer, description);
}
@@ -45,6 +48,7 @@
testFailed = true;
writer.println("FAILED: " + failure.getTestHeader() + " " + failure.getMessage());
printK2F(writer,true,failure.getDescription());
+ printRemote(writer, failure.getDescription());
}
@Override
@@ -52,6 +56,7 @@
if (!testFailed) {
writer.println("Passed: " + description.getClassName() + "." + description.getMethodName());
printK2F(writer,false,description);
+ printRemote(writer, description);
}
}
@@ -93,18 +98,22 @@
}
}
- public static KnownToFail getK2F(Description description) {
+
+ public static <T extends Annotation> T getAnnotation(Class q, String methodName, Class<T> a) {
try {
- Class q = description.getTestClass();
if (q != null) {
- String qs = description.getMethodName();
+ T rem = (T) q.getAnnotation(a);
+ if (rem != null) {
+ return rem;
+ }
+ String qs = methodName;
if (qs.contains(" - ")) {
qs = qs.replaceAll(" - .*", "");
}
Method qm = q.getMethod(qs);
if (qm != null) {
- KnownToFail k2f = qm.getAnnotation(KnownToFail.class);
- return k2f;
+ rem = qm.getAnnotation(a);
+ return rem;
}
}
@@ -114,4 +123,23 @@
return null;
}
+ public static KnownToFail getK2F(Description description) {
+ return (KnownToFail) getAnnotation(description.getTestClass(), description.getMethodName(), KnownToFail.class);
+ }
+
+ public static Remote getRemote(Description description) {
+ return (Remote) getAnnotation(description.getTestClass(), description.getMethodName(), Remote.class);
+
+ }
+
+ private void printRemote(PrintStream writer, Description description) {
+ try {
+ Remote rem = getRemote(description);
+ if (rem != null) {
+ writer.println(" - This test is running remote content, note that failures may be caused by broken taget application or connection");
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
}
diff -r 892cc7f39358 -r 18ee1b8417d8 tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java
--- a/tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java Tue Dec 18 16:15:01 2012 +0100
+++ b/tests/netx/unit/net/sourceforge/jnlp/runtime/CodeBaseClassLoaderTest.java Thu Dec 20 17:10:38 2012 +0100
@@ -50,6 +50,7 @@
import net.sourceforge.jnlp.ServerAccess;
import net.sourceforge.jnlp.runtime.JNLPClassLoader.CodeBaseClassLoader;
import net.sourceforge.jnlp.annotations.Bug;
+import net.sourceforge.jnlp.annotations.Remote;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -122,6 +123,7 @@
"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-March/017626.html",
"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-March/017667.html"})
@Test
+ @Remote
public void testClassResourceLoadSuccessCachingApplication() throws Exception {
setWSA();
//we are testing new resource not in cache
@@ -129,6 +131,7 @@
}
@Test
+ @Remote
public void testClassResourceLoadSuccessCachingApplet() throws Exception {
setApplet();
//so new resource again not in cache
@@ -136,6 +139,7 @@
}
@Test
+ @Remote
public void testResourceLoadSuccessCachingApplication() throws Exception {
setWSA();
//we are testing new resource not in cache
@@ -143,6 +147,7 @@
}
@Test
+ @Remote
public void testResourceLoadSuccessCachingApplet() throws Exception {
setApplet();
//so new resource again not in cache
@@ -196,6 +201,7 @@
"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-March/017626.html",
"http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2012-March/017667.html"})
@Test
+ @Remote
public void testResourceLoadFailureCachingApplication() throws Exception {
setWSA();
testResourceCaching("net/sourceforge/jnlp/about/Main_FOO_.class", false);
@@ -208,12 +214,14 @@
}
@Test
+ @Remote
public void testParentClassLoaderIsAskedForClassesApplication() throws Exception {
setWSA();
testParentClassLoaderIsAskedForClasses();
}
@Test
+ @Remote
public void testParentClassLoaderIsAskedForClassesApplet() throws Exception {
setApplet();
testParentClassLoaderIsAskedForClasses();
@@ -248,6 +256,7 @@
}
@Test
+ @Remote
public void testNullFileSecurityDescApplet() throws Exception {
setApplet();
testNullFileSecurityDesc();
diff -r 892cc7f39358 -r 18ee1b8417d8 tests/report-styles/jreport.xsl
--- a/tests/report-styles/jreport.xsl Tue Dec 18 16:15:01 2012 +0100
+++ b/tests/report-styles/jreport.xsl Thu Dec 20 17:10:38 2012 +0100
@@ -268,6 +268,11 @@
</xsl:otherwise>
</xsl:choose>
</xsl:when>
+ </xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@remote">
+ <i><xsl:text> - This test is running remote content, note that failures may be caused by broken taget application or connection</xsl:text></i>
+ </xsl:when>
</xsl:choose>
</div>
</xsl:when>
@@ -279,6 +284,11 @@
<b><xsl:text> - This test is known to fail</xsl:text></b>
</xsl:when>
</xsl:choose>
+ <xsl:choose>
+ <xsl:when test="@remote">
+ <i><xsl:text> - This test is running remote content, note that failures may be caused by broken taget application or connection</xsl:text></i>
+ </xsl:when>
+ </xsl:choose>
</div>
<div class="wtrace">
<div class="theader">
diff -r 892cc7f39358 -r 18ee1b8417d8 tests/reproducers/custom/remote/srcs/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/custom/remote/srcs/Makefile Thu Dec 20 17:10:38 2012 +0100
@@ -0,0 +1,5 @@
+prepare-reproducer:
+ echo "Nothing to do to prepare remote reproducers now"
+
+clean-reproducer:
+ echo "Nothing to do to clean remote reproducers now"
diff -r 892cc7f39358 -r 18ee1b8417d8 tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/reproducers/custom/remote/testcases/RemoteApplicationSettings.java Thu Dec 20 17:10:38 2012 +0100
@@ -0,0 +1,231 @@
+/* RemoteApplicationTests.java
+ Copyright (C) 2011 Red Hat, Inc.
+
+ This file is part of IcedTea.
+
+ IcedTea is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, version 2.
+
+ IcedTea 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with IcedTea; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version.
+ */
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import net.sourceforge.jnlp.ProcessResult;
+import org.junit.Assert;
+import org.junit.Test;
+
+;
+
+public class RemoteApplicationSettings {
+
+ public static final String mustEmpty = "must be empty, was not";
+ public static final String stdout = "Stdout";
+ public static final String stderr = "Stderr";
+ public static final String stdoutEmpty = stdout + " " + mustEmpty;
+ public static final String stderrEmpty = stderr + " " + mustEmpty;
+
+ public static URL createCatchedUrl(String r) {
+ try {
+ return new URL(r);
+ } catch (MalformedURLException mex) {
+ throw new RuntimeException(mex);
+ }
+ }
+
+ public interface RemoteApplicationTestcaseSettings {
+
+ public URL getUrl();
+
+ public void evaluate(ProcessResult pr);
+ }
+
+ public static abstract class StringBasedURL implements RemoteApplicationTestcaseSettings {
+
+ URL u;
+
+ @Override
+ public URL getUrl() {
+ return u;
+ }
+
+ public StringBasedURL(String r) {
+ this.u = createCatchedUrl(r);
+ }
+ }
+
+ public static class FourierTransform extends StringBasedURL {
+
+ public FourierTransform() {
+ super("http://www.cs.brown.edu/exploratories/freeSoftware/repository/edu/brown/cs/exploratories/applets/fft1DApp/1d_fast_fourier_transform_java_jnlp.jnlp");
+ }
+
+ @Override
+ public void evaluate(ProcessResult pr) {
+ Assert.assertTrue(stdoutEmpty, pr.stdout.length() == 0);
+ Assert.assertTrue(pr.stderr.length() == 0 || pr.stderr.contains(IllegalStateException.class.getName()));
+
+ }
+ }
+
+ public static class OrawebCernCh extends StringBasedURL {
+
+ public OrawebCernCh() {
+ super("https://oraweb.cern.ch/pls/atlasintegration/docs/EMDH_atlas.jnlp");
+ }
+
+ @Override
+ public void evaluate(ProcessResult pr) {
+ Assert.assertTrue(stdoutEmpty, pr.stdout.length() == 0);
+ Assert.assertTrue(pr.stderr.length() == 0 || pr.stderr.contains("Cannot grant permissions to unsigned jars. Application requested security permissions, but jars are not signed"));
+
+ }
+ }
+
+ public static class GnattProject extends StringBasedURL {
+
+ public GnattProject() {
+ super("http://ganttproject.googlecode.com/svn/webstart/ganttproject-2.0.10/ganttproject-2.0.10.jnlp");
+ }
+
+ @Override
+ public void evaluate(ProcessResult pr) {
+ Assert.assertTrue(stdout, pr.stdout.length() == 0);
+ Assert.assertTrue(pr.stderr.contains("Splash closed"));
+ Assert.assertFalse(pr.stderr.contains("Exception"));
+
+ }
+ }
+
+ public static class GeoGebra extends StringBasedURL {
+
+ public GeoGebra() {
+ super("http://www.geogebra.org/webstart/geogebra.jnlp");
+ }
+
+ @Override
+ public void evaluate(ProcessResult pr) {
+ Assert.assertTrue(pr.stdout.length() > 0);
+ Assert.assertTrue(pr.stderr.length() > 0);
+ Assert.assertFalse(pr.stderr.contains("Exception"));
+ Assert.assertFalse(pr.stdout.contains("Exception"));
+
+ }
+ }
+
+ public abstract static class NoOutputs extends StringBasedURL {
+
+ public NoOutputs(String r) {
+ super(r);
+ }
+
+ @Override
+ public void evaluate(ProcessResult pr) {
+ Assert.assertTrue(stdoutEmpty, pr.stdout.length() == 0);
+ Assert.assertTrue(stderrEmpty, pr.stderr.length() == 0);
+
+ }
+ }
+
+ public static class Arbores extends NoOutputs {
+
+ public Arbores() {
+ super("http://www.arbores.ca/AnnuityCalc.jnlp");
+ }
+ }
+
+ public static class PhetSims extends NoOutputs {
+
+ public PhetSims() {
+ super("http://phetsims.colorado.edu/sims/circuit-construction-kit/circuit-construction-kit-dc_en.jnlp");
+ }
+ }
+
+ public static class TopCoder extends NoOutputs {
+
+ public TopCoder() {
+ super("http://www.topcoder.com/contest/arena/ContestAppletProd.jnlp");
+ }
+ }
+
+ public static class SunSwingDemo extends NoOutputs {
+
+ public SunSwingDemo() throws MalformedURLException {
+ super("http://java.sun.com/docs/books/tutorialJWS/uiswing/events/ex6/ComponentEventDemo.jnlp");
+ }
+ }
+
+ public static class ArboresDeposit extends NoOutputs {
+
+ public ArboresDeposit() throws MalformedURLException {
+ super("http://www.arbores.ca/Deposit.jnlp");
+ }
+ }
+
+ public static class AviationWeather extends NoOutputs {
+
+ public AviationWeather() {
+ super("http://aviationweather.gov/static/adds/java/fpt/fpt.jnlp");
+ }
+ }
+
+ public static class FuseSwing extends NoOutputs {
+
+ public FuseSwing() {
+ super("http://www.progx.org/users/Gfx/apps/fuse-swing-demo.jnlp");
+ }
+ }
+
+ @Test
+ public void remoteApplicationSettingsAreWorking() throws Exception {
+ RemoteApplicationTestcaseSettings s5 = new FourierTransform();
+ Assert.assertNotNull(s5.getUrl());
+ RemoteApplicationTestcaseSettings s4 = new Arbores();
+ Assert.assertNotNull(s4.getUrl());
+ RemoteApplicationTestcaseSettings s3 = new PhetSims();
+ Assert.assertNotNull(s3.getUrl());
+ RemoteApplicationTestcaseSettings s2 = new TopCoder();
+ Assert.assertNotNull(s2.getUrl());
+ RemoteApplicationTestcaseSettings s1 = new SunSwingDemo();
+ Assert.assertNotNull(s1.getUrl());
+ RemoteApplicationTestcaseSettings s6 = new ArboresDeposit();
+ Assert.assertNotNull(s6.getUrl());
+ RemoteApplicationTestcaseSettings s7 = new OrawebCernCh();
More information about the distro-pkg-dev
mailing list