Mercurial > hg > release > icedtea-web-1.6
changeset 1167:d0e2beda96ca
Fixed CacheReproducerTest and VersionedJarTest tests
* tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java: fixed
* tests/reproducers/simple/VersionedJar__V1/testcases/VersionedJarTest.java: fixed
* tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java: introduced executeJavawsClearCache shortcut method to executeJavawsHeadless
author | Jiri Vanek <jvanek@redhat.com> |
---|---|
date | Tue, 03 Mar 2015 15:33:27 +0100 |
parents | 11b46740b094 |
children | a89fc59ab516 |
files | ChangeLog tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java tests/reproducers/simple/VersionedJar__V1/testcases/VersionedJarTest.java tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java |
diffstat | 4 files changed, 28 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Mar 03 09:14:07 2015 -0500 +++ b/ChangeLog Tue Mar 03 15:33:27 2015 +0100 @@ -1,3 +1,13 @@ +2015-02-27 Jiri Vanek <jvanek@redhat.com> + + Fixed CacheReproducerTest and VersionedJarTest tests + * tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java: + fixed + * tests/reproducers/simple/VersionedJar__V1/testcases/VersionedJarTest.java: + fixed + * tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java: introduced + executeJavawsClearCache shortcut method to executeJavawsHeadless + 2015-03-03 Jie Kang <jkang@redhat.com> Fix DeadLockTest reproducers
--- a/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java Tue Mar 03 09:14:07 2015 -0500 +++ b/tests/reproducers/signed/CacheReproducer/testcases/CacheReproducerTest.java Tue Mar 03 15:33:27 2015 +0100 @@ -51,6 +51,7 @@ import net.sourceforge.jnlp.ProcessResult; import net.sourceforge.jnlp.annotations.KnownToFail; import net.sourceforge.jnlp.config.Defaults; +import net.sourceforge.jnlp.config.PathsAndFiles; import net.sourceforge.jnlp.tools.MessageProperties; import org.junit.AfterClass; import org.junit.Assert; @@ -60,7 +61,6 @@ public class CacheReproducerTest { private static final ServerAccess server = new ServerAccess(); - private static final List<String> clear = Arrays.asList(new String[]{server.getJavawsLocation(), "-Xclearcache", ServerAccess.HEADLES_OPTION}); private static final List<String> trustedVerboses = Arrays.asList(new String[]{"-Xtrustall", ServerAccess.HEADLES_OPTION,"-verbose"}); private static final List<String> verbosed = Arrays.asList(new String[]{"-verbose", ServerAccess.HEADLES_OPTION}); @@ -70,7 +70,7 @@ private static final Pattern corruptPatern = Pattern.compile(corruptRegex); private static final String corruptString = "156dsf1562kd5"; - private static final File icedteaCache = new File(Defaults.USER_CACHE_HOME, "cache"); + private static final File icedteaCache = new File(PathsAndFiles.USER_CACHE_HOME, "cache"); private static final File icedteaCacheFile = new File(icedteaCache, "recently_used"); private static final File netxLock = new File(System.getProperty("java.io.tmpdir"), System.getProperty("user.name") + File.separator + @@ -476,7 +476,7 @@ } private static ProcessResult tryToClearcache() throws Exception { - ProcessResult pr1 = ServerAccess.executeProcess(clear); + ProcessResult pr1 = server.executeJavawsClearCache(); return pr1; } }
--- a/tests/reproducers/simple/VersionedJar__V1/testcases/VersionedJarTest.java Tue Mar 03 09:14:07 2015 -0500 +++ b/tests/reproducers/simple/VersionedJar__V1/testcases/VersionedJarTest.java Tue Mar 03 15:33:27 2015 +0100 @@ -38,6 +38,7 @@ import net.sourceforge.jnlp.ServerAccess; import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.Test; public class VersionedJarTest { @@ -46,8 +47,17 @@ private static final String VERSIONED = "Versioned jar was accessed."; private static final String FAILURE = "net.sourceforge.jnlp.LaunchException"; + @BeforeClass + public static void clearCache() throws Exception{ + //to speedup individual methods + server.executeJavawsClearCache(); + } + @Test public void testDisabledVersionParameter() throws Exception { + //if testEnabledVersionParameter is run before this onne, then it fails + server.executeJavawsClearCache(); + //the versioning is realted only to downloading of resources, so afaik this behaviour is correct ProcessResult pr = server.executeJavawsHeadless("/VersionedJarDisabled.jnlp"); Assert.assertFalse("Stdout should NOT contain '" + VERSIONED + "', but did.", pr.stdout.contains(VERSIONED)); Assert.assertTrue("Stderr should contain '" +FAILURE + "', but did not.", pr.stderr.contains(FAILURE)); @@ -55,6 +65,7 @@ @Test public void testEnabledVersionParameter() throws Exception { + server.executeJavawsClearCache(); ProcessResult pr = server.executeJavawsHeadless("/VersionedJarEnabled.jnlp"); Assert.assertTrue("Stdout should contain '" + VERSIONED + "', but did not.", pr.stdout.contains(VERSIONED)); Assert.assertFalse("Stderr should NOT contain '" +FAILURE + "', but did.", pr.stderr.contains(FAILURE));
--- a/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java Tue Mar 03 09:14:07 2015 -0500 +++ b/tests/test-extensions/net/sourceforge/jnlp/ServerAccess.java Tue Mar 03 15:33:27 2015 +0100 @@ -46,6 +46,7 @@ import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import net.sourceforge.jnlp.browsertesting.Browser; import net.sourceforge.jnlp.browsertesting.BrowserFactory; @@ -523,6 +524,9 @@ public ProcessResult executeJavawsHeadless(String resource,ContentReaderListener stdoutl,ContentReaderListener stderrl) throws Exception { return executeJavawsHeadless(null, resource,stdoutl,stderrl,null); } + public ProcessResult executeJavawsClearCache() throws Exception { + return executeProcess(Arrays.asList(new String[]{getJavawsLocation(), OptionsDefinitions.OPTIONS.CLEARCACHE.option, ServerAccess.HEADLES_OPTION})); + } /** * wrapping method to executeProcess (eg: javaws arg arg -headless http://localhost:port/resource)