Can run from unpackaged directories. E.g. mvn clean install -DskipTests; mvn test works now on JDK8.
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Wed, 11 Mar 2015 08:50:51 +0100
changeset 180972a0dbfa2ae8
parent 1808 68c0229e193e
child 1810 260d731c9504
Can run from unpackaged directories. E.g. mvn clean install -DskipTests; mvn test works now on JDK8.
javaquery/demo-calculator/src/test/java/org/apidesign/bck2brwsr/demo/calc/staticcompilation/MinifiedTest.java
ko/bck2brwsr/pom.xml
launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java
rt/aot-nb-test/pom.xml
rt/emul/brwsrtest/pom.xml
rt/emul/compacttest/pom.xml
     1.1 --- a/javaquery/demo-calculator/src/test/java/org/apidesign/bck2brwsr/demo/calc/staticcompilation/MinifiedTest.java	Tue Mar 10 20:35:20 2015 +0100
     1.2 +++ b/javaquery/demo-calculator/src/test/java/org/apidesign/bck2brwsr/demo/calc/staticcompilation/MinifiedTest.java	Wed Mar 11 08:50:51 2015 +0100
     1.3 @@ -18,6 +18,7 @@
     1.4  package org.apidesign.bck2brwsr.demo.calc.staticcompilation;
     1.5  
     1.6  import java.io.BufferedReader;
     1.7 +import java.io.File;
     1.8  import java.io.InputStreamReader;
     1.9  import java.net.URL;
    1.10  import java.util.Enumeration;
    1.11 @@ -26,6 +27,7 @@
    1.12  import java.util.jar.Manifest;
    1.13  import org.testng.annotations.Test;
    1.14  import static org.testng.Assert.*;
    1.15 +import org.testng.SkipException;
    1.16  
    1.17  public class MinifiedTest {
    1.18      @Test public void minifiedVersionDoesNotContainFQN() throws Exception {
    1.19 @@ -57,7 +59,11 @@
    1.20                  return;
    1.21              }
    1.22          }
    1.23 -        fail("No minified javaquery found: " + System.getProperty("java.class.path"));
    1.24 +        final String cp = System.getProperty("java.class.path");
    1.25 +        if (cp.contains("javaquery" + File.separatorChar + "api" + File.separatorChar + "target" + File.separatorChar + "classes")) {
    1.26 +            throw new SkipException("Classpath seems to contain classes directories, not JARs. Cannot test.\nCP: " + cp);
    1.27 +        }
    1.28 +        fail("No minified javaquery found: " + cp);
    1.29      }
    1.30  
    1.31      @Test public void debugVersionContainsFQN() throws Exception {
    1.32 @@ -89,7 +95,11 @@
    1.33                  fail("Found no FQN of non-public Knockout class. Is it debug version?:" + key);
    1.34              }
    1.35          }
    1.36 -        fail("No debug javaquery found: " + System.getProperty("java.class.path"));
    1.37 +        final String cp = System.getProperty("java.class.path");
    1.38 +        if (cp.contains("javaquery" + File.separatorChar + "api" + File.separatorChar + "target" + File.separatorChar + "classes")) {
    1.39 +            throw new SkipException("Classpath seems to contain classes directories, not JARs. Cannot test.\nCP: " + cp);
    1.40 +        }
    1.41 +        fail("No debug javaquery found: " + cp);
    1.42      }
    1.43      
    1.44  }
     2.1 --- a/ko/bck2brwsr/pom.xml	Tue Mar 10 20:35:20 2015 +0100
     2.2 +++ b/ko/bck2brwsr/pom.xml	Wed Mar 11 08:50:51 2015 +0100
     2.3 @@ -144,5 +144,11 @@
     2.4        <artifactId>net.java.html.sound</artifactId>
     2.5        <version>${net.java.html.version}</version>
     2.6      </dependency>
     2.7 +    <dependency>
     2.8 +      <groupId>${project.groupId}</groupId>
     2.9 +      <artifactId>emul.mini</artifactId>
    2.10 +      <version>${project.version}</version>
    2.11 +      <scope>test</scope>
    2.12 +    </dependency>
    2.13    </dependencies>
    2.14  </project>
     3.1 --- a/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java	Tue Mar 10 20:35:20 2015 +0100
     3.2 +++ b/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java	Wed Mar 11 08:50:51 2015 +0100
     3.3 @@ -97,21 +97,14 @@
     3.4              if (u == null) {
     3.5                  throw new IOException("Cannot find InterruptedException class on classpath: " + System.getProperty("java.class.path"));
     3.6              }
     3.7 -            final URLConnection conn = u.openConnection();
     3.8 -            if (conn instanceof JarURLConnection) {
     3.9 -                JarURLConnection juc = (JarURLConnection)conn;
    3.10 -                rt = Bck2BrwsrJars.configureFrom(null, new File(juc.getJarFileURL().toURI()));
    3.11 -            } else {
    3.12 -                throw new FileNotFoundException("Not a JAR URL: " + u);
    3.13 -            }
    3.14 +            rt = configureFrom(u, null, 3);
    3.15          } catch (URISyntaxException ex) {
    3.16              throw new IOException(ex);
    3.17          }
    3.18          final Bck2Brwsr all;
    3.19          try {
    3.20              URL u = r.get(Bck2Brwsr.class.getName().replace('.', '/') + ".class", 0);
    3.21 -            JarURLConnection juc = (JarURLConnection)u.openConnection();
    3.22 -            all = Bck2BrwsrJars.configureFrom(rt, new File(juc.getJarFileURL().toURI()));
    3.23 +            all = configureFrom(u, rt, 4);
    3.24          } catch (URISyntaxException ex) {
    3.25              throw new IOException(ex);
    3.26          }
    3.27 @@ -127,4 +120,21 @@
    3.28                  }
    3.29              }).generate(sb);
    3.30      }
    3.31 +
    3.32 +    static Bck2Brwsr configureFrom(URL u, Bck2Brwsr rt, int parents) throws IOException, URISyntaxException {
    3.33 +        final URLConnection conn = u.openConnection();
    3.34 +        if (conn instanceof JarURLConnection) {
    3.35 +            JarURLConnection juc = (JarURLConnection)conn;
    3.36 +            rt = Bck2BrwsrJars.configureFrom(null, new File(juc.getJarFileURL().toURI()));
    3.37 +        } else if (u.getProtocol().equals("file")) {
    3.38 +            File dir = new File(u.toURI());
    3.39 +            while (parents-- > 0) {
    3.40 +                dir = dir.getParentFile();
    3.41 +            }
    3.42 +            rt = Bck2BrwsrJars.configureFrom(null, dir);
    3.43 +        } else {
    3.44 +            throw new FileNotFoundException("Not a JAR or file URL: " + u);
    3.45 +        }
    3.46 +        return rt;
    3.47 +    }
    3.48  }
     4.1 --- a/rt/aot-nb-test/pom.xml	Tue Mar 10 20:35:20 2015 +0100
     4.2 +++ b/rt/aot-nb-test/pom.xml	Wed Mar 11 08:50:51 2015 +0100
     4.3 @@ -47,6 +47,12 @@
     4.4              <groupId>org.netbeans.api</groupId>
     4.5              <artifactId>org-openide-util-lookup</artifactId>
     4.6          </dependency>
     4.7 +        <dependency>
     4.8 +            <groupId>${project.groupId}</groupId>
     4.9 +            <artifactId>emul.mini</artifactId>
    4.10 +            <version>${project.version}</version>
    4.11 +            <scope>test</scope>
    4.12 +        </dependency>
    4.13      </dependencies>
    4.14      <build>
    4.15          <plugins>
     5.1 --- a/rt/emul/brwsrtest/pom.xml	Tue Mar 10 20:35:20 2015 +0100
     5.2 +++ b/rt/emul/brwsrtest/pom.xml	Wed Mar 11 08:50:51 2015 +0100
     5.3 @@ -55,5 +55,11 @@
     5.4        <version>${project.version}</version>
     5.5        <scope>test</scope>
     5.6      </dependency>
     5.7 +    <dependency>
     5.8 +        <groupId>${project.groupId}</groupId>
     5.9 +        <artifactId>emul.mini</artifactId>
    5.10 +        <version>${project.version}</version>
    5.11 +        <scope>test</scope>
    5.12 +    </dependency>
    5.13    </dependencies>
    5.14  </project>
     6.1 --- a/rt/emul/compacttest/pom.xml	Tue Mar 10 20:35:20 2015 +0100
     6.2 +++ b/rt/emul/compacttest/pom.xml	Wed Mar 11 08:50:51 2015 +0100
     6.3 @@ -39,6 +39,12 @@
     6.4              <artifactId>org-openide-util-lookup</artifactId>
     6.5              <scope>test</scope>
     6.6          </dependency>
     6.7 +        <dependency>
     6.8 +            <groupId>${project.groupId}</groupId>
     6.9 +            <artifactId>emul.mini</artifactId>
    6.10 +            <version>${project.version}</version>
    6.11 +            <scope>test</scope>
    6.12 +        </dependency>
    6.13      </dependencies>
    6.14      <build>
    6.15          <plugins>