Brinding in fixes from default branch minesweeper
authorJaroslav Tulach <jtulach@netbeans.org>
Wed, 12 Feb 2014 10:36:16 +0100
branchminesweeper
changeset 85748db72a7f57
parent 82 28985adb4f62
parent 84 9fcc1e38b4c9
child 86 e69ac983e3f7
Brinding in fixes from default branch
     1.1 --- a/chat/client/src/main/java/org/apidesign/html/chatserver/client/ChatClient.java	Tue Feb 11 17:00:06 2014 +0100
     1.2 +++ b/chat/client/src/main/java/org/apidesign/html/chatserver/client/ChatClient.java	Wed Feb 12 10:36:16 2014 +0100
     1.3 @@ -87,19 +87,4 @@
     1.4          }
     1.5          m.updateMsgs("" + (now + 1));
     1.6      }
     1.7 -    
     1.8 -    static {
     1.9 -        ChatModel chm = new ChatModel();
    1.10 -        Message m = new Message();
    1.11 -        m.setComment("Waiting for messages from the server...");
    1.12 -        m.setUser("system");
    1.13 -        chm.getMsgs().add(m);
    1.14 -        chm.applyBindings();
    1.15 -        try {
    1.16 -            // XXX: this should not be in static initializer -
    1.17 -            // XXX: prevents unit testing!
    1.18 -            chm.initialRead();
    1.19 -        } catch (Throwable ex) {
    1.20 -        }
    1.21 -    }
    1.22  }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/chat/client/src/main/java/org/apidesign/html/chatserver/client/Main.java	Wed Feb 12 10:36:16 2014 +0100
     2.3 @@ -0,0 +1,45 @@
     2.4 +/**
     2.5 + * The MIT License (MIT)
     2.6 + *
     2.7 + * Copyright (C) 2013 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     2.8 + *
     2.9 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    2.10 + * of this software and associated documentation files (the "Software"), to deal
    2.11 + * in the Software without restriction, including without limitation the rights
    2.12 + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    2.13 + * copies of the Software, and to permit persons to whom the Software is
    2.14 + * furnished to do so, subject to the following conditions:
    2.15 + *
    2.16 + * The above copyright notice and this permission notice shall be included in
    2.17 + * all copies or substantial portions of the Software.
    2.18 + *
    2.19 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.20 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.21 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    2.22 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    2.23 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    2.24 + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    2.25 + * THE SOFTWARE.
    2.26 + */
    2.27 +package org.apidesign.html.chatserver.client;
    2.28 +
    2.29 +import org.apidesign.html.chatserver.model.Message;
    2.30 +
    2.31 +/**
    2.32 + *
    2.33 + * @author Jaroslav Tulach <jtulach@netbeans.org>
    2.34 + */
    2.35 +public class Main {
    2.36 +    private Main() {
    2.37 +    }
    2.38 +    
    2.39 +    static {
    2.40 +        ChatModel chm = new ChatModel();
    2.41 +        Message m = new Message();
    2.42 +        m.setComment("Waiting for messages from the server...");
    2.43 +        m.setUser("system");
    2.44 +        chm.getMsgs().add(m);
    2.45 +        chm.applyBindings();
    2.46 +        chm.initialRead();
    2.47 +    }
    2.48 +}
     3.1 --- a/chat/client/src/main/resources/org/apidesign/html/chatserver/client/chat.html	Tue Feb 11 17:00:06 2014 +0100
     3.2 +++ b/chat/client/src/main/resources/org/apidesign/html/chatserver/client/chat.html	Wed Feb 12 10:36:16 2014 +0100
     3.3 @@ -47,7 +47,7 @@
     3.4          <script src="bck2brwsr.js"></script>
     3.5          <script type="text/javascript">
     3.6              var vm = bck2brwsr('chat-client-1.0-SNAPSHOT.jar');
     3.7 -            vm.loadClass('org.apidesign.html.chatserver.client.ChatClient');
     3.8 +            vm.loadClass('org.apidesign.html.chatserver.client.Main');
     3.9          </script>
    3.10          
    3.11      </body>
     4.1 --- a/spinningcube/src/test/java/org/apidesign/demo/spinningcube/DataModelTest.java	Tue Feb 11 17:00:06 2014 +0100
     4.2 +++ b/spinningcube/src/test/java/org/apidesign/demo/spinningcube/DataModelTest.java	Wed Feb 12 10:36:16 2014 +0100
     4.3 @@ -23,6 +23,7 @@
     4.4   */
     4.5  package org.apidesign.demo.spinningcube;
     4.6  
     4.7 +import java.util.List;
     4.8  import static org.testng.Assert.*;
     4.9  import org.testng.annotations.Test;
    4.10  
    4.11 @@ -31,9 +32,9 @@
    4.12          Data model = new Data();
    4.13          model.setMessage("Hello World!");
    4.14          
    4.15 -        String[] arr = model.getSides();
    4.16 -        assertEquals(arr.length, 6, "Cube has six sides");
    4.17 -        assertEquals("Hello", arr[0], "Hello is the first word");
    4.18 -        assertEquals("World!", arr[1], "World is the second word");
    4.19 +        List<String> arr = model.getSides();
    4.20 +        assertEquals(arr.size(), 6, "Cube has six sides");
    4.21 +        assertEquals("Hello", arr.get(0), "Hello is the first word");
    4.22 +        assertEquals("World!", arr.get(1), "World is the second word");
    4.23      }
    4.24  }