diff -r e4b9eee9be83 -r 885acca2fa0b vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java --- a/vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java Fri Dec 07 06:29:54 2012 +0100 +++ b/vm/src/test/java/org/apidesign/vm4brwsr/VMLazyTest.java Tue Dec 11 09:36:44 2012 +0100 @@ -17,10 +17,6 @@ */ package org.apidesign.vm4brwsr; -import java.io.IOException; -import java.io.InputStream; -import java.util.Set; -import java.util.TreeSet; import javax.script.Invocable; import javax.script.ScriptContext; import javax.script.ScriptEngine; @@ -53,9 +49,9 @@ ScriptEngine[] arr = { null }; code = StaticMethodTest.compileClass(sb, arr, - "org/apidesign/vm4brwsr/GenJS" + "org/apidesign/vm4brwsr/VM" ); - arr[0].getContext().setAttribute("loader", new FindBytes(), ScriptContext.ENGINE_SCOPE); + arr[0].getContext().setAttribute("loader", new BytesLoader(), ScriptContext.ENGINE_SCOPE); codeSeq = sb; } @@ -88,35 +84,4 @@ } assertEquals(ret, expRes, msg + "was: " + ret + "\n" + StaticMethodTest.dumpJS(codeSeq)); } - - public static final class FindBytes { - private static Set requested = new TreeSet(); - - public byte[] get(String name) throws IOException { - if (!requested.add(name)) { - throw new IllegalStateException("Requested for second time: " + name); - } - - InputStream is = VMLazyTest.class.getClassLoader().getResourceAsStream(name); - if (is == null) { - throw new IOException("Can't find " + name); - } - byte[] arr = new byte[is.available()]; - int len = is.read(arr); - if (len != arr.length) { - throw new IOException("Read only " + len + " wanting " + arr.length); - } - /* - System.err.print("loader['" + name + "'] = ["); - for (int i = 0; i < arr.length; i++) { - if (i > 0) { - System.err.print(", "); - } - System.err.print(arr[i]); - } - System.err.println("]"); - */ - return arr; - } - } }