Don't need any callbacks checks in the env.js integration envjs
authorJaroslav Tulach <jtulach@netbeans.org>
Wed, 04 Jun 2014 13:18:18 +0200
branchenvjs
changeset 68647deb0517807
parent 685 cc858a41a4bd
child 687 950ff5ae6e5e
Don't need any callbacks checks in the env.js integration
boot-script/src/test/java/net/java/html/boot/script/ko4j/KnockoutEnvJSTest.java
boot-script/src/test/java/net/java/html/boot/script/ko4j/LessCallbacksCheck.java
     1.1 --- a/boot-script/src/test/java/net/java/html/boot/script/ko4j/KnockoutEnvJSTest.java	Wed Jun 04 12:34:25 2014 +0200
     1.2 +++ b/boot-script/src/test/java/net/java/html/boot/script/ko4j/KnockoutEnvJSTest.java	Wed Jun 04 13:18:18 2014 +0200
     1.3 @@ -121,8 +121,6 @@
     1.4              Class<?> c = Class.forName(arr[i].getName(), true, l);
     1.5              seekKOTests(c, res);
     1.6          }
     1.7 -        Class<?> c = Class.forName(LessCallbacksCheck.class.getName(), true, l);
     1.8 -        seekKOTests(c, res);
     1.9          return res.toArray();
    1.10      }
    1.11  
     2.1 --- a/boot-script/src/test/java/net/java/html/boot/script/ko4j/LessCallbacksCheck.java	Wed Jun 04 12:34:25 2014 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,97 +0,0 @@
     2.4 -/**
     2.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     2.6 - *
     2.7 - * Copyright 2013-2014 Oracle and/or its affiliates. All rights reserved.
     2.8 - *
     2.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    2.10 - * Other names may be trademarks of their respective owners.
    2.11 - *
    2.12 - * The contents of this file are subject to the terms of either the GNU
    2.13 - * General Public License Version 2 only ("GPL") or the Common
    2.14 - * Development and Distribution License("CDDL") (collectively, the
    2.15 - * "License"). You may not use this file except in compliance with the
    2.16 - * License. You can obtain a copy of the License at
    2.17 - * http://www.netbeans.org/cddl-gplv2.html
    2.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    2.19 - * specific language governing permissions and limitations under the
    2.20 - * License.  When distributing the software, include this License Header
    2.21 - * Notice in each file and include the License file at
    2.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    2.23 - * particular file as subject to the "Classpath" exception as provided
    2.24 - * by Oracle in the GPL Version 2 section of the License file that
    2.25 - * accompanied this code. If applicable, add the following below the
    2.26 - * License Header, with the fields enclosed by brackets [] replaced by
    2.27 - * your own identifying information:
    2.28 - * "Portions Copyrighted [year] [name of copyright owner]"
    2.29 - *
    2.30 - * Contributor(s):
    2.31 - *
    2.32 - * The Original Software is NetBeans. The Initial Developer of the Original
    2.33 - * Software is Oracle. Portions Copyright 2013-2014 Oracle. All Rights Reserved.
    2.34 - *
    2.35 - * If you wish your version of this file to be governed by only the CDDL
    2.36 - * or only the GPL Version 2, indicate your decision by adding
    2.37 - * "[Contributor] elects to include this software in this distribution
    2.38 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    2.39 - * single choice of license, a recipient has the option to distribute
    2.40 - * your version of this file under either the CDDL, the GPL Version 2 or
    2.41 - * to extend the choice of license to its licensees as provided above.
    2.42 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    2.43 - * Version 2 license, then the option applies only if the new code is
    2.44 - * made subject to such option by the copyright holder.
    2.45 - */
    2.46 -package net.java.html.boot.script.ko4j;
    2.47 -
    2.48 -import java.io.PrintWriter;
    2.49 -import java.io.StringWriter;
    2.50 -import net.java.html.json.ComputedProperty;
    2.51 -import net.java.html.json.Model;
    2.52 -import net.java.html.json.Property;
    2.53 -import org.apidesign.html.json.tck.KOTest;
    2.54 -
    2.55 -/**
    2.56 - *
    2.57 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    2.58 - */
    2.59 -@Model(className = "LessCalls", properties = {
    2.60 -    @Property(name = "value", type = int.class)
    2.61 -})
    2.62 -public class LessCallbacksCheck {
    2.63 -    private static StringWriter sw;
    2.64 -    
    2.65 -    @ComputedProperty static int plusOne(int value) {
    2.66 -        if (sw == null) {
    2.67 -            sw = new StringWriter();
    2.68 -        }
    2.69 -        new Exception("Who calls me?").printStackTrace(
    2.70 -            new PrintWriter(sw)
    2.71 -        );
    2.72 -        return value + 1;
    2.73 -    }
    2.74 -    
    2.75 -    @KOTest public void dontCallForInitialValueBackToJavaVM() {
    2.76 -        sw = null;
    2.77 -        LessCalls m = new LessCalls(10).applyBindings();
    2.78 -        assert m.getPlusOne() == 11 : "Expecting 11: " + m.getPlusOne();
    2.79 -        
    2.80 -        assert sw != null : "StringWriter should be initialized: " + sw;
    2.81 -        
    2.82 -        if (sw.toString().contains("$JsCallbacks$")) {
    2.83 -            assert false : "Don't call for initial value via JsCallbacks:\n" + sw;
    2.84 -        }
    2.85 -    }
    2.86 -
    2.87 -    @KOTest public void dontCallForChangeValueBackToJavaVM() {
    2.88 -        LessCalls m = new LessCalls(10).applyBindings();
    2.89 -        assert m.getPlusOne() == 11 : "Expecting 11: " + m.getPlusOne();
    2.90 -        
    2.91 -        sw = null;
    2.92 -        m.setValue(5);
    2.93 -        assert m.getPlusOne() == 6: "Expecting 6: " + m.getPlusOne();
    2.94 -        assert sw != null : "StringWriter should be initialized: " + sw;
    2.95 -        
    2.96 -        if (sw.toString().contains("$JsCallbacks$")) {
    2.97 -            assert false : "Don't call for initial value via JsCallbacks:\n" + sw;
    2.98 -        }
    2.99 -    }
   2.100 -}