You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/05/27 08:51:27 UTC
[25/27] git commit: ISIS-406: recreating qrj archetype prior to
release.
ISIS-406: recreating qrj archetype prior to release.
* also fix to updateGeneratedArchetypeSources.groovy to fix pragma editing issue
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/4a86f070
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/4a86f070
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/4a86f070
Branch: refs/heads/prepare/isis-1.2.0
Commit: 4a86f0704c65df412de6ddcbf76d6989feca8b9f
Parents: 923e243
Author: Dan Haywood <da...@apache.org>
Authored: Mon May 27 07:26:53 2013 +0100
Committer: Dan Haywood <da...@apache.org>
Committed: Mon May 27 07:26:53 2013 +0100
----------------------------------------------------------------------
.../integtests/pom.xml | 17 +
..._restful_jdo-viewer-webapp-with-fixtures.launch | 19 -
...ckstart_wicket_restful_jdo-viewer-webapp.launch | 18 -
.../quickstart_wicket_restful_jdo/pom.xml | 6 +-
.../META-INF/maven/archetype-metadata.xml | 30 ++-
.../main/resources/archetype-resources/dom/pom.xml | 20 +-
.../dom/src/main/java/dom/audit/AuditEntry.java | 136 -------
.../src/main/java/dom/audit/AuditServiceDemo.java | 48 ---
.../dom/src/main/java/dom/todo/ToDoItem.java | 202 +++++++---
.../dom/todo/ToDoItemChangedPayloadFactory.java | 46 +++
.../dom/src/main/java/dom/todo/ToDoItems.java | 72 +++-
.../archetype-resources/fixture/.gitignore | 1 +
.../main/java/fixture/todo/ToDoItemsFixture.java | 30 +-
.../integtests/logging.properties | 80 ++++
.../archetype-resources/integtests/pom.xml | 83 ++++
.../test/java/integtests/AbstractIntegTest.java | 161 ++++++++
.../src/test/java/integtests/ToDoItem_title.java | 119 ++++++
.../integtests/actions/ToDoItem_completed.java | 93 +++++
.../integtests/actions/ToDoItem_duplicate.java | 81 ++++
.../actions/ToDoItem_notYetCompleted.java | 83 ++++
.../colls/ToDoItem_dependencies_add.java | 93 +++++
.../colls/ToDoItem_dependencies_remove.java | 96 +++++
.../java/integtests/props/ToDoItem_attachment.java | 86 ++++
.../java/integtests/props/ToDoItem_category.java | 86 ++++
.../test/java/integtests/props/ToDoItem_cost.java | 100 +++++
.../integtests/props/ToDoItem_description.java | 87 +++++
.../test/java/integtests/props/ToDoItem_dueBy.java | 105 +++++
.../test/java/integtests/props/ToDoItem_notes.java | 81 ++++
.../java/integtests/props/ToDoItem_ownedBy.java | 53 +++
.../java/integtests/repo/ToDoItems_finders.java | 80 ++++
.../repo/ToDoItems_newToDo_and_delete.java | 55 +++
.../archetype-resources/objstore-jdo/.gitignore | 2 +
.../archetype-resources/objstore-jdo/pom.xml | 2 +-
.../main/java/objstore/jdo/todo/ToDoItemsJdo.java | 5 +-
.../src/main/resources/archetype-resources/pom.xml | 68 +++-
...ckstart_wicket_restful_jdo-viewer-webapp.launch | 22 -
.../viewer-webapp/lib/.gitignore | 5 -
.../archetype-resources/viewer-webapp/pom.xml | 179 ---------
.../ComponentFactoryRegistrarForQuickStart.java | 36 --
.../src/main/java/app/QuickStartApplication.java | 91 -----
.../src/main/jettyconsole/isis-banner.pdn | Bin 69658 -> 0 bytes
.../src/main/jettyconsole/isis-banner.png | Bin 30776 -> 0 bytes
.../src/main/resources/app/welcome.html | 31 --
.../webapp/WEB-INF/authentication_file.passwords | 28 --
.../webapp/WEB-INF/authentication_file.properties | 28 --
.../main/webapp/WEB-INF/authorization_file.allow | 28 --
.../webapp/WEB-INF/authorization_file.properties | 50 ---
.../src/main/webapp/WEB-INF/isis.properties | 183 ---------
.../src/main/webapp/WEB-INF/logging.properties | 93 -----
.../WEB-INF/persistor_datanucleus.properties | 114 ------
.../src/main/webapp/WEB-INF/shiro.ini | 93 -----
.../viewer-webapp/src/main/webapp/WEB-INF/web.xml | 251 ------------
.../src/main/webapp/about/images/isis-logo.png | Bin 14160 -> 0 bytes
.../viewer-webapp/src/main/webapp/about/index.html | 194 ----------
.../src/main/webapp/css/application.css | 32 --
.../src/main/webapp/scripts/application.js | 3 -
..._wicket_restful_jdo-webapp-with-fixtures.launch | 22 +
.../quickstart_wicket_restful_jdo-webapp.launch | 21 +
.../archetype-resources/webapp/lib/.gitignore | 5 +
.../resources/archetype-resources/webapp/pom.xml | 301 +++++++++++++++
.../ComponentFactoryRegistrarForQuickStart.java | 36 ++
.../src/main/java/app/QuickStartApplication.java | 106 +++++
.../webapp/src/main/jettyconsole/isis-banner.pdn | Bin 0 -> 69658 bytes
.../webapp/src/main/jettyconsole/isis-banner.png | Bin 0 -> 30776 bytes
.../webapp/src/main/resources/app/welcome.html | 31 ++
.../webapp/WEB-INF/authentication_file.passwords | 28 ++
.../webapp/WEB-INF/authentication_file.properties | 28 ++
.../main/webapp/WEB-INF/authorization_file.allow | 28 ++
.../webapp/WEB-INF/authorization_file.properties | 50 +++
.../webapp/src/main/webapp/WEB-INF/isis.properties | 205 ++++++++++
.../src/main/webapp/WEB-INF/logging.properties | 96 +++++
.../WEB-INF/persistor_datanucleus.properties | 132 +++++++
.../webapp/src/main/webapp/WEB-INF/shiro.ini | 93 +++++
.../WEB-INF/viewer_restfulobjects.properties | 26 ++
.../main/webapp/WEB-INF/viewer_wicket.properties | 42 ++
.../webapp/src/main/webapp/WEB-INF/web.xml | 290 ++++++++++++++
.../src/main/webapp/about/images/isis-logo.png | Bin 0 -> 14160 bytes
.../webapp/src/main/webapp/about/index.html | 187 +++++++++
.../webapp/src/main/webapp/css/application.css | 32 ++
.../webapp/src/main/webapp/scripts/application.js | 3 +
.../resources/projects/basic/archetype.properties | 2 +-
scripts/updateGeneratedArchetypeSources.groovy | 6 +-
82 files changed, 3750 insertions(+), 1825 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/application/quickstart_wicket_restful_jdo/integtests/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/pom.xml b/example/application/quickstart_wicket_restful_jdo/integtests/pom.xml
index 27a0e5d..0d6da73 100644
--- a/example/application/quickstart_wicket_restful_jdo/integtests/pom.xml
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/pom.xml
@@ -29,6 +29,23 @@
<artifactId>quickstart_wicket_restful_jdo-integtests</artifactId>
<name>Quickstart Wicket/Restful/JDO Integration Tests</name>
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Abstract*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
<dependencies>
<!-- other modules in this project -->
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/application/quickstart_wicket_restful_jdo/viewer-webapp/ide/eclipse/launch/quickstart_wicket_restful_jdo-viewer-webapp-with-fixtures.launch
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/viewer-webapp/ide/eclipse/launch/quickstart_wicket_restful_jdo-viewer-webapp-with-fixtures.launch b/example/application/quickstart_wicket_restful_jdo/viewer-webapp/ide/eclipse/launch/quickstart_wicket_restful_jdo-viewer-webapp-with-fixtures.launch
deleted file mode 100644
index ae21574..0000000
--- a/example/application/quickstart_wicket_restful_jdo/viewer-webapp/ide/eclipse/launch/quickstart_wicket_restful_jdo-viewer-webapp-with-fixtures.launch
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.apache.isis.runtimes.dflt.webserver/src/main/java/org/apache/isis/WebServer.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
-<mapEntry key="[debug]" value="org.eclipse.jdt.launching.localJavaApplication"/>
-<mapEntry key="[run]" value="org.eclipse.jdt.launching.localJavaApplication"/>
-</mapAttribute>
-<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
-<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.isis.WebServer"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--port 8080 -D isis.persistor.datanucleus.install-fixtures=true -t SERVER_EXPLORATION"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="quickstart_wicket_restful_jdo-viewer-webapp"/>
-</launchConfiguration>
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/application/quickstart_wicket_restful_jdo/viewer-webapp/ide/eclipse/launch/quickstart_wicket_restful_jdo-viewer-webapp.launch
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/viewer-webapp/ide/eclipse/launch/quickstart_wicket_restful_jdo-viewer-webapp.launch b/example/application/quickstart_wicket_restful_jdo/viewer-webapp/ide/eclipse/launch/quickstart_wicket_restful_jdo-viewer-webapp.launch
deleted file mode 100644
index 15b6fbb..0000000
--- a/example/application/quickstart_wicket_restful_jdo/viewer-webapp/ide/eclipse/launch/quickstart_wicket_restful_jdo-viewer-webapp.launch
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.apache.isis.runtimes.dflt.webserver/src/main/java/org/apache/isis/WebServer.java"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="1"/>
-</listAttribute>
-<mapAttribute key="org.eclipse.debug.core.preferred_launchers">
-<mapEntry key="[debug]" value="org.eclipse.jdt.launching.localJavaApplication"/>
-<mapEntry key="[run]" value="org.eclipse.jdt.launching.localJavaApplication"/>
-</mapAttribute>
-<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
-<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.isis.WebServer"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="quickstart_wicket_restful_jdo-viewer-webapp"/>
-</launchConfiguration>
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/pom.xml b/example/archetype/quickstart_wicket_restful_jdo/pom.xml
index 41a94cf..d4866ef 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/pom.xml
+++ b/example/archetype/quickstart_wicket_restful_jdo/pom.xml
@@ -17,7 +17,7 @@
specific language governing permissions and limitations
under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.isis.archetype</groupId>
<artifactId>quickstart_wicket_restful_jdo-archetype</artifactId>
@@ -44,7 +44,7 @@
<parent>
<groupId>org.apache.isis.core</groupId>
<artifactId>isis</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- <relativePath>../../../core/pom.xml</relativePath>
+ <version>1.2.0</version>
+ <relativePath>../../../core/pom.xm</relativePath>
</parent>
</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/META-INF/maven/archetype-metadata.xml
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/META-INF/maven/archetype-metadata.xml b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/META-INF/maven/archetype-metadata.xml
index 8c7709e..3dc69b7 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -51,6 +51,12 @@
<include>**/*.java</include>
</includes>
</fileSet>
+ <fileSet encoding="UTF-8">
+ <directory/>
+ <includes>
+ <include>.gitignore</include>
+ </includes>
+ </fileSet>
</fileSets>
</module>
<module id="${rootArtifactId}-objstore-jdo" dir="objstore-jdo" name="${rootArtifactId}-objstore-jdo">
@@ -67,9 +73,31 @@
<include>**/*.gitignore</include>
</includes>
</fileSet>
+ <fileSet encoding="UTF-8">
+ <directory/>
+ <includes>
+ <include>.gitignore</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ </module>
+ <module id="${rootArtifactId}-integtests" dir="integtests" name="${rootArtifactId}-integtests">
+ <fileSets>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory>src/test/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </fileSet>
+ <fileSet filtered="true" encoding="UTF-8">
+ <directory/>
+ <includes>
+ <include>logging.properties</include>
+ </includes>
+ </fileSet>
</fileSets>
</module>
- <module id="${rootArtifactId}-viewer-webapp" dir="viewer-webapp" name="${rootArtifactId}-viewer-webapp">
+ <module id="${rootArtifactId}-webapp" dir="webapp" name="${rootArtifactId}-webapp">
<fileSets>
<fileSet filtered="true" encoding="UTF-8">
<directory>src/main/java</directory>
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/pom.xml b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/pom.xml
index 5f55223..34893cf 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/pom.xml
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/pom.xml
@@ -32,8 +32,8 @@
<plugins>
<plugin>
<groupId>org.datanucleus</groupId>
- <artifactId>maven-datanucleus-plugin</artifactId>
- <version>3.1.1</version>
+ <artifactId>datanucleus-maven-plugin</artifactId>
+ <version>3.2.0-release</version>
<configuration>
<fork>false</fork>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
@@ -63,8 +63,8 @@
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.datanucleus</groupId>
- <artifactId>maven-datanucleus-plugin</artifactId>
- <versionRange>[3.0.2,)</versionRange>
+ <artifactId>datanucleus-maven-plugin</artifactId>
+ <versionRange>[3.2.0-release,)</versionRange>
<goals>
<goal>enhance</goal>
</goals>
@@ -104,10 +104,6 @@
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-enhancer</artifactId>
- </dependency>
- <dependency>
- <groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
</dependency>
@@ -133,13 +129,7 @@
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
- <version>(3.0.99, 3.1.99)</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.datanucleus</groupId>
- <artifactId>datanucleus-enhancer</artifactId>
- <version>(3.0.99, 3.1.99)</version>
+ <version>(3.1.99, 3.2.99)</version>
<scope>runtime</scope>
</dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/audit/AuditEntry.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/audit/AuditEntry.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/audit/AuditEntry.java
deleted file mode 100644
index adbf559..0000000
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/audit/AuditEntry.java
+++ /dev/null
@@ -1,136 +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 dom.audit;
-
-import javax.jdo.annotations.IdGeneratorStrategy;
-import javax.jdo.annotations.IdentityType;
-
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.Immutable;
-import org.apache.isis.applib.annotation.MemberOrder;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.annotation.Title;
-import org.apache.isis.applib.bookmarks.Bookmark;
-import org.apache.isis.applib.bookmarks.BookmarkHolder;
-import org.apache.isis.applib.value.DateTime;
-
-@javax.jdo.annotations.PersistenceCapable(identityType=IdentityType.DATASTORE)
-@javax.jdo.annotations.DatastoreIdentity(strategy=IdGeneratorStrategy.UUIDHEX)
-@Immutable
-public class AuditEntry implements BookmarkHolder {
-
- // {{ TimestampUtc (property)
- private Long timestampEpoch;
-
- @Hidden
- public Long getTimestampEpoch() {
- return timestampEpoch;
- }
-
- public void setTimestampEpoch(final Long timestampEpoch) {
- this.timestampEpoch = timestampEpoch;
- }
- // }}
-
- // {{ Timestamp (property)
- @Title(sequence="1")
- @MemberOrder(sequence = "1")
- public DateTime getTimestamp() {
- return timestampEpoch != null? new DateTime(timestampEpoch): null;
- }
-
- // }}
-
- // {{ User (property)
- private String user;
-
- @MemberOrder(sequence = "2")
- public String getUser() {
- return user;
- }
-
- public void setUser(final String user) {
- this.user = user;
- }
- // }}
-
- // {{ ObjectType (property)
- private String objectType;
-
- @Title(sequence="3", prepend=":")
- @MemberOrder(sequence = "3")
- public String getObjectType() {
- return objectType;
- }
-
- public void setObjectType(final String objectType) {
- this.objectType = objectType;
- }
- // }}
-
- // {{ Identifier (property)
- private String identifier;
-
- @MemberOrder(sequence = "4")
- public String getIdentifier() {
- return identifier;
- }
-
- public void setIdentifier(final String identifier) {
- this.identifier = identifier;
- }
- // }}
-
- // {{ PreValue (property)
- private String preValue;
-
- @MemberOrder(sequence = "5")
- public String getPreValue() {
- return preValue;
- }
-
- public void setPreValue(final String preValue) {
- this.preValue = preValue;
- }
- // }}
-
- // {{ PostValue (property)
- private String postValue;
-
- @MemberOrder(sequence = "6")
- public String getPostValue() {
- return postValue;
- }
-
- public void setPostValue(final String postValue) {
- this.postValue = postValue;
- }
- // }}
-
- // {{ bookmark (action)
- @Override
- @Programmatic
- public Bookmark bookmark() {
- return new Bookmark(getObjectType(), getIdentifier());
- }
- // }}
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/audit/AuditServiceDemo.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/audit/AuditServiceDemo.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/audit/AuditServiceDemo.java
deleted file mode 100644
index 691e955..0000000
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/audit/AuditServiceDemo.java
+++ /dev/null
@@ -1,48 +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 dom.audit;
-
-import java.util.List;
-
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.objectstore.jdo.applib.AuditService;
-
-public class AuditServiceDemo extends AbstractFactoryAndRepository implements AuditService {
-
- public List<AuditEntry> list() {
- return allInstances(AuditEntry.class);
- }
-
- @Hidden
- public void audit(String user, long currentTimestampEpoch, String objectType, String identifier, String preValue, String postValue) {
- AuditEntry auditEntry = newTransientInstance(AuditEntry.class);
- auditEntry.setTimestampEpoch(currentTimestampEpoch);
- auditEntry.setUser(user);
- auditEntry.setObjectType(objectType);
- auditEntry.setIdentifier(identifier);
- auditEntry.setPreValue(preValue);
- auditEntry.setPostValue(postValue);
- persist(auditEntry);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
index 8ae05a2..b854ae2 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItem.java
@@ -21,20 +21,26 @@
*/
package dom.todo;
+import java.math.BigDecimal;
import java.util.List;
import java.util.SortedSet;
import java.util.TreeSet;
import javax.jdo.JDOHelper;
-import javax.jdo.annotations.Element;
+import javax.jdo.annotations.Column;
import javax.jdo.annotations.IdentityType;
-import javax.jdo.annotations.Join;
-import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.VersionStrategy;
import javax.jdo.spi.PersistenceCapable;
+import com.google.common.base.Objects;
+import com.google.common.collect.Lists;
+
+import org.joda.time.LocalDate;
+
import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.annotation.Audited;
import org.apache.isis.applib.annotation.AutoComplete;
+import org.apache.isis.applib.annotation.Bookmarkable;
import org.apache.isis.applib.annotation.Bulk;
import org.apache.isis.applib.annotation.Disabled;
import org.apache.isis.applib.annotation.Hidden;
@@ -46,20 +52,17 @@ import org.apache.isis.applib.annotation.NotPersisted;
import org.apache.isis.applib.annotation.ObjectType;
import org.apache.isis.applib.annotation.Optional;
import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.annotation.PublishedAction;
+import org.apache.isis.applib.annotation.PublishedObject;
import org.apache.isis.applib.annotation.RegEx;
-import org.apache.isis.applib.annotation.Resolve;
-import org.apache.isis.applib.annotation.Resolve.Type;
+import org.apache.isis.applib.annotation.Render;
+import org.apache.isis.applib.annotation.Render.Type;
import org.apache.isis.applib.annotation.Where;
import org.apache.isis.applib.clock.Clock;
import org.apache.isis.applib.filter.Filter;
import org.apache.isis.applib.filter.Filters;
import org.apache.isis.applib.util.TitleBuffer;
import org.apache.isis.applib.value.Blob;
-import org.apache.isis.core.objectstore.jdo.applib.annotations.Auditable;
-import org.joda.time.LocalDate;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Lists;
@javax.jdo.annotations.PersistenceCapable(identityType=IdentityType.DATASTORE)
@javax.jdo.annotations.DatastoreIdentity(strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY)
@@ -78,13 +81,16 @@ import com.google.common.collect.Lists;
value="SELECT FROM dom.todo.ToDoItem WHERE ownedBy == :ownedBy && category == :category"),
@javax.jdo.annotations.Query(
name="todo_autoComplete", language="JDOQL",
- value="SELECT FROM dom.todo.ToDoItem WHERE ownedBy == :ownedBy && description.startsWith(:description)")
+ value="SELECT FROM dom.todo.ToDoItem WHERE ownedBy == :ownedBy && description.indexOf(:description) >= 0")
})
@javax.jdo.annotations.Version(strategy=VersionStrategy.VERSION_NUMBER, column="VERSION")
+@javax.jdo.annotations.Unique(name="ToDoItem_description_must_be_unique", members={"ownedBy","description"})
@ObjectType("TODO")
-@Auditable
+@Audited
+@PublishedObject(ToDoItemChangedPayloadFactory.class)
@AutoComplete(repository=ToDoItems.class, action="autoComplete")
@MemberGroups({"General", "Detail"})
+@Bookmarkable
public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3: uncomment to use https://github.com/danhaywood/isis-wicket-gmap3
private static final long ONE_WEEK_IN_MILLIS = 7 * 24 * 60 * 60 * 1000L;
@@ -98,17 +104,17 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
final TitleBuffer buf = new TitleBuffer();
buf.append(getDescription());
if (isComplete()) {
- buf.append(" - Completed!");
+ buf.append("- Completed!");
} else {
if (getDueBy() != null) {
- buf.append(" due by ", getDueBy());
+ buf.append(" due by", getDueBy());
}
}
return buf.toString();
}
-
// }}
+
// {{ Description
private String description;
@@ -124,10 +130,11 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
}
// }}
+
// {{ DueBy (property)
+ @javax.jdo.annotations.Persistent(defaultFetchGroup="true")
private LocalDate dueBy;
- @javax.jdo.annotations.Persistent
@MemberOrder(name="Detail", sequence = "3")
@Optional
public LocalDate getDueBy() {
@@ -149,6 +156,7 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
}
// }}
+
// {{ Category
private Category category;
@@ -162,6 +170,7 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
}
// }}
+
// {{ OwnedBy (property)
private String ownedBy;
@@ -177,7 +186,7 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// }}
- // {{ Complete (property)
+ // {{ Complete (property), Done (action), Undo (action)
private boolean complete;
@Disabled
@@ -191,6 +200,62 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
this.complete = complete;
}
+
+ @Named("Done")
+ @PublishedAction
+ @Bulk
+ @MemberOrder(name="complete", sequence = "1")
+ public ToDoItem completed() {
+ setComplete(true);
+ return this;
+ }
+ // disable action dependent on state of object
+ public String disableCompleted() {
+ return complete ? "Already completed" : null;
+ }
+
+
+ @Named("Undo")
+ @PublishedAction
+ @MemberOrder(name="complete", sequence = "2")
+ public ToDoItem notYetCompleted() {
+ setComplete(false);
+ return this;
+ }
+ // disable action dependent on state of object
+ public String disableNotYetCompleted() {
+ return !complete ? "Not yet completed" : null;
+ }
+ // }}
+
+
+ // {{ Cost (property), updateCost (action)
+ private BigDecimal cost;
+
+ @Column(scale = 2)
+ @Optional
+ @MemberOrder(sequence = "4.1")
+ public BigDecimal getCost() {
+ return cost;
+ }
+
+ public void setCost(final BigDecimal cost) {
+ this.cost = cost;
+ }
+
+ @Named("Update")
+ @MemberOrder(name="cost", sequence = "1")
+ public ToDoItem updateCost(@Named("New cost") final BigDecimal cost) {
+ setCost(cost);
+ return this;
+ }
+ // provide a default value
+ public BigDecimal default0UpdateCost() {
+ return getCost();
+ }
+ // }}
+
+
// {{ Notes (property)
private String notes;
@@ -207,14 +272,14 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
}
// }}
-
// {{ Attachment (property)
private Blob attachment;
- @Persistent
+ @javax.jdo.annotations.Persistent(defaultFetchGroup="false")
@Optional
@MemberOrder(name="Detail", sequence = "7")
+ @Hidden(where=Where.STANDALONE_TABLES)
public Blob getAttachment() {
return attachment;
}
@@ -240,51 +305,22 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
final Long version = (Long) JDOHelper.getVersion(persistenceCapable);
return version;
}
+ // hide property (imperatively, based on state of object)
public boolean hideVersionSequence() {
return !(this instanceof PersistenceCapable);
}
// }}
- // {{ completed (action)
- @Bulk
- @MemberOrder(sequence = "1")
- public ToDoItem completed() {
- setComplete(true);
- return this;
- }
-
- // disable action dependent on state of object
- public String disableCompleted() {
- return complete ? "Already completed" : null;
- }
- // }}
-
- // {{ notYetCompleted (action)
- @MemberOrder(sequence = "2")
- public ToDoItem notYetCompleted() {
- setComplete(false);
- return this;
- }
-
-
- // disable action dependent on state of object
- public String disableNotYetCompleted() {
- return !complete ? "Not yet completed" : null;
- }
- // }}
-
-
-
// {{ dependencies (Collection)
- @Persistent(table="TODO_DEPENDENCIES")
- @Join(column="DEPENDING_TODO_ID")
- @Element(column="DEPENDENT_TODO_ID")
+ @javax.jdo.annotations.Persistent(table="TODO_DEPENDENCIES")
+ @javax.jdo.annotations.Join(column="DEPENDING_TODO_ID")
+ @javax.jdo.annotations.Element(column="DEPENDENT_TODO_ID")
private SortedSet<ToDoItem> dependencies = new TreeSet<ToDoItem>();
@Disabled
@MemberOrder(sequence = "1")
- @Resolve(Type.EAGERLY)
+ @Render(Type.EAGERLY)
public SortedSet<ToDoItem> getDependencies() {
return dependencies;
}
@@ -295,11 +331,19 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// }}
// {{ add (action)
+ @PublishedAction
@MemberOrder(name="dependencies", sequence = "3")
public ToDoItem add(final ToDoItem toDoItem) {
getDependencies().add(toDoItem);
return this;
}
+ public String disableAdd(final ToDoItem toDoItem) {
+ if(isComplete()) {
+ return "Cannot add dependencies for items that are complete";
+ }
+ return null;
+ }
+ // validate the provided argument prior to invoking action
public String validateAdd(final ToDoItem toDoItem) {
if(getDependencies().contains(toDoItem)) {
return "Already a dependency";
@@ -317,15 +361,21 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
getDependencies().remove(toDoItem);
return this;
}
+ // disable action dependent on state of object
public String disableRemove(final ToDoItem toDoItem) {
+ if(isComplete()) {
+ return "Cannot remove dependencies for items that are complete";
+ }
return getDependencies().isEmpty()? "No dependencies to remove": null;
}
+ // validate the provided argument prior to invoking action
public String validateRemove(final ToDoItem toDoItem) {
if(!getDependencies().contains(toDoItem)) {
return "Not a dependency";
}
return null;
}
+ // provide a drop-down
public List<ToDoItem> choices0Remove() {
return Lists.newArrayList(getDependencies());
}
@@ -346,8 +396,11 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
ToDoItem.Category category,
@Named("Due by")
@Optional
- LocalDate dueBy) {
- return toDoItems.newToDo(description, category, dueBy);
+ LocalDate dueBy,
+ @Named("Cost")
+ @Optional
+ BigDecimal cost) {
+ return toDoItems.newToDo(description, category, dueBy, cost);
}
public String default0Duplicate() {
return getDescription() + " - Copy";
@@ -360,9 +413,21 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
}
// }}
+
+ // {{ delete (action)
+ @Bulk
+ @MemberOrder(sequence = "4")
+ public List<ToDoItem> delete() {
+ container.removeIfNotAlready(this);
+ container.informUser("Deleted " + container.titleOf(this));
+ // invalid to return 'this' (cannot render a deleted object)
+ return toDoItems.notYetComplete();
+ }
+ // }}
+
+
// {{ isDue (programmatic)
- @Programmatic
- // excluded from the framework's metamodel
+ @Programmatic // excluded from the framework's metamodel
public boolean isDue() {
if (getDueBy() == null) {
return false;
@@ -376,7 +441,7 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// {{ SimilarItems (derived collection)
@MemberOrder(sequence = "5")
@NotPersisted
- @Resolve(Type.LAZILY)
+ @Render(Type.LAZILY)
public List<ToDoItem> getSimilarItems() {
return toDoItems.similarTo(this);
}
@@ -387,9 +452,11 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// {{ compareTo (programmatic)
/**
- * by complete flag, then due by date, then description
+ * by complete flag, then due by date, then description.
+ *
+ * <p>
+ * Required because {@link ${symbol_pound}getDependencies()} is of type {@link SortedSet}.
*/
- // exclude from the framework's metamodel
@Override
public int compareTo(final ToDoItem other) {
if (isComplete() && !other.isComplete()) {
@@ -461,11 +528,12 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
}
// }}
+
+
// {{ injected: DomainObjectContainer
- @SuppressWarnings("unused")
private DomainObjectContainer container;
- public void setDomainObjectContainer(final DomainObjectContainer container) {
+ public void injectDomainObjectContainer(final DomainObjectContainer container) {
this.container = container;
}
// }}
@@ -473,7 +541,7 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// {{ injected: ToDoItems
private ToDoItems toDoItems;
- public void setToDoItems(final ToDoItems toDoItems) {
+ public void injectToDoItems(final ToDoItems toDoItems) {
this.toDoItems = toDoItems;
}
// }}
@@ -493,4 +561,12 @@ public class ToDoItem implements Comparable<ToDoItem> /*, Locatable*/ { // GMAP3
// }
// // }}
+
+
+ public ToDoItem updateDueBy(
+ //@RenderedAdjusted
+ LocalDate dueBy) {
+ setDueBy(dueBy);
+ return this;
+ }
}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemChangedPayloadFactory.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemChangedPayloadFactory.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemChangedPayloadFactory.java
new file mode 100644
index 0000000..f3bd7b1
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItemChangedPayloadFactory.java
@@ -0,0 +1,46 @@
+#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 dom.todo;
+
+import org.apache.isis.applib.annotation.PublishedObject.ChangeKind;
+import org.apache.isis.applib.annotation.PublishedObject.PayloadFactory;
+import org.apache.isis.applib.services.publish.EventPayload;
+import org.apache.isis.applib.services.publish.EventPayloadForObjectChanged;
+
+public class ToDoItemChangedPayloadFactory implements PayloadFactory{
+
+ public static class ToDoItemPayload extends EventPayloadForObjectChanged<ToDoItem> {
+
+ public ToDoItemPayload(ToDoItem changed) {
+ super(changed);
+ }
+
+ public String getDescription() {
+ return getChanged().getDescription();
+ }
+ }
+ @Override
+ public EventPayload payloadFor(Object changedObject, ChangeKind changeKind) {
+ return new ToDoItemPayload((ToDoItem) changedObject);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
index 9a8b221..4ece800 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/dom/src/main/java/dom/todo/ToDoItems.java
@@ -21,9 +21,16 @@
*/
package dom.todo;
+import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
+import com.google.common.base.Objects;
+
+import dom.todo.ToDoItem.Category;
+
+import org.joda.time.LocalDate;
+
import org.apache.isis.applib.AbstractFactoryAndRepository;
import org.apache.isis.applib.annotation.ActionSemantics;
import org.apache.isis.applib.annotation.ActionSemantics.Of;
@@ -31,12 +38,11 @@ import org.apache.isis.applib.annotation.Hidden;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.Named;
import org.apache.isis.applib.annotation.NotInServiceMenu;
+import org.apache.isis.applib.annotation.Optional;
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.annotation.RegEx;
+import org.apache.isis.applib.clock.Clock;
import org.apache.isis.applib.filter.Filter;
-import org.joda.time.LocalDate;
-
-import com.google.common.base.Objects;
-
-import dom.todo.ToDoItem.Category;
@Named("ToDos")
public class ToDoItems extends AbstractFactoryAndRepository {
@@ -56,6 +62,14 @@ public class ToDoItems extends AbstractFactoryAndRepository {
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "1")
public List<ToDoItem> notYetComplete() {
+ List<ToDoItem> items = doNotYetComplete();
+ if(items.isEmpty()) {
+ getContainer().informUser("All to-do items have been completed :-)");
+ }
+ return items;
+ }
+
+ protected List<ToDoItem> doNotYetComplete() {
return allMatches(ToDoItem.class, new Filter<ToDoItem>() {
@Override
public boolean accept(final ToDoItem t) {
@@ -69,6 +83,14 @@ public class ToDoItems extends AbstractFactoryAndRepository {
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "2")
public List<ToDoItem> complete() {
+ List<ToDoItem> items = doComplete();
+ if(items.isEmpty()) {
+ getContainer().informUser("No to-do items have yet been completed :-(");
+ }
+ return items;
+ }
+
+ protected List<ToDoItem> doComplete() {
return allMatches(ToDoItem.class, new Filter<ToDoItem>() {
@Override
public boolean accept(final ToDoItem t) {
@@ -78,25 +100,43 @@ public class ToDoItems extends AbstractFactoryAndRepository {
}
// }}
+
// {{ newToDo (action)
@MemberOrder(sequence = "3")
public ToDoItem newToDo(
+ @RegEx(validation = "${symbol_escape}${symbol_escape}w[@&:${symbol_escape}${symbol_escape}-${symbol_escape}${symbol_escape},${symbol_escape}${symbol_escape}.${symbol_escape}${symbol_escape}+ ${symbol_escape}${symbol_escape}w]*") // words, spaces and selected punctuation
@Named("Description") String description,
@Named("Category") Category category,
- @Named("Due by") LocalDate dueBy) {
+ @Optional
+ @Named("Due by") LocalDate dueBy,
+ @Optional
+ @Named("Cost") BigDecimal cost) {
final String ownedBy = currentUserName();
- return newToDo(description, category, ownedBy, dueBy);
+ return newToDo(description, category, ownedBy, dueBy, cost);
+ }
+ public LocalDate default2NewToDo() {
+ return new LocalDate(Clock.getTime()).plusDays(14);
}
// }}
-
- // {{ AllToDos (action)
+
+ // {{ allToDos (action)
@ActionSemantics(Of.SAFE)
@MemberOrder(sequence = "4")
public List<ToDoItem> allToDos() {
+ return allToDos(NotifyUserIfNone.YES);
+ }
+
+ public enum NotifyUserIfNone { YES, NO }
+
+ @Programmatic
+ public List<ToDoItem> allToDos(NotifyUserIfNone notifyUser) {
final String currentUser = currentUserName();
final List<ToDoItem> items = allMatches(ToDoItem.class, ToDoItem.thoseOwnedBy(currentUser));
Collections.sort(items);
+ if(notifyUser == NotifyUserIfNone.YES && items.isEmpty()) {
+ getContainer().warnUser("No to-do items found.");
+ }
return items;
}
// }}
@@ -105,15 +145,17 @@ public class ToDoItems extends AbstractFactoryAndRepository {
// {{ newToDo (hidden)
@Hidden // for use by fixtures
public ToDoItem newToDo(
- String description,
- Category category,
- String userName,
- LocalDate dueBy) {
+ final String description,
+ final Category category,
+ final String userName,
+ final LocalDate dueBy,
+ final BigDecimal cost) {
final ToDoItem toDoItem = newTransientInstance(ToDoItem.class);
toDoItem.setDescription(description);
toDoItem.setCategory(category);
toDoItem.setOwnedBy(userName);
toDoItem.setDueBy(dueBy);
+ toDoItem.setCost(cost);
//
// GMAP3: uncomment to use https://github.com/danhaywood/isis-wicket-gmap3
@@ -146,7 +188,7 @@ public class ToDoItems extends AbstractFactoryAndRepository {
}
// }}
-
+
// {{ autoComplete (hidden)
@Hidden
public List<ToDoItem> autoComplete(final String description) {
@@ -169,5 +211,5 @@ public class ToDoItems extends AbstractFactoryAndRepository {
}
// }}
-
+
}
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/.gitignore
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/.gitignore b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/.gitignore
new file mode 100644
index 0000000..a48e45b
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/.gitignore
@@ -0,0 +1 @@
+/target-ide
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java
index 8df2049..4fd97db 100644
--- a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java
@@ -22,6 +22,7 @@
package fixture.todo;
+import java.math.BigDecimal;
import java.util.List;
import org.apache.isis.applib.clock.Clock;
@@ -31,6 +32,7 @@ import org.joda.time.LocalDate;
import dom.todo.ToDoItem;
import dom.todo.ToDoItem.Category;
import dom.todo.ToDoItems;
+import dom.todo.ToDoItems.NotifyUserIfNone;
public class ToDoItemsFixture extends AbstractFixture {
@@ -39,12 +41,8 @@ public class ToDoItemsFixture extends AbstractFixture {
removeAllToDosForCurrentUser();
- createToDoItemForCurrentUser("Buy milk", Category.Domestic, daysFromToday(0));
- createToDoItemForCurrentUser("Buy stamps", Category.Domestic, daysFromToday(0));
- createToDoItemForCurrentUser("Pick up laundry", Category.Other, daysFromToday(6));
- createToDoItemForCurrentUser("Write blog post", Category.Professional, null);
- createToDoItemForCurrentUser("Organize brown bag", Category.Professional, daysFromToday(14));
-
+ installFor(getContainer().getUser().getName());
+
getContainer().flush();
}
@@ -52,11 +50,11 @@ public class ToDoItemsFixture extends AbstractFixture {
removeAllToDosFor(user);
- createToDoItemForUser("Buy milk", Category.Domestic, user, daysFromToday(0));
- createToDoItemForUser("Buy stamps", Category.Domestic, user, daysFromToday(0));
- createToDoItemForUser("Pick up laundry", Category.Other, user, daysFromToday(6));
- createToDoItemForUser("Write blog post", Category.Professional, user, null);
- createToDoItemForUser("Organize brown bag", Category.Professional, user, daysFromToday(14));
+ createToDoItemForUser("Buy milk", Category.Domestic, user, daysFromToday(0), new BigDecimal("1.50"));
+ createToDoItemForUser("Buy stamps", Category.Domestic, user, daysFromToday(0), new BigDecimal("10.00"));
+ createToDoItemForUser("Pick up laundry", Category.Other, user, daysFromToday(6), new BigDecimal("7.50"));
+ createToDoItemForUser("Write blog post", Category.Professional, user, null, null);
+ createToDoItemForUser("Organize brown bag", Category.Professional, user, daysFromToday(14), null);
getContainer().flush();
}
@@ -64,7 +62,7 @@ public class ToDoItemsFixture extends AbstractFixture {
// {{ helpers
private void removeAllToDosForCurrentUser() {
- final List<ToDoItem> allToDos = toDoItems.allToDos();
+ final List<ToDoItem> allToDos = toDoItems.allToDos(NotifyUserIfNone.NO);
for (final ToDoItem toDoItem : allToDos) {
getContainer().remove(toDoItem);
}
@@ -77,12 +75,8 @@ public class ToDoItemsFixture extends AbstractFixture {
}
}
- private ToDoItem createToDoItemForCurrentUser(final String description, final Category category, final LocalDate dueBy) {
- return toDoItems.newToDo(description, category, dueBy);
- }
-
- private ToDoItem createToDoItemForUser(final String description, final Category category, String user, final LocalDate dueBy) {
- return toDoItems.newToDo(description, category, user, dueBy);
+ private ToDoItem createToDoItemForUser(final String description, final Category category, String user, final LocalDate dueBy, final BigDecimal cost) {
+ return toDoItems.newToDo(description, category, user, dueBy, cost);
}
private static LocalDate daysFromToday(final int i) {
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/logging.properties
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/logging.properties b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/logging.properties
new file mode 100644
index 0000000..aaa4c52
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/logging.properties
@@ -0,0 +1,80 @@
+#set( $symbol_pound = '#' )
+#set( $symbol_dollar = '$' )
+#set( $symbol_escape = '\' )
+${symbol_pound} Licensed to the Apache Software Foundation (ASF) under one
+${symbol_pound} or more contributor license agreements. See the NOTICE file
+${symbol_pound} distributed with this work for additional information
+${symbol_pound} regarding copyright ownership. The ASF licenses this file
+${symbol_pound} to you under the Apache License, Version 2.0 (the
+${symbol_pound} "License"); you may not use this file except in compliance
+${symbol_pound} with the License. You may obtain a copy of the License at
+${symbol_pound}
+${symbol_pound} http://www.apache.org/licenses/LICENSE-2.0
+${symbol_pound}
+${symbol_pound} Unless required by applicable law or agreed to in writing,
+${symbol_pound} software distributed under the License is distributed on an
+${symbol_pound} "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+${symbol_pound} KIND, either express or implied. See the License for the
+${symbol_pound} specific language governing permissions and limitations
+${symbol_pound} under the License.
+
+
+${symbol_pound}
+${symbol_pound} Isis uses log4j is used to provide system logging
+${symbol_pound}
+log4j.rootCategory=INFO, Console
+
+${symbol_pound} The console appender
+log4j.appender.Console=org.apache.log4j.ConsoleAppender
+log4j.appender.Console.target=System.out
+log4j.appender.Console.layout=org.apache.log4j.PatternLayout
+log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} [%-20c{1} %-10t %-5p] %m%n
+
+log4j.appender.File=org.apache.log4j.RollingFileAppender
+log4j.appender.File.file=isis.log
+log4j.appender.File.append=false
+log4j.appender.File.layout=org.apache.log4j.PatternLayout
+log4j.appender.File.layout.ConversionPattern=%d [%-20c{1} %-10t %-5p] %m%n
+
+! turn on the internal log4j debugging flag so we can see what it is doing
+${symbol_pound}log4j.debug=true
+
+${symbol_pound} DataNucleus
+log4j.logger.DataNucleus.Datastore.Native=DEBUG, Console
+
+log4j.logger.DataNucleus.Persistence=WARN, Console
+log4j.logger.DataNucleus.Transaction=WARN, Console
+log4j.logger.DataNucleus.Connection=WARN, Console
+log4j.logger.DataNucleus.Query=WARN, Console
+log4j.logger.DataNucleus.Cache=WARN, Console
+log4j.logger.DataNucleus.MetaData=WARN, Console
+log4j.logger.DataNucleus.Datastore=WARN, Console
+log4j.logger.DataNucleus.Datastore.Schema=WARN, Console
+log4j.logger.DataNucleus.Datastore.Persist=WARN, Console
+log4j.logger.DataNucleus.Datastore.Retrieve=WARN, Console
+log4j.logger.DataNucleus.General=WARN, Console
+log4j.logger.DataNucleus.Lifecycle=WARN, Console
+log4j.logger.DataNucleus.ValueGeneration=WARN, Console
+log4j.logger.DataNucleus.Enhancer=WARN, Console
+log4j.logger.DataNucleus.SchemaTool=ERROR, Console
+log4j.logger.DataNucleus.JDO=WARN, Console
+log4j.logger.DataNucleus.JPA=ERROR, Console
+log4j.logger.DataNucleus.JCA=WARN, Console
+log4j.logger.DataNucleus.IDE=ERROR, Console
+
+
+${symbol_pound} if using log4jdbc-remix as JDBC driver
+${symbol_pound}log4j.logger.jdbc.sqlonly=DEBUG, sql, Console
+${symbol_pound}log4j.additivity.jdbc.sqlonly=false
+${symbol_pound}log4j.logger.jdbc.resultsettable=DEBUG, jdbc, Console
+${symbol_pound}log4j.additivity.jdbc.resultsettable=false
+
+${symbol_pound}log4j.logger.jdbc.audit=WARN,jdbc, Console
+${symbol_pound}log4j.additivity.jdbc.audit=false
+${symbol_pound}log4j.logger.jdbc.resultset=WARN,jdbc
+${symbol_pound}log4j.additivity.jdbc.resultset=false
+${symbol_pound}log4j.logger.jdbc.sqltiming=WARN,sqltiming
+${symbol_pound}log4j.additivity.jdbc.sqltiming=false
+${symbol_pound}log4j.logger.jdbc.connection=FATAL,connection
+${symbol_pound}log4j.additivity.jdbc.connection=false
+
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/pom.xml
----------------------------------------------------------------------
diff --git a/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/pom.xml b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/pom.xml
new file mode 100644
index 0000000..b7a8d8d
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>${groupId}</groupId>
+ <artifactId>${rootArtifactId}</artifactId>
+ <version>${version}</version>
+ </parent>
+
+ <artifactId>${artifactId}</artifactId>
+ <name>Quickstart Wicket/Restful/JDO Integration Tests</name>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Abstract*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+ <dependencies>
+
+ <!-- other modules in this project -->
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${rootArtifactId}-fixture</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${rootArtifactId}-objstore-jdo</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-unittestsupport</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-integtestsupport</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.core</groupId>
+ <artifactId>isis-core-wrapper</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ </dependency>
+
+
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/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
new file mode 100644
index 0000000..4bc9631
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/AbstractIntegTest.java
@@ -0,0 +1,161 @@
+#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.apache.log4j.Level;
+import org.apache.log4j.PropertyConfigurator;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.rules.ExpectedException;
+import org.junit.rules.MethodRule;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+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();
+ }
+ };
+ }
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/4a86f070/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
new file mode 100644
index 0000000..7f00d4f
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/ToDoItem_title.java
@@ -0,0 +1,119 @@
+#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/4a86f070/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
new file mode 100644
index 0000000..f96c0c0
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_completed.java
@@ -0,0 +1,93 @@
+#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/4a86f070/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
new file mode 100644
index 0000000..4149ccd
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_duplicate.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 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/4a86f070/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
new file mode 100644
index 0000000..723627c
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/actions/ToDoItem_notYetCompleted.java
@@ -0,0 +1,83 @@
+#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/4a86f070/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
new file mode 100644
index 0000000..47b584e
--- /dev/null
+++ b/example/archetype/quickstart_wicket_restful_jdo/src/main/resources/archetype-resources/integtests/src/test/java/integtests/colls/ToDoItem_dependencies_add.java
@@ -0,0 +1,93 @@
+#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