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/12/22 20:01:49 UTC

[1/4] isis git commit: Checks datanucleus StoreManager for support of SchemaAwareStoreManager before casting.

Repository: isis
Updated Branches:
  refs/heads/master de823cfbb -> 5a92f60ae


Checks datanucleus StoreManager for support of SchemaAwareStoreManager
before casting.

Now supports Neo4J embedded DB with DataNucleus.

Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/21541a72
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/21541a72
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/21541a72

Branch: refs/heads/master
Commit: 21541a724153338c23ec6ccffafd1f6d22754bad
Parents: de823cf
Author: jdbranham <Je...@Sprint.com>
Authored: Sat Dec 20 19:22:00 2014 -0600
Committer: jdbranham <Je...@Sprint.com>
Committed: Sat Dec 20 19:22:00 2014 -0600

----------------------------------------------------------------------
 .../datanucleus/DataNucleusApplicationComponents.java  |  8 +++++---
 example/application/simpleapp/webapp/.gitignore        |  1 +
 example/application/simpleapp/webapp/pom.xml           |  5 +++++
 .../src/main/webapp/WEB-INF/persistor.properties       | 13 ++++++++-----
 4 files changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/21541a72/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusApplicationComponents.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusApplicationComponents.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusApplicationComponents.java
index 18cb6ad..6ca9e5d 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusApplicationComponents.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusApplicationComponents.java
@@ -32,8 +32,8 @@ import com.google.common.collect.Maps;
 import org.datanucleus.NucleusContext;
 import org.datanucleus.api.jdo.JDOPersistenceManagerFactory;
 import org.datanucleus.metadata.MetaDataManager;
+import org.datanucleus.store.StoreManager;
 import org.datanucleus.store.schema.SchemaAwareStoreManager;
-
 import org.apache.isis.core.commons.components.ApplicationScopedComponent;
 import org.apache.isis.core.metamodel.spec.ObjectSpecification;
 import org.apache.isis.core.runtime.system.context.IsisContext;
@@ -122,8 +122,10 @@ public class DataNucleusApplicationComponents implements ApplicationScopedCompon
     private void createSchema(final Map<String, String> props, final Set<String> classesToBePersisted) {
         final JDOPersistenceManagerFactory jdopmf = (JDOPersistenceManagerFactory)persistenceManagerFactory;
         final NucleusContext nucleusContext = jdopmf.getNucleusContext();
-        final SchemaAwareStoreManager storeManager = (SchemaAwareStoreManager) nucleusContext.getStoreManager();
-        storeManager.createSchema(classesToBePersisted, asProperties(props));
+        final StoreManager storeManager = nucleusContext.getStoreManager();
+        if (storeManager instanceof SchemaAwareStoreManager) {
+            ((SchemaAwareStoreManager)storeManager).createSchema(classesToBePersisted, asProperties(props));
+		}
     }
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/21541a72/example/application/simpleapp/webapp/.gitignore
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/.gitignore b/example/application/simpleapp/webapp/.gitignore
new file mode 100644
index 0000000..7cfef61
--- /dev/null
+++ b/example/application/simpleapp/webapp/.gitignore
@@ -0,0 +1 @@
+/testDB/

http://git-wip-us.apache.org/repos/asf/isis/blob/21541a72/example/application/simpleapp/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/pom.xml b/example/application/simpleapp/webapp/pom.xml
index 1b9961c..9c3faf7 100644
--- a/example/application/simpleapp/webapp/pom.xml
+++ b/example/application/simpleapp/webapp/pom.xml
@@ -252,6 +252,11 @@
           </exclusions>
         </dependency>
 
+        <dependency>
+        	<groupId>org.datanucleus</groupId>
+        	<artifactId>datanucleus-neo4j</artifactId>
+        	<version>3.2.3</version>
+        </dependency>
     </dependencies>
 
     <profiles>

http://git-wip-us.apache.org/repos/asf/isis/blob/21541a72/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
index a4bffa6..d60a45f 100644
--- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
+++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
@@ -48,15 +48,18 @@ isis.persistor.disableConcurrencyChecking=false
 # (also update the pom.xml to reference the appropriate JDBC driver)
 #
 
-
+#
+# neo4j
+#
+isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=neo4j:testDB
 
 #
 # HSQLDB in-memory
 #
-isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
-isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:hsqldb:mem:test
-isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
-isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:hsqldb:mem:test
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
 
 #
 # HSQLDB in-memory (using log4jdbc-remix)


[3/4] isis git commit: Merge remote-tracking branch 'jdbranham/master'

Posted by da...@apache.org.
Merge remote-tracking branch 'jdbranham/master'


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/fe30771a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/fe30771a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/fe30771a

Branch: refs/heads/master
Commit: fe30771aecaedd0d4963e5cefca306fb17bb94b0
Parents: de823cf 81dbfd8
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Dec 22 17:06:28 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Dec 22 17:06:28 2014 +0000

----------------------------------------------------------------------
 .../jdo/datanucleus/DataNucleusApplicationComponents.java |  8 +++++---
 example/application/simpleapp/webapp/.gitignore           |  1 +
 example/application/simpleapp/webapp/pom.xml              | 10 ++++++++++
 .../webapp/src/main/webapp/WEB-INF/persistor.properties   |  5 ++++-
 example/application/todoapp/webapp/.gitignore             |  1 +
 example/application/todoapp/webapp/pom.xml                | 10 ++++++++++
 .../webapp/src/main/webapp/WEB-INF/persistor.properties   |  5 ++++-
 7 files changed, 35 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[4/4] isis git commit: ISIS-983: testing neo4j support for todoapp and simpleapp.

Posted by da...@apache.org.
ISIS-983: testing neo4j support for todoapp and simpleapp.

changes:
- the todoapp has been changed to use a Set (rather than SortedSet) for ToDoItem#dependencies... would seem that DataNucleus' neo4j support returns an object of the incorrect type.
- the neo4j settings in persistor.properties has been moved to the end (and is commented out).
- replaced tabs for spaces in pom.xml.

With these change the webapps run ok:
* edit in neo4j setting in WEB-INF/persistor.properties
* build using "mvn clean install -P neo4j"
* run using "mvn antrun:run -Pself-host,neo4j -o"

However, note that the integration tests were tested and do NOT pass:
- the issue for simpleapp was that looks like unique index constraints are not implemented,
- the issue for todoapp looked down to ordering of the dependencies collection.

This commit also:
- renames ToDoSystemInitializer to ToDoAppSystemInitializer (for consistency with simpleapp)
- adds a new putDataNucleusProperty in IsisConfigurationForJdoIntegTests


Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/5a92f60a
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/5a92f60a
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/5a92f60a

Branch: refs/heads/master
Commit: 5a92f60aeca3fd6aada52795540493756e858ac0
Parents: fe30771
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Mon Dec 22 18:54:31 2014 +0000
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Mon Dec 22 18:54:31 2014 +0000

----------------------------------------------------------------------
 .../IsisConfigurationForJdoIntegTests.java      | 15 ++++
 .../application/simpleapp/integtests/.gitignore |  1 +
 example/application/simpleapp/webapp/pom.xml    | 16 ++--
 .../main/webapp/WEB-INF/persistor.properties    | 14 ++--
 .../dom/src/main/java/dom/todo/ToDoItem.java    | 14 ++--
 .../application/todoapp/integtests/.gitignore   |  1 +
 .../integration/ToDoAppSystemInitializer.java   | 77 ++++++++++++++++++++
 .../java/integration/ToDoSystemInitializer.java | 77 --------------------
 .../integration/glue/BootstrappingGlue.java     |  4 +-
 .../tests/AbstractToDoIntegTest.java            |  4 +-
 .../integration/tests/ToDoItemIntegTest.java    |  2 +-
 example/application/todoapp/webapp/pom.xml      | 16 ++--
 .../main/webapp/WEB-INF/persistor.properties    | 12 ++-
 13 files changed, 139 insertions(+), 114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/IsisConfigurationForJdoIntegTests.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/IsisConfigurationForJdoIntegTests.java b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/IsisConfigurationForJdoIntegTests.java
index 6df273f..ee6de7e 100644
--- a/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/IsisConfigurationForJdoIntegTests.java
+++ b/core/runtime/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/IsisConfigurationForJdoIntegTests.java
@@ -86,6 +86,11 @@ public class IsisConfigurationForJdoIntegTests extends IsisConfigurationDefault
         return this;
     }
 
