1.1 --- a/ko/bck2brwsr/pom.xml Wed Apr 15 14:32:54 2015 +0200
1.2 +++ b/ko/bck2brwsr/pom.xml Wed Apr 15 17:21:28 2015 +0200
1.3 @@ -48,6 +48,18 @@
1.4 <debug>false</debug>
1.5 </configuration>
1.6 </plugin>
1.7 + <plugin>
1.8 + <artifactId>maven-failsafe-plugin</artifactId>
1.9 + <version>2.16</version>
1.10 + <executions>
1.11 + <execution>
1.12 + <goals>
1.13 + <goal>integration-test</goal>
1.14 + <goal>verify</goal>
1.15 + </goals>
1.16 + </execution>
1.17 + </executions>
1.18 + </plugin>
1.19 </plugins>
1.20 </build>
1.21 <dependencies>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/ko/bck2brwsr/src/test/java/org/apidesign/bck2brwsr/ko2brwsr/MinifiedIT.java Wed Apr 15 17:21:28 2015 +0200
2.3 @@ -0,0 +1,60 @@
2.4 +/**
2.5 + * Back 2 Browser Bytecode Translator
2.6 + * Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
2.7 + *
2.8 + * This program is free software: you can redistribute it and/or modify
2.9 + * it under the terms of the GNU General Public License as published by
2.10 + * the Free Software Foundation, version 2 of the License.
2.11 + *
2.12 + * This program is distributed in the hope that it will be useful,
2.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2.15 + * GNU General Public License for more details.
2.16 + *
2.17 + * You should have received a copy of the GNU General Public License
2.18 + * along with this program. Look for COPYING file in the top folder.
2.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
2.20 + */
2.21 +package org.apidesign.bck2brwsr.ko2brwsr;
2.22 +
2.23 +import java.io.File;
2.24 +import java.io.InputStream;
2.25 +import java.net.URL;
2.26 +import java.util.Enumeration;
2.27 +import java.util.jar.JarEntry;
2.28 +import java.util.jar.JarFile;
2.29 +import org.testng.annotations.Test;
2.30 +import static org.testng.Assert.*;
2.31 +import org.testng.annotations.BeforeMethod;
2.32 +import org.testng.reporters.Files;
2.33 +
2.34 +public class MinifiedIT {
2.35 + private File file;
2.36 +
2.37 + @BeforeMethod public void findPrecompiledLibraries() throws Exception {
2.38 + File dir = new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI()).getParentFile();
2.39 + for (File f : dir.listFiles()) {
2.40 + if (f.getName().endsWith("-bck2brwsr.jar")) {
2.41 + file = f;
2.42 + return;
2.43 + }
2.44 + }
2.45 + fail("Cannot find precompiled libraries in " + dir);
2.46 + }
2.47 +
2.48 + @Test public void minifiedVersionDoesNotContainFQN() throws Exception {
2.49 + JarFile jf = new JarFile(file);
2.50 + Enumeration<JarEntry> en = jf.entries();
2.51 + while (en.hasMoreElements()) {
2.52 + JarEntry e = en.nextElement();
2.53 + String content;
2.54 + try (InputStream is = jf.getInputStream(e)) {
2.55 + content = Files.readFile(is);
2.56 + }
2.57 + if (content.contains("registerResource']('org/netbeans/html/ko4j/knockout")) {
2.58 + fail("@JavaScriptResource resource should be missing: "+ e.getName() + " in " + file);
2.59 + }
2.60 + }
2.61 + }
2.62 +
2.63 +}
3.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java Wed Apr 15 14:32:54 2015 +0200
3.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java Wed Apr 15 17:21:28 2015 +0200
3.3 @@ -691,6 +691,7 @@
3.4 @Override
3.5 protected void requireResource(String resourcePath) throws IOException {
3.6 requireResourceImpl(resourcePath);
3.7 + super.asBinary.remove(resourcePath);
3.8 }
3.9 }
3.10
3.11 @@ -791,6 +792,7 @@
3.12 @Override
3.13 protected void requireResource(String resourcePath) throws IOException {
3.14 requireResourceImpl(resourcePath);
3.15 + super.asBinary.remove(resourcePath);
3.16 }
3.17 }
3.18 }