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:34:27 UTC
[1/5] git commit: ISIS-776: initial implementation
Repository: isis
Updated Branches:
refs/heads/ISIS-550 2637a0551 -> fe05886c7
ISIS-776: initial implementation
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/98758f7c
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/98758f7c
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/98758f7c
Branch: refs/heads/ISIS-550
Commit: 98758f7c65479a56c685a3b494ca20257ec82d5e
Parents: 31acb0f
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri May 9 15:26:07 2014 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri May 9 15:29:49 2014 +0100
----------------------------------------------------------------------
.../components/widgets/cssmenu/CssMenuPanel.css | 2 +-
.../viewer/wicket/ui/pages/PageAbstract.css | 2 +-
.../isis/applib/DomainObjectContainer.java | 6 +
.../fixturescripts/CompositeFixtureScript.java | 90 +++++++++
.../applib/fixturescripts/FixtureResult.java | 68 +++++++
.../fixturescripts/FixtureResultList.java | 72 +++++++
.../applib/fixturescripts/FixtureScript.java | 196 +++++++++++++++++++
.../applib/fixturescripts/FixtureScripts.java | 167 ++++++++++++++++
.../fixturescripts/SimpleFixtureScript.java | 56 ++++++
.../metamodel/adapter/DomainObjectServices.java | 2 +
.../noruntime/RuntimeContextNoRuntime.java | 5 +
.../container/DomainObjectContainerDefault.java | 11 ++
.../internal/RuntimeContextFromSession.java | 5 +
.../prototyping/ToDoItemResetForUser.java | 64 ++++++
.../prototyping/ToDoItemsCreateForUser.java | 96 +++++++++
.../prototyping/ToDoItemsDeleteForUser.java | 51 +++++
.../prototyping/ToDoItemsFixturesService.java | 14 +-
17 files changed, 902 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuPanel.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuPanel.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuPanel.css
index 74df67a..89991d0 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuPanel.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/widgets/cssmenu/CssMenuPanel.css
@@ -318,7 +318,7 @@
}
.entityActions a.prototype span {
- color: #CCCC00;
+ color: #DBDB4D;
font-style: italic;
}
.entityActions a.prototype {
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
----------------------------------------------------------------------
diff --git a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
index dc580e7..a6557f6 100644
--- a/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
+++ b/component/viewer/wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/pages/PageAbstract.css
@@ -286,7 +286,7 @@ colors
}
#applicationActions .cssMenuPanel .menuh a.prototype span {
- color: #CCCC00;
+ color: #DBDB4D;
font-style: italic;
}
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/core/applib/src/main/java/org/apache/isis/applib/DomainObjectContainer.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/DomainObjectContainer.java b/core/applib/src/main/java/org/apache/isis/applib/DomainObjectContainer.java
index edabe32..170e86d 100644
--- a/core/applib/src/main/java/org/apache/isis/applib/DomainObjectContainer.java
+++ b/core/applib/src/main/java/org/apache/isis/applib/DomainObjectContainer.java
@@ -210,6 +210,12 @@ public interface DomainObjectContainer {
<T> T newInstance(final Class<T> ofType, final Object object);
// ////////////////////////////////////////////////////////////////
+ // injectServicesInto
+ // ////////////////////////////////////////////////////////////////
+
+ <T> T injectServicesInto(final T domainObject);
+
+ // ////////////////////////////////////////////////////////////////
// isValid, validate
// ////////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/CompositeFixtureScript.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/CompositeFixtureScript.java b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/CompositeFixtureScript.java
new file mode 100644
index 0000000..aec034a
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/CompositeFixtureScript.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.isis.applib.fixturescripts;
+
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+import org.apache.isis.applib.annotation.Named;
+
+@Named("Composite Script")
+public abstract class CompositeFixtureScript extends FixtureScript {
+
+ private static Discoverability defaultDiscoverability() {
+ return Discoverability.DISCOVERABLE;
+ }
+
+ public CompositeFixtureScript(final String localName) {
+ this(localName, localName, defaultDiscoverability());
+ }
+ public CompositeFixtureScript(String friendlyName, final String localName) {
+ this(friendlyName, localName, defaultDiscoverability());
+ }
+ public CompositeFixtureScript(final FixtureScript parent, String friendlyName, final String localName) {
+ this(parent, friendlyName, localName, defaultDiscoverability());
+ }
+
+ public CompositeFixtureScript(final String localName, Discoverability discoverability) {
+ super(localName, localName, discoverability);
+ }
+ public CompositeFixtureScript(String friendlyName, final String localName, Discoverability discoverability) {
+ super(friendlyName, localName, discoverability);
+ }
+ public CompositeFixtureScript(final FixtureScript parent, String friendlyName, final String localName, Discoverability discoverability) {
+ super(parent, friendlyName, localName, discoverability);
+ }
+
+ // //////////////////////////////////////
+
+ private final List<FixtureScript> children = Lists.newArrayList();
+ /**
+ * Adds a child {@link FixtureScript fixture script} (simply using its default name).
+ */
+ protected final void add(FixtureScript fixtureScript) {
+ add(null, fixtureScript);
+ }
+ /**
+ * Adds a child {@link FixtureScript fixture script}, overriding its default name with one more
+ * meaningful in the context of this fixture.
+ */
+ protected final void add(String localNameOverride, FixtureScript fixtureScript) {
+ fixtureScript.setParentPath(pathWith(""));
+ if(localNameOverride != null) {
+ fixtureScript.setLocalName(localNameOverride);
+ }
+ getContainer().injectServicesInto(fixtureScript);
+ children.add(fixtureScript);
+ }
+
+ // //////////////////////////////////////
+
+ /**
+ * Mandatory hook method.
+ */
+ protected abstract void addChildren();
+
+ protected void doRun(FixtureResultList fixtureResults) {
+ addChildren();
+ for (final FixtureScript child : children) {
+ child.doRun(fixtureResults);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResult.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResult.java b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResult.java
new file mode 100644
index 0000000..095327f
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResult.java
@@ -0,0 +1,68 @@
+/*
+ * 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.fixturescripts;
+
+import org.apache.isis.applib.AbstractViewModel;
+import org.apache.isis.applib.annotation.MemberOrder;
+import org.apache.isis.applib.annotation.Title;
+
+public class FixtureResult extends AbstractViewModel {
+
+ @Override
+ public String viewModelMemento() {
+ return fixtureScripts.mementoFor(this);
+ }
+
+ @Override
+ public void viewModelInit(String memento) {
+ fixtureScripts.initOf(memento, this);
+ }
+
+ // //////////////////////////////////////
+
+ private String key;
+
+ @Title(sequence="1", append=": ")
+ @MemberOrder(sequence="1")
+ public String getKey() {
+ return key;
+ }
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ // //////////////////////////////////////
+
+ private Object object;
+
+ @Title(sequence="2")
+ @MemberOrder(sequence="1")
+ public Object getObject() {
+ return object;
+ }
+ public void setObject(Object object) {
+ this.object = object;
+ }
+
+ // //////////////////////////////////////
+
+ @javax.inject.Inject
+ FixtureScripts fixtureScripts;
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResultList.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResultList.java b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResultList.java
new file mode 100644
index 0000000..7527675
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureResultList.java
@@ -0,0 +1,72 @@
+/*
+ * 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.fixturescripts;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+/**
+ * Collecting parameter.
+ */
+public class FixtureResultList {
+
+ private final FixtureScripts fixtureScripts;
+
+ FixtureResultList(FixtureScripts fixtureScripts) {
+ this.fixtureScripts = fixtureScripts;
+ }
+
+ // //////////////////////////////////////
+
+
+ private final List<FixtureResult> list = Lists.newArrayList();
+
+ public <T> T add(final FixtureScript script, final T object) {
+ return add(script, nextItemFor(script), object);
+ }
+
+ public <T> T add(final FixtureScript script, final String key, final T object) {
+ final FixtureResult fr = fixtureScripts.newFixtureResult(script, key, object);
+ list.add(fr);
+ return object;
+ }
+
+ public List<FixtureResult> getResults() {
+ return list;
+ }
+
+ // //////////////////////////////////////
+
+ private final Map<FixtureScript, AtomicInteger> itemNumberByScript = Maps.newHashMap();
+
+ String nextItemFor(final FixtureScript script) {
+ AtomicInteger atomicInteger = itemNumberByScript.get(script);
+ if(atomicInteger == null) {
+ atomicInteger = new AtomicInteger();
+ itemNumberByScript.put(script, atomicInteger);
+ }
+ return "item-"+atomicInteger.incrementAndGet();
+ }
+
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/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
new file mode 100644
index 0000000..53262e0
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScript.java
@@ -0,0 +1,196 @@
+/*
+ * 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.fixturescripts;
+
+import java.util.List;
+
+import org.apache.isis.applib.AbstractViewModel;
+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;
+
+@Named("Script")
+public abstract class FixtureScript extends AbstractViewModel {
+
+ protected static final String PATH_SEPARATOR = "/";
+
+ // //////////////////////////////////////
+
+ /**
+ * Whether this fixture script should be automatically discoverable or not.
+ */
+ public enum Discoverability {
+ /**
+ * the fixture script is discoverable and so will be listed by the
+ * {@link FixtureScripts#runFixtureScript(FixtureScript) run fixture script} action
+ */
+ DISCOVERABLE,
+ /**
+ * The fixture script is non-discoverable and so will <i>not</i> be listed by the
+ * {@link FixtureScripts#runFixtureScript(FixtureScript) run fixture script} action
+ */
+ NON_DISCOVERABLE
+ }
+
+ // //////////////////////////////////////
+
+ public FixtureScript(
+ final String friendlyName,
+ final String localName,
+ final Discoverability discoverability) {
+ this(null, friendlyName, localName, discoverability);
+ }
+ public FixtureScript(
+ final FixtureScript parent,
+ final String friendlyName,
+ final String localName,
+ final Discoverability discoverability) {
+ this.localName = ensureNotNull("localName", localName);
+ this.friendlyName = ensureNotNull("friendlyName", friendlyName);
+ this.parentPath = parentPathOf(parent);
+ this.discoverability = discoverability;
+ }
+
+ private static String parentPathOf(FixtureScript parent) {
+ return parent != null? parent.getParentPath() + PATH_SEPARATOR : "";
+ }
+
+ // for subclasses
+ protected static String ensureNotNull(String name, String val) {
+ if(val == null) {
+ throw new IllegalArgumentException(name + " cannot be null");
+ }
+ return val;
+ }
+
+ // //////////////////////////////////////
+
+ @Override
+ public String viewModelMemento() {
+ return fixtureScripts.mementoFor(this);
+ }
+
+ @Override
+ public void viewModelInit(String mementoStr) {
+ fixtureScripts.initOf(mementoStr, this);
+ }
+
+ // //////////////////////////////////////
+
+ @Hidden
+ public String getQualifiedName() {
+ return getParentPath() + getLocalName();
+ }
+
+ // //////////////////////////////////////
+
+ private String friendlyName;
+
+ @Title
+ @Hidden
+ public String getFriendlyName() {
+ return friendlyName;
+ }
+ public void setFriendlyName(String friendlyName) {
+ this.friendlyName = friendlyName;
+ }
+
+ // //////////////////////////////////////
+
+ private String localName;
+ /**
+ * Will always be populated, initially by the default name, but can be
+ * {@link #setLocalName(String) overridden} if {@link CompositeFixtureScript#add(String, FixtureScript) reused} within a {@link CompositeFixtureScript composite fixture script}.
+ */
+ @Hidden
+ public String getLocalName() {
+ return localName;
+ }
+ public void setLocalName(String localName) {
+ this.localName = localName;
+ }
+
+ // //////////////////////////////////////
+
+ private String parentPath;
+
+ /**
+ * Path of the parent of this script (if any), with trailing period.
+ */
+ @Hidden
+ public String getParentPath() {
+ return parentPath;
+ }
+ public void setParentPath(String parentPath) {
+ this.parentPath = parentPath;
+ }
+
+ // //////////////////////////////////////
+
+ private Discoverability discoverability;
+
+ /**
+ * Whether this fixture script is {@link Discoverability discoverable} (in other words
+ * whether it will be listed to be run in the {@link FixtureScripts#runFixtureScript(FixtureScript) run fixture script} action.
+ *
+ * <p>
+ * By default {@link CompositeFixtureScript}s are {@link Discoverability#DISCOVERABLE discoverable}, while
+ * {@link SimpleFixtureScript}s are {@link Discoverability#NON_DISCOVERABLE not}. This can be overridden in the
+ * constructor, however.
+ */
+ @Hidden
+ public boolean isDiscoverable() {
+ return discoverability == Discoverability.DISCOVERABLE;
+ }
+ public void setDiscoverability(Discoverability discoverability) {
+ this.discoverability = discoverability;
+ }
+
+ // //////////////////////////////////////
+
+ @Programmatic
+ public final List<FixtureResult> run() {
+ FixtureResultList fixtureResults = new FixtureResultList(fixtureScripts);
+ doRun(fixtureResults);
+ return fixtureResults.getResults();
+ }
+
+ @Programmatic
+ protected abstract void doRun(FixtureResultList fixtureResults);
+
+ // //////////////////////////////////////
+
+ @Programmatic
+ String pathWith(String subkey) {
+ return (getQualifiedName() != null? getQualifiedName() + PATH_SEPARATOR: "") + subkey;
+ }
+
+ // //////////////////////////////////////
+
+
+
+ // //////////////////////////////////////
+
+ @javax.inject.Inject
+ protected FixtureScripts fixtureScripts;
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/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
new file mode 100644
index 0000000..d8f6b0a
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/FixtureScripts.java
@@ -0,0 +1,167 @@
+/*
+ * 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.fixturescripts;
+
+import java.lang.reflect.Constructor;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.PostConstruct;
+
+import com.google.common.collect.Lists;
+
+import org.reflections.Reflections;
+import org.reflections.scanners.SubTypesScanner;
+import org.reflections.util.ClasspathHelper;
+
+import org.apache.isis.applib.AbstractService;
+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.memento.MementoService;
+import org.apache.isis.applib.services.memento.MementoService.Memento;
+import org.apache.isis.applib.util.ObjectContracts;
+
+public abstract class FixtureScripts extends AbstractService {
+
+ private final String packagePrefix;
+
+ /**
+ * @param packagePrefix - to search for fixture script implementations, eg "com.mycompany"
+ */
+ public FixtureScripts(String packagePrefix) {
+ this.packagePrefix = packagePrefix;
+ }
+
+ // //////////////////////////////////////
+
+ private final List<FixtureScript> fixtureScriptList = Lists.newArrayList();
+
+ @PostConstruct
+ public void init() {
+ findAndInstantiateFixtureScripts(fixtureScriptList);
+ }
+
+ private void findAndInstantiateFixtureScripts(List<FixtureScript> fixtureScriptList) {
+ final Set<Class<? extends FixtureScript>> classes = findFixtureScriptClasses();
+ for (final Class<? extends FixtureScript> fixtureScriptCls : classes) {
+ final String packageName = fixtureScriptCls.getPackage().getName();
+ if(!packageName.startsWith(packagePrefix)) {
+ continue;
+ }
+ final FixtureScript fs = newFixtureScript(fixtureScriptCls);
+ if(fs != null) {
+ fixtureScriptList.add(fs);
+ }
+ }
+ Collections.sort(fixtureScriptList, new Comparator<FixtureScript>() {
+ @Override
+ public int compare(FixtureScript o1, FixtureScript o2) {
+ return ObjectContracts.compare(o1, o2, "friendlyName,qualifiedName");
+ }
+ });
+ }
+
+ 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();
+ final FixtureScript template = constructor.newInstance();
+ if(!template.isDiscoverable()) {
+ return null;
+ }
+ return container.newViewModelInstance(fixtureScriptCls, mementoFor(template));
+ } catch(Exception ex) {
+ // ignore if does not have a no-arg constructor or cannot be instantiated
+ return null;
+ }
+ }
+
+ // //////////////////////////////////////
+
+ @Prototype
+ public List<FixtureResult> runFixtureScript(final FixtureScript fixtureScript) {
+ return fixtureScript.run();
+ }
+ public List<FixtureScript> choices0RunFixtureScript() {
+ return fixtureScriptList;
+ }
+ public String disableRunFixtureScript(final FixtureScript fixtureScript) {
+ return fixtureScriptList.isEmpty()? "No fixture scripts found under package '" + packagePrefix + "'": null;
+ }
+
+ // //////////////////////////////////////
+
+ String mementoFor(FixtureScript fs) {
+ return mementoService.create()
+ .set("path", fs.getParentPath())
+ .asString();
+ }
+ void initOf(String mementoStr, FixtureScript fs) {
+ Memento memento = mementoService.parse(mementoStr);
+ fs.setParentPath(memento.get("path", String.class));
+ }
+
+ // //////////////////////////////////////
+
+ String mementoFor(FixtureResult fr) {
+ return mementoService.create()
+ .set("key", fr.getKey())
+ .set("object", bookmarkService.bookmarkFor(fr.getObject()))
+ .asString();
+ }
+ void initOf(String mementoStr, FixtureResult fr) {
+ Memento memento = mementoService.parse(mementoStr);
+ fr.setKey(memento.get("key", String.class));
+ fr.setObject(bookmarkService.lookup(memento.get("object", Bookmark.class)));
+ }
+
+ FixtureResult newFixtureResult(FixtureScript script, String subkey, Object object) {
+ String mementoFor = mementoFor(script, subkey, object);
+ return container.newViewModelInstance(FixtureResult.class, mementoFor);
+ }
+
+ private String mementoFor(FixtureScript script, String subkey, Object object) {
+ final FixtureResult template = new FixtureResult();
+ template.setKey(script.pathWith(subkey));
+ template.setObject(object);
+ return mementoFor(template);
+ }
+
+ // //////////////////////////////////////
+
+ @javax.inject.Inject
+ private MementoService mementoService;
+
+ @javax.inject.Inject
+ private BookmarkService bookmarkService;
+
+ @javax.inject.Inject
+ private DomainObjectContainer container;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/SimpleFixtureScript.java
----------------------------------------------------------------------
diff --git a/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/SimpleFixtureScript.java b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/SimpleFixtureScript.java
new file mode 100644
index 0000000..a9f4079
--- /dev/null
+++ b/core/applib/src/main/java/org/apache/isis/applib/fixturescripts/SimpleFixtureScript.java
@@ -0,0 +1,56 @@
+/*
+ * 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.fixturescripts;
+
+import org.apache.isis.applib.annotation.Named;
+import org.apache.isis.applib.annotation.Programmatic;
+
+@Named("Simple Script")
+public abstract class SimpleFixtureScript extends FixtureScript {
+
+ private static Discoverability defaultDiscoverability() {
+ return Discoverability.NON_DISCOVERABLE;
+ }
+
+ public SimpleFixtureScript(String localName) {
+ this(localName, defaultDiscoverability());
+ }
+ public SimpleFixtureScript(String friendlyName, String localName) {
+ this(friendlyName, localName, defaultDiscoverability());
+ }
+ public SimpleFixtureScript(FixtureScript parent, String friendlyName, String localName) {
+ this(parent, friendlyName, localName, defaultDiscoverability());
+ }
+
+ public SimpleFixtureScript(String localName, Discoverability discoverability) {
+ this(localName, localName, discoverability);
+ }
+ public SimpleFixtureScript(String friendlyName, String localName, Discoverability discoverability) {
+ super(friendlyName, localName, discoverability);
+ }
+ public SimpleFixtureScript(FixtureScript parent, String friendlyName, String localName, Discoverability discoverability) {
+ super(parent, friendlyName, localName, discoverability);
+ }
+
+ // //////////////////////////////////////
+
+ @Programmatic
+ protected abstract void doRun(FixtureResultList fixtureResults);
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/DomainObjectServices.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/DomainObjectServices.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/DomainObjectServices.java
index a365b05..f559c4c 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/DomainObjectServices.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/DomainObjectServices.java
@@ -56,6 +56,8 @@ public interface DomainObjectServices extends Injectable {
*/
ObjectAdapter createAggregatedInstance(ObjectSpecification spec, ObjectAdapter parent);
+ void injectServicesInto(Object domainObject);
+
// ///////////////////////////////////////////
// retrieve
// ///////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java
index 2f1da7c..f9dfa76 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/runtimecontext/noruntime/RuntimeContextNoRuntime.java
@@ -257,6 +257,11 @@ public class RuntimeContextNoRuntime extends RuntimeContextAbstract {
throw new UnsupportedOperationException("Not supported by this implementation of RuntimeContext");
}
+ @Override
+ public void injectServicesInto(Object domainObject) {
+ throw new UnsupportedOperationException("Not supported by this implementation of RuntimeContext");
+ }
+
};
localizationProvider = new LocalizationProviderAbstract() {
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java
index 8204559..59973a0 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/services/container/DomainObjectContainerDefault.java
@@ -201,6 +201,17 @@ public class DomainObjectContainerDefault implements DomainObjectContainer, Que
remove(object);
}
+
+ // //////////////////////////////////////////////////////////////////
+ // injectServicesInto
+ // //////////////////////////////////////////////////////////////////
+
+ @Override
+ public <T> T injectServicesInto(T domainObject) {
+ getDomainObjectServices().injectServicesInto(domainObject);
+ return domainObject;
+ }
+
// //////////////////////////////////////////////////////////////////
// resolve, objectChanged
// //////////////////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
index 02fa73e..09437cc 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/persistence/internal/RuntimeContextFromSession.java
@@ -264,6 +264,11 @@ public class RuntimeContextFromSession extends RuntimeContextAbstract {
return RuntimeContextFromSession.this.getPropertyNames();
}
+ @Override
+ public void injectServicesInto(Object domainObject) {
+ getPersistenceSession().getServicesInjector().injectServicesInto(domainObject);
+ }
+
};
this.querySubmitter = new QuerySubmitterAbstract() {
http://git-wip-us.apache.org/repos/asf/isis/blob/98758f7c/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
new file mode 100644
index 0000000..2586c17
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemResetForUser.java
@@ -0,0 +1,64 @@
+/*
+ * 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/98758f7c/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
new file mode 100644
index 0000000..b70e5b0
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsCreateForUser.java
@@ -0,0 +1,96 @@
+/*
+ * 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/98758f7c/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
new file mode 100644
index 0000000..81f0b65
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/webapp/src/main/java/webapp/prototyping/ToDoItemsDeleteForUser.java
@@ -0,0 +1,51 @@
+/*
+ * 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/98758f7c/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
index 1417ff4..2eebaab 100644
--- 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
@@ -26,17 +26,23 @@ import dom.todo.ToDoItem;
import dom.todo.ToDoItems;
import fixture.todo.ToDoItemsFixture;
-import org.apache.isis.applib.AbstractService;
+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 AbstractService {
+public class ToDoItemsFixturesService extends FixtureScripts {
+ public ToDoItemsFixturesService() {
+ super("webapp.prototyping");
+ }
+
+ @Hidden
@Prototype
public String installFixtures() {
installFixturesFor(null); // ie current user
@@ -45,6 +51,7 @@ public class ToDoItemsFixturesService extends AbstractService {
// //////////////////////////////////////
+ @Hidden
@Prototype
public String installFixturesForUser(@Named("User") String user) {
installFixturesFor(user);
@@ -59,6 +66,7 @@ public class ToDoItemsFixturesService extends AbstractService {
// //////////////////////////////////////
+ @Hidden
@Prototype
public ToDoItem installFixturesAndReturnFirst() {
installFixtures();
@@ -75,7 +83,7 @@ public class ToDoItemsFixturesService extends AbstractService {
}
// //////////////////////////////////////
-
+
private ToDoItems toDoItems;
public void injectToDoItems(ToDoItems toDoItems) {
this.toDoItems = toDoItems;
[5/5] git commit: ISIS-550: fixing unit test.
Posted by da...@apache.org.
ISIS-550: fixing unit test.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/fe05886c
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/fe05886c
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/fe05886c
Branch: refs/heads/ISIS-550
Commit: fe05886c7ad70560419647bbee0c220f466a0046
Parents: f883304
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri May 9 18:33:48 2014 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri May 9 18:33:48 2014 +0100
----------------------------------------------------------------------
.../facets/ImperativeFacetUtilsTest.java | 47 ++++++++++++++------
1 file changed, 33 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/fe05886c/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/ImperativeFacetUtilsTest.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/ImperativeFacetUtilsTest.java b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/ImperativeFacetUtilsTest.java
index 5efadc3..feee4dd 100644
--- a/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/ImperativeFacetUtilsTest.java
+++ b/core/metamodel/src/test/java/org/apache/isis/core/metamodel/facets/ImperativeFacetUtilsTest.java
@@ -30,20 +30,26 @@ import com.google.common.collect.Lists;
import org.jmock.Expectations;
import org.jmock.Mockery;
+import org.jmock.auto.Mock;
import org.jmock.integration.junit4.JMock;
import org.jmock.integration.junit4.JUnit4Mockery;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.apache.isis.applib.filter.Filter;
import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.spec.feature.ObjectMember;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
+import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
import org.apache.isis.core.unittestsupport.jmocking.JavassistImposteriser;
-@RunWith(JMock.class)
public class ImperativeFacetUtilsTest {
+ @Rule
+ public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
+
public static class Customer {
private String firstName;
@@ -58,31 +64,45 @@ public class ImperativeFacetUtilsTest {
}
- private final Mockery context = new JUnit4Mockery() {
- {
- setImposteriser(JavassistImposteriser.INSTANCE);
- }
- };
-
+ @Mock
private ObjectMember mockObjectMember;
+
+ public static interface ImperativeFacetAndFacet extends ImperativeFacet, Facet {}
+ @Mock
+ private ImperativeFacetAndFacet mockImperativeFacet;
+
private Method method;
@Before
public void setUp() throws Exception {
- mockObjectMember = context.mock(ObjectMember.class);
method = Customer.class.getDeclaredMethod("getFirstName");
+
+ context.checking(new Expectations() {
+ {
+ allowing(mockImperativeFacet).getMethods();
+ will(returnValue(Lists.newArrayList(method)));
+
+ allowing(mockImperativeFacet).impliesResolve();
+ will(returnValue(true));
+
+ allowing(mockImperativeFacet).impliesObjectChanged();
+ will(returnValue(true));
+ }
+ });
+
}
@SuppressWarnings("unchecked")
@Test
public void getImperativeFacetsWhenHasNone() throws Exception {
+
context.checking(new Expectations() {
{
- one(mockObjectMember).getFacets(with(any(Filter.class)));
+ oneOf(mockObjectMember).getFacets(with(any(Filter.class)));
will(returnValue(Lists.newArrayList()));
}
});
- final ImperativeFacet.Flags flags = ImperativeFacetUtils.getImperativeFacetFlags(mockObjectMember, method);
+ final ImperativeFacet.Flags flags = ImperativeFacet.Util.getImperativeFacetFlags(mockObjectMember, method);
assertThat(flags, is(not(nullValue())));
assertThat(flags.impliesResolve(), is(false));
assertThat(flags.impliesObjectChanged(), is(false));
@@ -91,14 +111,13 @@ public class ImperativeFacetUtilsTest {
@SuppressWarnings("unchecked")
@Test
public void getImperativeFacetsWhenHasOneImperativeFacet() throws Exception {
- final ImperativeFacet imperativeFacet = null;
context.checking(new Expectations() {
{
- one(mockObjectMember).getFacets(with(any(Filter.class)));
- will(returnValue(Lists.newArrayList((Facet) imperativeFacet)));
+ oneOf(mockObjectMember).getFacets(with(any(Filter.class)));
+ will(returnValue(Lists.newArrayList((Facet) mockImperativeFacet)));
}
});
- final ImperativeFacet.Flags flags = ImperativeFacetUtils.getImperativeFacetFlags(mockObjectMember, method);
+ final ImperativeFacet.Flags flags = ImperativeFacet.Util.getImperativeFacetFlags(mockObjectMember, method);
assertThat(flags, is(not(nullValue())));
// TODO: need more tests here, these don't go deep enough...
}
[4/5] git commit: ISIS-550: PostsCollectionRemovedFromEvent
implemented. Subscription Tests needed
Posted by da...@apache.org.
ISIS-550: PostsCollectionRemovedFromEvent implemented. Subscription Tests needed
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/f8833040
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/f8833040
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/f8833040
Branch: refs/heads/ISIS-550
Commit: f8833040119f72d41e0a7f7442725f4b2e118184
Parents: 1dac3ed
Author: Oscar Bou <os...@apache.org>
Authored: Fri May 9 13:47:23 2014 +0200
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri May 9 17:58:45 2014 +0100
----------------------------------------------------------------------
.../event/PostsCollectionAddedToEventFacet.java | 2 -
.../PostsCollectionRemovedFromEventFacet.java | 35 ++++
...CollectionRemovedFromEventFacetAbstract.java | 55 ++++++
...tsCollectionAddedToEventFacetAnnotation.java | 1 -
...nRemovedFromEventAnnotationFacetFactory.java | 78 +++++++++
...llectionRemovedFromEventFacetAnnotation.java | 167 +++++++++++++++++++
.../dflt/ProgrammingModelFacetsJava5.java | 2 +
...emovedEventFacetAnnotationTest_newEvent.java | 50 ++++++
.../dom/src/main/java/dom/todo/ToDoItem.java | 9 +-
.../java/dom/todo/ToDoItemSubscriptions.java | 7 +
.../ToDoItemTest_dependencies_addedEvent.java | 85 ++++++++++
11 files changed, 487 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/f8833040/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionAddedToEventFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionAddedToEventFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionAddedToEventFacet.java
index 91d7d3c..72edf00 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionAddedToEventFacet.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionAddedToEventFacet.java
@@ -21,8 +21,6 @@ package org.apache.isis.core.metamodel.facets.collections.event;
import org.apache.isis.applib.services.eventbus.CollectionAddedToEvent;
import org.apache.isis.applib.services.eventbus.EventBusService;
-import org.apache.isis.applib.services.eventbus.PropertyChangedEvent;
-import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.facetapi.MultiTypedFacet;
import org.apache.isis.core.metamodel.facets.PostsEventWithWrapperPolicy;
import org.apache.isis.core.metamodel.facets.SingleValueFacet;
http://git-wip-us.apache.org/repos/asf/isis/blob/f8833040/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionRemovedFromEventFacet.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionRemovedFromEventFacet.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionRemovedFromEventFacet.java
new file mode 100644
index 0000000..d351f84
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionRemovedFromEventFacet.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.metamodel.facets.collections.event;
+
+import org.apache.isis.applib.services.eventbus.CollectionRemovedFromEvent;
+import org.apache.isis.applib.services.eventbus.EventBusService;
+import org.apache.isis.core.metamodel.facetapi.MultiTypedFacet;
+import org.apache.isis.core.metamodel.facets.PostsEventWithWrapperPolicy;
+import org.apache.isis.core.metamodel.facets.SingleValueFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionRemoveFromFacet;
+
+/**
+ * Indicates that (the specified subclass of) {@link CollectionRemovedFromEvent} should be posted to the
+ * {@link EventBusService}.
+ */
+public interface PostsCollectionRemovedFromEventFacet extends SingleValueFacet<Class<? extends CollectionRemovedFromEvent<?,?>>>, CollectionRemoveFromFacet, MultiTypedFacet, PostsEventWithWrapperPolicy {
+}
+
http://git-wip-us.apache.org/repos/asf/isis/blob/f8833040/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionRemovedFromEventFacetAbstract.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionRemovedFromEventFacetAbstract.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionRemovedFromEventFacetAbstract.java
new file mode 100644
index 0000000..a317467
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/facets/collections/event/PostsCollectionRemovedFromEventFacetAbstract.java
@@ -0,0 +1,55 @@
+/*
+ * 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.core.metamodel.facets.collections.event;
+
+import org.apache.isis.applib.annotation.WrapperPolicy;
+import org.apache.isis.applib.services.eventbus.CollectionRemovedFromEvent;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.SingleValueFacetAbstract;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionRemoveFromFacet;
+
+
+public abstract class PostsCollectionRemovedFromEventFacetAbstract
+ extends SingleValueFacetAbstract<Class<? extends CollectionRemovedFromEvent<?,?>>>
+ implements PostsCollectionRemovedFromEventFacet {
+
+ public static Class<? extends Facet> type() {
+
+ // the "primary" type is CollectionAddToFacet rather than PostsRemovedFromCollectionEventFacet
+ // so that this facet can wrap an existing (via setUnderlying).
+
+ //return PostsRemovedFromCollectionEventFacet.class;
+ return CollectionRemoveFromFacet.class;
+ }
+
+ private final WrapperPolicy wrapperPolicy;
+
+ public PostsCollectionRemovedFromEventFacetAbstract(Class<? extends CollectionRemovedFromEvent<?, ?>> changedEventType, WrapperPolicy wrapperPolicy, FacetHolder holder) {
+ super(type(), changedEventType, holder);
+ this.wrapperPolicy = wrapperPolicy;
+ }
+
+ @Override
+ public WrapperPolicy getWrapperPolicy() {
+ return wrapperPolicy;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/f8833040/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionAddedToEventFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionAddedToEventFacetAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionAddedToEventFacetAnnotation.java
index f1e30ec..bd69339 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionAddedToEventFacetAnnotation.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionAddedToEventFacetAnnotation.java
@@ -35,7 +35,6 @@ import org.apache.isis.core.metamodel.adapter.ServicesProvider;
import org.apache.isis.core.metamodel.adapter.util.AdapterUtils;
import org.apache.isis.core.metamodel.facetapi.Facet;
import org.apache.isis.core.metamodel.facetapi.FacetHolder;
-import org.apache.isis.core.metamodel.facetapi.FacetUtil;
import org.apache.isis.core.metamodel.facets.accessor.PropertyOrCollectionAccessorFacet;
import org.apache.isis.core.metamodel.facets.collections.event.PostsCollectionAddedToEventFacet;
import org.apache.isis.core.metamodel.facets.collections.event.PostsCollectionAddedToEventFacetAbstract;
http://git-wip-us.apache.org/repos/asf/isis/blob/f8833040/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedFromEventAnnotationFacetFactory.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedFromEventAnnotationFacetFactory.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedFromEventAnnotationFacetFactory.java
new file mode 100644
index 0000000..67e8871
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedFromEventAnnotationFacetFactory.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.core.progmodel.facets.collections.event;
+
+import java.lang.reflect.Method;
+
+import org.apache.isis.applib.annotation.PostsCollectionRemovedFromEvent;
+import org.apache.isis.applib.annotation.WrapperPolicy;
+import org.apache.isis.applib.services.eventbus.CollectionRemovedFromEvent;
+import org.apache.isis.core.metamodel.adapter.ServicesProvider;
+import org.apache.isis.core.metamodel.adapter.ServicesProviderAware;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facetapi.FacetUtil;
+import org.apache.isis.core.metamodel.facetapi.FeatureType;
+import org.apache.isis.core.metamodel.facets.Annotations;
+import org.apache.isis.core.metamodel.facets.FacetFactoryAbstract;
+import org.apache.isis.core.metamodel.facets.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.collections.event.PostsCollectionRemovedFromEventFacet;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionRemoveFromFacet;
+
+public class PostsCollectionRemovedFromEventAnnotationFacetFactory extends FacetFactoryAbstract implements ServicesProviderAware {
+
+ private ServicesProvider servicesProvider;
+
+ public PostsCollectionRemovedFromEventAnnotationFacetFactory() {
+ super(FeatureType.COLLECTIONS_ONLY);
+ }
+
+ @Override
+ public void process(final ProcessMethodContext processMethodContext) {
+ final Method method = processMethodContext.getMethod();
+ FacetUtil.addFacet(create(method, processMethodContext.getFacetHolder()));
+ }
+
+ private PostsCollectionRemovedFromEventFacet create(Method method, final FacetHolder holder) {
+ final PostsCollectionRemovedFromEvent annotation = Annotations.getAnnotation(method, PostsCollectionRemovedFromEvent.class);
+ if(annotation == null) {
+ return null;
+ }
+
+ final PropertyOrCollectionAccessorFacet getterFacet = holder.getFacet(PropertyOrCollectionAccessorFacet.class);
+ if(getterFacet == null) {
+ return null;
+ }
+ final CollectionRemoveFromFacet collectionRemoveFromFacet = holder.getFacet(CollectionRemoveFromFacet.class);
+ if(collectionRemoveFromFacet == null) {
+ return null;
+ }
+ // the collectionRemoveFromFacet will end up as the underlying facet of the PostsCollectionRemovedFromEventFacetAnnotation
+
+ final Class<? extends CollectionRemovedFromEvent<?,?>> changedEventType = annotation.value();
+ final WrapperPolicy wrapperPolicy = annotation.wrapperPolicy();
+ return new PostsCollectionRemovedFromEventFacetAnnotation(changedEventType, wrapperPolicy, getterFacet, collectionRemoveFromFacet, servicesProvider, holder);
+ }
+
+ @Override
+ public void setServicesProvider(ServicesProvider servicesProvider) {
+ this.servicesProvider = servicesProvider;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/f8833040/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedFromEventFacetAnnotation.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedFromEventFacetAnnotation.java b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedFromEventFacetAnnotation.java
new file mode 100644
index 0000000..a19b55d
--- /dev/null
+++ b/core/metamodel/src/main/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedFromEventFacetAnnotation.java
@@ -0,0 +1,167 @@
+/*
+ * 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.core.progmodel.facets.collections.event;
+
+import java.lang.reflect.Field;
+import java.util.Collection;
+import java.util.List;
+
+import com.google.common.collect.Lists;
+
+import org.apache.isis.applib.FatalException;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.annotation.WrapperPolicy;
+import org.apache.isis.applib.services.eventbus.CollectionRemovedFromEvent;
+import org.apache.isis.applib.services.eventbus.EventBusService;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ServicesProvider;
+import org.apache.isis.core.metamodel.adapter.util.AdapterUtils;
+import org.apache.isis.core.metamodel.facetapi.Facet;
+import org.apache.isis.core.metamodel.facetapi.FacetHolder;
+import org.apache.isis.core.metamodel.facets.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.collections.event.PostsCollectionRemovedFromEventFacet;
+import org.apache.isis.core.metamodel.facets.collections.event.PostsCollectionRemovedFromEventFacetAbstract;
+import org.apache.isis.core.metamodel.facets.collections.modify.CollectionRemoveFromFacet;
+
+public class PostsCollectionRemovedFromEventFacetAnnotation extends
+ PostsCollectionRemovedFromEventFacetAbstract {
+
+ private final PropertyOrCollectionAccessorFacet getterFacet;
+ private final CollectionRemoveFromFacet collectionRemoveFromFacet;
+ private final ServicesProvider servicesProvider;
+
+ private EventBusService eventBusService;
+ private boolean searchedForEventBusService = false;
+
+ public PostsCollectionRemovedFromEventFacetAnnotation(
+ final Class<? extends CollectionRemovedFromEvent<?, ?>> eventType,
+ final WrapperPolicy wrapperPolicy,
+ final PropertyOrCollectionAccessorFacet getterFacet,
+ final CollectionRemoveFromFacet collectionRemoveFromFacet,
+ final ServicesProvider servicesProvider, final FacetHolder holder) {
+ super(eventType, wrapperPolicy, holder);
+ this.getterFacet = getterFacet;
+ this.collectionRemoveFromFacet = collectionRemoveFromFacet;
+ this.servicesProvider = servicesProvider;
+ }
+
+ @Override
+ public void remove(ObjectAdapter targetAdapter,
+ ObjectAdapter referencedObjectAdapter) {
+ if (this.collectionRemoveFromFacet == null) {
+ return;
+ }
+ eventBusService = getEventBusService();
+ if (eventBusService == null) {
+ collectionRemoveFromFacet.remove(targetAdapter,
+ referencedObjectAdapter);
+ return;
+ }
+
+ final Object referencedObject = AdapterUtils
+ .unwrap(referencedObjectAdapter);
+
+ // get hold of underlying collection
+ final Object collection = getterFacet.getProperty(targetAdapter);
+
+ // don't post event if the collections does not contain object
+ if (!((Collection<?>) collection).contains(referencedObject)) {
+ return;
+ }
+
+ // contains the element. So the event must be posted.
+ collectionRemoveFromFacet
+ .remove(targetAdapter, referencedObjectAdapter);
+
+ postEvent(targetAdapter, getIdentified().getIdentifier(),
+ referencedObject);
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ private void postEvent(final ObjectAdapter targetAdapter,
+ final Identifier identifier, final Object removedReference) {
+
+ final Object source = targetAdapter.getObject();
+ try {
+ final Class type = value();
+ final CollectionRemovedFromEvent<?, ?> event = newEvent(type, source,
+ identifier, removedReference);
+ eventBusService.post(event);
+ } catch (Exception e) {
+ throw new FatalException(e);
+ }
+ }
+
+ static <S, T> CollectionRemovedFromEvent<S, T> newEvent(
+ final Class<? extends CollectionRemovedFromEvent<S, T>> type,
+ final S source, final Identifier identifier, final T value)
+ throws InstantiationException, IllegalAccessException,
+ NoSuchFieldException {
+ final CollectionRemovedFromEvent<S, T> event = type.newInstance();
+
+ setField("source", event, source);
+ setField("identifier", event, identifier);
+ setField("value", event, value);
+ return event;
+ }
+
+ private static void setField(final String name,
+ final CollectionRemovedFromEvent<?, ?> event, final Object sourceValue)
+ throws NoSuchFieldException, IllegalAccessException {
+ final Field sourceField = CollectionRemovedFromEvent.class
+ .getDeclaredField(name);
+ sourceField.setAccessible(true);
+ sourceField.set(event, sourceValue);
+ }
+
+ private EventBusService getEventBusService() {
+ if (!searchedForEventBusService) {
+ final List<ObjectAdapter> serviceAdapters = servicesProvider
+ .getServices();
+ for (ObjectAdapter serviceAdapter : serviceAdapters) {
+ final Object service = serviceAdapter.getObject();
+ if (service instanceof EventBusService) {
+ eventBusService = (EventBusService) service;
+ break;
+ }
+ }
+ }
+ searchedForEventBusService = true;
+ return eventBusService;
+ }
+
+ // //////////////////////////////////////
+ // MultiTypedFacet
+ // //////////////////////////////////////
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends Facet>[] facetTypes() {
+ return Lists.newArrayList(type(), // ie CollectionRemoveFromFacet
+ PostsCollectionRemovedFromEventFacet.class).toArray(new Class[] {});
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T extends Facet> T getFacet(Class<T> facet) {
+ return (T) this;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/f8833040/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
index 1e4598c..ca75555 100644
--- a/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
+++ b/core/metamodel/src/main/java/org/apache/isis/progmodels/dflt/ProgrammingModelFacetsJava5.java
@@ -48,6 +48,7 @@ import org.apache.isis.core.progmodel.facets.collections.clear.CollectionClearFa
import org.apache.isis.core.progmodel.facets.collections.collection.CollectionFacetFactory;
import org.apache.isis.core.progmodel.facets.collections.disabled.fromimmutable.DisabledFacetForCollectionDerivedFromImmutableTypeFacetFactory;
import org.apache.isis.core.progmodel.facets.collections.event.PostsCollectionAddedToEventAnnotationFacetFactory;
+import org.apache.isis.core.progmodel.facets.collections.event.PostsCollectionRemovedFromEventAnnotationFacetFactory;
import org.apache.isis.core.progmodel.facets.collections.modify.CollectionAddRemoveAndValidateFacetFactory;
import org.apache.isis.core.progmodel.facets.collections.notpersisted.annotation.NotPersistedAnnotationForCollectionFacetFactory;
import org.apache.isis.core.progmodel.facets.collections.sortedby.SortedByAnnotationFacetFactory;
@@ -366,6 +367,7 @@ public final class ProgrammingModelFacetsJava5 extends ProgrammingModelAbstract
// must come after the property/collection/action accessor+mutator facet factories
addFactory(PostsPropertyChangedEventAnnotationFacetFactory.class);
addFactory(PostsCollectionAddedToEventAnnotationFacetFactory.class);
+ addFactory(PostsCollectionRemovedFromEventAnnotationFacetFactory.class);
addFactory(ImmutableMarkerInterfaceFacetFactory.class);
http://git-wip-us.apache.org/repos/asf/isis/blob/f8833040/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedEventFacetAnnotationTest_newEvent.java
----------------------------------------------------------------------
diff --git a/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedEventFacetAnnotationTest_newEvent.java b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedEventFacetAnnotationTest_newEvent.java
new file mode 100644
index 0000000..a713a74
--- /dev/null
+++ b/core/metamodel/src/test/java/org/apache/isis/core/progmodel/facets/collections/event/PostsCollectionRemovedEventFacetAnnotationTest_newEvent.java
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.isis.core.progmodel.facets.collections.event;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.Set;
+
+import org.junit.Test;
+import org.apache.isis.applib.Identifier;
+import org.apache.isis.applib.services.eventbus.CollectionRemovedFromEvent;
+
+public class PostsCollectionRemovedEventFacetAnnotationTest_newEvent {
+
+ public static class SomeDomainObject {
+ public Set<SomeReferencedObject> getReferences() { return null; }
+ }
+ public static class SomeReferencedObject {}
+
+ public static class SomeDomainObjectCollectionRemovedFromEvent extends CollectionRemovedFromEvent<SomeDomainObject, SomeReferencedObject> {}
+
+ @Test
+ public void test() throws Exception {
+ SomeDomainObject sdo = new SomeDomainObject();
+ SomeReferencedObject other = new SomeReferencedObject();
+ Identifier identifier = Identifier.propertyOrCollectionIdentifier(SomeDomainObject.class, "references");
+
+ final CollectionRemovedFromEvent<SomeDomainObject, SomeReferencedObject> ev = PostsCollectionRemovedFromEventFacetAnnotation.newEvent(
+ SomeDomainObjectCollectionRemovedFromEvent.class, sdo, identifier, other);
+ assertThat(ev.getSource(), is(sdo));
+ assertThat(ev.getIdentifier(), is(identifier));
+ assertThat(ev.getValue(), is(other));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/f8833040/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
index 5f9fc1d..6f81049 100644
--- a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
+++ b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItem.java
@@ -488,6 +488,7 @@ public class ToDoItem implements Comparable<ToDoItem> {
private SortedSet<ToDoItem> dependencies = new TreeSet<ToDoItem>();
@PostsCollectionAddedToEvent(wrapperPolicy=WrapperPolicy.SKIP_RULES)
+ @PostsCollectionRemovedFromEvent(wrapperPolicy=WrapperPolicy.SKIP_RULES)
@SortedBy(DependenciesComparator.class)
public SortedSet<ToDoItem> getDependencies() {
return dependencies;
@@ -508,6 +509,9 @@ public class ToDoItem implements Comparable<ToDoItem> {
public ToDoItem add(
@TypicalLength(20)
final ToDoItem toDoItem) {
+ // By wrapping the call, Isis will detect that the collection is modified
+ // and it will automatically send a CollectionAddedToEvent to the Event Bus.
+ // See ToDoItemSubscriptions.
wrapperFactory.wrap(this).addToDependencies(toDoItem);
return this;
}
@@ -538,7 +542,10 @@ public class ToDoItem implements Comparable<ToDoItem> {
public ToDoItem remove(
@TypicalLength(20)
final ToDoItem toDoItem) {
- this.removeFromDependencies(toDoItem);
+ // By wrapping the call, Isis will detect that the collection is modified
+ // and it will automatically send a CollectionRemovedFromEvent to the Event Bus.
+ // See ToDoItemSubscriptions.
+ wrapperFactory.wrap(this).removeFromDependencies(toDoItem);
return this;
}
// disable action dependent on state of object
http://git-wip-us.apache.org/repos/asf/isis/blob/f8833040/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java
index 0a4b02f..15623bb 100644
--- a/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java
+++ b/example/application/quickstart_wicket_restful_jdo/dom/src/main/java/dom/todo/ToDoItemSubscriptions.java
@@ -23,6 +23,7 @@ import com.google.common.eventbus.Subscribe;
import org.apache.isis.applib.DomainObjectContainer;
import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.services.eventbus.CollectionAddedToEvent;
+import org.apache.isis.applib.services.eventbus.CollectionRemovedFromEvent;
import org.apache.isis.applib.services.eventbus.EventBusService;
import org.apache.isis.applib.services.eventbus.PropertyChangedEvent;
@@ -50,6 +51,12 @@ public class ToDoItemSubscriptions {
LOG.info(container.titleOf(ev.getSource()) + ", added to " + ev.getIdentifier().getMemberName() + " : " + ev.getValue());
}
+ @Programmatic
+ @Subscribe
+ public void on(CollectionRemovedFromEvent<?,?> ev) {
+ LOG.info(container.titleOf(ev.getSource()) + ", removed from " + ev.getIdentifier().getMemberName() + " : " + ev.getValue());
+ }
+
//region > injected services
// //////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/isis/blob/f8833040/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/tests/events/ToDoItemTest_dependencies_addedEvent.java
----------------------------------------------------------------------
diff --git a/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/tests/events/ToDoItemTest_dependencies_addedEvent.java b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/tests/events/ToDoItemTest_dependencies_addedEvent.java
new file mode 100644
index 0000000..6cfd491
--- /dev/null
+++ b/example/application/quickstart_wicket_restful_jdo/integtests/src/test/java/integration/tests/events/ToDoItemTest_dependencies_addedEvent.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package integration.tests.events;
+
+import integration.tests.ToDoIntegTest;
+
+import java.util.List;
+
+import dom.todo.ToDoItem;
+import dom.todo.ToDoItems;
+import fixture.todo.ToDoItemsFixture;
+
+import org.apache.isis.applib.annotation.Programmatic;
+import org.apache.isis.applib.services.eventbus.CollectionAddedToEvent;
+import org.apache.isis.applib.services.eventbus.EventBusService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.eventbus.Subscribe;
+
+public class ToDoItemTest_dependencies_addedEvent extends ToDoIntegTest {
+
+ private ToDoItem toDoItem;
+ private ToDoItem otherToDoItem;
+ private EventBusService eventBusService;
+
+
+ public class TestSubscription {
+
+ @Programmatic
+ @Subscribe
+ public Boolean on(CollectionAddedToEvent<?,?> ev) {
+ return true;
+ }
+
+ }
+
+
+ @Before
+ public void setUp() throws Exception {
+ scenarioExecution().install(new ToDoItemsFixture());
+
+ final List<ToDoItem> items = wrap(service(ToDoItems.class)).notYetComplete();
+ toDoItem = wrap(items.get(0));
+ otherToDoItem = items.get(1); // wrapping this seems to trip up cglib :-(
+ eventBusService = this.service(EventBusService.class);
+
+ // Register new Service.
+
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ unwrap(toDoItem).getDependencies().clear();
+ }
+
+ @Test
+ public void collectionAddedToEventReceived() throws Exception {
+
+ // given
+
+ // when
+ toDoItem.add(otherToDoItem);
+
+ // then
+ }
+
+}
\ No newline at end of file
[3/5] git commit: ISIS-550 and ISIS-776: merging
Posted by da...@apache.org.
ISIS-550 and ISIS-776: merging
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/1dac3edf
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/1dac3edf
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/1dac3edf
Branch: refs/heads/ISIS-550
Commit: 1dac3edff844f427a9916fc67aad8c1f615128f3
Parents: 2637a05 55c4ea8
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Fri May 9 17:54:04 2014 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Fri May 9 17:54:04 2014 +0100
----------------------------------------------------------------------
...Put_whenArgValid_thenPropertyUpdated_ok.java | 262 ------------------
...henArgValid_thenPropertyUpdated_ok_TODO.java | 267 +++++++++++++++++++
.../components/widgets/cssmenu/CssMenuPanel.css | 2 +-
.../viewer/wicket/ui/pages/PageAbstract.css | 2 +-
core/applib/pom.xml | 6 +
.../isis/applib/DomainObjectContainer.java | 6 +
.../fixturescripts/CompositeFixtureScript.java | 90 +++++++
.../applib/fixturescripts/FixtureResult.java | 68 +++++
.../fixturescripts/FixtureResultList.java | 72 +++++
.../applib/fixturescripts/FixtureScript.java | 208 +++++++++++++++
.../applib/fixturescripts/FixtureScripts.java | 164 ++++++++++++
.../fixturescripts/SimpleFixtureScript.java | 56 ++++
.../classdiscovery/ClassDiscoveryService.java | 30 +++
.../ClassDiscoveryServiceUsingReflections.java | 42 +++
.../metamodel/adapter/DomainObjectServices.java | 2 +
.../noruntime/RuntimeContextNoRuntime.java | 5 +
.../container/DomainObjectContainerDefault.java | 11 +
.../internal/RuntimeContextFromSession.java | 5 +
.../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/ToDoItemsFixturesService.java | 84 ------
.../src/main/webapp/WEB-INF/isis.properties | 3 +-
29 files changed, 1329 insertions(+), 428 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/1dac3edf/example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
----------------------------------------------------------------------
diff --cc example/application/quickstart_wicket_restful_jdo/webapp/src/main/webapp/WEB-INF/isis.properties
index 153f3f9,a6f1e96..a542934
--- 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
@@@ -189,7 -189,7 +189,8 @@@ 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.core.wrapper.WrapperFactoryDefault,\
+ org.apache.isis.applib.services.classdiscovery.ClassDiscoveryServiceUsingReflections,\
\
# JDO implementation of the EventBusService, \
org.apache.isis.objectstore.jdo.datanucleus.service.eventbus.EventBusServiceJdo,\
[2/5] git commit: ISIS-776: retroft with applib.InstallableFixture;
decouple org.reflections...
Posted by da...@apache.org.
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-550
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,\