diff -r 64211e906133 Makefile.am --- a/Makefile.am Tue Oct 25 10:02:45 2011 -0400 +++ b/Makefile.am Fri Oct 28 13:11:37 2011 +0200 @@ -473,22 +473,24 @@ stamps/netx-dist-tests-prepare-reproducers.stamp: stamps/junit-jnlp-dist-dirs types=(simple signed); \ for which in "$${types[@]}" ; do \ + . $(abs_top_builddir)/NEW_LINE_IFS ; \ simpleReproducers=(`cat $(abs_top_builddir)/junit-jnlp-dist-$$which.txt `); \ + restoreIFS ; \ for dir in "$${simpleReproducers[@]}" ; do \ echo "processing: $$dir" ; \ - mkdir -p $(JNLP_TESTS_DIR)/$$dir ; \ + mkdir -p "$(JNLP_TESTS_DIR)/$$dir" ; \ d=`pwd` ; \ - cd $(JNLP_TESTS_SRCDIR)/$$which/$$dir/srcs/ ; \ + cd "$(JNLP_TESTS_SRCDIR)/$$which/$$dir/srcs/" ; \ srcFiles=`find . -mindepth 1 -type f -name "*.java" | sed "s/.\/*//"` ; \ notSrcFiles=`find . -mindepth 1 -type f \! -name "*.java" | sed "s/.\/*//"` ; \ - $(BOOT_DIR)/bin/javac -d $(JNLP_TESTS_DIR)/$$dir/ $$srcFiles ; \ + $(BOOT_DIR)/bin/javac -d "$(JNLP_TESTS_DIR)/$$dir/" $$srcFiles ; \ if [ -n "$$notSrcFiles" ] ; then \ - cp -R --parents $$notSrcFiles $(JNLP_TESTS_DIR)/$$dir/ ; \ + cp -R --parents "$$notSrcFiles" "$(JNLP_TESTS_DIR)/$$dir/" ; \ fi ; \ - cd $(JNLP_TESTS_DIR)/$$dir/ ; \ - $(BOOT_DIR)/bin/jar cf $(JNLP_TESTS_SERVER_DEPLOYDIR)/$$dir.jar * ; \ - cd $$d ; \ - cp -R $(JNLP_TESTS_SRCDIR)/$$which/$$dir/resources/* $(JNLP_TESTS_SERVER_DEPLOYDIR)/ ; \ + cd "$(JNLP_TESTS_DIR)/$$dir/" ; \ + $(BOOT_DIR)/bin/jar cf "$(JNLP_TESTS_SERVER_DEPLOYDIR)/$$dir.jar" * ; \ + cd "$$d" ; \ + cp -R "$(JNLP_TESTS_SRCDIR)/$$which/$$dir/resources/"* $(JNLP_TESTS_SERVER_DEPLOYDIR)/ ; \ done ; \ done ; \ mkdir -p stamps && \ @@ -499,9 +501,11 @@ keystore=$(abs_top_builddir)/$(KEYSTORE_NAME); \ pass=123456789; \ $(BOOT_DIR)/bin/keytool -genkey -alias $$alias -keystore $$keystore -keypass $$pass -storepass $$pass -dname "cn=$$alias, ou=$$alias, o=$$alias, c=$$alias" ; \ + . $(abs_top_builddir)/NEW_LINE_IFS ; \ signedReproducers=(`cat $(abs_top_builddir)/junit-jnlp-dist-signed.txt `); \ + restoreIFS ; \ for dir in "$${signedReproducers[@]}" ; do \ - $(BOOT_DIR)/bin/jarsigner -keystore $$keystore -storepass $$pass -keypass $$pass $(JNLP_TESTS_SERVER_DEPLOYDIR)/$$dir.jar $$alias ; \ + $(BOOT_DIR)/bin/jarsigner -keystore $$keystore -storepass $$pass -keypass $$pass "$(JNLP_TESTS_SERVER_DEPLOYDIR)/$$dir.jar" $$alias ; \ done ; \ mkdir -p stamps && \ touch $@ @@ -522,12 +526,14 @@ netx-dist-tests-source-files.txt stamps/netx-dist-tests-compile.stamp types=(simple signed); \ for which in "$${types[@]}" ; do \ + . $(abs_top_builddir)/NEW_LINE_IFS ; \ simpleReproducers=(`cat $(abs_top_builddir)/junit-jnlp-dist-$$which.txt `); \ + restoreIFS ; \ for dir in "$${simpleReproducers[@]}" ; do \ $(BOOT_DIR)/bin/javac $(IT_JAVACFLAGS) \ -d $(JNLP_TESTS_ENGINE_DIR) \ -classpath $(JUNIT_JAR):$(NETX_DIR)/lib/classes.jar:$(JNLP_TESTS_ENGINE_DIR) \ - $(JNLP_TESTS_SRCDIR)/$$which/$$dir/testcases/* ; \ + "$(JNLP_TESTS_SRCDIR)/$$which/$$dir/testcases/"* ; \ done ; \ done ; \ mkdir -p stamps && \ diff -r 64211e906133 NEW_LINE_IFS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NEW_LINE_IFS Fri Oct 28 13:11:37 2011 +0200 @@ -0,0 +1,14 @@ +#!/bin/sh +NEW_LINE_IFS=" +" + +function restoreIFS(){ +#echo "3xx""$IFS""xx" ; +IFS="$IFS_BACKUP" +#echo "4xx""$IFS""xx" ; +} + +IFS_BACKUP="$IFS"; +#echo "1xx""$IFS""xx" ; +IFS="$NEW_LINE_IFS" ; +#echo "2xx""$IFS""xx" ; diff -r 64211e906133 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ResourcesTest.java --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ResourcesTest.java Tue Oct 25 10:02:45 2011 -0400 +++ b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ResourcesTest.java Fri Oct 28 13:11:37 2011 +0200 @@ -38,6 +38,7 @@ import java.io.File; import java.io.FileFilter; +import java.net.URI; import org.junit.Assert; import org.junit.Test; @@ -45,7 +46,6 @@ public class ResourcesTest { private static ServerAccess server = new ServerAccess(); - @Test public void testResourcesExists() throws Exception { @@ -64,9 +64,12 @@ for (int i = 0; i < simpleContent.length; i++) { File file = simpleContent[i]; - System.err.println(file.getName()); + System.err.print(file.getName()); + URI u = new URI((String)null,(String)null,(String)null,server.getPort(),file.getName(),(String)null,null); + System.err.println(" ("+u.toString()+")"); + String fname=u.toString(); if (file.getName().toLowerCase().endsWith(".jnlp")) { - String c = server.getResourceAsString("/" + file.getName()); + String c = server.getResourceAsString("/" + fname); Assert.assertTrue(c.contains("<")); Assert.assertTrue(c.contains(">")); Assert.assertTrue(c.contains("jnlp")); @@ -74,7 +77,7 @@ Assert.assertTrue(c.replaceAll("\\s*", "").contains("")); } else { - byte[] c = server.getResourceAsBytes("/" + file.getName()).toByteArray(); + byte[] c = server.getResourceAsBytes("/" + fname).toByteArray(); Assert.assertEquals(c.length, file.length()); } diff -r 64211e906133 tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java --- a/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java Tue Oct 25 10:02:45 2011 -0400 +++ b/tests/netx/jnlp_testsengine/net/sourceforge/jnlp/ServerAccess.java Fri Oct 28 13:11:37 2011 +0200 @@ -53,7 +53,9 @@ import java.net.MalformedURLException; import java.net.ServerSocket; import java.net.Socket; +import java.net.URI; import java.net.URL; +import java.net.URLDecoder; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; @@ -134,6 +136,7 @@ findPortTestingSocket.close(); return port; } + public static final String HEADLES_OPTION="-headless"; /** * we would like to have an singleton instance asap @@ -454,7 +457,7 @@ otherargs = new ArrayList(1); } List headlesList = new ArrayList(otherargs); - headlesList.add("-headless"); + headlesList.add(HEADLES_OPTION); return executeJavaws(headlesList, resource); } @@ -515,6 +518,9 @@ return executeProcess(urledArgs); } + public static ProcessResult executeProcess(final List args) throws Exception { + return executeProcess(args, null); + } /** * utility method to lunch process, get its stdou/stderr, its return value and to kill it if runing to long (@see PROCESS_TIMEOUT) * @@ -527,12 +533,13 @@ * Construct result from readed stdout, stderr, process return value, assasin sucessfulity * * @param args binary with args to be executed + * @param dir optional, directory where this process will run * @return what left from process - proces sitself, its stdout, stderr and return value and weather it was terminated by assasin. * @throws Exception */ - public static ProcessResult executeProcess(final List args) throws Exception { + public static ProcessResult executeProcess(final List args,File dir) throws Exception { - ThreadedProcess t = new ThreadedProcess(args); + ThreadedProcess t = new ThreadedProcess(args,dir); ProcessAssasin pa = new ProcessAssasin(t, PROCESS_TIMEOUT); pa.start(); t.start(); @@ -569,6 +576,7 @@ List args; Integer exitCode; Boolean running; + File dir; public Boolean isRunning() { return running; @@ -581,6 +589,10 @@ public ThreadedProcess(List args) { this.args = args; } + public ThreadedProcess(List args,File dir) { + this.args = args; + this.dir=dir; + } public String getCommandLine() { String commandLine = "unknown command"; @@ -608,7 +620,11 @@ try { running = true; Runtime r = Runtime.getRuntime(); - p = r.exec(args.toArray(new String[0])); + if (dir==null){ + p = r.exec(args.toArray(new String[0])); + }else{ + p = r.exec(args.toArray(new String[0]),new String[0], dir); + } exitCode = p.waitFor(); } catch (Exception ex) { if (ex instanceof InterruptedException) { @@ -744,6 +760,9 @@ StringTokenizer t = new StringTokenizer(s, " "); t.nextToken(); String p = t.nextToken(); + System.err.println("Getting: "+p); + p=URLDecoder.decode(p, "UTF-8"); + System.err.println("Serving: "+p); p = (".".concat(((p.endsWith("/")) ? p.concat( "index.html") : p))).replace('/', File.separatorChar); File pp = new File(dir, p);