# HG changeset patch # User Jaroslav Tulach # Date 1426060251 -3600 # Node ID 72a0dbfa2ae8148bf832e59e6a4dd5dc451be78e # Parent 68c0229e193e1a2b59dd625da708cafb818e715b Can run from unpackaged directories. E.g. mvn clean install -DskipTests; mvn test works now on JDK8. diff -r 68c0229e193e -r 72a0dbfa2ae8 javaquery/demo-calculator/src/test/java/org/apidesign/bck2brwsr/demo/calc/staticcompilation/MinifiedTest.java --- a/javaquery/demo-calculator/src/test/java/org/apidesign/bck2brwsr/demo/calc/staticcompilation/MinifiedTest.java Tue Mar 10 20:35:20 2015 +0100 +++ b/javaquery/demo-calculator/src/test/java/org/apidesign/bck2brwsr/demo/calc/staticcompilation/MinifiedTest.java Wed Mar 11 08:50:51 2015 +0100 @@ -18,6 +18,7 @@ package org.apidesign.bck2brwsr.demo.calc.staticcompilation; import java.io.BufferedReader; +import java.io.File; import java.io.InputStreamReader; import java.net.URL; import java.util.Enumeration; @@ -26,6 +27,7 @@ import java.util.jar.Manifest; import org.testng.annotations.Test; import static org.testng.Assert.*; +import org.testng.SkipException; public class MinifiedTest { @Test public void minifiedVersionDoesNotContainFQN() throws Exception { @@ -57,7 +59,11 @@ return; } } - fail("No minified javaquery found: " + System.getProperty("java.class.path")); + final String cp = System.getProperty("java.class.path"); + if (cp.contains("javaquery" + File.separatorChar + "api" + File.separatorChar + "target" + File.separatorChar + "classes")) { + throw new SkipException("Classpath seems to contain classes directories, not JARs. Cannot test.\nCP: " + cp); + } + fail("No minified javaquery found: " + cp); } @Test public void debugVersionContainsFQN() throws Exception { @@ -89,7 +95,11 @@ fail("Found no FQN of non-public Knockout class. Is it debug version?:" + key); } } - fail("No debug javaquery found: " + System.getProperty("java.class.path")); + final String cp = System.getProperty("java.class.path"); + if (cp.contains("javaquery" + File.separatorChar + "api" + File.separatorChar + "target" + File.separatorChar + "classes")) { + throw new SkipException("Classpath seems to contain classes directories, not JARs. Cannot test.\nCP: " + cp); + } + fail("No debug javaquery found: " + cp); } } diff -r 68c0229e193e -r 72a0dbfa2ae8 ko/bck2brwsr/pom.xml --- a/ko/bck2brwsr/pom.xml Tue Mar 10 20:35:20 2015 +0100 +++ b/ko/bck2brwsr/pom.xml Wed Mar 11 08:50:51 2015 +0100 @@ -144,5 +144,11 @@ net.java.html.sound ${net.java.html.version} + + ${project.groupId} + emul.mini + ${project.version} + test + diff -r 68c0229e193e -r 72a0dbfa2ae8 launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java --- a/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java Tue Mar 10 20:35:20 2015 +0100 +++ b/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java Wed Mar 11 08:50:51 2015 +0100 @@ -97,21 +97,14 @@ if (u == null) { throw new IOException("Cannot find InterruptedException class on classpath: " + System.getProperty("java.class.path")); } - final URLConnection conn = u.openConnection(); - if (conn instanceof JarURLConnection) { - JarURLConnection juc = (JarURLConnection)conn; - rt = Bck2BrwsrJars.configureFrom(null, new File(juc.getJarFileURL().toURI())); - } else { - throw new FileNotFoundException("Not a JAR URL: " + u); - } + rt = configureFrom(u, null, 3); } catch (URISyntaxException ex) { throw new IOException(ex); } final Bck2Brwsr all; try { URL u = r.get(Bck2Brwsr.class.getName().replace('.', '/') + ".class", 0); - JarURLConnection juc = (JarURLConnection)u.openConnection(); - all = Bck2BrwsrJars.configureFrom(rt, new File(juc.getJarFileURL().toURI())); + all = configureFrom(u, rt, 4); } catch (URISyntaxException ex) { throw new IOException(ex); } @@ -127,4 +120,21 @@ } }).generate(sb); } + + static Bck2Brwsr configureFrom(URL u, Bck2Brwsr rt, int parents) throws IOException, URISyntaxException { + final URLConnection conn = u.openConnection(); + if (conn instanceof JarURLConnection) { + JarURLConnection juc = (JarURLConnection)conn; + rt = Bck2BrwsrJars.configureFrom(null, new File(juc.getJarFileURL().toURI())); + } else if (u.getProtocol().equals("file")) { + File dir = new File(u.toURI()); + while (parents-- > 0) { + dir = dir.getParentFile(); + } + rt = Bck2BrwsrJars.configureFrom(null, dir); + } else { + throw new FileNotFoundException("Not a JAR or file URL: " + u); + } + return rt; + } } diff -r 68c0229e193e -r 72a0dbfa2ae8 rt/aot-nb-test/pom.xml --- a/rt/aot-nb-test/pom.xml Tue Mar 10 20:35:20 2015 +0100 +++ b/rt/aot-nb-test/pom.xml Wed Mar 11 08:50:51 2015 +0100 @@ -47,6 +47,12 @@ org.netbeans.api org-openide-util-lookup + + ${project.groupId} + emul.mini + ${project.version} + test + diff -r 68c0229e193e -r 72a0dbfa2ae8 rt/emul/brwsrtest/pom.xml --- a/rt/emul/brwsrtest/pom.xml Tue Mar 10 20:35:20 2015 +0100 +++ b/rt/emul/brwsrtest/pom.xml Wed Mar 11 08:50:51 2015 +0100 @@ -55,5 +55,11 @@ ${project.version} test + + ${project.groupId} + emul.mini + ${project.version} + test + diff -r 68c0229e193e -r 72a0dbfa2ae8 rt/emul/compacttest/pom.xml --- a/rt/emul/compacttest/pom.xml Tue Mar 10 20:35:20 2015 +0100 +++ b/rt/emul/compacttest/pom.xml Wed Mar 11 08:50:51 2015 +0100 @@ -39,6 +39,12 @@ org-openide-util-lookup test + + ${project.groupId} + emul.mini + ${project.version} + test +