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 13:55:09 UTC

git commit: ISIS-406: getting integration tests to run with wrapper

Updated Branches:
  refs/heads/master 2f39f583e -> 6246363c5


ISIS-406: getting integration tests to run with wrapper

* also small enhancement to allow wrapped objects to be unwrapped


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

Branch: refs/heads/master
Commit: 6246363c5ee3dffd039b36e175bd88fd70c4135e
Parents: 2f39f58
Author: Dan Haywood <da...@apache.org>
Authored: Sat May 25 12:54:47 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Sat May 25 12:54:47 2013 +0100

----------------------------------------------------------------------
 .../applib/services/wrapper/WrapperFactory.java    |   16 ++-
 .../isis/core/wrapper/WrapperFactoryDefault.java   |   19 ++-
 .../integtests/logging.properties                  |   77 ++++++++++
 .../test/java/integtests/AbstractIntegTest.java    |   21 ++-
 .../test/java/integtests/ToDoItemIntegTest.java    |  115 --------------
 .../src/test/java/integtests/ToDoItem_title.java   |  116 +++++++++++++++
 .../integtests/actions/ToDoItem_completed.java     |   90 +++++++++++
 .../integtests/actions/ToDoItem_duplicate.java     |   78 ++++++++++
 .../actions/ToDoItem_notYetCompleted.java          |   80 ++++++++++
 .../colls/ToDoItem_dependencies_add.java           |   90 +++++++++++
 .../colls/ToDoItem_dependencies_remove.java        |   93 ++++++++++++
 .../java/integtests/props/ToDoItem_attachment.java |   83 ++++++++++
 .../java/integtests/props/ToDoItem_category.java   |   83 ++++++++++
 .../test/java/integtests/props/ToDoItem_cost.java  |   97 ++++++++++++
 .../integtests/props/ToDoItem_description.java     |   84 +++++++++++
 .../test/java/integtests/props/ToDoItem_dueBy.java |  102 +++++++++++++
 .../test/java/integtests/props/ToDoItem_notes.java |   78 ++++++++++
 .../java/integtests/props/ToDoItem_ownedBy.java    |   50 ++++++
 .../java/integtests/repo/ToDoItems_finders.java    |   77 ++++++++++
 .../repo/ToDoItems_newToDo_and_delete.java         |   52 +++++++
 20 files changed, 1376 insertions(+), 125 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/core/applib/src/main/java/org/apache/isis/applib/services/wrapper/WrapperFactory.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/wrapper/WrapperFactory.java b/core/applib/src/main/java/org/apache/isis/applib/services/wrapper/WrapperFactory.java
