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 2014/03/06 18:14:26 UTC
[27/31] ISIS-695: recreating quickstart archetype
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/ToDoSystemInitializer.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/ToDoSystemInitializer.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/ToDoSystemInitializer.java
new file mode 100644
index 0000000..14c5616
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/ToDoSystemInitializer.java
@@ -0,0 +1,90 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/**
+ * 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 integration;
+
+import app.ToDoItemAnalysis;
+import dom.todo.ToDoItemContributions;
+import dom.todo.ToDoItems;
+
+import org.apache.isis.applib.annotation.Bulk;
+import org.apache.isis.applib.services.queryresultscache.QueryResultsCache;
+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.datanucleus.service.support.IsisJdoSupportImpl;
+
+/**
+ * Holds an instance of an {@link IsisSystemForTest} as a {@link ThreadLocal} on the current thread,
+ * initialized with ToDo app's domain services.
+ */
+public class ToDoSystemInitializer {
+
+ private ToDoSystemInitializer(){}
+
+ public static IsisSystemForTest initIsft() {
+ IsisSystemForTest isft = IsisSystemForTest.getElseNull();
+ if(isft == null) {
+ isft = new ToDoSystemBuilder().build().setUpSystem();
+ IsisSystemForTest.set(isft);
+ }
+ return isft;
+ }
+
+ private static class ToDoSystemBuilder extends IsisSystemForTest.Builder {
+
+ public ToDoSystemBuilder() {
+ //withFixtures( ... reference data fixtures ...); // if we had any...
+ withLoggingAt(org.apache.log4j.Level.INFO);
+ with(testConfiguration());
+ with(new DataNucleusPersistenceMechanismInstaller());
+
+ withServices(
+ new ToDoItems(),
+ new ToDoItemAnalysis(),
+ new ToDoItemContributions(),
+ new WrapperFactoryDefault(),
+ new IsisJdoSupportImpl(),
+ new Bulk.InteractionContext(),
+ new QueryResultsCache()
+ );
+ }
+
+ 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");
+
+ testConfiguration.add("isis.persistor.datanucleus.impl.datanucleus.identifier.case", "PreserveCase");
+
+ return testConfiguration;
+ }
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/BootstrappingGlue.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/BootstrappingGlue.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/BootstrappingGlue.java
new file mode 100644
index 0000000..f800e25
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/BootstrappingGlue.java
@@ -0,0 +1,59 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/**
+ * 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 integration.glue;
+
+import integration.ToDoSystemInitializer;
+import cucumber.api.java.After;
+import cucumber.api.java.Before;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import org.apache.isis.core.specsupport.scenarios.ScenarioExecutionScope;
+import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
+
+public class BootstrappingGlue extends CukeGlueAbstract {
+
+ // //////////////////////////////////////
+
+ @Before(value={"@unit"}, order=100)
+ public void beforeScenarioUnitScope() {
+ before(ScenarioExecutionScope.UNIT);
+ }
+
+ @Before(value={"@integration"}, order=100)
+ public void beforeScenarioIntegrationScope() {
+ org.apache.log4j.PropertyConfigurator.configure("logging.properties");
+ ToDoSystemInitializer.initIsft();
+
+ before(ScenarioExecutionScope.INTEGRATION);
+ }
+
+ @After
+ public void afterScenario(cucumber.api.Scenario sc) {
+ assertMocksSatisfied();
+ after(sc);
+ }
+
+ // //////////////////////////////////////
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java
new file mode 100644
index 0000000..c826d30
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java
@@ -0,0 +1,50 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/**
+ * 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 integration.glue;
+
+import cucumber.api.java.Before;
+import dom.todo.ToDoItem;
+import fixture.todo.ToDoItemsFixture;
+
+import org.apache.isis.core.specsupport.scenarios.InMemoryDB;
+import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
+
+public class CatalogOfFixturesGlue extends CukeGlueAbstract {
+
+
+ @Before(value={"@unit", "@ToDoItemsFixture"}, order=20000)
+ public void unitFixtures() throws Throwable {
+ final InMemoryDB inMemoryDB = new InMemoryDBForToDoApp(this.scenarioExecution());
+ inMemoryDB.getElseCreate(ToDoItem.class, "Write blog post");
+ inMemoryDB.getElseCreate(ToDoItem.class, "Pick up bread");
+ final ToDoItem t3 = inMemoryDB.getElseCreate(ToDoItem.class, "Pick up butter");
+ t3.setComplete(true);
+ putVar("isis", "in-memory-db", inMemoryDB);
+ }
+
+ // //////////////////////////////////////
+
+ @Before(value={"@integration", "@ToDoItemsFixture"}, order=20000)
+ public void integrationFixtures() throws Throwable {
+ scenarioExecution().install(new ToDoItemsFixture());
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/InMemoryDBForToDoApp.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/InMemoryDBForToDoApp.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/InMemoryDBForToDoApp.java
new file mode 100644
index 0000000..4d8af87
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/InMemoryDBForToDoApp.java
@@ -0,0 +1,43 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/**
+ * 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 integration.glue;
+
+import dom.todo.ToDoItem;
+
+import org.apache.isis.core.specsupport.scenarios.InMemoryDB;
+import org.apache.isis.core.specsupport.scenarios.ScenarioExecution;
+
+public class InMemoryDBForToDoApp extends InMemoryDB {
+
+ public InMemoryDBForToDoApp(ScenarioExecution scenarioExecution) {
+ super(scenarioExecution);
+ }
+
+ /**
+ * Hook to initialize if possible.
+ */
+ @Override
+ protected void init(Object obj, String str) {
+ if(obj instanceof ToDoItem) {
+ ToDoItem toDoItem = (ToDoItem) obj;
+ toDoItem.setDescription(str);
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/todoitem/ToDoItemGlue.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/todoitem/ToDoItemGlue.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/todoitem/ToDoItemGlue.java
new file mode 100644
index 0000000..ccbb270
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/glue/todoitem/ToDoItemGlue.java
@@ -0,0 +1,169 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/**
+ * 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 integration.glue.todoitem;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.Collections;
+import java.util.List;
+
+import com.google.common.base.Predicate;
+import com.google.common.base.Predicates;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+
+import cucumber.api.java.en.Given;
+import cucumber.api.java.en.Then;
+import cucumber.api.java.en.When;
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+
+import org.jmock.Expectations;
+import org.junit.Assert;
+
+import org.apache.isis.applib.annotation.Bulk;
+import org.apache.isis.applib.annotation.Bulk.InteractionContext;
+import org.apache.isis.core.specsupport.scenarios.InMemoryDB;
+import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
+
+public class ToDoItemGlue extends CukeGlueAbstract {
+
+ @Given("^there are a number of incomplete ToDo items${symbol_dollar}")
+ public void there_are_a_number_of_incomplete_ToDo_items() throws Throwable {
+ if(supportsMocks()) {
+ checking(new Expectations() {
+ {
+ allowing(service(ToDoItems.class)).notYetComplete();
+ will(returnValue(notYetCompleteItems()));
+ }
+ });
+ }
+ try {
+ final List<ToDoItem> notYetComplete = service(ToDoItems.class).notYetComplete();
+ assertThat(notYetComplete.isEmpty(), is(false));
+ putVar("list", "notYetCompleteItems", notYetComplete);
+
+ } finally {
+ assertMocksSatisfied();
+ }
+ }
+
+ @When("^I choose the first of the incomplete items${symbol_dollar}")
+ public void I_choose_the_first_one() throws Throwable {
+ @SuppressWarnings("unchecked")
+ List<ToDoItem> notYetComplete = getVar(null, "notYetCompleteItems", List.class);
+ assertThat(notYetComplete.isEmpty(), is(false));
+
+ putVar("todo", "toDoItem", notYetComplete.get(0));
+ }
+
+ @When("^mark the item as complete${symbol_dollar}")
+ public void mark_it_as_complete() throws Throwable {
+ final ToDoItem toDoItem = getVar(null, "toDoItem", ToDoItem.class);
+ if(supportsMocks()) {
+ final Bulk.InteractionContext bulkInteractionContext = service(Bulk.InteractionContext.class);
+ checking(new Expectations() {
+ {
+ allowing(bulkInteractionContext);
+ }
+ });
+ toDoItem.injectBulkInteractionContext(bulkInteractionContext);
+ }
+ wrap(toDoItem).completed();
+ }
+
+ @Then("^the item is no longer listed as incomplete${symbol_dollar}")
+ public void the_item_is_no_longer_listed_as_incomplete() throws Throwable {
+ ToDoItem toDoItem = getVar(null, "toDoItem", ToDoItem.class);
+ whetherNotYetCompletedContains(toDoItem, false);
+ }
+
+ @Given("^.*completed .*item${symbol_dollar}")
+ public void a_completed_ToDo_item() throws Throwable {
+ if(supportsMocks()) {
+ checking(new Expectations(){{
+ allowing(service(ToDoItems.class)).allToDos();
+ will(returnValue(findItems(Predicates.<ToDoItem>alwaysTrue()) ));
+ }});
+ }
+ try {
+ final List<ToDoItem> allToDos = service(ToDoItems.class).allToDos();
+ for (ToDoItem toDoItem : allToDos) {
+ if(toDoItem.isComplete()) {
+ putVar("todo", "toDoItem", toDoItem);
+ return;
+ }
+ }
+ Assert.fail("could not locate any completed ToDo items");
+ } finally {
+ assertMocksSatisfied();
+ }
+ }
+
+ @When("^I mark the .*item as not yet complete${symbol_dollar}")
+ public void I_mark_it_as_not_yet_complete() throws Throwable {
+ ToDoItem toDoItem = getVar(null, "toDoItem", ToDoItem.class);
+ assertThat(toDoItem.isComplete(), is(true));
+
+ toDoItem.setComplete(false);
+ }
+
+ @Then("^the .*item is listed as incomplete${symbol_dollar}")
+ public void the_item_is_listed_as_incomplete() throws Throwable {
+ ToDoItem toDoItem = getVar(null, "toDoItem", ToDoItem.class);
+ whetherNotYetCompletedContains(toDoItem, true);
+ }
+
+ private void whetherNotYetCompletedContains(ToDoItem toDoItem, final boolean whetherContained) {
+ if(supportsMocks()) {
+ final List<ToDoItem> notYetCompleteItems = notYetCompleteItems();
+ checking(new Expectations() {
+ {
+ oneOf(service(ToDoItems.class)).notYetComplete();
+ will(returnValue(notYetCompleteItems));
+ }
+ });
+ }
+ try {
+ final List<ToDoItem> notYetComplete = service(ToDoItems.class).notYetComplete();
+ assertThat(notYetComplete.contains(toDoItem), is(whetherContained));
+ } finally {
+ assertMocksSatisfied();
+ }
+ }
+
+
+ // helper
+ private List<ToDoItem> notYetCompleteItems() {
+ return findItems(new Predicate<ToDoItem>(){
+ @Override
+ public boolean apply(ToDoItem input) {
+ return !input.isComplete();
+ }
+ });
+ }
+
+ private List<ToDoItem> findItems(final Predicate<ToDoItem> predicate) {
+ final InMemoryDB inMemoryDB = getVar("isis", "in-memory-db", InMemoryDB.class);
+ final List<ToDoItem> items = inMemoryDB.findAll(ToDoItem.class);
+ return Lists.newArrayList(Iterables.filter(items, predicate));
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/RunSpecs.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/RunSpecs.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/RunSpecs.java
new file mode 100644
index 0000000..a0d30e2
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/RunSpecs.java
@@ -0,0 +1,41 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/**
+ * 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 integration.specs.todoitem;
+
+import cucumber.api.junit.Cucumber;
+
+import org.junit.runner.RunWith;
+
+
+/**
+ * Runs scenarios in all <tt>.feature</tt> files (this package and any subpackages).
+ */
+@RunWith(Cucumber.class)
+@Cucumber.Options(
+ format = {
+ "html:target/cucumber-html-report"
+ ,"json:target/cucumber.json"
+ },
+ glue={"classpath:integration.glue"},
+ strict = true,
+ tags = { "~@backlog", "~@ignore" })
+public class RunSpecs {
+ // intentionally empty
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/ToDoItemSpec_findAndComplete.feature
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/ToDoItemSpec_findAndComplete.feature b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/ToDoItemSpec_findAndComplete.feature
new file mode 100644
index 0000000..9fc1596
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/ToDoItemSpec_findAndComplete.feature
@@ -0,0 +1,39 @@
+#
+# 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.
+#
+@ToDoItemsFixture
+Feature: Find And Complete ToDo Items
+
+ # the scenario is listed twice here just to demonstrate that it
+ # can be run either at @unit-level scope (using mocks) or
+ # at @integration-level scope (against the running system).
+
+ @unit
+ Scenario: Todo items once completed are no longer listed
+ Given there are a number of incomplete ToDo items
+ When I choose the first of the incomplete items
+ And mark the item as complete
+ Then the item is no longer listed as incomplete
+
+
+ @integration
+ Scenario: Todo items once completed are no longer listed
+ Given there are a number of incomplete ToDo items
+ When I choose the first of the incomplete items
+ And mark the item as complete
+ Then the item is no longer listed as incomplete
+
+
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/ToDoItemSpec_findCompletedAndMarkAsNotYetComplete.feature
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/ToDoItemSpec_findCompletedAndMarkAsNotYetComplete.feature b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/ToDoItemSpec_findCompletedAndMarkAsNotYetComplete.feature
new file mode 100644
index 0000000..1f5f73e
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/specs/todoitem/ToDoItemSpec_findCompletedAndMarkAsNotYetComplete.feature
@@ -0,0 +1,35 @@
+#
+# 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.
+#
+@ToDoItemsFixture
+Feature: Find completed ToDoItem and mark as not yet complete
+
+ # the scenario is listed twice here just to demonstrate that it
+ # can be run either at @unit-level scope (using mocks) or
+ # at @integration-level scope (against the running system).
+
+ @integration
+ Scenario: Todo items can be uncompleted
+ Given a completed item
+ When I mark the item as not yet complete
+ Then the item is listed as incomplete
+
+
+ @unit
+ Scenario: Todo items can be uncompleted
+ Given a completed ToDo item
+ When I mark the item as not yet complete
+ Then the item is listed as incomplete
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoIntegTest.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoIntegTest.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoIntegTest.java
new file mode 100644
index 0000000..4e60a9b
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/ToDoIntegTest.java
@@ -0,0 +1,43 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests;
+
+import integration.ToDoSystemInitializer;
+
+import org.junit.BeforeClass;
+
+import org.apache.isis.core.integtestsupport.IntegrationTestAbstract;
+import org.apache.isis.core.integtestsupport.scenarios.ScenarioExecutionForIntegration;
+
+public abstract class ToDoIntegTest extends IntegrationTestAbstract {
+
+
+ @BeforeClass
+ public static void initClass() {
+ org.apache.log4j.PropertyConfigurator.configure("logging.properties");
+ ToDoSystemInitializer.initIsft();
+
+ // instantiating will install onto ThreadLocal
+ new ScenarioExecutionForIntegration();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemContributionsTest_updateCategory.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemContributionsTest_updateCategory.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemContributionsTest_updateCategory.java
new file mode 100644
index 0000000..ec23d72
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemContributionsTest_updateCategory.java
@@ -0,0 +1,101 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.actions;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItemContributions;
+import dom.todo.ToDoItems;
+import dom.todo.ToDoItem.Category;
+import dom.todo.ToDoItem.Subcategory;
+import fixture.todo.ToDoItemsFixture;
+
+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 ToDoItemContributionsTest_updateCategory extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+ private ToDoItemContributions toDoItemContributions;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final ToDoItems toDoItems = wrap(service(ToDoItems.class));
+ toDoItemContributions = wrap(service(ToDoItemContributions.class));
+ final List<ToDoItem> all = toDoItems.notYetComplete();
+ toDoItem = wrap(all.get(0));
+ }
+
+ @Test
+ public void happyCase() throws Exception {
+
+ // when
+ toDoItemContributions.updateCategory(toDoItem, Category.Professional, Subcategory.Consulting);
+
+ // then
+ assertThat(toDoItem.getCategory(), is(Category.Professional));
+ assertThat(toDoItem.getSubcategory(), is(Subcategory.Consulting));
+
+ // when
+ toDoItemContributions.updateCategory(toDoItem, Category.Domestic, Subcategory.Chores);
+
+ // then
+ assertThat(toDoItem.getCategory(), is(Category.Domestic));
+ assertThat(toDoItem.getSubcategory(), is(Subcategory.Chores));
+ }
+
+
+ @Test
+ public void categoryCannotBeNull() throws Exception {
+
+ // when, then
+ expectedExceptions.expectMessage("Category is mandatory");
+ toDoItemContributions.updateCategory(toDoItem, null, Subcategory.Chores);
+ }
+
+ @Test
+ public void subcategoryCanBeNull() throws Exception {
+
+ // when, then
+ toDoItemContributions.updateCategory(toDoItem, Category.Professional, null);
+ }
+
+ @Test
+ public void subcategoryMustBelongToCategory() throws Exception {
+
+ // when, then
+ expectedExceptions.expectMessage(containsString("Invalid subcategory"));
+ toDoItemContributions.updateCategory(toDoItem, Category.Professional, Subcategory.Chores);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_completed.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_completed.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_completed.java
new file mode 100644
index 0000000..7f31f74
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_completed.java
@@ -0,0 +1,86 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.actions;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemTest_completed extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(all.get(0));
+ }
+
+
+ @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/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_duplicate.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_duplicate.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_duplicate.java
new file mode 100644
index 0000000..20366aa
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_duplicate.java
@@ -0,0 +1,76 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.actions;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.joda.time.LocalDate;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.clock.Clock;
+
+public class ToDoItemTest_duplicate extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+ private ToDoItem duplicateToDoItem;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(all.get(0));
+ }
+
+ @Test
+ public void happyCase() throws Exception {
+
+ // given
+ final LocalDate todaysDate = Clock.getTimeAsLocalDate();
+ toDoItem.setDueBy(todaysDate);
+ toDoItem.updateCost(new BigDecimal("123.45"));
+
+ duplicateToDoItem = toDoItem.duplicate(
+ unwrap(toDoItem).default0Duplicate(),
+ unwrap(toDoItem).default1Duplicate(),
+ unwrap(toDoItem).default2Duplicate(),
+ unwrap(toDoItem).default3Duplicate(),
+ 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/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_notYetCompleted.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_notYetCompleted.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_notYetCompleted.java
new file mode 100644
index 0000000..f6f33cf
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_notYetCompleted.java
@@ -0,0 +1,76 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.actions;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemTest_notYetCompleted extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(all.get(0));
+ }
+
+
+ @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/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemContributionsTest_similarTo.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemContributionsTest_similarTo.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemContributionsTest_similarTo.java
new file mode 100644
index 0000000..48a11a3
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemContributionsTest_similarTo.java
@@ -0,0 +1,69 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.colls;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItemContributions;
+import dom.todo.ToDoItems;
+import dom.todo.ToDoItem.Category;
+import dom.todo.ToDoItem.Subcategory;
+import fixture.todo.ToDoItemsFixture;
+
+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 ToDoItemContributionsTest_similarTo extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+ private ToDoItemContributions toDoItemContributions;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final ToDoItems toDoItems = wrap(service(ToDoItems.class));
+ toDoItemContributions = wrap(service(ToDoItemContributions.class));
+ final List<ToDoItem> all = toDoItems.notYetComplete();
+ toDoItem = wrap(all.get(0));
+ }
+
+ @Test
+ public void happyCase() throws Exception {
+
+ // when
+ List<ToDoItem> similarItems = toDoItemContributions.similarTo(toDoItem);
+
+ // then
+ assertThat(similarItems.size(), is(6));
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemTest_dependencies_add.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemTest_dependencies_add.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemTest_dependencies_add.java
new file mode 100644
index 0000000..e6bc674
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemTest_dependencies_add.java
@@ -0,0 +1,92 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.colls;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemTest_dependencies_add extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+ private ToDoItem otherToDoItem;
+
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> items = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(items.get(0));
+ otherToDoItem = items.get(1); // wrapping this seems to trip up cglib :-(
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ unwrap(toDoItem).getDependencies().clear();
+ }
+
+ @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/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemTest_dependencies_remove.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemTest_dependencies_remove.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemTest_dependencies_remove.java
new file mode 100644
index 0000000..c417d12
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemTest_dependencies_remove.java
@@ -0,0 +1,96 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.colls;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemTest_dependencies_remove extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+ private ToDoItem otherToDoItem;
+ private ToDoItem yetAnotherToDoItem;
+
+
+ @Before
+ public void setUp() throws Exception {
+ // given
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> items = wrap(service(ToDoItems.class)).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);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ unwrap(toDoItem).getDependencies().clear();
+ }
+
+ @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/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemContributionsTest_priority.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemContributionsTest_priority.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemContributionsTest_priority.java
new file mode 100644
index 0000000..ffa6a11
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemContributionsTest_priority.java
@@ -0,0 +1,71 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItemContributions;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemContributionsTest_priority extends ToDoIntegTest {
+
+ private ToDoItemContributions toDoItemContributions;
+
+ private List<ToDoItem> notYetComplete;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final ToDoItems toDoItems = wrap(service(ToDoItems.class));
+ toDoItemContributions = service(ToDoItemContributions.class);
+ notYetComplete = toDoItems.notYetComplete();
+ }
+
+ @Test
+ public void happyCase() throws Exception {
+ assertPriority(0, 1);
+ assertPriority(1, 2);
+ assertPriority(2, 4);
+ assertPriority(3, 6);
+ assertPriority(4, 5);
+ assertPriority(5, 7);
+ assertPriority(6, 9);
+ assertPriority(7, 8);
+ assertPriority(8, 3);
+ assertPriority(9, 10);
+ }
+
+ private void assertPriority(final int n, final int priority) {
+ assertThat(toDoItemContributions.relativePriority(notYetComplete.get(n)), is(Integer.valueOf(priority)));
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_attachment.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_attachment.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_attachment.java
new file mode 100644
index 0000000..9f9060e
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_attachment.java
@@ -0,0 +1,81 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.nio.charset.Charset;
+import java.util.List;
+
+import javax.activation.MimeType;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.value.Blob;
+
+public class ToDoItemTest_attachment extends ToDoIntegTest {
+
+
+ private ToDoItem toDoItem;
+
+ @Before
+ public void setUp() throws Exception {
+
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(all.get(0));
+ }
+
+ @Test
+ public void happyCase() throws Exception {
+
+ byte[] bytes = "{${symbol_escape}"foo${symbol_escape}": ${symbol_escape}"bar${symbol_escape}"}".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/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_category.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_category.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_category.java
new file mode 100644
index 0000000..6d3726b
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_category.java
@@ -0,0 +1,56 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.props;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import dom.todo.ToDoItem.Category;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemTest_category extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(all.get(0));
+ }
+
+ @Test
+ public void cannotModify() throws Exception {
+
+ // when, then
+ expectedExceptions.expectMessage(containsString("Reason: Use action to update both category and subcategory."));
+ toDoItem.setCategory(Category.Professional);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_cost.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_cost.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_cost.java
new file mode 100644
index 0000000..10816e3
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_cost.java
@@ -0,0 +1,95 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemTest_cost extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+ private BigDecimal cost;
+
+ @Before
+ public void setUp() throws Exception {
+ // given
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(all.get(0));
+ cost = toDoItem.getCost();
+ }
+
+ @Test
+ public void happyCaseUsingProperty() throws Exception {
+
+ final BigDecimal newCost = new BigDecimal("123.45");
+
+ // when
+ toDoItem.updateCost(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.updateCost((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/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_description.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_description.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_description.java
new file mode 100644
index 0000000..7c2aaa1
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_description.java
@@ -0,0 +1,102 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemTest_description extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(all.get(0));
+ }
+
+ @Test
+ public void happyCase() throws Exception {
+
+ // given
+ assertThat(toDoItem.getDescription(), is("Buy bread"));
+
+ // when
+ toDoItem.setDescription("Buy bread and butter");
+
+ // then
+ assertThat(toDoItem.getDescription(), is("Buy bread 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);
+ }
+
+ @Test
+ public void onlyJustShortEnough() throws Exception {
+
+ // when, then
+ toDoItem.setDescription(characters(100));
+ }
+
+ @Test
+ public void tooLong() throws Exception {
+
+ // when, then
+ expectedExceptions.expectMessage("The value proposed exceeds the maximum length of 100");
+ toDoItem.setDescription(characters(101));
+ }
+
+ private static String characters(final int n) {
+ StringBuffer buf = new StringBuffer();
+ for(int i=0; i<n; i++) {
+ buf.append("a");
+ }
+ return buf.toString();
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_dueBy.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_dueBy.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_dueBy.java
new file mode 100644
index 0000000..6f6f2eb
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_dueBy.java
@@ -0,0 +1,99 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+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 ToDoItemTest_dueBy extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(all.get(0));
+ }
+
+ @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 nowAsLocalDate = Clock.getTimeAsLocalDate();
+ final LocalDate sixDaysAgo = nowAsLocalDate.plusDays(-5);
+
+ // 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/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_notes.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_notes.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_notes.java
new file mode 100644
index 0000000..bce40e6
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_notes.java
@@ -0,0 +1,73 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.props;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemTest_notes extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+
+ @Before
+ public void setUp() throws Exception {
+ // given
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(all.get(0));
+ }
+
+ @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/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_ownedBy.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_ownedBy.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_ownedBy.java
new file mode 100644
index 0000000..fa5af04
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_ownedBy.java
@@ -0,0 +1,59 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.props;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import dom.todo.ToDoItem.Category;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemTest_ownedBy extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).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/10242866/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_subcategory.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_subcategory.java b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_subcategory.java
new file mode 100644
index 0000000..48fac31
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/archetype/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_subcategory.java
@@ -0,0 +1,56 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+/*
+ * 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 integration.tests.props;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItem.Subcategory;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemTest_subcategory extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(all.get(0));
+ }
+
+ @Test
+ public void cannotModify() throws Exception {
+
+ // when, then
+ expectedExceptions.expectMessage(containsString("Reason: Use action to update both category and subcategory."));
+ toDoItem.setSubcategory(Subcategory.Chores);
+ }
+}