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/10/25 13:45:32 UTC
[17/28] ISIS-437: updating quickstart archetype
http://git-wip-us.apache.org/repos/asf/isis/blob/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_duplicate.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_duplicate.java b/example/archetype/quickstart_wicket_restful_jdo/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/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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_notYetCompleted.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/actions/ToDoItemTest_notYetCompleted.java b/example/archetype/quickstart_wicket_restful_jdo/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/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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemContributionsTest_similarTo.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemContributionsTest_similarTo.java b/example/archetype/quickstart_wicket_restful_jdo/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/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/c742898c/example/archetype/quickstart_wicket_restful_jdo/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/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemTest_dependencies_add.java b/example/archetype/quickstart_wicket_restful_jdo/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/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/c742898c/example/archetype/quickstart_wicket_restful_jdo/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/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/colls/ToDoItemTest_dependencies_remove.java b/example/archetype/quickstart_wicket_restful_jdo/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/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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemContributionsTest_priority.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemContributionsTest_priority.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemContributionsTest_priority.java
new file mode 100644
index 0000000..a41d96e
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/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.priority(notYetComplete.get(n)), is(Integer.valueOf(priority)));
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_attachment.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_attachment.java b/example/archetype/quickstart_wicket_restful_jdo/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/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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_category.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_category.java b/example/archetype/quickstart_wicket_restful_jdo/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/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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_cost.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_cost.java b/example/archetype/quickstart_wicket_restful_jdo/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/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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_description.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_description.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_description.java
new file mode 100644
index 0000000..c60bf24
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_description.java
@@ -0,0 +1,94 @@
+#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("123456789012345678901234567890");
+ }
+
+ @Test
+ public void tooLong() throws Exception {
+
+ // when, then
+ expectedExceptions.expectMessage("The value proposed exceeds the maximum length of 30");
+ toDoItem.setDescription("1234567890123456789012345678901");
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_dueBy.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_dueBy.java b/example/archetype/quickstart_wicket_restful_jdo/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/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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_notes.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_notes.java b/example/archetype/quickstart_wicket_restful_jdo/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/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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_ownedBy.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_ownedBy.java b/example/archetype/quickstart_wicket_restful_jdo/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/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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_subcategory.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/props/ToDoItemTest_subcategory.java b/example/archetype/quickstart_wicket_restful_jdo/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/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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/repo/ToDoItemsTest_finders.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/repo/ToDoItemsTest_finders.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/repo/ToDoItemsTest_finders.java
new file mode 100644
index 0000000..a909609
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/repo/ToDoItemsTest_finders.java
@@ -0,0 +1,78 @@
+#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.repo;
+
+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.hamcrest.Matchers;
+import org.junit.Before;
+import org.junit.Test;
+
+public class ToDoItemsTest_finders extends ToDoIntegTest {
+
+ private int notYetCompletedSize;
+ private int completedSize;
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> notYetCompleteItems = wrap(service(ToDoItems.class)).notYetComplete();
+ final List<ToDoItem> completedItems = wrap(service(ToDoItems.class)).complete();
+
+ notYetCompletedSize = notYetCompleteItems.size();
+ completedSize = completedItems.size();
+
+ assertThat(notYetCompletedSize, is(Matchers.greaterThan(5)));
+ }
+
+ @Test
+ public void complete_and_notYetComplete() throws Exception {
+
+ // given
+ List<ToDoItem> notYetCompleteItems = wrap(service(ToDoItems.class)).notYetComplete();
+ final ToDoItem toDoItem = wrap(notYetCompleteItems.get(0));
+
+ // when
+ toDoItem.completed();
+
+ // then
+ assertThat(wrap(service(ToDoItems.class)).notYetComplete().size(), is(notYetCompletedSize-1));
+ assertThat(wrap(service(ToDoItems.class)).complete().size(), is(completedSize+1));
+
+ // and when
+ toDoItem.notYetCompleted();
+
+ // then
+ assertThat(wrap(service(ToDoItems.class)).notYetComplete().size(), is(notYetCompletedSize));
+ assertThat(wrap(service(ToDoItems.class)).complete().size(), is(completedSize));
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/repo/ToDoItemsTest_newToDo_and_delete.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/repo/ToDoItemsTest_newToDo_and_delete.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/repo/ToDoItemsTest_newToDo_and_delete.java
new file mode 100644
index 0000000..250b857
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/repo/ToDoItemsTest_newToDo_and_delete.java
@@ -0,0 +1,57 @@
+#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.repo;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import integration.tests.ToDoIntegTest;
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import dom.todo.ToDoItem.Category;
+import dom.todo.ToDoItem.Subcategory;
+
+import org.junit.Test;
+
+public class ToDoItemsTest_newToDo_and_delete extends ToDoIntegTest {
+
+ @Test
+ public void happyCase() throws Exception {
+
+ // given
+ int size = wrap(service(ToDoItems.class)).notYetComplete().size();
+
+ // when
+ final ToDoItem newToDo = wrap(service(ToDoItems.class)).newToDo("new todo", Category.Professional, Subcategory.OpenSource, null, null);
+
+ // then
+ assertThat(newToDo.getDescription(), is("new todo"));
+ assertThat(newToDo.getCategory(), is(Category.Professional));
+ assertThat(wrap(service(ToDoItems.class)).notYetComplete().size(), is(size+1));
+
+ // when
+ newToDo.delete();
+
+ // then
+ assertThat(wrap(service(ToDoItems.class)).notYetComplete().size(), is(size));
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/smoke/ToDoItemTest_title.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/smoke/ToDoItemTest_title.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/smoke/ToDoItemTest_title.java
new file mode 100644
index 0000000..65ed2f0
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integration/tests/smoke/ToDoItemTest_title.java
@@ -0,0 +1,112 @@
+#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.smoke;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.not;
+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.Before;
+import org.junit.Test;
+
+import org.apache.isis.applib.clock.Clock;
+
+public class ToDoItemTest_title extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+ private LocalDate dueBy;
+
+
+ @Before
+ public void setUp() throws Exception {
+
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> all = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(all.get(0));
+
+ dueBy = toDoItem.getDueBy();
+ }
+
+
+ @Test
+ public void includesDescription() throws Exception {
+
+ // given
+ assertThat(container().titleOf(toDoItem), containsString("Buy bread due by"));
+
+ // when
+ unwrap(toDoItem).setDescription("Buy bread and butter");
+
+ // then
+ assertThat(container().titleOf(toDoItem), containsString("Buy bread 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 bread - Completed!"));
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/AbstractIntegTest.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/AbstractIntegTest.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/AbstractIntegTest.java
deleted file mode 100644
index 2e032c6..0000000
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/AbstractIntegTest.java
+++ /dev/null
@@ -1,163 +0,0 @@
-#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 integtests;
-
-import dom.todo.ToDoItems;
-import fixture.todo.ToDoItemsFixture;
-import objstore.jdo.todo.ToDoItemsJdo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-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;
-
-import org.apache.isis.applib.DomainObjectContainer;
-import org.apache.isis.applib.services.wrapper.WrapperFactory;
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.commons.config.IsisConfigurationDefault;
-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;
-import org.apache.isis.objectstore.jdo.service.RegisterEntities;
-
-public abstract class AbstractIntegTest {
-
- protected ToDoItems toDoItems;
- protected WrapperFactory wrapperFactory;
- protected DomainObjectContainer container;
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- @Rule
- public IsisSystemForTestRule bootstrapIsis = new IsisSystemForTestRule();
-
- @Rule
- public ExpectedException expectedExceptions = ExpectedException.none();
-
- /**
- * Same running system returned for all tests, set up with {@link ToDoItemsFixture}.
- *
- * <p>
- * The database is NOT reset between tests.
- */
- public IsisSystemForTest getIsft() {
- return bootstrapIsis.getIsisSystemForTest();
- }
-
- @Before
- public void init() {
- toDoItems = getIsft().getService(ToDoItemsJdo.class);
- wrapperFactory = getIsft().getService(WrapperFactoryDefault.class);
- container = getIsft().container;
- }
-
- protected <T> T wrap(T obj) {
- return wrapperFactory.wrap(obj);
- }
-
- protected <T> T unwrap(T obj) {
- return wrapperFactory.unwrap(obj);
- }
-
-
- ////////////////////////////////////////////////////////////////
- // Boilerplate
- ////////////////////////////////////////////////////////////////
-
- @BeforeClass
- public static void initClass() {
- PropertyConfigurator.configure("logging.properties");
- }
-
- private static class ToDoIntegTestBuilder extends IsisSystemForTest.Builder {
-
- public ToDoIntegTestBuilder() {
- withFixtures(new ToDoItemsFixture());
- withLoggingAt(Level.INFO);
- with(testConfiguration());
- with(new DataNucleusPersistenceMechanismInstaller());
-
- withServices(
- new ToDoItemsJdo(),
- new WrapperFactoryDefault(),
- new RegisterEntities()
- );
- }
-
- private IsisConfiguration testConfiguration() {
- final IsisConfigurationDefault testConfiguration = new IsisConfigurationDefault();
-
- testConfiguration.add("isis.persistor.datanucleus.RegisterEntities.packagePrefix", "dom");
- testConfiguration.add("isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL", "jdbc:hsqldb:mem:test");
-
- testConfiguration.add("isis.persistor.datanucleus.impl.datanucleus.defaultInheritanceStrategy", "TABLE_PER_CLASS");
- testConfiguration.add(DataNucleusObjectStore.INSTALL_FIXTURES_KEY , "true");
-
- testConfiguration.add("isis.persistor.datanucleus.impl.datanucleus.cache.level2.type","none");
-
- return testConfiguration;
- }
- }
-
- private static class IsisSystemForTestRule implements MethodRule {
- private static ThreadLocal<IsisSystemForTest> ISFT = new ThreadLocal<IsisSystemForTest>() {
- @Override
- protected IsisSystemForTest initialValue() {
- return new ToDoIntegTestBuilder().build().setUpSystem();
- };
- };
-
- public IsisSystemForTest getIsisSystemForTest() {
- // reuse same system for all calls.
- return ISFT.get();
- }
-
- @Override
- public Statement apply(final Statement base, final FrameworkMethod method, final Object target) {
- final IsisSystemForTest isft = getIsisSystemForTest(); // creates and starts running if required
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- isft.beginTran();
- base.evaluate();
- // if an exception is thrown by any test, then we don't attempt to cleanup (eg by calling bounceSystem)${symbol_pound}
- // because - in any case - we only ever install the fixtures once for ALL of the tests.
- // therefore, just fix the first test that fails and don't worry about any other test failures beyond that
- // (fix them up one by one)
- isft.commitTran();
- }
- };
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/ToDoItem_title.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/ToDoItem_title.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/ToDoItem_title.java
deleted file mode 100644
index 7f00d4f..0000000
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/ToDoItem_title.java
+++ /dev/null
@@ -1,119 +0,0 @@
-#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 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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_completed.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_completed.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_completed.java
deleted file mode 100644
index f96c0c0..0000000
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_completed.java
+++ /dev/null
@@ -1,93 +0,0 @@
-#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 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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_duplicate.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_duplicate.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_duplicate.java
deleted file mode 100644
index 4149ccd..0000000
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_duplicate.java
+++ /dev/null
@@ -1,81 +0,0 @@
-#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 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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_notYetCompleted.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_notYetCompleted.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_notYetCompleted.java
deleted file mode 100644
index 723627c..0000000
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_notYetCompleted.java
+++ /dev/null
@@ -1,83 +0,0 @@
-#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 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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_add.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_add.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_add.java
deleted file mode 100644
index 47b584e..0000000
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_add.java
+++ /dev/null
@@ -1,93 +0,0 @@
-#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 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/c742898c/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_remove.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_remove.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_remove.java
deleted file mode 100644
index c671258..0000000
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_remove.java
+++ /dev/null
@@ -1,96 +0,0 @@
-#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 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