You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/05/25 09:55:52 UTC

[1/4] git commit: ISIS-406: reapplying fixes in the prepare/isis-1.2.0-RC1 branch...

Updated Branches:
  refs/heads/master 81955752e -> 2f39f583e


ISIS-406: reapplying fixes in the prepare/isis-1.2.0-RC1 branch...

... prior to going round again.
* missing licenses in Wicket src files
* fixing Wicket rendering on firefox
* workaround for MRRESOURCES-58


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/c0ab239e
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/c0ab239e
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/c0ab239e

Branch: refs/heads/master
Commit: c0ab239e83669c8ee5dde180771ccad51d6d1386
Parents: 8195575
Author: Dan Haywood <da...@apache.org>
Authored: Sat May 25 07:56:15 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat May 25 07:56:15 2013 +0100

----------------------------------------------------------------------
 component/objectstore/jdo/pom.xml                  |   20 ++-
 .../CollectionContentsAsAjaxTablePanel.css         |    1 +
 .../CollectionContentsAsAjaxTablePanel.html        |    1 +
 .../isis/viewer/wicket/ui/pages/PageAbstract.css   |    4 -
 .../isis/viewer/wicket/ui/pages/jquery.jgrowl.css  |  117 +++++++++++++++
 .../isisapplib/DateConverterForApplibDateTest.java |   18 +++
 .../DateConverterForApplibDateTimeTest.java        |   18 +++
 .../jdkdates/DateConverterForJavaSqlDateTest.java  |   18 +++
 .../jdkdates/DateConverterForJavaUtilDateTest.java |   18 +++
 .../jodatime/DateConverterForJodaDateTimeTest.java |   18 +++
 .../DateConverterForJodaLocalDateTest.java         |   18 +++
 .../DateConverterForJodaLocalDateTimeTest.java     |   18 +++
 12 files changed, 261 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/objectstore/jdo/pom.xml
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/pom.xml b/component/objectstore/jdo/pom.xml
index 85e561f..c2fc9b7 100644
--- a/component/objectstore/jdo/pom.xml
+++ b/component/objectstore/jdo/pom.xml
@@ -29,9 +29,11 @@
 	<packaging>pom</packaging>
 
 	<properties>
+        <datanucleus.version>[3.1.99, )</datanucleus.version>
+        
 		<siteBaseDir>.</siteBaseDir>
 		<relativeUrl />
-
+        
 		<docbkxGuideTitle>Apache Isis JDO ObjectStore</docbkxGuideTitle>
 		<docbkxGuideSubTitle>Customization, Configuration and Deployment Guide</docbkxGuideSubTitle>
 		<docbkxGuideName>isis-jdo-objectstore</docbkxGuideName>
@@ -151,17 +153,17 @@
             <dependency>
                 <groupId>org.datanucleus</groupId>
                 <artifactId>datanucleus-core</artifactId>
