From 62ade1de5d9c396839480bc55662d31b1127df9c Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Mon, 2 Jan 2012 20:59:19 +0100 Subject: [PATCH] OnlineGlom: Make clientFactory a (protected) member, and test it a bit. * src/main/java/org/glom/web/client/OnlineGlom.java: Make clientFactory a class member instead of a local variable in the method. This lets us use it to get the view instances, for use in tests. * src/test/java/org/glom/web/client/GwtTestOnlineGlom.java: beforeOnlineGlom(): Test some more details of the initial view. Again, this is not very useful. To really test gwt-glom we will need to start a local postgresql instance with local data, like the Glom tests in C++. --- ChangeLog | 14 ++++++++++++++ src/main/java/org/glom/web/client/OnlineGlom.java | 4 +++- src/test/java/org/glom/web/client/GwtTestOnlineGlom.java | 9 ++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e09897..a8ecfa0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2012-01-02 Murray Cumming + OnlineGlom: Make clientFactory a (protected) member, and test it a bit. + + * src/main/java/org/glom/web/client/OnlineGlom.java: Make clientFactory + a class member instead of a local variable in the method. + This lets us use it to get the view instances, for use in tests. + * src/test/java/org/glom/web/client/GwtTestOnlineGlom.java: + beforeOnlineGlom(): Test some more details of the initial view. + Again, this is not very useful. + + To really test gwt-glom we will need to start a local postgresql + instance with local data, like the Glom tests in C++. + +2012-01-02 Murray Cumming + pom.xml: Mention the LGPL license. * pom.xml: Add a licenses section. diff --git a/src/main/java/org/glom/web/client/OnlineGlom.java b/src/main/java/org/glom/web/client/OnlineGlom.java index 38dd879..157a373 100644 --- a/src/main/java/org/glom/web/client/OnlineGlom.java +++ b/src/main/java/org/glom/web/client/OnlineGlom.java @@ -55,6 +55,8 @@ public class OnlineGlom implements EntryPoint { protected SimplePanel docSelectionPanel = new SimplePanel(); protected SimplePanel dataPanel = new SimplePanel(); protected SimplePanel tableSelectionPanel = new SimplePanel(); + + protected ClientFactory clientFactory; AcceptsOneWidget docSelectionDisplay = new AcceptsOneWidget() { @Override @@ -119,7 +121,7 @@ public class OnlineGlom implements EntryPoint { // for different browser types (such as mobile), so we use GWT.create() to have deferred binding. // See http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html // which describes how to do this via our OnlineGlom.gwt.xml file. - ClientFactory clientFactory = GWT.create(ClientFactory.class); + clientFactory = GWT.create(ClientFactory.class); EventBus eventBus = clientFactory.getEventBus(); PlaceController placeController = clientFactory.getPlaceController(); diff --git a/src/test/java/org/glom/web/client/GwtTestOnlineGlom.java b/src/test/java/org/glom/web/client/GwtTestOnlineGlom.java index 6ecf786..cc10bb3 100644 --- a/src/test/java/org/glom/web/client/GwtTestOnlineGlom.java +++ b/src/test/java/org/glom/web/client/GwtTestOnlineGlom.java @@ -14,6 +14,7 @@ import org.junit.Test; import org.junit.Assert; import org.glom.web.client.mvp.AppPlaceHistoryMapper; +import org.glom.web.client.ui.DocumentSelectionView; import org.easymock.EasyMock; public class GwtTestOnlineGlom extends GwtTestWithEasyMock { @@ -52,7 +53,13 @@ public class GwtTestOnlineGlom extends GwtTestWithEasyMock { public void beforeOnlineGlom() { app = new OnlineGlom(); app.onModuleLoad(); - + + assertNotNull(app.clientFactory); + DocumentSelectionView view = app.clientFactory.getDocumentSelectionView(); + assertNotNull(view); + assertNotNull(view.asWidget()); + assertTrue(view.asWidget().isVisible()); + // Some pre-assertions assertTrue(app.docSelectionPanel.isVisible()); assertFalse(app.dataPanel.isVisible()); -- 2.1.4