ko-osgi-test/src/main/java/org/netbeans/html/ko/osgi/test/KnockoutEquinoxTCKImpl.java
1.1 --- a/ko-osgi-test/src/main/java/org/netbeans/html/ko/osgi/test/KnockoutEquinoxTCKImpl.java Tue Aug 26 18:13:30 2014 +0200
1.2 +++ b/ko-osgi-test/src/main/java/org/netbeans/html/ko/osgi/test/KnockoutEquinoxTCKImpl.java Thu Dec 04 09:21:55 2014 +0100
1.3 @@ -46,6 +46,7 @@
1.4 import java.io.IOException;
1.5 import java.io.InputStreamReader;
1.6 import java.lang.reflect.Constructor;
1.7 +import java.lang.reflect.InvocationTargetException;
1.8 import java.lang.reflect.Method;
1.9 import java.net.URI;
1.10 import java.net.URISyntaxException;
1.11 @@ -135,16 +136,9 @@
1.12 @Override
1.13 public BrwsrCtx createContext() {
1.14 try {
1.15 - Class<?> fxCls = loadOSGiClass(
1.16 - "org.netbeans.html.ko4j.FXContext",
1.17 - FrameworkUtil.getBundle(KnockoutEquinoxTCKImpl.class).getBundleContext()
1.18 - );
1.19 - final Constructor<?> cnstr = fxCls.getConstructor(Fn.Presenter.class);
1.20 - cnstr.setAccessible(true);
1.21 - Object fx = cnstr.newInstance(browserContext);
1.22 Contexts.Builder cb = Contexts.newBuilder().
1.23 - register(Technology.class, (Technology)fx, 10).
1.24 - register(Transfer.class, (Transfer)fx, 10).
1.25 + register(Technology.class, (Technology)osgiInstance("KOTech"), 10).
1.26 + register(Transfer.class, (Transfer)osgiInstance("KOTransfer"), 10).
1.27 register(Executor.class, (Executor)browserContext, 10);
1.28 // if (fx.areWebSocketsSupported()) {
1.29 // cb.register(WSTransfer.class, fx, 10);
1.30 @@ -154,6 +148,16 @@
1.31 throw new IllegalStateException(ex);
1.32 }
1.33 }
1.34 + private Object osgiInstance(String simpleName) throws IllegalAccessException, SecurityException, IllegalArgumentException, Exception, NoSuchMethodException, InstantiationException, InvocationTargetException {
1.35 + Class<?> fxCls = loadOSGiClass(
1.36 + "org.netbeans.html.ko4j." + simpleName,
1.37 + FrameworkUtil.getBundle(KnockoutEquinoxTCKImpl.class).getBundleContext()
1.38 + );
1.39 + final Constructor<?> cnstr = fxCls.getDeclaredConstructor();
1.40 + cnstr.setAccessible(true);
1.41 + Object fx = cnstr.newInstance();
1.42 + return fx;
1.43 + }
1.44
1.45 @Override
1.46 public Object createJSON(Map<String, Object> values) {