-                <version>[3.1.99, )</version>
+                <version>${datanucleus.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.datanucleus</groupId>
                 <artifactId>datanucleus-api-jdo</artifactId>
-                <version>[3.1.99, )</version>
+                <version>${datanucleus.version}</version>
             </dependency>
             <dependency>
                 <groupId>org.datanucleus</groupId>
                 <artifactId>datanucleus-rdbms</artifactId>
-                <version>[3.1.99, )</version>
+                <version>${datanucleus.version}</version>
             </dependency>
 	        <dependency>
 	            <groupId>org.datanucleus</groupId>
@@ -183,4 +185,14 @@
 
 		</dependencies>
 	</dependencyManagement>
+    
+    <profiles>
+        <profile>
+            <id>apache-release</id>
+            <properties>
+                <!-- workaround for http://jira.codehaus.org/browse/MRRESOURCES-58 -->
+                <datanucleus.version>3.2.2</datanucleus.version>
+            </properties>
+        </profile>        
+    </profiles>    
 </project>

http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.css
index 4fbfe74..81ef5d9 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.css
@@ -151,6 +151,7 @@
 
 .collectionContentsAsAjaxTablePanel .actions {
 	margin-top: -1px;
+    margin-bottom: -10px;
     float: left;
     padding:0em 0em;
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
index 0fff9d0..0f6bbf6 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/ajaxtable/CollectionContentsAsAjaxTablePanel.html
@@ -32,6 +32,7 @@
 	           			</tbody>
 	   			   </table>
 			    </div>
+                <div class="clear"/>
 				<table class="contents" cellspacing="0" wicket:id="table">[table]</table>
 			</div>
 		</wicket:panel>

http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
index dd646a1..157e17e 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
@@ -190,10 +190,6 @@ colors
 
 /********** CLASSes **********/
 
-.clear {
-    clear: both;
-}
-
 .feedbackPanel li {
 	list-style: none;	
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.jgrowl.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.jgrowl.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.jgrowl.css
index dbfde23..b603356 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.jgrowl.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/jquery.jgrowl.css
@@ -1,3 +1,120 @@
+/**
+ * jGrowl 1.2.10
+ *
+ * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
+ * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
+ *
+ * Written by Stan Lemon <st...@gmail.com>
+ * Last updated: 2013.02.14
+ *
+ * jGrowl is a jQuery plugin implementing unobtrusive userland notifications.  These 
+ * notifications function similarly to the Growl Framework available for
+ * Mac OS X (http://growl.info).
+ *
+ * To Do:
+ * - Move library settings to containers and allow them to be changed per container
+ *
+ * Changes in 1.2.10
+ * - Fix beforeClose to be called in click event
+ *
+ * Changes in 1.2.9
+ * - Fixed BC break in jQuery 2.0 beta
+ *
+ * Changes in 1.2.8
+ * - Fixes for jQuery 1.9 and the MSIE6 check, note that with jQuery 2.0 support
+ *   jGrowl intends to drop support for IE6 altogether
+ *
+ * Changes in 1.2.6
+ * - Fixed js error when a notification is opening and closing at the same time
+ * 
+ * Changes in 1.2.5
+ * - Changed wrapper jGrowl's options usage to "o" instead of $.jGrowl.defaults
+ * - Added themeState option to control 'highlight' or 'error' for jQuery UI
+ * - Ammended some CSS to provide default positioning for nested usage.
+ * - Changed some CSS to be prefixed with jGrowl- to prevent namespacing issues
+ * - Added two new options - openDuration and closeDuration to allow 
+ *   better control of notification open and close speeds, respectively 
+ *   Patch contributed by Jesse Vincet.
+ * - Added afterOpen callback.  Patch contributed by Russel Branca.
+ *
+ * Changes in 1.2.4
+ * - Fixed IE bug with the close-all button
+ * - Fixed IE bug with the filter CSS attribute (special thanks to gotwic)
+ * - Update IE opacity CSS
+ * - Changed font sizes to use "em", and only set the base style
+ *
+ * Changes in 1.2.3
+ * - The callbacks no longer use the container as context, instead they use the actual notification
+ * - The callbacks now receive the container as a parameter after the options parameter
+ * - beforeOpen and beforeClose now check the return value, if it's false - the notification does
+ *   not continue.  The open callback will also halt execution if it returns false.
+ * - Fixed bug where containers would get confused
+ * - Expanded the pause functionality to pause an entire container.
+ *
+ * Changes in 1.2.2
+ * - Notification can now be theme rolled for jQuery UI, special thanks to Jeff Chan!
+ *
+ * Changes in 1.2.1
+ * - Fixed instance where the interval would fire the close method multiple times.
+ * - Added CSS to hide from print media
+ * - Fixed issue with closer button when div { position: relative } is set
+ * - Fixed leaking issue with multiple containers.  Special thanks to Matthew Hanlon!
+ *
+ * Changes in 1.2.0
+ * - Added message pooling to limit the number of messages appearing at a given time.
+ * - Closing a notification is now bound to the notification object and triggered by the close button.
+ *
+ * Changes in 1.1.2
+ * - Added iPhone styled example
+ * - Fixed possible IE7 bug when determining if the ie6 class shoudl be applied.
+ * - Added template for the close button, so that it's content could be customized.
+ *
+ * Changes in 1.1.1
+ * - Fixed CSS styling bug for ie6 caused by a mispelling
+ * - Changes height restriction on default notifications to min-height
+ * - Added skinned examples using a variety of images
+ * - Added the ability to customize the content of the [close all] box
+ * - Added jTweet, an example of using jGrowl + Twitter
+ *
+ * Changes in 1.1.0
+ * - Multiple container and instances.
+ * - Standard $.jGrowl() now wraps $.fn.jGrowl() by first establishing a generic jGrowl container.
+ * - Instance methods of a jGrowl container can be called by $.fn.jGrowl(methodName)
+ * - Added glue preferenced, which allows notifications to be inserted before or after nodes in the container
+ * - Added new log callback which is called before anything is done for the notification
+ * - Corner's attribute are now applied on an individual notification basis.
+ *
+ * Changes in 1.0.4
+ * - Various CSS fixes so that jGrowl renders correctly in IE6.
+ *
+ * Changes in 1.0.3
+ * - Fixed bug with options persisting across notifications
+ * - Fixed theme application bug
+ * - Simplified some selectors and manipulations.
+ * - Added beforeOpen and beforeClose callbacks
+ * - Reorganized some lines of code to be more readable
+ * - Removed unnecessary this.defaults context
+ * - If corners plugin is present, it's now customizable.
+ * - Customizable open animation.
+ * - Customizable close animation.
+ * - Customizable animation easing.
+ * - Added customizable positioning (top-left, top-right, bottom-left, bottom-right, center)
+ *
+ * Changes in 1.0.2
+ * - All CSS styling is now external.
+ * - Added a theme parameter which specifies a secondary class for styling, such
+ *   that notifications can be customized in appearance on a per message basis.
+ * - Notification life span is now customizable on a per message basis.
+ * - Added the ability to disable the global closer, enabled by default.
+ * - Added callbacks for when a notification is opened or closed.
+ * - Added callback for the global closer.
+ * - Customizable animation speed.
+ * - jGrowl now set itself up and tears itself down.
+ *
+ * Changes in 1.0.1:
+ * - Removed dependency on metadata plugin in favor of .data()
+ * - Namespaced all events
+ */
 
 div.jGrowl {
 	z-index: 			9999;

http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTest.java
index cd82de3..dc84f41 100644
--- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTest.java
+++ b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTest.java
@@ -1,3 +1,21 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
 package org.apache.isis.viewer.wicket.ui.components.scalars.isisapplib;
 
 import static org.hamcrest.CoreMatchers.is;

http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTimeTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTimeTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTimeTest.java
index 9f3940c..1b8af62 100644
--- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTimeTest.java
+++ b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/isisapplib/DateConverterForApplibDateTimeTest.java
@@ -1,3 +1,21 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
 package org.apache.isis.viewer.wicket.ui.components.scalars.isisapplib;
 
 import static org.hamcrest.CoreMatchers.is;

http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDateTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDateTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDateTest.java
index 52d8dbc..59ecf62 100644
--- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDateTest.java
+++ b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaSqlDateTest.java
@@ -1,3 +1,21 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
 package org.apache.isis.viewer.wicket.ui.components.scalars.jdkdates;
 
 import static org.hamcrest.CoreMatchers.is;

http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDateTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDateTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDateTest.java
index 3eec493..e84ef97 100644
--- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDateTest.java
+++ b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jdkdates/DateConverterForJavaUtilDateTest.java
@@ -1,3 +1,21 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
 package org.apache.isis.viewer.wicket.ui.components.scalars.jdkdates;
 
 import static org.hamcrest.CoreMatchers.is;

http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaDateTimeTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaDateTimeTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaDateTimeTest.java
index 8c9406f..f98b17c 100644
--- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaDateTimeTest.java
+++ b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaDateTimeTest.java
@@ -1,3 +1,21 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
 package org.apache.isis.viewer.wicket.ui.components.scalars.jodatime;
 
 import static org.hamcrest.CoreMatchers.is;

http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTest.java
index 39a2bc4..b4d304f 100644
--- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTest.java
+++ b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTest.java
@@ -1,3 +1,21 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
 package org.apache.isis.viewer.wicket.ui.components.scalars.jodatime;
 
 import static org.hamcrest.CoreMatchers.is;

http://git-wip-us.apache.org/repos/asf/isis/blob/c0ab239e/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTimeTest.java
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTimeTest.java b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTimeTest.java
index 692e5fa..2686f91 100644
--- a/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTimeTest.java
+++ b/component/viewer/wicket/ui/src/test/java/org/apache/isis/viewer/wicket/ui/components/scalars/jodatime/DateConverterForJodaLocalDateTimeTest.java
@@ -1,3 +1,21 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
 package org.apache.isis.viewer.wicket.ui.components.scalars.jodatime;
 
 import static org.hamcrest.CoreMatchers.is;


[4/4] git commit: ISIS-406: getting integration tests to run with wrapper

Posted by da...@apache.org.
ISIS-406: getting integration tests to run with wrapper


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/2f39f583
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/2f39f583
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/2f39f583

Branch: refs/heads/master
Commit: 2f39f583e6b5f90cb482015d4147ad7cb0de1a79
Parents: 6728af7
Author: Dan Haywood <da...@apache.org>
Authored: Sat May 25 08:36:45 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat May 25 08:36:45 2013 +0100

----------------------------------------------------------------------
 .../core/bytecode/cglib/CglibClassSubstitutor.java |    3 -
 .../javassist/JavassistClassSubstitutor.java       |    4 +-
 .../isis/core/commons/lang/JavaClassUtils.java     |    9 ++++
 .../classsubstitutor/ClassSubstitutorAbstract.java |   30 ++++++++++++---
 .../identity/ClassSubstitutorIdentity.java         |    2 +
 .../internal/DomainObjectInvocationHandler.java    |   28 +++++++++++--
 .../dom/src/main/java/dom/todo/ToDoItem.java       |    4 +-
 .../test/java/integtests/ToDoItemIntegTest.java    |    8 ++-
 8 files changed, 67 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/2f39f583/core/bytecode-cglib/src/main/java/org/apache/isis/core/bytecode/cglib/CglibClassSubstitutor.java
----------------------------------------------------------------------
diff --git a/core/bytecode-cglib/src/main/java/org/apache/isis/core/bytecode/cglib/CglibClassSubstitutor.java b/core/bytecode-cglib/src/main/java/org/apache/isis/core/bytecode/cglib/CglibClassSubstitutor.java
index b1e8c52..5392754 100644
--- a/core/bytecode-cglib/src/main/java/org/apache/isis/core/bytecode/cglib/CglibClassSubstitutor.java
+++ b/core/bytecode-cglib/src/main/java/org/apache/isis/core/bytecode/cglib/CglibClassSubstitutor.java
@@ -26,9 +26,6 @@ import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitut
 public class CglibClassSubstitutor extends ClassSubstitutorAbstract {
 
     public CglibClassSubstitutor() {
-        ignore(net.sf.cglib.proxy.Factory.class);
-        ignore(net.sf.cglib.proxy.MethodProxy.class);
-        ignore(net.sf.cglib.proxy.Callback.class);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/isis/blob/2f39f583/core/bytecode-javassist/src/main/java/org/apache/isis/core/bytecode/javassist/JavassistClassSubstitutor.java
----------------------------------------------------------------------
diff --git a/core/bytecode-javassist/src/main/java/org/apache/isis/core/bytecode/javassist/JavassistClassSubstitutor.java b/core/bytecode-javassist/src/main/java/org/apache/isis/core/bytecode/javassist/JavassistClassSubstitutor.java
index 548ed2c..013a7aa 100644
--- a/core/bytecode-javassist/src/main/java/org/apache/isis/core/bytecode/javassist/JavassistClassSubstitutor.java
+++ b/core/bytecode-javassist/src/main/java/org/apache/isis/core/bytecode/javassist/JavassistClassSubstitutor.java
@@ -25,8 +25,8 @@ import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitut
 public class JavassistClassSubstitutor extends ClassSubstitutorAbstract {
 
     public JavassistClassSubstitutor() {
-        ignore(javassist.util.proxy.ProxyObject.class);
-        ignore(javassist.util.proxy.MethodHandler.class);
+        ignore("javassist.util.proxy.ProxyObject");
+        ignore("javassist.util.proxy.MethodHandler");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/isis/blob/2f39f583/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/JavaClassUtils.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/JavaClassUtils.java b/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/JavaClassUtils.java
index 1f4c1a2..77e7f92 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/JavaClassUtils.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/commons/lang/JavaClassUtils.java
@@ -144,6 +144,15 @@ public final class JavaClassUtils {
         return false;
     }
 
+    public static boolean directlyImplements(final Class<?> cls, final String interfaceTypeName) {
+        try {
+            final Class<?> interfaceType = Thread.currentThread().getContextClassLoader().loadClass(interfaceTypeName);
+            return directlyImplements(cls, interfaceType);
+        } catch (ClassNotFoundException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     public static boolean isStatic(final Method method) {
         return Modifier.isStatic(method.getModifiers());
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/2f39f583/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAbstract.java
index 0a9b43c..04b49b6 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAbstract.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/classsubstitutor/ClassSubstitutorAbstract.java
@@ -19,21 +19,33 @@
 
 package org.apache.isis.core.metamodel.specloader.classsubstitutor;
 
-import java.util.Collections;
-import java.util.HashSet;
 import java.util.Set;
 
+import com.google.common.collect.Sets;
+
 import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.core.commons.lang.JavaClassUtils;
 
 public abstract class ClassSubstitutorAbstract implements ClassSubstitutor {
 
-    private final Set<Class<?>> classesToIgnore = new HashSet<Class<?>>();
+    private final Set<Class<?>> classesToIgnore = Sets.newHashSet();
+    private final Set<String> classNamesToIgnore = Sets.newHashSet();
 
     /**
      * Will implicitly ignore the {@link DomainObjectContainer}.
      */
     public ClassSubstitutorAbstract() {
         ignore(DomainObjectContainer.class);
+        
+        // ignore cglib
+        ignore("net.sf.cglib.proxy.Factory");
+        ignore("net.sf.cglib.proxy.MethodProxy");
+        ignore("net.sf.cglib.proxy.Callback");
+
+        // ignore javassist
+        ignore("javassist.util.proxy.ProxyObject");
+        ignore("javassist.util.proxy.MethodHandler");
+
     }
 
     // /////////////////////////////////////////////////////////////////
@@ -74,11 +86,12 @@ public abstract class ClassSubstitutorAbstract implements ClassSubstitutor {
         return cls;
     }
 
+    
     private boolean shouldIgnore(final Class<?> cls) {
         if (cls.isArray()) {
             return shouldIgnore(cls.getComponentType());
         }
-        return classesToIgnore.contains(cls);
+        return classesToIgnore.contains(cls) || classNamesToIgnore.contains(cls.getCanonicalName());
     }
 
     // ////////////////////////////////////////////////////////////////////
@@ -93,10 +106,15 @@ public abstract class ClassSubstitutorAbstract implements ClassSubstitutor {
         return classesToIgnore.add(q);
     }
 
-    public Set<Class<?>> getIgnoredClasses() {
-        return Collections.unmodifiableSet(classesToIgnore);
+    /**
+     * For any classes registered as ignored, {@link #getClass(Class)} will
+     * return <tt>null</tt>.
+     */
+    protected boolean ignore(final String className) {
+        return classNamesToIgnore.add(className);
     }
 
+
     // ////////////////////////////////////////////////////////////////////
     // injectInto
     // ////////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/isis/blob/2f39f583/core/runtime/src/main/java/org/apache/isis/core/runtime/bytecode/identity/ClassSubstitutorIdentity.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/bytecode/identity/ClassSubstitutorIdentity.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/bytecode/identity/ClassSubstitutorIdentity.java
index 79a165f..6da6df8 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/bytecode/identity/ClassSubstitutorIdentity.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/bytecode/identity/ClassSubstitutorIdentity.java
@@ -24,6 +24,8 @@ import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitut
 public class ClassSubstitutorIdentity extends ClassSubstitutorAbstract {
 
     public ClassSubstitutorIdentity() {
+        
+
     }
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/2f39f583/core/wrapper/src/main/java/org/apache/isis/core/wrapper/internal/DomainObjectInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/internal/DomainObjectInvocationHandler.java b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/internal/DomainObjectInvocationHandler.java
index 081f82a..ee04b79 100644
--- a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/internal/DomainObjectInvocationHandler.java
+++ b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/internal/DomainObjectInvocationHandler.java
@@ -129,12 +129,23 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
             return delegate(method, args);
         }
 
+        // workaround for JDO-enhanced..
+        if(isJdoMethod(method)) {
+            return delegate(method, args);
+        }
+
+        if(isInjectMethod(method)) {
+            return delegate(method, args);
+        }
+
         final ObjectAdapter targetAdapter = getAdapterManager().getAdapterFor(getDelegate());
 
         if (isTitleMethod(method)) {
             return handleTitleMethod(method, args, targetAdapter);
         }
 
+
+
         final ObjectSpecification targetNoSpec = targetAdapter.getSpecification();
 
         // save method, through the proxy
@@ -146,11 +157,6 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
             return getDelegate();
         }
 
-        // workaround for JDO-enhanced..
-        if(method.getName().startsWith("jdo")) {
-            return delegate(method, args);
-        }
-
         final ObjectMember objectMember = locateAndCheckMember(method);
         final List<Facet> imperativeFacets = getImperativeFacets(objectMember, method);
 
@@ -233,6 +239,18 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
         throw new UnsupportedOperationException(String.format("Unknown member type '%s'", objectMember));
     }
 
+    private boolean isJdoMethod(final Method method) {
+        return methodStartsWith(method, "jdo");
+    }
+
+    private boolean isInjectMethod(final Method method) {
+        return methodStartsWith(method, "inject");
+    }
+
+    private boolean methodStartsWith(final Method method, final String prefix) {
+        return method.getName().startsWith(prefix);
+    }
+    
     public List<Facet> getImperativeFacets(final ObjectMember objectMember, final Method method) {
         final List<Facet> imperativeFacets = objectMember.getFacets(new Filter<Facet>() {
             @Override

http://git-wip-us.apache.org/repos/asf/isis/blob/2f39f583/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
index 950b321..cbcfc77 100644
--- a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
+++ b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
@@ -101,10 +101,10 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
         final TitleBuffer buf = new TitleBuffer();
         buf.append(getDescription());
         if (isComplete()) {
-            buf.append(" - Completed!");
+            buf.append("- Completed!");
         } else {
             if (getDueBy() != null) {
-                buf.append(" due by ", getDueBy());
+                buf.append(" due by", getDueBy());
             }
         }
         return buf.toString();

http://git-wip-us.apache.org/repos/asf/isis/blob/2f39f583/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
index 380dc79..5042657 100644
--- a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
@@ -49,12 +49,14 @@ public class ToDoItemIntegTest extends AbstractIntegTest {
         final ToDoItem toDoItem = wrap(all.get(0));
         
         assertThat(toDoItem.getDescription(), is("Buy milk"));
+        assertThat(container.titleOf(toDoItem), is("Buy milk due by 2013-05-25"));
         
         // when
         toDoItem.setDescription("Buy milk and butter");
         
         // then
         assertThat(toDoItem.getDescription(), is("Buy milk and butter"));
+        assertThat(container.titleOf(toDoItem), is("Buy milk and butter due by 2013-05-25"));
     }
 
 
@@ -66,14 +68,14 @@ public class ToDoItemIntegTest extends AbstractIntegTest {
         
         assertThat(toDoItem.getDescription(), is("Buy milk and butter"));
         assertThat(toDoItem.isComplete(), is(false));
-        assertThat(container.titleOf(toDoItem), is("foo"));
+        assertThat(container.titleOf(toDoItem), is("Buy milk and butter due by 2013-05-25"));
         
         // when
         toDoItem.completed();
         
         // then
         assertThat(toDoItem.isComplete(), is(true));
-        assertThat(container.titleOf(toDoItem), is("foo"));
+        assertThat(container.titleOf(toDoItem), is("Buy milk and butter - Completed!"));
 
         all = wrap(toDoItems).notYetComplete();
         assertThat(all.size(), is(4));
@@ -83,7 +85,7 @@ public class ToDoItemIntegTest extends AbstractIntegTest {
         
         // then
         assertThat(toDoItem.isComplete(), is(false));
-        assertThat(container.titleOf(toDoItem), is("foo"));
+        assertThat(container.titleOf(toDoItem), is("Buy milk and butter due by 2013-05-25"));
 
         all = wrap(toDoItems).notYetComplete();
         assertThat(all.size(), is(5));


[3/4] git commit: ISIS-406: more on integration tests and wrapper.

Posted by da...@apache.org.
ISIS-406: more on integration tests and wrapper.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/6728af76
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/6728af76
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/6728af76

Branch: refs/heads/master
Commit: 6728af769d7c7a3fdfd55d3b2a692ebb55f729ef
Parents: a55c76b
Author: Dan Haywood <da...@apache.org>
Authored: Sat May 25 06:56:04 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat May 25 07:57:12 2013 +0100

----------------------------------------------------------------------
 .../internal/DomainObjectInvocationHandler.java    |    6 +++
 .../test/java/integtests/AbstractIntegTest.java    |    4 ++
 .../test/java/integtests/ToDoItemIntegTest.java    |   30 +++++++++++---
 3 files changed, 33 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/6728af76/core/wrapper/src/main/java/org/apache/isis/core/wrapper/internal/DomainObjectInvocationHandler.java
----------------------------------------------------------------------
diff --git a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/internal/DomainObjectInvocationHandler.java b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/internal/DomainObjectInvocationHandler.java
index 6caf76e..081f82a 100644
--- a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/internal/DomainObjectInvocationHandler.java
+++ b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/internal/DomainObjectInvocationHandler.java
@@ -146,6 +146,11 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
             return getDelegate();
         }
 
+        // workaround for JDO-enhanced..
+        if(method.getName().startsWith("jdo")) {
+            return delegate(method, args);
+        }
+
         final ObjectMember objectMember = locateAndCheckMember(method);
         final List<Facet> imperativeFacets = getImperativeFacets(objectMember, method);
 
@@ -578,6 +583,7 @@ public class DomainObjectInvocationHandler<T> extends DelegatingInvocationHandle
     private ObjectMember locateAndCheckMember(final Method method) {
         final ObjectSpecificationDefault objectSpecificationDefault = getJavaSpecificationOfOwningClass(method);
         final ObjectMember member = objectSpecificationDefault.getMember(method);
+        
         if (member == null) {
             final String methodName = method.getName();
             throw new UnsupportedOperationException("Method '" + methodName + "' being invoked does not correspond to any of the object's fields or actions.");

http://git-wip-us.apache.org/repos/asf/isis/blob/6728af76/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/AbstractIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/AbstractIntegTest.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/AbstractIntegTest.java
index 44510bd..16284d2 100644
--- a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/AbstractIntegTest.java
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/AbstractIntegTest.java
@@ -31,6 +31,7 @@ import org.junit.rules.MethodRule;
 import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.Statement;
 
+import org.apache.isis.applib.DomainObjectContainer;
 import org.apache.isis.applib.services.wrapper.WrapperFactory;
 import org.apache.isis.core.commons.config.IsisConfiguration;
 import org.apache.isis.core.commons.config.IsisConfigurationDefault;
@@ -44,6 +45,7 @@ public class AbstractIntegTest {
 
     protected ToDoItems toDoItems;
     protected WrapperFactory wrapperFactory;
+    protected DomainObjectContainer container;
     
     @Rule
     public IsisSystemForTestRule rule = new IsisSystemForTestRule();
@@ -62,6 +64,7 @@ public class AbstractIntegTest {
     public void init() {
         toDoItems = getIsft().getService(ToDoItemsJdo.class);
         wrapperFactory = getIsft().getService(WrapperFactoryDefault.class);
+        container = getIsft().container;
     }
 
     protected <T> T wrap(T obj) {
@@ -85,6 +88,7 @@ public class AbstractIntegTest {
             withLoggingAt(Level.INFO);
             with(testConfiguration());
             with(new DataNucleusPersistenceMechanismInstaller());
+            
             withServices(
                     new ToDoItemsJdo(),
                     new WrapperFactoryDefault(),

http://git-wip-us.apache.org/repos/asf/isis/blob/6728af76/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
index 5aab2d8..380dc79 100644
--- a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
@@ -18,6 +18,7 @@
  */
 package integtests;
 
+import static org.hamcrest.CoreMatchers.*;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.fail;
@@ -36,13 +37,13 @@ import org.apache.isis.applib.services.wrapper.DisabledException;
 public class ToDoItemIntegTest extends AbstractIntegTest {
 
     @Test
-    public void t01_findNotYetCompleted() throws Exception {
+    public void t010_findNotYetCompleted() throws Exception {
         final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
         assertThat(all.size(), is(5));
     }
 
     @Test
-    public void t02_update() throws Exception {
+    public void t020_updateDescription() throws Exception {
         // given
         final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
         final ToDoItem toDoItem = wrap(all.get(0));
@@ -58,27 +59,39 @@ public class ToDoItemIntegTest extends AbstractIntegTest {
 
 
     @Test
-    public void t03_complete() throws Exception {
+    public void t030_complete_and_notYetComplete() throws Exception {
         // given
-        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        List<ToDoItem> all = wrap(toDoItems).notYetComplete();
         final ToDoItem toDoItem = wrap(all.get(0));
         
         assertThat(toDoItem.getDescription(), is("Buy milk and butter"));
         assertThat(toDoItem.isComplete(), is(false));
+        assertThat(container.titleOf(toDoItem), is("foo"));
         
         // when
         toDoItem.completed();
         
         // then
         assertThat(toDoItem.isComplete(), is(true));
+        assertThat(container.titleOf(toDoItem), is("foo"));
+
+        all = wrap(toDoItems).notYetComplete();
+        assertThat(all.size(), is(4));
+        
+        // and when
+        toDoItem.notYetCompleted();
+        
+        // then
+        assertThat(toDoItem.isComplete(), is(false));
+        assertThat(container.titleOf(toDoItem), is("foo"));
 
-        final List<ToDoItem> all2 = wrap(toDoItems).notYetComplete();
-        assertThat(all2.size(), is(4));
+        all = wrap(toDoItems).notYetComplete();
+        assertThat(all.size(), is(5));
     }
 
 
     @Test
-    public void t04_cannotCompleteAndObjectAlreadyCompleted() throws Exception {
+    public void t040_cannotCompleteAndObjectAlreadyCompleted() throws Exception {
         // given
         final List<ToDoItem> all = wrap(toDoItems).notYetComplete(); // 4 left
         final ToDoItem toDoItem = wrap(all.get(0));
@@ -92,6 +105,9 @@ public class ToDoItemIntegTest extends AbstractIntegTest {
         } catch(DisabledException ex) {
             assertThat(ex.getMessage(), is("Already completed"));
         }
+        
+        // reset
+        toDoItem.notYetCompleted();
     }
 
 }
\ No newline at end of file


[2/4] git commit: ISIS-406: adding integration tests to the todo example app.

Posted by da...@apache.org.
ISIS-406: adding integration tests to the todo example app.


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/a55c76ba
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/a55c76ba
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/a55c76ba

Branch: refs/heads/master
Commit: a55c76ba690ca1fc68107f5ca3e41d29851c2aab
Parents: c0ab239
Author: Dan Haywood <da...@apache.org>
Authored: Fri May 24 09:33:21 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat May 25 07:56:50 2013 +0100

----------------------------------------------------------------------
 .../application/claims/viewer-wicket/.gitignore    |    1 +
 .../dom/src/main/java/dom/todo/ToDoItem.java       |    1 -
 .../integtests/pom.xml                             |   67 +++++++
 .../test/java/integtests/AbstractIntegTest.java    |  141 +++++++++++++++
 .../test/java/integtests/ToDoItemIntegTest.java    |   97 ++++++++++
 5 files changed, 306 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/a55c76ba/example/application/claims/viewer-wicket/.gitignore
----------------------------------------------------------------------
diff --git a/example/application/claims/viewer-wicket/.gitignore b/example/application/claims/viewer-wicket/.gitignore
new file mode 100644
index 0000000..ea8c4bf
--- /dev/null
+++ b/example/application/claims/viewer-wicket/.gitignore
@@ -0,0 +1 @@
+/target

http://git-wip-us.apache.org/repos/asf/isis/blob/a55c76ba/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
index 6ae4124..950b321 100644
--- a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
+++ b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
@@ -54,7 +54,6 @@ import org.apache.isis.applib.annotation.PublishedObject;
 import org.apache.isis.applib.annotation.RegEx;
 import org.apache.isis.applib.annotation.Render;
 import org.apache.isis.applib.annotation.Render.Type;
-import org.apache.isis.applib.annotation.RenderedAsDayBefore;
 import org.apache.isis.applib.annotation.Where;
 import org.apache.isis.applib.clock.Clock;
 import org.apache.isis.applib.filter.Filter;

http://git-wip-us.apache.org/repos/asf/isis/blob/a55c76ba/example/application/quickstart_wicket_restful_jdo/integtests/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/pom.xml b/example/application/quickstart_wicket_restful_jdo/integtests/pom.xml
new file mode 100644
index 0000000..27a0e5d
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/pom.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+         http://www.apache.org/licenses/LICENSE-2.0
+         
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+    <parent>
+    	<groupId>org.apache.isis.example.application</groupId>
+        <artifactId>quickstart_wicket_restful_jdo</artifactId>
+        <version>1.0.3-SNAPSHOT</version>
+    </parent>
+
+	<artifactId>quickstart_wicket_restful_jdo-integtests</artifactId>
+	<name>Quickstart Wicket/Restful/JDO Integration Tests</name>
+
+	<dependencies>
+	
+		<!-- other modules in this project -->
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>quickstart_wicket_restful_jdo-fixture</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>${project.groupId}</groupId>
+			<artifactId>quickstart_wicket_restful_jdo-objstore-jdo</artifactId>
+		</dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-unittestsupport</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-integtestsupport</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.isis.core</groupId>
+            <artifactId>isis-core-wrapper</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.hsqldb</groupId>
+            <artifactId>hsqldb</artifactId>
+        </dependency>
+
+		
+	</dependencies>
+
+</project>

http://git-wip-us.apache.org/repos/asf/isis/blob/a55c76ba/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/AbstractIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/AbstractIntegTest.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/AbstractIntegTest.java
new file mode 100644
index 0000000..44510bd
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/AbstractIntegTest.java
@@ -0,0 +1,141 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package integtests;
+
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+import objstore.jdo.todo.ToDoItemsJdo;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Level;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.rules.MethodRule;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+import org.apache.isis.applib.services.wrapper.WrapperFactory;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationDefault;
+import org.apache.isis.core.integtestsupport.IsisSystemForTest;
+import org.apache.isis.core.wrapper.WrapperFactoryDefault;
+import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore;
+import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
+import org.apache.isis.objectstore.jdo.service.RegisterEntities;
+
+public class AbstractIntegTest {
+
+    protected ToDoItems toDoItems;
+    protected WrapperFactory wrapperFactory;
+    
+    @Rule
+    public IsisSystemForTestRule rule = new IsisSystemForTestRule();
+
+    /**
+     * Same running system returned for all tests, set up with {@link ToDoItemsFixture}.
+     * 
+     * <p>
+     * The database is NOT reset between tests.
+     */
+    public IsisSystemForTest getIsft() {
+        return rule.getIsisSystemForTest();
+    }
+
+    @Before
+    public void init() {
+        toDoItems = getIsft().getService(ToDoItemsJdo.class);
+        wrapperFactory = getIsft().getService(WrapperFactoryDefault.class);
+    }
+
+    protected <T> T wrap(T obj) {
+        return wrapperFactory.wrap(obj);
+    }
+
+
+    ////////////////////////////////////////////////////////////////
+    // Boilerplate
+    ////////////////////////////////////////////////////////////////
+    
+    @BeforeClass
+    public static void initClass() {
+        BasicConfigurator.configure();
+    }
+    
+    private static class ToDoIntegTestBuilder extends IsisSystemForTest.Builder {
+
+        public ToDoIntegTestBuilder() {
+            withFixtures(new ToDoItemsFixture());
+            withLoggingAt(Level.INFO);
+            with(testConfiguration());
+            with(new DataNucleusPersistenceMechanismInstaller());
+            withServices(
+                    new ToDoItemsJdo(),
+                    new WrapperFactoryDefault(),
+                    new RegisterEntities()
+                    );
+        }
+
+        private IsisConfiguration testConfiguration() {
+            final IsisConfigurationDefault testConfiguration = new IsisConfigurationDefault();
+
+            testConfiguration.add("isis.persistor.datanucleus.RegisterEntities.packagePrefix", "dom");
+            testConfiguration.add("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL", "jdbc:hsqldb:mem:test");
+            
+            testConfiguration.add("isis.persistor.datanucleus.impl.datanucleus.defaultInheritanceStrategy", "TABLE_PER_CLASS");
+            testConfiguration.add(DataNucleusObjectStore.INSTALL_FIXTURES_KEY , "true");
+            
+            testConfiguration.add("isis.persistor.datanucleus.impl.datanucleus.cache.level2.type","none");
+
+            return testConfiguration;
+        }
+    }
+
+    private static class IsisSystemForTestRule implements MethodRule {
+        private static ThreadLocal<IsisSystemForTest> ISFT = new ThreadLocal<IsisSystemForTest>() {
+            @Override
+            protected IsisSystemForTest initialValue() {
+                return new ToDoIntegTestBuilder().build().setUpSystem();
+            };
+        };
+
+        public IsisSystemForTest getIsisSystemForTest() {
+            // reuse same system for all calls.
+            return ISFT.get();
+        }
+        
+        @Override
+        public Statement apply(final Statement base, final FrameworkMethod method, final Object target) {
+            final IsisSystemForTest isft = getIsisSystemForTest(); // creates and starts running if required
+            return new Statement() {
+                @Override
+                public void evaluate() throws Throwable {
+                    isft.beginTran();
+                    base.evaluate();
+                    // if an exception is thrown by any test, then we don't attempt to cleanup (eg by calling bounceSystem)#
+                    // because - in any case - we only ever install the fixtures once for ALL of the tests.
+                    // therefore, just fix the first test that fails and don't worry about any other test failures beyond that
+                    // (fix them up one by one)
+                    isft.commitTran();
+                }
+            };
+        }
+    }
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/a55c76ba/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
new file mode 100644
index 0000000..5aab2d8
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
@@ -0,0 +1,97 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package integtests;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import org.apache.isis.applib.services.wrapper.DisabledException;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class ToDoItemIntegTest extends AbstractIntegTest {
+
+    @Test
+    public void t01_findNotYetCompleted() throws Exception {
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        assertThat(all.size(), is(5));
+    }
+
+    @Test
+    public void t02_update() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        final ToDoItem toDoItem = wrap(all.get(0));
+        
+        assertThat(toDoItem.getDescription(), is("Buy milk"));
+        
+        // when
+        toDoItem.setDescription("Buy milk and butter");
+        
+        // then
+        assertThat(toDoItem.getDescription(), is("Buy milk and butter"));
+    }
+
+
+    @Test
+    public void t03_complete() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        final ToDoItem toDoItem = wrap(all.get(0));
+        
+        assertThat(toDoItem.getDescription(), is("Buy milk and butter"));
+        assertThat(toDoItem.isComplete(), is(false));
+        
+        // when
+        toDoItem.completed();
+        
+        // then
+        assertThat(toDoItem.isComplete(), is(true));
+
+        final List<ToDoItem> all2 = wrap(toDoItems).notYetComplete();
+        assertThat(all2.size(), is(4));
+    }
+
+
+    @Test
+    public void t04_cannotCompleteAndObjectAlreadyCompleted() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete(); // 4 left
+        final ToDoItem toDoItem = wrap(all.get(0));
+        
+        toDoItem.completed();
+        
+        // when, then should fail
+        try {
+            toDoItem.completed();
+            fail("completed should have been disabled");
+        } catch(DisabledException ex) {
+            assertThat(ex.getMessage(), is("Already completed"));
+        }
+    }
+
+}
\ No newline at end of file