index e347c82..8693f30 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/services/wrapper/WrapperFactory.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/wrapper/WrapperFactory.java
@@ -78,8 +78,6 @@ public interface WrapperFactory {
      * <p>
      * If the object has (see {@link #isWrapper(Object)} already been wrapped),
      * then should just return the object back unchanged.
-     * 
-     * @see #addInteractionListener(InteractionListener)
      */
     @Programmatic
     <T> T wrap(T domainObject);
@@ -95,6 +93,18 @@ public interface WrapperFactory {
     @Programmatic
     <T> T wrap(T domainObject, ExecutionMode mode);
 
+
+    /**
+     * Obtains the underlying domain object, if wrapped.
+     * 
+     * <p>
+     * If the object {@link #isWrapper(Object) is not wrapped}, then
+     * should just return the obejct back unchanged.
+     */
+    @Programmatic
+    <T> T unwrap(T possibleWrappedDomainObject);
+
+    
     /**
      * Whether the supplied object has been wrapped.
      * 
@@ -104,7 +114,7 @@ public interface WrapperFactory {
      * @return
      */
     @Programmatic
-    <T> boolean isWrapper(T possibleWrapper);
+    <T> boolean isWrapper(T possibleWrappedDomainObject);
 
     /**
      * All {@link InteractionListener}s that have been registered using

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryDefault.java
----------------------------------------------------------------------
diff --git a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryDefault.java b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryDefault.java
index b0cc78a..5e86d7d 100644
--- a/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryDefault.java
+++ b/core/wrapper/src/main/java/org/apache/isis/core/wrapper/WrapperFactoryDefault.java
@@ -200,7 +200,7 @@ public class WrapperFactoryDefault implements WrapperFactory, AuthenticationSess
     }
 
     // /////////////////////////////////////////////////////////////
-    // Wrapped
+    // wrap and unwrap
     // /////////////////////////////////////////////////////////////
 
     @Override
@@ -217,8 +217,19 @@ public class WrapperFactoryDefault implements WrapperFactory, AuthenticationSess
     }
 
     @Override
-    public boolean isWrapper(final Object possibleWrapper) {
-        return possibleWrapper instanceof WrapperObject;
+    public boolean isWrapper(final Object possibleWrappedDomainObject) {
+        return possibleWrappedDomainObject instanceof WrapperObject;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    @Programmatic
+    public <T> T unwrap(T possibleWrappedDomainObject) {
+        if(isWrapper(possibleWrappedDomainObject)) {
+            WrapperObject wrapperObject = (WrapperObject) possibleWrappedDomainObject;
+            return (T) wrapperObject.wrapped();
+        } 
+        return possibleWrappedDomainObject;
     }
 
     // /////////////////////////////////////////////////////////////
@@ -277,4 +288,6 @@ public class WrapperFactoryDefault implements WrapperFactory, AuthenticationSess
         this.objectPersistor = objectPersistor;
     }
 
+
+
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/logging.properties
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/logging.properties b/example/application/quickstart_wicket_restful_jdo/integtests/logging.properties
new file mode 100644
index 0000000..a49456b
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/logging.properties
@@ -0,0 +1,77 @@
+#  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.
+
+
+#
+# Isis uses log4j is used to provide system logging
+#
+log4j.rootCategory=INFO, Console
+
+# The console appender
+log4j.appender.Console=org.apache.log4j.ConsoleAppender
+log4j.appender.Console.target=System.out
+log4j.appender.Console.layout=org.apache.log4j.PatternLayout
+log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE}  [%-20c{1} %-10t %-5p]  %m%n
+
+log4j.appender.File=org.apache.log4j.RollingFileAppender
+log4j.appender.File.file=isis.log
+log4j.appender.File.append=false
+log4j.appender.File.layout=org.apache.log4j.PatternLayout
+log4j.appender.File.layout.ConversionPattern=%d [%-20c{1} %-10t %-5p]  %m%n
+
+! turn on the internal log4j debugging flag so we can see what it is doing
+#log4j.debug=true
+
+# DataNucleus
+log4j.logger.DataNucleus.Datastore.Native=DEBUG, Console
+
+log4j.logger.DataNucleus.Persistence=WARN, Console
+log4j.logger.DataNucleus.Transaction=WARN, Console
+log4j.logger.DataNucleus.Connection=WARN, Console
+log4j.logger.DataNucleus.Query=WARN, Console
+log4j.logger.DataNucleus.Cache=WARN, Console
+log4j.logger.DataNucleus.MetaData=WARN, Console
+log4j.logger.DataNucleus.Datastore=WARN, Console
+log4j.logger.DataNucleus.Datastore.Schema=WARN, Console
+log4j.logger.DataNucleus.Datastore.Persist=WARN, Console
+log4j.logger.DataNucleus.Datastore.Retrieve=WARN, Console
+log4j.logger.DataNucleus.General=WARN, Console
+log4j.logger.DataNucleus.Lifecycle=WARN, Console
+log4j.logger.DataNucleus.ValueGeneration=WARN, Console
+log4j.logger.DataNucleus.Enhancer=WARN, Console
+log4j.logger.DataNucleus.SchemaTool=ERROR, Console
+log4j.logger.DataNucleus.JDO=WARN, Console
+log4j.logger.DataNucleus.JPA=ERROR, Console
+log4j.logger.DataNucleus.JCA=WARN, Console
+log4j.logger.DataNucleus.IDE=ERROR, Console
+
+
+# if using log4jdbc-remix as JDBC driver
+#log4j.logger.jdbc.sqlonly=DEBUG, sql, Console
+#log4j.additivity.jdbc.sqlonly=false
+#log4j.logger.jdbc.resultsettable=DEBUG, jdbc, Console
+#log4j.additivity.jdbc.resultsettable=false
+
+#log4j.logger.jdbc.audit=WARN,jdbc, Console
+#log4j.additivity.jdbc.audit=false
+#log4j.logger.jdbc.resultset=WARN,jdbc
+#log4j.additivity.jdbc.resultset=false
+#log4j.logger.jdbc.sqltiming=WARN,sqltiming
+#log4j.additivity.jdbc.sqltiming=false
+#log4j.logger.jdbc.connection=FATAL,connection
+#log4j.additivity.jdbc.connection=false
+

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/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 16284d2..e17bc20 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
@@ -22,11 +22,12 @@ 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.apache.log4j.PropertyConfigurator;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Rule;
+import org.junit.rules.ExpectedException;
 import org.junit.rules.MethodRule;
 import org.junit.runners.model.FrameworkMethod;
 import org.junit.runners.model.Statement;
@@ -36,6 +37,8 @@ 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.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
 import org.apache.isis.core.wrapper.WrapperFactoryDefault;
 import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusObjectStore;
 import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
@@ -46,9 +49,15 @@ public class AbstractIntegTest {
     protected ToDoItems toDoItems;
     protected WrapperFactory wrapperFactory;
     protected DomainObjectContainer container;
+
+    @Rule
+    public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
     
     @Rule
-    public IsisSystemForTestRule rule = new IsisSystemForTestRule();
+    public IsisSystemForTestRule bootstrapIsis = new IsisSystemForTestRule();
+
+    @Rule
+    public ExpectedException expectedExceptions = ExpectedException.none();
 
     /**
      * Same running system returned for all tests, set up with {@link ToDoItemsFixture}.
@@ -57,7 +66,7 @@ public class AbstractIntegTest {
      * The database is NOT reset between tests.
      */
     public IsisSystemForTest getIsft() {
-        return rule.getIsisSystemForTest();
+        return bootstrapIsis.getIsisSystemForTest();
     }
 
     @Before
@@ -71,6 +80,10 @@ public class AbstractIntegTest {
         return wrapperFactory.wrap(obj);
     }
 
+    protected <T> T unwrap(T obj) {
+        return wrapperFactory.unwrap(obj);
+    }
+
 
     ////////////////////////////////////////////////////////////////
     // Boilerplate
@@ -78,7 +91,7 @@ public class AbstractIntegTest {
     
     @BeforeClass
     public static void initClass() {
-        BasicConfigurator.configure();
+        PropertyConfigurator.configure("logging.properties");
     }
     
     private static class ToDoIntegTestBuilder extends IsisSystemForTest.Builder {

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/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
deleted file mode 100644
index 5042657..0000000
--- a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItemIntegTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- *  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.*;
-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 t010_findNotYetCompleted() throws Exception {
-        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
-        assertThat(all.size(), is(5));
-    }
-
-    @Test
-    public void t020_updateDescription() throws Exception {
-        // given
-        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
-        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"));
-    }
-
-
-    @Test
-    public void t030_complete_and_notYetComplete() throws Exception {
-        // given
-        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("Buy milk and butter due by 2013-05-25"));
-        
-        // when
-        toDoItem.completed();
-        
-        // then
-        assertThat(toDoItem.isComplete(), is(true));
-        assertThat(container.titleOf(toDoItem), is("Buy milk and butter - Completed!"));
-
-        all = wrap(toDoItems).notYetComplete();
-        assertThat(all.size(), is(4));
-        
-        // and when
-        toDoItem.notYetCompleted();
-        
-        // then
-        assertThat(toDoItem.isComplete(), is(false));
-        assertThat(container.titleOf(toDoItem), is("Buy milk and butter due by 2013-05-25"));
-
-        all = wrap(toDoItems).notYetComplete();
-        assertThat(all.size(), is(5));
-    }
-
-
-    @Test
-    public void t040_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"));
-        }
-        
-        // reset
-        toDoItem.notYetCompleted();
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItem_title.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItem_title.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItem_title.java
new file mode 100644
index 0000000..8379675
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/ToDoItem_title.java
@@ -0,0 +1,116 @@
+/*
+ *  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.containsString;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.joda.time.LocalDate;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.clock.Clock;
+
+public class ToDoItem_title extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private String description;
+    private boolean isComplete;
+    private LocalDate dueBy;
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(all.get(0));
+
+        // to reset after
+        description = toDoItem.getDescription();
+        isComplete = toDoItem.isComplete();
+        dueBy = toDoItem.getDueBy();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        unwrap(toDoItem).setDescription(description);
+        unwrap(toDoItem).setComplete(isComplete);
+        unwrap(toDoItem).setDueBy(dueBy);
+    }
+    
+    
+    @Test
+    public void includesDescription() throws Exception {
+
+        // given
+        assertThat(container.titleOf(toDoItem), containsString("Buy milk due by"));
+
+        // when
+        unwrap(toDoItem).setDescription("Buy milk and butter");
+        
+        // then
+        assertThat(container.titleOf(toDoItem), containsString("Buy milk and butter due by"));
+    }
+
+    @Test
+    public void includesDueDateIfAny() throws Exception {
+
+        // given
+        assertThat(container.titleOf(toDoItem), containsString("due by " + dueBy.toString("yyyy-MM-dd")));
+
+        // when
+        final LocalDate fiveDaysFromNow = Clock.getTimeAsLocalDate().plusDays(5);
+        unwrap(toDoItem).setDueBy(fiveDaysFromNow);
+
+        // then
+        assertThat(container.titleOf(toDoItem), containsString("due by " + fiveDaysFromNow.toString("yyyy-MM-dd")));
+    }
+
+
+    @Test
+    public void ignoresDueDateIfNone() throws Exception {
+
+        // when
+        // (since wrapped, will call clearDueBy) 
+        toDoItem.setDueBy(null);
+
+        // then
+        assertThat(container.titleOf(toDoItem), not(containsString("due by")));
+    }
+
+    @Test
+    public void usesWhetherCompleted() throws Exception {
+
+        // given
+        assertThat(container.titleOf(toDoItem), not(containsString("Completed!")));
+
+        // when
+        toDoItem.completed();
+
+        // then
+        assertThat(container.titleOf(toDoItem), not(containsString("due by")));
+        assertThat(container.titleOf(toDoItem), containsString("Buy milk - Completed!"));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_completed.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_completed.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_completed.java
new file mode 100644
index 0000000..3180bf2
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_completed.java
@@ -0,0 +1,90 @@
+/*
+ *  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.actions;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import integtests.AbstractIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItem_completed extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private boolean isComplete;
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(all.get(0));
+
+        // to reset after
+        isComplete = toDoItem.isComplete();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        unwrap(toDoItem).setComplete(isComplete);
+    }
+
+    @Test
+    public void happyCase() throws Exception {
+        
+        // given
+        assertThat(toDoItem.isComplete(), is(false));
+        
+        // when
+        toDoItem.completed();
+        
+        // then
+        assertThat(toDoItem.isComplete(), is(true));
+    }
+
+
+    @Test
+    public void cannotCompleteIfAlreadyCompleted() throws Exception {
+        
+        // given
+        unwrap(toDoItem).setComplete(true);
+
+        // when, then should fail
+        expectedExceptions.expectMessage("Already completed");
+        toDoItem.completed();
+    }
+
+
+    @Test
+    public void cannotSetPropertyDirectly() throws Exception {
+        
+        // given
+
+        // when, then should fail
+        expectedExceptions.expectMessage("Always disabled");
+        toDoItem.setComplete(true);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_duplicate.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_duplicate.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_duplicate.java
new file mode 100644
index 0000000..028c645
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_duplicate.java
@@ -0,0 +1,78 @@
+/*
+ *  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.actions;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import integtests.AbstractIntegTest;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItem.Category;
+
+import org.joda.time.LocalDate;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.clock.Clock;
+
+public class ToDoItem_duplicate extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private ToDoItem duplicateToDoItem;
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(all.get(0));
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        duplicateToDoItem.delete();
+    }
+
+    @Test
+    public void happyCase() throws Exception {
+        
+        // given
+        final LocalDate todaysDate = Clock.getTimeAsLocalDate();
+        toDoItem.setDueBy(todaysDate);
+        toDoItem.setCost(new BigDecimal("123.45"));
+        
+        duplicateToDoItem = toDoItem.duplicate(
+                unwrap(toDoItem).default0Duplicate(), 
+                unwrap(toDoItem).default1Duplicate(),
+                unwrap(toDoItem).default2Duplicate(),
+                new BigDecimal("987.65"));
+        
+        // then
+        assertThat(duplicateToDoItem.getDescription(), is(toDoItem.getDescription() + " - Copy"));
+        assertThat(duplicateToDoItem.getCategory(), is(toDoItem.getCategory()));
+        assertThat(duplicateToDoItem.getDueBy(), is(todaysDate));
+        assertThat(duplicateToDoItem.getCost(), is(new BigDecimal("987.65")));
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_notYetCompleted.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_notYetCompleted.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_notYetCompleted.java
new file mode 100644
index 0000000..0e0202d
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/actions/ToDoItem_notYetCompleted.java
@@ -0,0 +1,80 @@
+/*
+ *  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.actions;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import integtests.AbstractIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItem_notYetCompleted extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private boolean isComplete;
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(all.get(0));
+
+        // to reset after
+        isComplete = toDoItem.isComplete();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        unwrap(toDoItem).setComplete(isComplete);
+    }
+
+
+    @Test
+    public void happyCase() throws Exception {
+        
+        // given
+        unwrap(toDoItem).setComplete(true);
+        
+        // when
+        toDoItem.notYetCompleted();
+        
+        // then
+        assertThat(toDoItem.isComplete(), is(false));
+    }
+
+
+    @Test
+    public void cannotUndoIfNotYetCompleted() throws Exception {
+        
+        // given
+        assertThat(toDoItem.isComplete(), is(false));
+
+        // when, then should fail
+        expectedExceptions.expectMessage("Not yet completed");
+        toDoItem.notYetCompleted();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_add.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_add.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_add.java
new file mode 100644
index 0000000..97b8199
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_add.java
@@ -0,0 +1,90 @@
+/*
+ *  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.colls;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integtests.AbstractIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItem_dependencies_add extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private ToDoItem otherToDoItem;
+    private boolean isComplete;
+    
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> items = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(items.get(0));
+        otherToDoItem = items.get(1); // wrapping this seems to trip up cglib :-(
+        
+        isComplete = toDoItem.isComplete();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        unwrap(toDoItem).getDependencies().clear();
+        unwrap(toDoItem).setComplete(isComplete);
+    }
+
+    @Test
+    public void happyCase() throws Exception {
+
+        // given
+        assertThat(toDoItem.getDependencies().size(), is(0));
+        
+        // when
+        toDoItem.add(otherToDoItem);
+        
+        // then
+        assertThat(toDoItem.getDependencies().size(), is(1));
+        assertThat(toDoItem.getDependencies().first(), is(unwrap(otherToDoItem)));
+    }
+
+
+    @Test
+    public void cannotDependOnSelf() throws Exception {
+
+        // when, then
+        expectedExceptions.expectMessage("Can't set up a dependency to self");
+        toDoItem.add(toDoItem);
+    }
+
+    @Test
+    public void cannotAddDependencyIfComplete() throws Exception {
+
+        // given
+        unwrap(toDoItem).setComplete(true);
+        
+        // when, then
+        expectedExceptions.expectMessage("Cannot add dependencies for items that are complete");
+        toDoItem.add(otherToDoItem);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_remove.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_remove.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_remove.java
new file mode 100644
index 0000000..1abfc2c
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_remove.java
@@ -0,0 +1,93 @@
+/*
+ *  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.colls;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integtests.AbstractIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItem_dependencies_remove extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private ToDoItem otherToDoItem;
+    private ToDoItem yetAnotherToDoItem;
+    private boolean isComplete;
+    
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> items = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(items.get(0));
+        otherToDoItem = items.get(1); // wrapping this seems to trip up cglib :-(
+        yetAnotherToDoItem = items.get(2); // wrapping this seems to trip up cglib :-(
+        
+        toDoItem.add(otherToDoItem);
+
+        isComplete = toDoItem.isComplete();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        unwrap(toDoItem).getDependencies().clear();
+        unwrap(toDoItem).setComplete(isComplete);
+    }
+
+    @Test
+    public void happyCase() throws Exception {
+
+        // given
+        assertThat(toDoItem.getDependencies().size(), is(1));
+        
+        // when
+        toDoItem.remove(otherToDoItem);
+        
+        // then
+        assertThat(toDoItem.getDependencies().size(), is(0));
+    }
+
+
+    @Test
+    public void cannotRemoveItemIfNotADepedndency() throws Exception {
+
+        // when, then
+        expectedExceptions.expectMessage("Not a dependency");
+        toDoItem.remove(yetAnotherToDoItem);
+    }
+
+    @Test
+    public void cannotRemoveDependencyIfComplete() throws Exception {
+
+        // given
+        unwrap(toDoItem).setComplete(true);
+        
+        // when, then
+        expectedExceptions.expectMessage("Cannot remove dependencies for items that are complete");
+        toDoItem.remove(otherToDoItem);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_attachment.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_attachment.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_attachment.java
new file mode 100644
index 0000000..4e3b27d
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_attachment.java
@@ -0,0 +1,83 @@
+/*
+ *  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.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import integtests.AbstractIntegTest;
+
+import java.nio.charset.Charset;
+import java.util.List;
+
+import javax.activation.MimeType;
+
+import dom.todo.ToDoItem;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.value.Blob;
+
+public class ToDoItem_attachment extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private Blob attachment;
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(all.get(0));
+
+        // to reset after
+        attachment = toDoItem.getAttachment();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        unwrap(toDoItem).setAttachment(attachment);
+    }
+
+    @Test
+    public void happyCase() throws Exception {
+        
+        byte[] bytes = "{\"foo\": \"bar\"}".getBytes(Charset.forName("UTF-8"));
+        final Blob newAttachment = new Blob("myfile.json", new MimeType("application/json"), bytes);
+        
+        // when
+        toDoItem.setAttachment(newAttachment);
+        
+        // then
+        assertThat(toDoItem.getAttachment(), is(newAttachment));
+    }
+
+    @Test
+    public void canBeNull() throws Exception {
+        
+        // when
+        toDoItem.setAttachment((Blob)null);
+        
+        // then
+        assertThat(toDoItem.getAttachment(), is((Blob)null));
+    }
+
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_category.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_category.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_category.java
new file mode 100644
index 0000000..f72ec4c
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_category.java
@@ -0,0 +1,83 @@
+/*
+ *  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.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import integtests.AbstractIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItem.Category;
+
+import org.joda.time.LocalDate;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.clock.Clock;
+
+public class ToDoItem_category extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private Category category;
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(all.get(0));
+
+        // to reset after
+        category = toDoItem.getCategory();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        unwrap(toDoItem).setCategory(category);
+    }
+
+    @Test
+    public void happyCase() throws Exception {
+        
+        // when
+        toDoItem.setCategory(Category.Professional);
+        
+        // then
+        assertThat(toDoItem.getCategory(), is(Category.Professional));
+        
+        // when
+        toDoItem.setCategory(Category.Domestic);
+        
+        // then
+        assertThat(toDoItem.getCategory(), is(Category.Domestic));
+    }
+
+
+    @Test
+    public void cannotBeNull() throws Exception {
+        
+        // when, then
+        expectedExceptions.expectMessage("Mandatory");
+        toDoItem.setCategory(null);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_cost.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_cost.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_cost.java
new file mode 100644
index 0000000..efdb762
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_cost.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.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import integtests.AbstractIntegTest;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItem_cost extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private BigDecimal cost;
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(all.get(0));
+
+        // to reset after
+        cost = toDoItem.getCost();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        unwrap(toDoItem).setCost(cost);
+    }
+
+    @Test
+    public void happyCaseUsingProperty() throws Exception {
+        
+        final BigDecimal newCost = new BigDecimal("123.45");
+        
+        // when
+        toDoItem.setCost(newCost);
+        
+        // then
+        assertThat(toDoItem.getCost(), is(newCost));
+    }
+
+    @Test
+    public void happyCaseUsingAction() throws Exception {
+        
+        final BigDecimal newCost = new BigDecimal("123.45");
+        
+        // when
+        toDoItem.updateCost(newCost);
+        
+        // then
+        assertThat(toDoItem.getCost(), is(newCost));
+    }
+    
+    @Test
+    public void canBeNull() throws Exception {
+        
+        // when
+        toDoItem.setCost((BigDecimal)null);
+        
+        // then
+        assertThat(toDoItem.getCost(), is((BigDecimal)null));
+    }
+
+    @Test
+    public void defaultForAction() throws Exception {
+        
+        // then
+        assertThat(unwrap(toDoItem).default0UpdateCost(), is(cost));
+    }
+    
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_description.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_description.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_description.java
new file mode 100644
index 0000000..a5feaa2
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_description.java
@@ -0,0 +1,84 @@
+/*
+ *  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.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import integtests.AbstractIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItem_description extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private String description;
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(all.get(0));
+
+        // to reset after
+        description = toDoItem.getDescription();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        unwrap(toDoItem).setDescription(description);
+    }
+    
+    @Test
+    public void happyCase() throws Exception {
+        
+        // given
+        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 failsRegex() throws Exception {
+        
+        // when
+        expectedExceptions.expectMessage("Doesn't match pattern");
+        toDoItem.setDescription("exclamation marks are not allowed!!!");
+    }
+
+    @Test
+    public void cannotBeNull() throws Exception {
+        
+        // when, then
+        expectedExceptions.expectMessage("Mandatory");
+        toDoItem.setDescription(null);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_dueBy.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_dueBy.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_dueBy.java
new file mode 100644
index 0000000..87420e2
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_dueBy.java
@@ -0,0 +1,102 @@
+/*
+ *  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.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import integtests.AbstractIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.joda.time.LocalDate;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.clock.Clock;
+
+public class ToDoItem_dueBy extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private LocalDate dueBy;
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(all.get(0));
+
+        // to reset after
+        dueBy = toDoItem.getDueBy();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        unwrap(toDoItem).setDueBy(dueBy);
+    }
+
+    @Test
+    public void happyCase() throws Exception {
+        
+        // when
+        final LocalDate fiveDaysFromNow = Clock.getTimeAsLocalDate().plusDays(5);
+        toDoItem.setDueBy(fiveDaysFromNow);
+        
+        // then
+        assertThat(toDoItem.getDueBy(), is(fiveDaysFromNow));
+    }
+
+
+    @Test
+    public void canBeNull() throws Exception {
+        
+        // when
+        toDoItem.setDueBy((LocalDate)null);
+        
+        // then
+        assertThat(toDoItem.getDueBy(), is((LocalDate)null));
+    }
+
+    @Test
+    public void canBeUpToSixDaysInPast() throws Exception {
+        
+        final LocalDate sixDaysAgo = Clock.getTimeAsLocalDate().plusDays(-6);
+
+        // when
+        toDoItem.setDueBy(sixDaysAgo);
+        
+        // then
+        assertThat(toDoItem.getDueBy(), is(sixDaysAgo));
+    }
+
+
+    @Test
+    public void cannotBeMoreThanSixDaysInPast() throws Exception {
+        
+        final LocalDate sevenDaysAgo = Clock.getTimeAsLocalDate().plusDays(-7);
+        
+        // when, then
+        expectedExceptions.expectMessage("Due by date cannot be more than one week old");
+        toDoItem.setDueBy(sevenDaysAgo);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_notes.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_notes.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_notes.java
new file mode 100644
index 0000000..5bba549
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_notes.java
@@ -0,0 +1,78 @@
+/*
+ *  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.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import integtests.AbstractIntegTest;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItem_notes extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+    private String notes;
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(all.get(0));
+
+        // to reset after
+        notes = toDoItem.getNotes();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        unwrap(toDoItem).setNotes(notes);
+    }
+
+    @Test
+    public void happyCase() throws Exception {
+        
+        final String newNotes = "Lorem ipsum yada yada";
+        
+        // when
+        toDoItem.setNotes(newNotes);
+        
+        // then
+        assertThat(toDoItem.getNotes(), is(newNotes));
+    }
+
+    @Test
+    public void canBeNull() throws Exception {
+        
+        // when
+        toDoItem.setNotes((String)null);
+        
+        // then
+        assertThat(toDoItem.getNotes(), is((String)null));
+    }
+
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_ownedBy.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_ownedBy.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_ownedBy.java
new file mode 100644
index 0000000..5094f31
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/props/ToDoItem_ownedBy.java
@@ -0,0 +1,50 @@
+/*
+ *  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.props;
+
+import integtests.AbstractIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItem_ownedBy extends AbstractIntegTest {
+
+    private ToDoItem toDoItem;
+
+    @Before
+    public void setUp() throws Exception {
+        // given
+        final List<ToDoItem> all = wrap(toDoItems).notYetComplete();
+        toDoItem = wrap(all.get(0));
+    }
+
+    @Test
+    public void cannotModify() throws Exception {
+        
+        // when, then
+        expectedExceptions.expectMessage("Always hidden");
+        toDoItem.setOwnedBy("other");
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/repo/ToDoItems_finders.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/repo/ToDoItems_finders.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/repo/ToDoItems_finders.java
new file mode 100644
index 0000000..4b165e3
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/repo/ToDoItems_finders.java
@@ -0,0 +1,77 @@
+/*
+ *  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.repo;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import integtests.AbstractIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+
+import org.junit.Test;
+
+public class ToDoItems_finders extends AbstractIntegTest {
+
+    @Test
+    public void t010_notYetCompleted() throws Exception {
+        
+        // when
+        final List<ToDoItem> notYetCompleteItems = wrap(toDoItems).notYetComplete();
+        
+        // then
+        assertThat(notYetCompleteItems.size(), is(5));
+    }
+
+    @Test
+    public void t020_complete() throws Exception {
+        
+        // when
+        final List<ToDoItem> completedItems = wrap(toDoItems).complete();
+        
+        // then
+        assertThat(completedItems.size(), is(0));
+    }
+
+    @Test
+    public void t030_complete_and_notYetComplete() throws Exception {
+        
+        // given
+        List<ToDoItem> notYetCompleteItems = wrap(toDoItems).notYetComplete();
+        final ToDoItem toDoItem = wrap(notYetCompleteItems.get(0));
+        
+        // when
+        toDoItem.completed();
+        
+        // then
+        assertThat(wrap(toDoItems).notYetComplete().size(), is(4));
+        assertThat(wrap(toDoItems).complete().size(), is(1));
+        
+        // and when
+        toDoItem.notYetCompleted();
+        
+        // then
+        assertThat(wrap(toDoItems).notYetComplete().size(), is(5));
+        assertThat(wrap(toDoItems).complete().size(), is(0));
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/6246363c/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/repo/ToDoItems_newToDo_and_delete.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/repo/ToDoItems_newToDo_and_delete.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/repo/ToDoItems_newToDo_and_delete.java
new file mode 100644
index 0000000..30ffc3f
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integtests/repo/ToDoItems_newToDo_and_delete.java
@@ -0,0 +1,52 @@
+/*
+ *  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.repo;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integtests.AbstractIntegTest;
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItem.Category;
+
+import org.junit.Test;
+
+public class ToDoItems_newToDo_and_delete extends AbstractIntegTest {
+
+    @Test
+    public void happyCase() throws Exception {
+        
+        // given
+        int size = wrap(toDoItems).notYetComplete().size();
+        
+        // when
+        final ToDoItem newToDo = wrap(toDoItems).newToDo("new todo", Category.Professional, null, null);
+
+        // then
+        assertThat(newToDo.getDescription(), is("new todo"));
+        assertThat(newToDo.getCategory(), is(Category.Professional));
+        assertThat(wrap(toDoItems).notYetComplete().size(), is(size+1));
+        
+        // when
+        newToDo.delete();
+
+        // then
+        assertThat(wrap(toDoItems).notYetComplete().size(), is(size));
+    }
+
+}
\ No newline at end of file