ko-bck2brwsr/src/test/java/org/apidesign/html/ko2brwsr/Bck2BrwsrKnockoutTest.java
1.1 --- a/ko-bck2brwsr/src/test/java/org/apidesign/html/ko2brwsr/Bck2BrwsrKnockoutTest.java Wed May 29 19:36:31 2013 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,81 +0,0 @@
1.4 -/**
1.5 - * HTML via Java(tm) Language Bindings
1.6 - * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
1.7 - *
1.8 - * This program is free software: you can redistribute it and/or modify
1.9 - * it under the terms of the GNU General Public License as published by
1.10 - * the Free Software Foundation, version 2 of the License.
1.11 - *
1.12 - * This program is distributed in the hope that it will be useful,
1.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.15 - * GNU General Public License for more details. apidesign.org
1.16 - * designates this particular file as subject to the
1.17 - * "Classpath" exception as provided by apidesign.org
1.18 - * in the License file that accompanied this code.
1.19 - *
1.20 - * You should have received a copy of the GNU General Public License
1.21 - * along with this program. Look for COPYING file in the top folder.
1.22 - * If not, see http://wiki.apidesign.org/wiki/GPLwithClassPathException
1.23 - */
1.24 -package org.apidesign.html.ko2brwsr;
1.25 -
1.26 -import java.util.Map;
1.27 -import net.java.html.BrwsrCtx;
1.28 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
1.29 -import org.apidesign.bck2brwsr.vmtest.VMTest;
1.30 -import org.apidesign.html.context.spi.Contexts;
1.31 -import org.apidesign.html.json.spi.Technology;
1.32 -import org.apidesign.html.json.spi.Transfer;
1.33 -import org.apidesign.html.json.tck.KnockoutTCK;
1.34 -import org.openide.util.lookup.ServiceProvider;
1.35 -import org.testng.annotations.Factory;
1.36 -
1.37 -/**
1.38 - *
1.39 - * @author Jaroslav Tulach <jtulach@netbeans.org>
1.40 - */
1.41 -@ServiceProvider(service = KnockoutTCK.class)
1.42 -public final class Bck2BrwsrKnockoutTest extends KnockoutTCK {
1.43 - @Factory public static Object[] create() {
1.44 - return VMTest.newTests().
1.45 - withClasses(testClasses()).
1.46 - withLaunchers("bck2brwsr").
1.47 - build();
1.48 - }
1.49 -
1.50 - @Override
1.51 - public BrwsrCtx createContext() {
1.52 - return Contexts.newBuilder().
1.53 - register(Transfer.class, BrwsrCtxImpl.DEFAULT, 9).
1.54 - register(Technology.class, BrwsrCtxImpl.DEFAULT, 9).build();
1.55 - }
1.56 -
1.57 -
1.58 -
1.59 - @Override
1.60 - public Object createJSON(Map<String, Object> values) {
1.61 - Object json = createJSON();
1.62 -
1.63 - for (Map.Entry<String, Object> entry : values.entrySet()) {
1.64 - putValue(json, entry.getKey(), entry.getValue());
1.65 - }
1.66 - return json;
1.67 - }
1.68 -
1.69 - @JavaScriptBody(args = {}, body = "return new Object();")
1.70 - private static native Object createJSON();
1.71 -
1.72 - @JavaScriptBody(args = { "json", "key", "value" }, body = "json[key] = value;")
1.73 - private static native void putValue(Object json, String key, Object value);
1.74 -
1.75 - @Override
1.76 - public Object executeScript(String script, Object[] arguments) {
1.77 - return execScript(script, arguments);
1.78 - }
1.79 -
1.80 - @JavaScriptBody(args = { "s", "args" }, body =
1.81 - "var f = new Function(s); return f.apply(null, args);"
1.82 - )
1.83 - private static native Object execScript(String s, Object[] arguments);
1.84 -}