1.1 --- a/vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java Fri Dec 07 06:29:54 2012 +0100
1.2 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java Tue Dec 11 09:36:44 2012 +0100
1.3 @@ -17,10 +17,6 @@
1.4 */
1.5 package org.apidesign.vm4brwsr;
1.6
1.7 -import java.io.IOException;
1.8 -import java.io.InputStream;
1.9 -import java.util.Set;
1.10 -import java.util.TreeSet;
1.11 import javax.script.Invocable;
1.12 import javax.script.ScriptContext;
1.13 import javax.script.ScriptEngine;
1.14 @@ -53,9 +49,9 @@
1.15
1.16 ScriptEngine[] arr = { null };
1.17 code = StaticMethodTest.compileClass(sb, arr,
1.18 - "org/apidesign/vm4brwsr/GenJS"
1.19 + "org/apidesign/vm4brwsr/VM"
1.20 );
1.21 - arr[0].getContext().setAttribute("loader", new FindBytes(), ScriptContext.ENGINE_SCOPE);
1.22 + arr[0].getContext().setAttribute("loader", new BytesLoader(), ScriptContext.ENGINE_SCOPE);
1.23 codeSeq = sb;
1.24 }
1.25
1.26 @@ -88,35 +84,4 @@
1.27 }
1.28 assertEquals(ret, expRes, msg + "was: " + ret + "\n" + StaticMethodTest.dumpJS(codeSeq));
1.29 }
1.30 -
1.31 - public static final class FindBytes {
1.32 - private static Set<String> requested = new TreeSet<String>();
1.33 -
1.34 - public byte[] get(String name) throws IOException {
1.35 - if (!requested.add(name)) {
1.36 - throw new IllegalStateException("Requested for second time: " + name);
1.37 - }
1.38 -
1.39 - InputStream is = VMLazyTest.class.getClassLoader().getResourceAsStream(name);
1.40 - if (is == null) {
1.41 - throw new IOException("Can't find " + name);
1.42 - }
1.43 - byte[] arr = new byte[is.available()];
1.44 - int len = is.read(arr);
1.45 - if (len != arr.length) {
1.46 - throw new IOException("Read only " + len + " wanting " + arr.length);
1.47 - }
1.48 - /*
1.49 - System.err.print("loader['" + name + "'] = [");
1.50 - for (int i = 0; i < arr.length; i++) {
1.51 - if (i > 0) {
1.52 - System.err.print(", ");
1.53 - }
1.54 - System.err.print(arr[i]);
1.55 - }
1.56 - System.err.println("]");
1.57 - */
1.58 - return arr;
1.59 - }
1.60 - }
1.61 }