+    public final IsisConfigurationForJdoIntegTests putDataNucleusProperty(final String key, final String value) {
+        put(DataNucleusObjectStore.DATANUCLEUS_PROPERTIES_ROOT + key, value);
+        return this;
+    }
+
     /**
      * Typically integration tests should set the {@link RegisterEntities} package prefix(es); this method makes it
      * easy to do so.
@@ -96,5 +101,15 @@ public class IsisConfigurationForJdoIntegTests extends IsisConfigurationDefault
         return this;
     }
 
+    /**
+     * Typically integration tests should set the {@link RegisterEntities} package prefix(es); this method makes it
+     * easy to do so.
+     */
+    public final IsisConfigurationForJdoIntegTests putRegisterEntitiesPackagePrefix(final String... packagePrefix) {
+        final String commaSeparated = Joiner.on(',').join(packagePrefix);
+        put(RegisterEntities.PACKAGE_PREFIX_KEY, commaSeparated);
+        return this;
+    }
+
 
 }

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/simpleapp/integtests/.gitignore
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/.gitignore b/example/application/simpleapp/integtests/.gitignore
new file mode 100644
index 0000000..7cfef61
--- /dev/null
+++ b/example/application/simpleapp/integtests/.gitignore
@@ -0,0 +1 @@
+/testDB/

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/simpleapp/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/pom.xml b/example/application/simpleapp/webapp/pom.xml
index c12cf6f..a8d8d47 100644
--- a/example/application/simpleapp/webapp/pom.xml
+++ b/example/application/simpleapp/webapp/pom.xml
@@ -336,14 +336,14 @@
             </build>
         </profile>
         <profile>
-        	<id>neo4j</id>
-        	<dependencies>
-		        <dependency>
-		        	<groupId>org.datanucleus</groupId>
-		        	<artifactId>datanucleus-neo4j</artifactId>
-		        	<version>3.2.3</version>
-		        </dependency>
-        	</dependencies>
+            <id>neo4j</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.datanucleus</groupId>
+                    <artifactId>datanucleus-neo4j</artifactId>
+                    <version>3.2.3</version>
+                </dependency>
+            </dependencies>
         </profile>
     </profiles>
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
index 043e68b..93fe69b 100644
--- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
+++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
@@ -49,11 +49,6 @@ isis.persistor.disableConcurrencyChecking=false
 #
 
 #
-# neo4j
-#
-#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=neo4j:testDB
-
-#
 # HSQLDB in-memory
 #
 isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
@@ -122,3 +117,12 @@ isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
 #isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:log4jdbc:sqlserver://127.0.0.1:1433;instance=SQLEXPRESS;databaseName=jdo
 #isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=jdo
 #isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=jdopass
+
+
+
+#
+# neo4j
+# (experimental; run with -P neo4j profile in webapp project)
+#
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=neo4j:testDB
+

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java
----------------------------------------------------------------------
diff --git a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java
index 1fff120..7d7ab90 100644
--- a/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java
+++ b/example/application/todoapp/dom/src/main/java/dom/todo/ToDoItem.java
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 import javax.jdo.JDOHelper;
@@ -499,15 +500,16 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
     @javax.jdo.annotations.Persistent(table="ToDoItemDependencies")
     @javax.jdo.annotations.Join(column="dependingId")
     @javax.jdo.annotations.Element(column="dependentId")
-    private SortedSet<ToDoItem> dependencies = new TreeSet<ToDoItem>();
+    private Set<ToDoItem> dependencies = new TreeSet<>();
+    //private SortedSet<ToDoItem> dependencies = new TreeSet<>();  // not compatible with neo4j (as of DN v3.2.3)
 
     @CollectionInteraction
