# HG changeset patch # User Jaroslav Tulach # Date 1392197776 -3600 # Node ID 748db72a7f57866fb1c3fcd11cb1b96f1a01037e # Parent 28985adb4f6202128517dd577366decd6f1fba12# Parent 9fcc1e38b4c97658d6e7d0ab4c6774c854d1ea1d Brinding in fixes from default branch diff -r 28985adb4f62 -r 748db72a7f57 chat/client/src/main/java/org/apidesign/html/chatserver/client/ChatClient.java --- a/chat/client/src/main/java/org/apidesign/html/chatserver/client/ChatClient.java Tue Feb 11 17:00:06 2014 +0100 +++ b/chat/client/src/main/java/org/apidesign/html/chatserver/client/ChatClient.java Wed Feb 12 10:36:16 2014 +0100 @@ -87,19 +87,4 @@ } m.updateMsgs("" + (now + 1)); } - - static { - ChatModel chm = new ChatModel(); - Message m = new Message(); - m.setComment("Waiting for messages from the server..."); - m.setUser("system"); - chm.getMsgs().add(m); - chm.applyBindings(); - try { - // XXX: this should not be in static initializer - - // XXX: prevents unit testing! - chm.initialRead(); - } catch (Throwable ex) { - } - } } diff -r 28985adb4f62 -r 748db72a7f57 chat/client/src/main/java/org/apidesign/html/chatserver/client/Main.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/chat/client/src/main/java/org/apidesign/html/chatserver/client/Main.java Wed Feb 12 10:36:16 2014 +0100 @@ -0,0 +1,45 @@ +/** + * The MIT License (MIT) + * + * Copyright (C) 2013 Jaroslav Tulach + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package org.apidesign.html.chatserver.client; + +import org.apidesign.html.chatserver.model.Message; + +/** + * + * @author Jaroslav Tulach + */ +public class Main { + private Main() { + } + + static { + ChatModel chm = new ChatModel(); + Message m = new Message(); + m.setComment("Waiting for messages from the server..."); + m.setUser("system"); + chm.getMsgs().add(m); + chm.applyBindings(); + chm.initialRead(); + } +} diff -r 28985adb4f62 -r 748db72a7f57 chat/client/src/main/resources/org/apidesign/html/chatserver/client/chat.html --- a/chat/client/src/main/resources/org/apidesign/html/chatserver/client/chat.html Tue Feb 11 17:00:06 2014 +0100 +++ b/chat/client/src/main/resources/org/apidesign/html/chatserver/client/chat.html Wed Feb 12 10:36:16 2014 +0100 @@ -47,7 +47,7 @@ diff -r 28985adb4f62 -r 748db72a7f57 spinningcube/src/test/java/org/apidesign/demo/spinningcube/DataModelTest.java --- a/spinningcube/src/test/java/org/apidesign/demo/spinningcube/DataModelTest.java Tue Feb 11 17:00:06 2014 +0100 +++ b/spinningcube/src/test/java/org/apidesign/demo/spinningcube/DataModelTest.java Wed Feb 12 10:36:16 2014 +0100 @@ -23,6 +23,7 @@ */ package org.apidesign.demo.spinningcube; +import java.util.List; import static org.testng.Assert.*; import org.testng.annotations.Test; @@ -31,9 +32,9 @@ Data model = new Data(); model.setMessage("Hello World!"); - String[] arr = model.getSides(); - assertEquals(arr.length, 6, "Cube has six sides"); - assertEquals("Hello", arr[0], "Hello is the first word"); - assertEquals("World!", arr[1], "World is the second word"); + List arr = model.getSides(); + assertEquals(arr.size(), 6, "Cube has six sides"); + assertEquals("Hello", arr.get(0), "Hello is the first word"); + assertEquals("World!", arr.get(1), "World is the second word"); } }