You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2014/05/09 19:35:18 UTC
[3/6] git commit: ISIS-776: retroft with applib.InstallableFixture;
decouple org.reflections...
ISIS-776: retroft with applib.InstallableFixture; decouple org.reflections...
dependency by introducing a new ClassDiscoveryService.
Also:
- fixes for todo app's integration tests, to use the ToDoItemsFixtureService rather than ToDoItemFixture directly (ie uses fixture scripts to setup).
- ignored RO TCK test (ISIS-421)
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/55c4ea85
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/55c4ea85
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/55c4ea85
Branch: refs/heads/ISIS-764
Commit: 55c4ea85334373661ad4f21f01f4638c51b207a6
Parents: 98758f7
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri May 9 17:23:28 2014 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri May 9 17:23:28 2014 +0100
----------------------------------------------------------------------
...Put_whenArgValid_thenPropertyUpdated_ok.java | 262 ------------------
...henArgValid_thenPropertyUpdated_ok_TODO.java | 267 +++++++++++++++++++
core/applib/pom.xml | 6 +
.../applib/fixturescripts/FixtureScript.java | 22 +-
.../applib/fixturescripts/FixtureScripts.java | 15 +-
.../classdiscovery/ClassDiscoveryService.java | 30 +++
.../ClassDiscoveryServiceUsingReflections.java | 42 +++
.../src/main/java/dom/todo/ToDoItem.layout.json | 6 +-
.../fixture/todo/ToDoItemsCreateForUser.java | 105 ++++++++
.../fixture/todo/ToDoItemsDeleteForUser.java | 60 +++++
.../java/fixture/todo/ToDoItemsFixture.java | 75 +-----
.../fixture/todo/ToDoItemsFixturesService.java | 34 +++
.../fixture/todo/ToDoItemsResetForUser.java | 75 ++++++
.../java/integration/ToDoSystemInitializer.java | 12 +-
.../integration/glue/CatalogOfFixturesGlue.java | 3 +-
.../webapp/prototyping/DeveloperUtilities.java | 2 +
.../prototyping/ToDoItemResetForUser.java | 64 -----
.../prototyping/ToDoItemsCreateForUser.java | 96 -------
.../prototyping/ToDoItemsDeleteForUser.java | 51 ----
.../prototyping/ToDoItemsFixturesService.java | 92 -------
.../src/main/webapp/WEB-INF/isis.properties | 3 +-
21 files changed, 663 insertions(+), 659 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok.java
deleted file mode 100644
index a24c2e3..0000000
--- a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
-
-import java.io.IOException;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.Response.Status.Family;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.LocalDate;
-import org.joda.time.LocalDateTime;
-import org.joda.time.format.ISODateTimeFormat;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.apache.isis.core.webserver.WebServer;
-import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
-import org.apache.isis.viewer.restfulobjects.applib.Rel;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
-import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
-import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation;
-import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-
-public class Put_whenArgValid_thenPropertyUpdated_ok {
-
- @Rule
- public IsisWebServerRule webServerRule = new IsisWebServerRule();
-
- protected RestfulClient client;
-
- private DomainObjectResource domainObjectResource;
-
- private LinkRepresentation modifyLink;
- private JsonRepresentation argRepr;
-
- @Before
- public void setUp() throws Exception {
- final WebServer webServer = webServerRule.getWebServer();
- client = new RestfulClient(webServer.getBase());
- domainObjectResource = client.getDomainObjectResource();
- }
-
- /**
- * Tests change state, so discard such that will be recreated by next test.
- */
- @After
- public void tearDown() throws Exception {
- webServerRule.discardWebApp();
- }
-
- @Test
- public void primitivePropertiesUpdated() throws Exception {
-
- // byte
- final byte b = (byte)99;
- modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "byteProperty");
- argRepr = modifyLink.getArguments().mapPut("value", b);
- assertThat(followedRepr(modifyLink,argRepr).getByte("value"), is(b));
-
- // char
- final char c = 'b';
- modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "charProperty");
- argRepr = modifyLink.getArguments().mapPut("value", c);
- assertThat(followedRepr(modifyLink,argRepr).getChar("value"), is(c));
-
- // double
- final double d = 12345.678;
- modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "doubleProperty");
- argRepr = modifyLink.getArguments().mapPut("value", d);
- assertThat(followedRepr(modifyLink,argRepr).getDouble("value"), is(d));
-
- // float
- final float f = 54321.123F;
- modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "floatProperty");
- argRepr = modifyLink.getArguments().mapPut("value", f);
- assertThat(followedRepr(modifyLink,argRepr).getFloat("value"), is(f));
-
- // int
- final int i = 999999;
- modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "intProperty");
- argRepr = modifyLink.getArguments().mapPut("value", i);
- assertThat(followedRepr(modifyLink,argRepr).getInt("value"), is(i));
-
- // long
- final long l = 99999999999L;
- modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "longProperty");
- argRepr = modifyLink.getArguments().mapPut("value", l);
- assertThat(followedRepr(modifyLink,argRepr).getLong("value"), is(l));
-
- // short
- final short s = (short)999;
- modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "shortProperty");
- argRepr = modifyLink.getArguments().mapPut("value", s);
- assertThat(followedRepr(modifyLink,argRepr).getShort("value"), is(s));
-
- // boolean
- final boolean z = false;
- modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "booleanProperty");
- argRepr = modifyLink.getArguments().mapPut("value", z);
- assertThat(followedRepr(modifyLink,argRepr).getBoolean("value"), is(z));
-
- }
-
- @Test
- public void jdkPropertiesUpdated() throws Exception {
-
- // big decimal
- final BigDecimal bd = new BigDecimal("12345678901234567.789");
- modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "bigDecimalProperty");
- argRepr = modifyLink.getArguments().mapPut("value", bd);
- assertThat(followedRepr(modifyLink,argRepr).getBigDecimal("value"), is(new BigDecimal("12345678901234567.7890000000"))); // big-decimal(30,10)
-
- // big integer
- final BigInteger bi = new BigInteger("123456789012345678");
- modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "bigIntegerProperty");
- argRepr = modifyLink.getArguments().mapPut("value", bi);
- assertThat(followedRepr(modifyLink,argRepr).getBigInteger("value"), is(bi));
-
- // java.sql.Date
- final java.sql.Date sqld = new java.sql.Date(new DateTime(2014,5,1, 0,0, DateTimeZone.UTC).getMillis());
- modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "javaSqlDateProperty");
- argRepr = modifyLink.getArguments().mapPut("value", asIsoNoT(sqld));
- assertThat(followedRepr(modifyLink,argRepr).getDate("value"), is((java.util.Date)sqld));
-
- // java.sql.Time
- final java.sql.Time sqlt = new java.sql.Time(13,0,0);
- modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "javaSqlTimeProperty");
- argRepr = modifyLink.getArguments().mapPut("value", asIsoOnlyT(sqlt));
- assertThat(followedRepr(modifyLink,argRepr).getTime("value"), is((java.util.Date)sqlt));
-
- // java.sql.Timestamp
- final java.sql.Timestamp sqlts = new java.sql.Timestamp(114,4,1,13,0,0,0);
- modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "javaSqlTimestampProperty");
- argRepr = modifyLink.getArguments().mapPut("value", sqlts.getTime());
- assertThat(followedRepr(modifyLink,argRepr).getLong("value"), is(sqlts.getTime()));
-
- // java.util.Date
- final java.util.Date d = new java.util.Date(114,4,1,13,0,0);
- modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "javaUtilDateProperty");
- argRepr = modifyLink.getArguments().mapPut("value", asIso(d));
- assertThat(followedRepr(modifyLink,argRepr).getDateTime("value"), is(d));
-
- // enum
- final String e = "ORANGE";
- modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "myEnum");
- argRepr = modifyLink.getArguments().mapPut("value", e);
- assertThat(followedRepr(modifyLink,argRepr).getString("value"), is(e));
-
- // String
- final String s = "Tangerine";
- modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "stringProperty");
- argRepr = modifyLink.getArguments().mapPut("value", s);
- assertThat(followedRepr(modifyLink,argRepr).getString("value"), is(s));
-
- }
-
-
- @Test
- public void jodaPropertiesUpdated() throws Exception {
-
- // LocalDate
- final LocalDate ld = new LocalDate(2013,5,1);
- modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "localDateProperty");
- argRepr = modifyLink.getArguments().mapPut("value", "2013-05-01");
- assertThat(followedRepr(modifyLink,argRepr).getString("value"), is("2013-05-01")); // hacky
-
- // LocalDateTime
- final LocalDateTime ldt = new LocalDateTime(2013,2,1,14,15,0);
- modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "localDateTimeProperty");
- argRepr = modifyLink.getArguments().mapPut("value", asIso(ldt.toDate()));
- assertThat(followedRepr(modifyLink,argRepr).getDateTime("value"), is(ldt.toDate()));
-
- // DateTime
- final DateTime dt = new DateTime(2013,2,1,14,15,0);
- modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "dateTimeProperty");
- argRepr = modifyLink.getArguments().mapPut("value", asIso(dt.toDate()));
- assertThat(followedRepr(modifyLink,argRepr).getDateTime("value"), is(dt.toDate()));
-
- // String
- final String s = "New string";
- modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "stringProperty");
- argRepr = modifyLink.getArguments().mapPut("value", s);
- assertThat(followedRepr(modifyLink,argRepr).getString("value"), is(s));
- }
-
- private ObjectPropertyRepresentation getObjectPropertyRepr(final String domainType, final String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
- final Response domainObjectResp = domainObjectResource.propertyDetails(domainType, instanceId, propertyId);
- final RestfulResponse<ObjectPropertyRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
- assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
-
- final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
- return repr;
- }
-
- private LinkRepresentation getObjectPropertyReprModifyLink(String domainType, String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
- ObjectPropertyRepresentation objectPropertyRepr = getObjectPropertyRepr(domainType, instanceId, propertyId);
- return objectPropertyRepr.getLinkWithRel(Rel.MODIFY);
- }
-
- private JsonRepresentation followedRepr(LinkRepresentation modifyLink, JsonRepresentation argRepr) throws Exception {
- RestfulResponse<JsonRepresentation> result = client.follow(modifyLink, argRepr);
- assertThat(result.getStatus(), is(HttpStatusCode.OK));
- return result.getEntity().as(ObjectPropertyRepresentation.class);
- }
-
-
- private static String asIso(final java.util.Date d) {
- final org.joda.time.DateTime dt = new org.joda.time.DateTime(d.getTime());
- return asIso(dt);
- }
-
- private static String asIso(final org.joda.time.DateTime dt) {
- return ISODateTimeFormat.basicDateTimeNoMillis().withZoneUTC().print(dt);
- }
-
-
- private static String asIsoNoT(final java.util.Date d) {
- final org.joda.time.DateTime dt = new org.joda.time.DateTime(d.getTime());
- return asIsoNoT(dt);
- }
-
- private static String asIsoNoT(final org.joda.time.DateTime dt) {
- return ISODateTimeFormat.basicDate().withZoneUTC().print(dt);
- }
-
- private static String asIsoOnlyT(final java.util.Date d) {
- final org.joda.time.DateTime dt = new org.joda.time.DateTime(d.getTime());
- return asIsoOnlyT(dt);
- }
-
- private static String asIsoOnlyT(final org.joda.time.DateTime dt) {
- return ISODateTimeFormat.basicTime().withZoneUTC().print(dt);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok_TODO.java
----------------------------------------------------------------------
diff --git a/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok_TODO.java b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok_TODO.java
new file mode 100644
index 0000000..6feb0ff
--- /dev/null
+++ b/component/viewer/restfulobjects/tck/src/test/java/org/apache/isis/viewer/restfulobjects/tck/domainobject/oid/property/Put_whenArgValid_thenPropertyUpdated_ok_TODO.java
@@ -0,0 +1,267 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.viewer.restfulobjects.tck.domainobject.oid.property;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status.Family;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.format.ISODateTimeFormat;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.webserver.WebServer;
+import org.apache.isis.viewer.restfulobjects.applib.JsonRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.LinkRepresentation;
+import org.apache.isis.viewer.restfulobjects.applib.Rel;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulClient;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse;
+import org.apache.isis.viewer.restfulobjects.applib.client.RestfulResponse.HttpStatusCode;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.DomainObjectResource;
+import org.apache.isis.viewer.restfulobjects.applib.domainobjects.ObjectPropertyRepresentation;
+import org.apache.isis.viewer.restfulobjects.tck.IsisWebServerRule;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class Put_whenArgValid_thenPropertyUpdated_ok_TODO {
+
+ @Rule
+ public IsisWebServerRule webServerRule = new IsisWebServerRule();
+
+ protected RestfulClient client;
+
+ private DomainObjectResource domainObjectResource;
+
+ private LinkRepresentation modifyLink;
+ private JsonRepresentation argRepr;
+
+ @Before
+ public void setUp() throws Exception {
+ final WebServer webServer = webServerRule.getWebServer();
+ client = new RestfulClient(webServer.getBase());
+ domainObjectResource = client.getDomainObjectResource();
+ }
+
+ /**
+ * Tests change state, so discard such that will be recreated by next test.
+ */
+ @After
+ public void tearDown() throws Exception {
+ webServerRule.discardWebApp();
+ }
+
+ @Test
+ public void primitivePropertiesUpdated() throws Exception {
+
+ // byte
+ final byte b = (byte)99;
+ modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "byteProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", b);
+ assertThat(followedRepr(modifyLink,argRepr).getByte("value"), is(b));
+
+ // char
+ final char c = 'b';
+ modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "charProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", c);
+ assertThat(followedRepr(modifyLink,argRepr).getChar("value"), is(c));
+
+ // double
+ final double d = 12345.678;
+ modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "doubleProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", d);
+ assertThat(followedRepr(modifyLink,argRepr).getDouble("value"), is(d));
+
+ // float
+ final float f = 54321.123F;
+ modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "floatProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", f);
+ assertThat(followedRepr(modifyLink,argRepr).getFloat("value"), is(f));
+
+ // int
+ final int i = 999999;
+ modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "intProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", i);
+ assertThat(followedRepr(modifyLink,argRepr).getInt("value"), is(i));
+
+ // long
+ final long l = 99999999999L;
+ modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "longProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", l);
+ assertThat(followedRepr(modifyLink,argRepr).getLong("value"), is(l));
+
+ // short
+ final short s = (short)999;
+ modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "shortProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", s);
+ assertThat(followedRepr(modifyLink,argRepr).getShort("value"), is(s));
+
+ // boolean
+ final boolean z = false;
+ modifyLink = getObjectPropertyReprModifyLink("PRMV", "31", "booleanProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", z);
+ assertThat(followedRepr(modifyLink,argRepr).getBoolean("value"), is(z));
+
+ }
+
+ @Test
+ public void jdkPropertiesUpdated() throws Exception {
+
+ // big decimal
+ final BigDecimal bd = new BigDecimal("12345678901234567.789");
+ modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "bigDecimalProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", bd);
+ assertThat(followedRepr(modifyLink,argRepr).getBigDecimal("value"), is(new BigDecimal("12345678901234567.7890000000"))); // big-decimal(30,10)
+
+ // big integer
+ final BigInteger bi = new BigInteger("123456789012345678");
+ modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "bigIntegerProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", bi);
+ assertThat(followedRepr(modifyLink,argRepr).getBigInteger("value"), is(bi));
+
+ // java.sql.Date
+ final java.sql.Date sqld = new java.sql.Date(new DateTime(2014,5,1, 0,0, DateTimeZone.UTC).getMillis());
+ modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "javaSqlDateProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", asIsoNoT(sqld));
+ assertThat(followedRepr(modifyLink,argRepr).getDate("value"), is((java.util.Date)sqld));
+
+ // java.sql.Time
+ final java.sql.Time sqlt = new java.sql.Time(13,0,0);
+ modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "javaSqlTimeProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", asIsoOnlyT(sqlt));
+ assertThat(followedRepr(modifyLink,argRepr).getTime("value"), is((java.util.Date)sqlt));
+
+ // java.sql.Timestamp
+ final java.sql.Timestamp sqlts = new java.sql.Timestamp(114,4,1,13,0,0,0);
+ modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "javaSqlTimestampProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", sqlts.getTime());
+ assertThat(followedRepr(modifyLink,argRepr).getLong("value"), is(sqlts.getTime()));
+
+ // java.util.Date
+ final java.util.Date d = new java.util.Date(114,4,1,13,0,0);
+ modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "javaUtilDateProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", asIso(d));
+ assertThat(followedRepr(modifyLink,argRepr).getDateTime("value"), is(d));
+
+ // enum
+ final String e = "ORANGE";
+ modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "myEnum");
+ argRepr = modifyLink.getArguments().mapPut("value", e);
+ assertThat(followedRepr(modifyLink,argRepr).getString("value"), is(e));
+
+ // String
+ final String s = "Tangerine";
+ modifyLink = getObjectPropertyReprModifyLink("JDKV", "29", "stringProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", s);
+ assertThat(followedRepr(modifyLink,argRepr).getString("value"), is(s));
+
+ }
+
+
+ @Ignore("breaking in CET")
+ @Test
+ public void jodaPropertiesUpdated() throws Exception {
+
+ // LocalDate
+ final LocalDate ld = new LocalDate(2013,5,1);
+ modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "localDateProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", "2013-05-01");
+ assertThat(followedRepr(modifyLink,argRepr).getString("value"), is("2013-05-01")); // hacky
+
+ // LocalDateTime
+ final LocalDateTime ldt = new LocalDateTime(2013,2,1,14,15,0);
+ modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "localDateTimeProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", asIso(ldt.toDate()));
+ assertThat(followedRepr(modifyLink,argRepr).getDateTime("value"), is(ldt.toDate()));
+
+ // DateTime
+ final DateTime dt = new DateTime(2013,2,1,14,15,0);
+ modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "dateTimeProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", asIso(dt.toDate()));
+ assertThat(followedRepr(modifyLink,argRepr).getDateTime("value"), is(dt.toDate()));
+
+ // String
+ final String s = "New string";
+ modifyLink = getObjectPropertyReprModifyLink("JODA", "73", "stringProperty");
+ argRepr = modifyLink.getArguments().mapPut("value", s);
+ assertThat(followedRepr(modifyLink,argRepr).getString("value"), is(s));
+ }
+
+ private ObjectPropertyRepresentation getObjectPropertyRepr(final String domainType, final String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
+ final Response domainObjectResp = domainObjectResource.propertyDetails(domainType, instanceId, propertyId);
+ final RestfulResponse<ObjectPropertyRepresentation> domainObjectJsonResp = RestfulResponse.ofT(domainObjectResp);
+ assertThat(domainObjectJsonResp.getStatus().getFamily(), is(Family.SUCCESSFUL));
+
+ final ObjectPropertyRepresentation repr = domainObjectJsonResp.getEntity();
+ return repr;
+ }
+
+ private LinkRepresentation getObjectPropertyReprModifyLink(String domainType, String instanceId, String propertyId) throws JsonParseException, JsonMappingException, IOException {
+ ObjectPropertyRepresentation objectPropertyRepr = getObjectPropertyRepr(domainType, instanceId, propertyId);
+ return objectPropertyRepr.getLinkWithRel(Rel.MODIFY);
+ }
+
+ private JsonRepresentation followedRepr(LinkRepresentation modifyLink, JsonRepresentation argRepr) throws Exception {
+ RestfulResponse<JsonRepresentation> result = client.follow(modifyLink, argRepr);
+ assertThat(result.getStatus(), is(HttpStatusCode.OK));
+ return result.getEntity().as(ObjectPropertyRepresentation.class);
+ }
+
+
+ private static String asIso(final java.util.Date d) {
+ final org.joda.time.DateTime dt = new org.joda.time.DateTime(d.getTime());
+ return asIso(dt);
+ }
+
+ private static String asIso(final org.joda.time.DateTime dt) {
+ return ISODateTimeFormat.basicDateTimeNoMillis().withZoneUTC().print(dt);
+ }
+
+
+ private static String asIsoNoT(final java.util.Date d) {
+ final org.joda.time.DateTime dt = new org.joda.time.DateTime(d.getTime());
+ return asIsoNoT(dt);
+ }
+
+ private static String asIsoNoT(final org.joda.time.DateTime dt) {
+ return ISODateTimeFormat.basicDate().withZoneUTC().print(dt);
+ }
+
+ private static String asIsoOnlyT(final java.util.Date d) {
+ final org.joda.time.DateTime dt = new org.joda.time.DateTime(d.getTime());
+ return asIsoOnlyT(dt);
+ }
+
+ private static String asIsoOnlyT(final org.joda.time.DateTime dt) {
+ return ISODateTimeFormat.basicTime().withZoneUTC().print(dt);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/core/applib/pom.xml
----------------------------------------------------------------------
diff --git a/core/applib/pom.xml b/core/applib/pom.xml
index e1a8171..c94741e 100644
--- a/core/applib/pom.xml
+++ b/core/applib/pom.xml
@@ -90,6 +90,12 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.reflections</groupId>
+ <artifactId>reflections</artifactId>
+ <optional>true</optional>
+ </dependency>
+
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScript.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScript.java b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScript.java
index 53262e0..befb5e8 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScript.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScript.java
@@ -25,9 +25,13 @@ import org.apache.isis.applib.annotation.Hidden;
import org.apache.isis.applib.annotation.Named;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.annotation.Title;
+import org.apache.isis.applib.fixtures.FixtureType;
+import org.apache.isis.applib.fixtures.InstallableFixture;
@Named("Script")
-public abstract class FixtureScript extends AbstractViewModel {
+public abstract class FixtureScript
+ extends AbstractViewModel
+ implements InstallableFixture {
protected static final String PATH_SEPARATOR = "/";
@@ -176,16 +180,24 @@ public abstract class FixtureScript extends AbstractViewModel {
protected abstract void doRun(FixtureResultList fixtureResults);
// //////////////////////////////////////
+
+ @Override
+ public FixtureType getType() {
+ return FixtureType.DOMAIN_OBJECTS;
+ }
@Programmatic
- String pathWith(String subkey) {
- return (getQualifiedName() != null? getQualifiedName() + PATH_SEPARATOR: "") + subkey;
+ public final void install() {
+ run();
}
// //////////////////////////////////////
-
-
+ @Programmatic
+ String pathWith(String subkey) {
+ return (getQualifiedName() != null? getQualifiedName() + PATH_SEPARATOR: "") + subkey;
+ }
+
// //////////////////////////////////////
@javax.inject.Inject
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScripts.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScripts.java b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScripts.java
index d8f6b0a..4dc983a 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScripts.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScripts.java
@@ -37,6 +37,7 @@ import org.apache.isis.applib.DomainObjectContainer;
import org.apache.isis.applib.annotation.Prototype;
import org.apache.isis.applib.services.bookmark.Bookmark;
import org.apache.isis.applib.services.bookmark.BookmarkService;
+import org.apache.isis.applib.services.classdiscovery.ClassDiscoveryService;
import org.apache.isis.applib.services.memento.MementoService;
import org.apache.isis.applib.services.memento.MementoService.Memento;
import org.apache.isis.applib.util.ObjectContracts;
@@ -62,7 +63,7 @@ public abstract class FixtureScripts extends AbstractService {
}
private void findAndInstantiateFixtureScripts(List<FixtureScript> fixtureScriptList) {
- final Set<Class<? extends FixtureScript>> classes = findFixtureScriptClasses();
+ final Set<Class<? extends FixtureScript>> classes = classDiscoveryService.findSubTypesOfClasses(FixtureScript.class);
for (final Class<? extends FixtureScript> fixtureScriptCls : classes) {
final String packageName = fixtureScriptCls.getPackage().getName();
if(!packageName.startsWith(packagePrefix)) {
@@ -81,14 +82,6 @@ public abstract class FixtureScripts extends AbstractService {
});
}
- private static Set<Class<? extends FixtureScript>> findFixtureScriptClasses() {
- final Reflections reflections = new Reflections(
- ClasspathHelper.forClassLoader(Thread.currentThread().getContextClassLoader()),
- ClasspathHelper.forClass(Object.class),
- new SubTypesScanner(false));
- return reflections.getSubTypesOf(FixtureScript.class);
- }
-
private FixtureScript newFixtureScript(Class<? extends FixtureScript> fixtureScriptCls) {
try {
final Constructor<? extends FixtureScript> constructor = fixtureScriptCls.getConstructor();
@@ -164,4 +157,8 @@ public abstract class FixtureScripts extends AbstractService {
@javax.inject.Inject
private DomainObjectContainer container;
+
+ @javax.inject.Inject
+ private ClassDiscoveryService classDiscoveryService;
+
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/core/applib/src/main/java/org/apache/isis/applib/services/classdiscovery/ClassDiscoveryService.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/classdiscovery/ClassDiscoveryService.java b/core/applib/src/main/java/org/apache/isis/applib/services/classdiscovery/ClassDiscoveryService.java
new file mode 100644
index 0000000..0f32664
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/classdiscovery/ClassDiscoveryService.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.services.classdiscovery;
+
+import java.util.Set;
+
+import org.apache.isis.applib.annotation.Programmatic;
+
+public interface ClassDiscoveryService {
+
+ @Programmatic
+ public <T> Set<Class<? extends T>> findSubTypesOfClasses(Class<T> type);
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/core/applib/src/main/java/org/apache/isis/applib/services/classdiscovery/ClassDiscoveryServiceUsingReflections.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/services/classdiscovery/ClassDiscoveryServiceUsingReflections.java b/core/applib/src/main/java/org/apache/isis/applib/services/classdiscovery/ClassDiscoveryServiceUsingReflections.java
new file mode 100644
index 0000000..f88bf2c
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/services/classdiscovery/ClassDiscoveryServiceUsingReflections.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.services.classdiscovery;
+
+import java.util.Set;
+
+import org.reflections.Reflections;
+import org.reflections.scanners.SubTypesScanner;
+import org.reflections.util.ClasspathHelper;
+
+import org.apache.isis.applib.AbstractService;
+
+public class ClassDiscoveryServiceUsingReflections
+ extends AbstractService
+ implements ClassDiscoveryService {
+
+ @Override
+ public <T> Set<Class<? extends T>> findSubTypesOfClasses(Class<T> type) {
+ final Reflections reflections = new Reflections(
+ ClasspathHelper.forClassLoader(Thread.currentThread().getContextClassLoader()),
+ ClasspathHelper.forClass(Object.class),
+ new SubTypesScanner(false));
+ return reflections.getSubTypesOf(type);
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json
index 81cdea3..4db6560 100644
--- a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json
+++ b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.layout.json
@@ -54,12 +54,12 @@
},
cssClass: { value: "x-highlight" }
},
+ notYetCompleted: {
+ named: { value: "Not done" }
+ },
scheduleExplicitly: {
},
scheduleImplicitly: {
- },
- notYetCompleted: {
- named: { value: "Not done" }
}
},
describedAs: {
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsCreateForUser.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsCreateForUser.java b/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsCreateForUser.java
new file mode 100644
index 0000000..33c7ada
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsCreateForUser.java
@@ -0,0 +1,105 @@
+/*
+ * 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 fixture.todo;
+
+import java.math.BigDecimal;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItem.Category;
+import dom.todo.ToDoItem.Subcategory;
+import dom.todo.ToDoItems;
+
+import org.joda.time.LocalDate;
+
+import org.apache.isis.applib.clock.Clock;
+import org.apache.isis.applib.fixturescripts.FixtureResultList;
+import org.apache.isis.applib.fixturescripts.SimpleFixtureScript;
+
+public class ToDoItemsCreateForUser extends SimpleFixtureScript {
+
+ // //////////////////////////////////////
+ // Constructor
+ // //////////////////////////////////////
+
+ private final String user;
+
+ public ToDoItemsCreateForUser(String user) {
+ super(friendlyNameFor(user), localNameFor(user));
+ this.user = user;
+ }
+
+ static String localNameFor(String user) {
+ return user != null? user: "current";
+ }
+
+ static String friendlyNameFor(String user) {
+ return "Create ToDoItems for " + (user != null ? "'" + user + "'" : "current user");
+ }
+
+ @Override
+ protected void doRun(final FixtureResultList resultList) {
+ final String ownedBy = user != null? user: getContainer().getUser().getName();
+ installFor(ownedBy, resultList);
+ getContainer().flush();
+ }
+
+ private void installFor(final String user, final FixtureResultList resultList) {
+
+ createToDoItemForUser("Buy milk", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("0.75"), resultList);
+ createToDoItemForUser("Buy bread", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("1.75"), resultList);
+ createToDoItemForUser("Buy stamps", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("10.00"), resultList).setComplete(true);
+ createToDoItemForUser("Pick up laundry", Category.Domestic, Subcategory.Chores, user, daysFromToday(6), new BigDecimal("7.50"), resultList);
+ createToDoItemForUser("Mow lawn", Category.Domestic, Subcategory.Garden, user, daysFromToday(6), null, resultList);
+ createToDoItemForUser("Vacuum house", Category.Domestic, Subcategory.Housework, user, daysFromToday(3), null, resultList);
+ createToDoItemForUser("Sharpen knives", Category.Domestic, Subcategory.Chores, user, daysFromToday(14), null, resultList);
+
+ createToDoItemForUser("Write to penpal", Category.Other, Subcategory.Other, user, null, null, resultList);
+
+ createToDoItemForUser("Write blog post", Category.Professional, Subcategory.Marketing, user, daysFromToday(7), null, resultList).setComplete(true);
+ createToDoItemForUser("Organize brown bag", Category.Professional, Subcategory.Consulting, user, daysFromToday(14), null, resultList);
+ createToDoItemForUser("Submit conference session", Category.Professional, Subcategory.Education, user, daysFromToday(21), null, resultList);
+ createToDoItemForUser("Stage Isis release", Category.Professional, Subcategory.OpenSource, user, null, null, resultList);
+
+ getContainer().flush();
+ }
+
+ // //////////////////////////////////////
+
+ private ToDoItem createToDoItemForUser(
+ final String description,
+ final Category category, Subcategory subcategory,
+ final String user,
+ final LocalDate dueBy, final BigDecimal cost, FixtureResultList resultList) {
+ ToDoItem newToDo = toDoItems.newToDo(description, category, subcategory, user, dueBy, cost);
+ return resultList.add(this, newToDo);
+ }
+
+ private static LocalDate daysFromToday(final int i) {
+ final LocalDate date = new LocalDate(Clock.getTimeAsDateTime());
+ return date.plusDays(i);
+ }
+
+
+ // //////////////////////////////////////
+ // Injected services
+ // //////////////////////////////////////
+
+ @javax.inject.Inject
+ private ToDoItems toDoItems;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsDeleteForUser.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsDeleteForUser.java b/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsDeleteForUser.java
new file mode 100644
index 0000000..ed3b242
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsDeleteForUser.java
@@ -0,0 +1,60 @@
+/*
+ * 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 fixture.todo;
+
+import org.apache.isis.applib.fixturescripts.FixtureResultList;
+import org.apache.isis.applib.fixturescripts.SimpleFixtureScript;
+import org.apache.isis.objectstore.jdo.applib.service.support.IsisJdoSupport;
+
+public class ToDoItemsDeleteForUser extends SimpleFixtureScript {
+
+ // //////////////////////////////////////
+ // Constructor
+ // //////////////////////////////////////
+
+ private final String user;
+
+ public ToDoItemsDeleteForUser(final String user) {
+ super(friendlyNameFor(user), localNameFor(user));
+ this.user = user;
+ }
+
+ static String localNameFor(final String user) {
+ return user != null? user: "current";
+ }
+
+ static String friendlyNameFor(final String user) {
+ return "Delete ToDoItems for " + (user != null ? "'" + user + "'" : "current user");
+ }
+
+ @Override
+ protected void doRun(final FixtureResultList resultList) {
+ final String ownedBy = user != null? user: getContainer().getUser().getName();
+ isisJdoSupport.executeUpdate("delete from \"ToDoItem\" where \"ownedBy\" = '" + ownedBy + "'");
+ getContainer().flush();
+ }
+
+ // //////////////////////////////////////
+ // Injected services
+ // //////////////////////////////////////
+
+ @javax.inject.Inject
+ private IsisJdoSupport isisJdoSupport;
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java b/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java
index 10f12f3..ece3726 100644
--- a/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java
+++ b/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsFixture.java
@@ -19,84 +19,15 @@
package fixture.todo;
-import java.math.BigDecimal;
-import dom.todo.ToDoItem;
-import dom.todo.ToDoItem.Category;
-import dom.todo.ToDoItem.Subcategory;
-import dom.todo.ToDoItems;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.clock.Clock;
-import org.apache.isis.applib.fixtures.AbstractFixture;
-import org.apache.isis.objectstore.jdo.applib.service.support.IsisJdoSupport;
-
-public class ToDoItemsFixture extends AbstractFixture {
-
- private final String user;
+public class ToDoItemsFixture extends ToDoItemsResetForUser {
public ToDoItemsFixture() {
this(null);
}
- public ToDoItemsFixture(String ownedBy) {
- this.user = ownedBy;
- }
-
- @Override
- public void install() {
-
- final String ownedBy = this.user != null? this.user : getContainer().getUser().getName();
-
- isisJdoSupport.executeUpdate("delete from \"ToDoItem\" where \"ownedBy\" = '" + ownedBy + "'");
-
- installFor(ownedBy);
-
- getContainer().flush();
- }
-
- private void installFor(String user) {
-
- createToDoItemForUser("Buy milk", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("0.75"));
- createToDoItemForUser("Buy bread", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("1.75"));
- createToDoItemForUser("Buy stamps", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("10.00")).setComplete(true);
- createToDoItemForUser("Pick up laundry", Category.Domestic, Subcategory.Chores, user, daysFromToday(6), new BigDecimal("7.50"));
- createToDoItemForUser("Mow lawn", Category.Domestic, Subcategory.Garden, user, daysFromToday(6), null);
- createToDoItemForUser("Vacuum house", Category.Domestic, Subcategory.Housework, user, daysFromToday(3), null);
- createToDoItemForUser("Sharpen knives", Category.Domestic, Subcategory.Chores, user, daysFromToday(14), null);
-
- createToDoItemForUser("Write to penpal", Category.Other, Subcategory.Other, user, null, null);
-
- createToDoItemForUser("Write blog post", Category.Professional, Subcategory.Marketing, user, daysFromToday(7), null).setComplete(true);
- createToDoItemForUser("Organize brown bag", Category.Professional, Subcategory.Consulting, user, daysFromToday(14), null);
- createToDoItemForUser("Submit conference session", Category.Professional, Subcategory.Education, user, daysFromToday(21), null);
- createToDoItemForUser("Stage Isis release", Category.Professional, Subcategory.OpenSource, user, null, null);
-
- getContainer().flush();
- }
-
-
- // //////////////////////////////////////
-
- private ToDoItem createToDoItemForUser(final String description, final Category category, Subcategory subcategory, String user, final LocalDate dueBy, final BigDecimal cost) {
- return toDoItems.newToDo(description, category, subcategory, user, dueBy, cost);
+ public ToDoItemsFixture(String user) {
+ super(user);
}
- private static LocalDate daysFromToday(final int i) {
- final LocalDate date = new LocalDate(Clock.getTimeAsDateTime());
- return date.plusDays(i);
- }
-
-
- // //////////////////////////////////////
- // Injected services
- // //////////////////////////////////////
-
- @javax.inject.Inject
- private ToDoItems toDoItems;
-
- @javax.inject.Inject
- private IsisJdoSupport isisJdoSupport;
-
}
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java b/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java
new file mode 100644
index 0000000..76d7d63
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsFixturesService.java
@@ -0,0 +1,34 @@
+/*
+ * 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 fixture.todo;
+
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.fixturescripts.FixtureScripts;
+
+/**
+ * Enables fixtures to be installed from the application.
+ */
+@Named("Prototyping") // has the effect of defining a "Prototyping" menu item
+public class ToDoItemsFixturesService extends FixtureScripts {
+
+ public ToDoItemsFixturesService() {
+ super("fixture.todo");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsResetForUser.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsResetForUser.java b/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsResetForUser.java
new file mode 100644
index 0000000..49793a3
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/fixture/src/main/java/fixture/todo/ToDoItemsResetForUser.java
@@ -0,0 +1,75 @@
+/*
+ * 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 fixture.todo;
+
+import org.apache.isis.applib.fixturescripts.CompositeFixtureScript;
+
+public class ToDoItemsResetForUser extends CompositeFixtureScript {
+
+ // //////////////////////////////////////
+ // Subclasses
+ // //////////////////////////////////////
+
+ public static final class ToDoItemResetForDick extends ToDoItemsResetForUser {
+ public ToDoItemResetForDick() {
+ super("dick");
+ }
+ }
+
+ public static final class ToDoItemResetForJoe extends ToDoItemsResetForUser {
+ public ToDoItemResetForJoe() {
+ super("joe");
+ }
+ }
+
+ public static final class ToDoItemResetForSven extends ToDoItemsResetForUser {
+ public ToDoItemResetForSven() {
+ super("sven");
+ }
+ }
+
+ // //////////////////////////////////////
+ // Constructor
+ // //////////////////////////////////////
+
+ private String user;
+
+ public ToDoItemsResetForUser() {
+ this(null);
+ }
+
+ public ToDoItemsResetForUser(String user) {
+ super(friendlyNameFor(localNameFor(user)), localNameFor(user));
+ this.user = user;
+ }
+
+ static String localNameFor(String user) {
+ return user != null? user: "current";
+ }
+
+ static String friendlyNameFor(String user) {
+ return "Reset ToDoItems for " + (user != null ? "'" + user + "'" : "current user");
+ }
+
+ @Override
+ protected void addChildren() {
+ add("delete", new ToDoItemsDeleteForUser(user));
+ add("create", new ToDoItemsCreateForUser(user));
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/ToDoSystemInitializer.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/ToDoSystemInitializer.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/ToDoSystemInitializer.java
index 66f90b5..7fbd36c 100644
--- a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/ToDoSystemInitializer.java
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/ToDoSystemInitializer.java
@@ -19,11 +19,15 @@ package integration;
import app.ToDoItemAnalysis;
import dom.todo.ToDoItemContributions;
import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixturesService;
import org.apache.isis.applib.annotation.Bulk;
+import org.apache.isis.applib.services.classdiscovery.ClassDiscoveryServiceUsingReflections;
import org.apache.isis.applib.services.queryresultscache.QueryResultsCache;
import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.core.integtestsupport.IsisSystemForTest;
+import org.apache.isis.core.metamodel.services.bookmarks.BookmarkServiceDefault;
+import org.apache.isis.core.runtime.services.memento.MementoServiceDefault;
import org.apache.isis.core.wrapper.WrapperFactoryDefault;
import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests;
@@ -59,11 +63,15 @@ public class ToDoSystemInitializer {
new ToDoItems(),
new ToDoItemAnalysis(),
new ToDoItemContributions(),
+ new ToDoItemsFixturesService(),
+ new ClassDiscoveryServiceUsingReflections(),
new WrapperFactoryDefault(),
new IsisJdoSupportImpl(),
new Bulk.InteractionContext(),
new EventBusServiceJdo(),
- new QueryResultsCache()
+ new QueryResultsCache(),
+ new MementoServiceDefault(),
+ new BookmarkServiceDefault()
);
}
@@ -72,7 +80,5 @@ public class ToDoSystemInitializer {
testConfiguration.addRegisterEntitiesPackagePrefix("dom");
return testConfiguration;
}
-
}
-
}
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java
index 9115a71..af0d92d 100644
--- a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/glue/CatalogOfFixturesGlue.java
@@ -18,6 +18,7 @@ package integration.glue;
import cucumber.api.java.Before;
import dom.todo.ToDoItem;
+import fixture.todo.ToDoItemsResetForUser;
import fixture.todo.ToDoItemsFixture;
import org.apache.isis.core.specsupport.scenarios.InMemoryDB;
@@ -40,7 +41,7 @@ public class CatalogOfFixturesGlue extends CukeGlueAbstract {
@Before(value={"@integration", "@ToDoItemsFixture"}, order=20000)
public void integrationFixtures() throws Throwable {
- scenarioExecution().install(new ToDoItemsFixture());
+ scenarioExecution().install(new ToDoItemsResetForUser());
}
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/DeveloperUtilities.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/DeveloperUtilities.java b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/DeveloperUtilities.java
index 19b342d..e1e8792 100644
--- a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/DeveloperUtilities.java
+++ b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/DeveloperUtilities.java
@@ -16,6 +16,8 @@
*/
package webapp.prototyping;
+import fixture.todo.ToDoItemsFixturesService;
+
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.value.Blob;
import org.apache.isis.applib.value.Clob;
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemResetForUser.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemResetForUser.java b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemResetForUser.java
deleted file mode 100644
index 2586c17..0000000
--- a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemResetForUser.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package webapp.prototyping;
-
-import org.apache.isis.applib.fixturescripts.CompositeFixtureScript;
-
-public abstract class ToDoItemResetForUser extends CompositeFixtureScript {
-
- // //////////////////////////////////////
- // Subclasses
- // //////////////////////////////////////
-
- public static final class ToDoItemResetForDick extends ToDoItemResetForUser {
- public ToDoItemResetForDick() {
- super("dick");
- }
- }
-
- public static final class ToDoItemResetForJoe extends ToDoItemResetForUser {
- public ToDoItemResetForJoe() {
- super("joe");
- }
- }
-
- public static final class ToDoItemResetForSven extends ToDoItemResetForUser {
- public ToDoItemResetForSven() {
- super("sven");
- }
- }
-
- // //////////////////////////////////////
- // Constructor
- // //////////////////////////////////////
-
- private String user;
-
- public ToDoItemResetForUser(String user) {
- super("Reset ToDoItems for '" + user + "'", user);
- this.user = user;
- }
-
- @Override
- protected void addChildren() {
- add("delete", new ToDoItemsDeleteForUser(user));
- add("create", new ToDoItemsCreateForUser(user));
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsCreateForUser.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsCreateForUser.java b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsCreateForUser.java
deleted file mode 100644
index b70e5b0..0000000
--- a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsCreateForUser.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package webapp.prototyping;
-
-import java.math.BigDecimal;
-
-import dom.todo.ToDoItem;
-import dom.todo.ToDoItem.Category;
-import dom.todo.ToDoItem.Subcategory;
-import dom.todo.ToDoItems;
-
-import org.joda.time.LocalDate;
-
-import org.apache.isis.applib.clock.Clock;
-import org.apache.isis.applib.fixturescripts.FixtureResultList;
-import org.apache.isis.applib.fixturescripts.SimpleFixtureScript;
-
-public class ToDoItemsCreateForUser extends SimpleFixtureScript {
-
- // //////////////////////////////////////
- // Constructor
- // //////////////////////////////////////
-
- private final String user;
-
- public ToDoItemsCreateForUser(String user) {
- super("Create ToDoItems for '" + user + "'", user);
- this.user = user;
- }
-
- @Override
- protected void doRun(final FixtureResultList resultList) {
- installFor(user, resultList);
- getContainer().flush();
- }
-
- private void installFor(final String user, final FixtureResultList resultList) {
-
- createToDoItemForUser("Buy milk", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("0.75"), resultList);
- createToDoItemForUser("Buy bread", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("1.75"), resultList);
- createToDoItemForUser("Buy stamps", Category.Domestic, Subcategory.Shopping, user, daysFromToday(0), new BigDecimal("10.00"), resultList).setComplete(true);
- createToDoItemForUser("Pick up laundry", Category.Domestic, Subcategory.Chores, user, daysFromToday(6), new BigDecimal("7.50"), resultList);
- createToDoItemForUser("Mow lawn", Category.Domestic, Subcategory.Garden, user, daysFromToday(6), null, resultList);
- createToDoItemForUser("Vacuum house", Category.Domestic, Subcategory.Housework, user, daysFromToday(3), null, resultList);
- createToDoItemForUser("Sharpen knives", Category.Domestic, Subcategory.Chores, user, daysFromToday(14), null, resultList);
-
- createToDoItemForUser("Write to penpal", Category.Other, Subcategory.Other, user, null, null, resultList);
-
- createToDoItemForUser("Write blog post", Category.Professional, Subcategory.Marketing, user, daysFromToday(7), null, resultList).setComplete(true);
- createToDoItemForUser("Organize brown bag", Category.Professional, Subcategory.Consulting, user, daysFromToday(14), null, resultList);
- createToDoItemForUser("Submit conference session", Category.Professional, Subcategory.Education, user, daysFromToday(21), null, resultList);
- createToDoItemForUser("Stage Isis release", Category.Professional, Subcategory.OpenSource, user, null, null, resultList);
-
- getContainer().flush();
- }
-
- // //////////////////////////////////////
-
- private ToDoItem createToDoItemForUser(
- final String description,
- final Category category, Subcategory subcategory,
- final String user,
- final LocalDate dueBy, final BigDecimal cost, FixtureResultList resultList) {
- ToDoItem newToDo = toDoItems.newToDo(description, category, subcategory, user, dueBy, cost);
- return resultList.add(this, newToDo);
- }
-
- private static LocalDate daysFromToday(final int i) {
- final LocalDate date = new LocalDate(Clock.getTimeAsDateTime());
- return date.plusDays(i);
- }
-
-
- // //////////////////////////////////////
- // Injected services
- // //////////////////////////////////////
-
- @javax.inject.Inject
- private ToDoItems toDoItems;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsDeleteForUser.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsDeleteForUser.java b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsDeleteForUser.java
deleted file mode 100644
index 81f0b65..0000000
--- a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsDeleteForUser.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package webapp.prototyping;
-
-import org.apache.isis.applib.fixturescripts.FixtureResultList;
-import org.apache.isis.applib.fixturescripts.SimpleFixtureScript;
-import org.apache.isis.objectstore.jdo.applib.service.support.IsisJdoSupport;
-
-public class ToDoItemsDeleteForUser extends SimpleFixtureScript {
-
- // //////////////////////////////////////
- // Constructor
- // //////////////////////////////////////
-
- private final String user;
-
- public ToDoItemsDeleteForUser(String user) {
- super("Delete ToDoItems for '" + user + "'", user);
- this.user = user;
- }
-
- @Override
- protected void doRun(final FixtureResultList resultList) {
- isisJdoSupport.executeUpdate("delete from \"ToDoItem\" where \"ownedBy\" = '" + user + "'");
- getContainer().flush();
- }
-
- // //////////////////////////////////////
- // Injected services
- // //////////////////////////////////////
-
- @javax.inject.Inject
- private IsisJdoSupport isisJdoSupport;
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsFixturesService.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsFixturesService.java b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsFixturesService.java
deleted file mode 100644
index 2eebaab..0000000
--- a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsFixturesService.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package webapp.prototyping;
-
-import java.util.List;
-
-import com.google.common.collect.Lists;
-
-import dom.todo.ToDoItem;
-import dom.todo.ToDoItems;
-import fixture.todo.ToDoItemsFixture;
-
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.isis.applib.annotation.Named;
-import org.apache.isis.applib.annotation.Prototype;
-import org.apache.isis.applib.fixturescripts.FixtureScripts;
-import org.apache.isis.core.runtime.fixtures.FixturesInstallerDelegate;
-
-/**
- * Enables fixtures to be installed from the application.
- */
-@Named("Prototyping") // has the effect of defining a "Prototyping" menu item
-public class ToDoItemsFixturesService extends FixtureScripts {
-
- public ToDoItemsFixturesService() {
- super("webapp.prototyping");
- }
-
- @Hidden
- @Prototype
- public String installFixtures() {
- installFixturesFor(null); // ie current user
- return "Example fixtures installed";
- }
-
- // //////////////////////////////////////
-
- @Hidden
- @Prototype
- public String installFixturesForUser(@Named("User") String user) {
- installFixturesFor(user);
- return "Example fixtures installed for " + user;
- }
- public String default0InstallFixturesForUser() {
- return "guest";
- }
- public List<String> choices0InstallFixturesForUser() {
- return Lists.newArrayList("guest", "sven", "dick", "bob", "joe");
- }
-
- // //////////////////////////////////////
-
- @Hidden
- @Prototype
- public ToDoItem installFixturesAndReturnFirst() {
- installFixtures();
- List<ToDoItem> notYetComplete = toDoItems.notYetComplete();
- return !notYetComplete.isEmpty() ? notYetComplete.get(0) : null;
- }
-
- // //////////////////////////////////////
-
- private static void installFixturesFor(String user) {
- final FixturesInstallerDelegate installer = new FixturesInstallerDelegate().withOverride();
- installer.addFixture(new ToDoItemsFixture(user));
- installer.installFixtures();
- }
-
- // //////////////////////////////////////
-
- private ToDoItems toDoItems;
- public void injectToDoItems(ToDoItems toDoItems) {
- this.toDoItems = toDoItems;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/55c4ea85/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
index 87f1857..a6f1e96 100644
--- a/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
+++ b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
@@ -163,7 +163,7 @@ isis.services = \
30:webapp.admin.Admin,\
30:webapp.admin.AdminContributions,\
\
- 40:webapp.prototyping.ToDoItemsFixturesService,\
+ 40:fixture.todo.ToDoItemsFixturesService,\
40:webapp.prototyping.DeveloperUtilities,\
40:webapp.prototyping.ExternalLinksService,\
\
@@ -189,6 +189,7 @@ isis.services = \
org.apache.isis.applib.annotation.Bulk$InteractionContext,\
org.apache.isis.applib.services.scratchpad.Scratchpad,\
org.apache.isis.applib.services.queryresultscache.QueryResultsCache,\
+ org.apache.isis.applib.services.classdiscovery.ClassDiscoveryServiceUsingReflections,\
\
# JDO implementation of the EventBusService, \
org.apache.isis.objectstore.jdo.datanucleus.service.eventbus.EventBusServiceJdo,\