-    @CollectionLayout(sortedBy = DependenciesComparator.class)
-    public SortedSet<ToDoItem> getDependencies() {
+    @CollectionLayout(/*sortedBy = DependenciesComparator.class*/) // not compatible with neo4j (as of DN v3.2.3)
+    public Set<ToDoItem> getDependencies() {
         return dependencies;
     }
 
-    public void setDependencies(final SortedSet<ToDoItem> dependencies) {
+    public void setDependencies(final Set<ToDoItem> dependencies) {
         this.dependencies = dependencies;
     }
 
@@ -518,9 +520,7 @@ public class ToDoItem implements Categorized, Comparable<ToDoItem> {
         getDependencies().remove(toDoItem);
     }
 
-    public ToDoItem add(
-            @TypicalLength(20)
-            final ToDoItem toDoItem) {
+    public ToDoItem add(final ToDoItem toDoItem) {
         // By wrapping the call, Isis will detect that the collection is modified
         // and it will automatically send CollectionInteractionEvents to the Event Bus.
         // ToDoItemSubscriptions is a demo subscriber to this event

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/todoapp/integtests/.gitignore
----------------------------------------------------------------------
diff --git a/example/application/todoapp/integtests/.gitignore b/example/application/todoapp/integtests/.gitignore
new file mode 100644
index 0000000..7cfef61
--- /dev/null
+++ b/example/application/todoapp/integtests/.gitignore
@@ -0,0 +1 @@
+/testDB/

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/todoapp/integtests/src/test/java/integration/ToDoAppSystemInitializer.java
----------------------------------------------------------------------
diff --git a/example/application/todoapp/integtests/src/test/java/integration/ToDoAppSystemInitializer.java b/example/application/todoapp/integtests/src/test/java/integration/ToDoAppSystemInitializer.java
new file mode 100644
index 0000000..3e21d50
--- /dev/null
+++ b/example/application/todoapp/integtests/src/test/java/integration/ToDoAppSystemInitializer.java
@@ -0,0 +1,77 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package integration;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.integtestsupport.IsisSystemForTest;
+import org.apache.isis.core.runtime.persistence.PersistenceConstants;
+import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
+import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests;
+
+/**
+ * Holds an instance of an {@link IsisSystemForTest} as a {@link ThreadLocal} on the current thread,
+ * initialized with ToDo app's domain services. 
+ */
+public class ToDoAppSystemInitializer {
+    
+    private ToDoAppSystemInitializer(){}
+
+    public static IsisSystemForTest initIsft() {
+        IsisSystemForTest isft = IsisSystemForTest.getElseNull();
+        if(isft == null) {
+            isft = new ToDoSystemBuilder().build().setUpSystem();
+            IsisSystemForTest.set(isft);
+        }
+        return isft;
+    }
+
+    private static class ToDoSystemBuilder extends IsisSystemForTest.Builder {
+
+        public ToDoSystemBuilder() {
+            withLoggingAt(org.apache.log4j.Level.INFO);
+            with(testConfiguration());
+            with(new DataNucleusPersistenceMechanismInstaller());
+
+            // services annotated with @DomainService
+            withServicesIn("app"
+                            ,"dom.todo"
+                            ,"fixture.todo"
+                            ,"webapp.admin"
+                            ,"webapp.prototyping"
+                            ,"org.apache.isis.core.wrapper"
+                            ,"org.apache.isis.applib"
+                            ,"org.apache.isis.core.metamodel.services"
+                            ,"org.apache.isis.core.runtime.services"
+                            ,"org.apache.isis.objectstore.jdo.datanucleus.service.support" // IsisJdoSupportImpl
+                            ,"org.apache.isis.objectstore.jdo.datanucleus.service.eventbus" // EventBusServiceJdo
+                            );
+        }
+
+        private static IsisConfiguration testConfiguration() {
+            final IsisConfigurationForJdoIntegTests testConfiguration = new IsisConfigurationForJdoIntegTests();
+            testConfiguration.addRegisterEntitiesPackagePrefix("dom");
+
+            // enable stricter checking
+            //
+            // the consequence of this is having to call 'nextTransaction()' between most of the given/when/then's
+            // because the command2 only ever refers to the event of the originating action.
+            testConfiguration.put(PersistenceConstants.ENFORCE_SAFE_SEMANTICS, "true");
+
+            return testConfiguration;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/todoapp/integtests/src/test/java/integration/ToDoSystemInitializer.java
----------------------------------------------------------------------
diff --git a/example/application/todoapp/integtests/src/test/java/integration/ToDoSystemInitializer.java b/example/application/todoapp/integtests/src/test/java/integration/ToDoSystemInitializer.java
deleted file mode 100644
index 176c94e..0000000
--- a/example/application/todoapp/integtests/src/test/java/integration/ToDoSystemInitializer.java
+++ /dev/null
@@ -1,77 +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 integration;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.integtestsupport.IsisSystemForTest;
-import org.apache.isis.core.runtime.persistence.PersistenceConstants;
-import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
-import org.apache.isis.objectstore.jdo.datanucleus.IsisConfigurationForJdoIntegTests;
-
-/**
- * Holds an instance of an {@link IsisSystemForTest} as a {@link ThreadLocal} on the current thread,
- * initialized with ToDo app's domain services. 
- */
-public class ToDoSystemInitializer {
-    
-    private ToDoSystemInitializer(){}
-
-    public static IsisSystemForTest initIsft() {
-        IsisSystemForTest isft = IsisSystemForTest.getElseNull();
-        if(isft == null) {
-            isft = new ToDoSystemBuilder().build().setUpSystem();
-            IsisSystemForTest.set(isft);
-        }
-        return isft;
-    }
-
-    private static class ToDoSystemBuilder extends IsisSystemForTest.Builder {
-
-        public ToDoSystemBuilder() {
-            withLoggingAt(org.apache.log4j.Level.INFO);
-            with(testConfiguration());
-            with(new DataNucleusPersistenceMechanismInstaller());
-
-            // services annotated with @DomainService
-            withServicesIn("app"
-                            ,"dom.todo"
-                            ,"fixture.todo"
-                            ,"webapp.admin"
-                            ,"webapp.prototyping"
-                            ,"org.apache.isis.core.wrapper"
-                            ,"org.apache.isis.applib"
-                            ,"org.apache.isis.core.metamodel.services"
-                            ,"org.apache.isis.core.runtime.services"
-                            ,"org.apache.isis.objectstore.jdo.datanucleus.service.support" // IsisJdoSupportImpl
-                            ,"org.apache.isis.objectstore.jdo.datanucleus.service.eventbus" // EventBusServiceJdo
-                            );
-        }
-
-        private static IsisConfiguration testConfiguration() {
-            final IsisConfigurationForJdoIntegTests testConfiguration = new IsisConfigurationForJdoIntegTests();
-            testConfiguration.addRegisterEntitiesPackagePrefix("dom");
-
-            // enable stricter checking
-            //
-            // the consequence of this is having to call 'nextTransaction()' between most of the given/when/then's
-            // because the command2 only ever refers to the event of the originating action.
-            testConfiguration.put(PersistenceConstants.ENFORCE_SAFE_SEMANTICS, "true");
-
-            return testConfiguration;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/todoapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java
----------------------------------------------------------------------
diff --git a/example/application/todoapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java b/example/application/todoapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java
index 0c92dac..9aae79c 100644
--- a/example/application/todoapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java
+++ b/example/application/todoapp/integtests/src/test/java/integration/glue/BootstrappingGlue.java
@@ -18,7 +18,7 @@ package integration.glue;
 
 import cucumber.api.java.After;
 import cucumber.api.java.Before;
-import integration.ToDoSystemInitializer;
+import integration.ToDoAppSystemInitializer;
 
 import org.apache.isis.core.specsupport.scenarios.ScenarioExecutionScope;
 import org.apache.isis.core.specsupport.specs.CukeGlueAbstract;
@@ -35,7 +35,7 @@ public class BootstrappingGlue extends CukeGlueAbstract {
     @Before(value={"@integration"}, order=100)
     public void beforeScenarioIntegrationScope() {
         org.apache.log4j.PropertyConfigurator.configure("logging.properties");
-        ToDoSystemInitializer.initIsft();
+        ToDoAppSystemInitializer.initIsft();
         
         before(ScenarioExecutionScope.INTEGRATION);
     }

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/todoapp/integtests/src/test/java/integration/tests/AbstractToDoIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/todoapp/integtests/src/test/java/integration/tests/AbstractToDoIntegTest.java b/example/application/todoapp/integtests/src/test/java/integration/tests/AbstractToDoIntegTest.java
index b80f974..ab15a30 100644
--- a/example/application/todoapp/integtests/src/test/java/integration/tests/AbstractToDoIntegTest.java
+++ b/example/application/todoapp/integtests/src/test/java/integration/tests/AbstractToDoIntegTest.java
@@ -18,7 +18,7 @@
  */
 package integration.tests;
 
-import integration.ToDoSystemInitializer;
+import integration.ToDoAppSystemInitializer;
 
 import org.junit.BeforeClass;
 import org.apache.isis.core.integtestsupport.IntegrationTestAbstract;
@@ -29,7 +29,7 @@ public abstract class AbstractToDoIntegTest extends IntegrationTestAbstract {
     @BeforeClass
     public static void initClass() {
         org.apache.log4j.PropertyConfigurator.configure("logging.properties");
-        ToDoSystemInitializer.initIsft();
+        ToDoAppSystemInitializer.initIsft();
 
         // instantiating will install onto ThreadLocal
         new ScenarioExecutionForIntegration();

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/todoapp/integtests/src/test/java/integration/tests/ToDoItemIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/todoapp/integtests/src/test/java/integration/tests/ToDoItemIntegTest.java b/example/application/todoapp/integtests/src/test/java/integration/tests/ToDoItemIntegTest.java
index d4eab58..5ab1015 100644
--- a/example/application/todoapp/integtests/src/test/java/integration/tests/ToDoItemIntegTest.java
+++ b/example/application/todoapp/integtests/src/test/java/integration/tests/ToDoItemIntegTest.java
@@ -470,7 +470,7 @@ public class ToDoItemIntegTest extends AbstractToDoIntegTest {
 
                     // then
                     assertThat(toDoItem.getDependencies().size(), is(1));
-                    assertThat(toDoItem.getDependencies().first(), is(unwrap(otherToDoItem)));
+                    assertThat(toDoItem.getDependencies().iterator().next(), is(unwrap(otherToDoItem)));
                 }
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/todoapp/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/todoapp/webapp/pom.xml b/example/application/todoapp/webapp/pom.xml
index 753b3b5..40ca5ae 100644
--- a/example/application/todoapp/webapp/pom.xml
+++ b/example/application/todoapp/webapp/pom.xml
@@ -336,14 +336,14 @@
             </build>
         </profile>
         <profile>
-        	<id>neo4j</id>
-        	<dependencies>
-		        <dependency>
-		        	<groupId>org.datanucleus</groupId>
-		        	<artifactId>datanucleus-neo4j</artifactId>
-		        	<version>3.2.3</version>
-		        </dependency>
-        	</dependencies>
+            <id>neo4j</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.datanucleus</groupId>
+                    <artifactId>datanucleus-neo4j</artifactId>
+                    <version>3.2.3</version>
+                </dependency>
+            </dependencies>
         </profile>
     </profiles>
 

http://git-wip-us.apache.org/repos/asf/isis/blob/5a92f60a/example/application/todoapp/webapp/src/main/webapp/WEB-INF/persistor.properties
----------------------------------------------------------------------
diff --git a/example/application/todoapp/webapp/src/main/webapp/WEB-INF/persistor.properties b/example/application/todoapp/webapp/src/main/webapp/WEB-INF/persistor.properties
index d365634..adaebbe 100644
--- a/example/application/todoapp/webapp/src/main/webapp/WEB-INF/persistor.properties
+++ b/example/application/todoapp/webapp/src/main/webapp/WEB-INF/persistor.properties
@@ -49,10 +49,6 @@ isis.persistor.disableConcurrencyChecking=false
 # (also update the pom.xml to reference the appropriate JDBC driver)
 #
 
-#
-# neo4j
-#
-#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=neo4j:testDB
 
 #
 # HSQLDB in-memory
@@ -123,3 +119,11 @@ isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
 #isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:log4jdbc:sqlserver://127.0.0.1:1433;instance=.;databaseName=isis
 #isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=isis
 #isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=isis
+
+
+
+#
+# neo4j
+# (experimental; run with '-P neo4j' profile in webapp project)
+#
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=neo4j:testDB


[2/4] isis git commit: ISIS-983 Enabled Embedded Neo4J support

Posted by da...@apache.org.
ISIS-983 Enabled Embedded Neo4J support

Added datanucleus-neo4j in a neo4j pom profile [simpleapp, todoapp]
Added neo4j example setting in persistor.properties [simpleapp, todoapp]
Added .gitignore to ignore embedded neo4j generated testDB folder
[simpleapp, todoapp]

Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/81dbfd8b
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/81dbfd8b
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/81dbfd8b

Branch: refs/heads/master
Commit: 81dbfd8b5b841a589b95fc2d282cd723532ad25d
Parents: 21541a7
Author: jdbranham <Je...@Sprint.com>
Authored: Mon Dec 22 08:20:06 2014 -0600
Committer: jdbranham <Je...@Sprint.com>
Committed: Mon Dec 22 08:20:06 2014 -0600

----------------------------------------------------------------------
 example/application/simpleapp/webapp/pom.xml         | 15 ++++++++++-----
 .../src/main/webapp/WEB-INF/persistor.properties     | 10 +++++-----
 example/application/todoapp/webapp/.gitignore        |  1 +
 example/application/todoapp/webapp/pom.xml           | 10 ++++++++++
 .../src/main/webapp/WEB-INF/persistor.properties     |  5 ++++-
 5 files changed, 30 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/81dbfd8b/example/application/simpleapp/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/pom.xml b/example/application/simpleapp/webapp/pom.xml
index 9c3faf7..c12cf6f 100644
--- a/example/application/simpleapp/webapp/pom.xml
+++ b/example/application/simpleapp/webapp/pom.xml
@@ -252,11 +252,6 @@
           </exclusions>
         </dependency>
 
-        <dependency>
-        	<groupId>org.datanucleus</groupId>
-        	<artifactId>datanucleus-neo4j</artifactId>
-        	<version>3.2.3</version>
-        </dependency>
     </dependencies>
 
     <profiles>
@@ -340,6 +335,16 @@
                 </plugins>
             </build>
         </profile>
+        <profile>
+        	<id>neo4j</id>
+        	<dependencies>
+		        <dependency>
+		        	<groupId>org.datanucleus</groupId>
+		        	<artifactId>datanucleus-neo4j</artifactId>
+		        	<version>3.2.3</version>
+		        </dependency>
+        	</dependencies>
+        </profile>
     </profiles>
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/81dbfd8b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
index d60a45f..043e68b 100644
--- a/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
+++ b/example/application/simpleapp/webapp/src/main/webapp/WEB-INF/persistor.properties
@@ -51,15 +51,15 @@ isis.persistor.disableConcurrencyChecking=false
 #
 # neo4j
 #
-isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=neo4j:testDB
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=neo4j:testDB
 
 #
 # HSQLDB in-memory
 #
-#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
-#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:hsqldb:mem:test
-#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
-#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
+isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionDriverName=org.hsqldb.jdbcDriver
+isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=jdbc:hsqldb:mem:test
+isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionUserName=sa
+isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionPassword=
 
 #
 # HSQLDB in-memory (using log4jdbc-remix)

http://git-wip-us.apache.org/repos/asf/isis/blob/81dbfd8b/example/application/todoapp/webapp/.gitignore
----------------------------------------------------------------------
diff --git a/example/application/todoapp/webapp/.gitignore b/example/application/todoapp/webapp/.gitignore
new file mode 100644
index 0000000..7cfef61
--- /dev/null
+++ b/example/application/todoapp/webapp/.gitignore
@@ -0,0 +1 @@
+/testDB/

http://git-wip-us.apache.org/repos/asf/isis/blob/81dbfd8b/example/application/todoapp/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/example/application/todoapp/webapp/pom.xml b/example/application/todoapp/webapp/pom.xml
index deba3b7..753b3b5 100644
--- a/example/application/todoapp/webapp/pom.xml
+++ b/example/application/todoapp/webapp/pom.xml
@@ -335,6 +335,16 @@
                 </plugins>
             </build>
         </profile>
+        <profile>
+        	<id>neo4j</id>
+        	<dependencies>
+		        <dependency>
+		        	<groupId>org.datanucleus</groupId>
+		        	<artifactId>datanucleus-neo4j</artifactId>
+		        	<version>3.2.3</version>
+		        </dependency>
+        	</dependencies>
+        </profile>
     </profiles>
 
 

http://git-wip-us.apache.org/repos/asf/isis/blob/81dbfd8b/example/application/todoapp/webapp/src/main/webapp/WEB-INF/persistor.properties
----------------------------------------------------------------------
diff --git a/example/application/todoapp/webapp/src/main/webapp/WEB-INF/persistor.properties b/example/application/todoapp/webapp/src/main/webapp/WEB-INF/persistor.properties
index 18ea3a1..d365634 100644
--- a/example/application/todoapp/webapp/src/main/webapp/WEB-INF/persistor.properties
+++ b/example/application/todoapp/webapp/src/main/webapp/WEB-INF/persistor.properties
@@ -49,7 +49,10 @@ isis.persistor.disableConcurrencyChecking=false
 # (also update the pom.xml to reference the appropriate JDBC driver)
 #
 
-
+#
+# neo4j
+#
+#isis.persistor.datanucleus.impl.javax.jdo.option.ConnectionURL=neo4j:testDB
 
 #
 # HSQLDB in-memory