You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2013/12/12 22:26:42 UTC

git commit: ISIS-635: JDO PublishedEvent working once more...

Updated Branches:
  refs/heads/master f54746f79 -> 9d6ee1fa7


ISIS-635: JDO PublishedEvent working once more...

... through guard in core.

In addition:
- debugging why some tests don't run in Maven; due to surefire config
  (need to fix up those failing tests before enabling).


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

Branch: refs/heads/master
Commit: 9d6ee1fa727acd47bd9354102a937b889bd076b2
Parents: f54746f
Author: Dan Haywood <da...@apache.org>
Authored: Thu Dec 12 21:26:24 2013 +0000
Committer: Dan Haywood <da...@apache.org>
Committed: Thu Dec 12 21:26:24 2013 +0000

----------------------------------------------------------------------
 core/pom.xml                                         |  9 +++++++++
 .../runtime/system/transaction/IsisTransaction.java  | 15 ++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/isis/blob/9d6ee1fa/core/pom.xml
----------------------------------------------------------------------
diff --git a/core/pom.xml b/core/pom.xml
index e9b9db6..d1477f7 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -56,6 +56,7 @@
         <docbkxGuideSubTitle>Architecture, APIs and Customization</docbkxGuideSubTitle>
         <docbkxGuideName>isis-core</docbkxGuideName>
 
+        <testsToInclude>**/*Test_*.java</testsToInclude>
         <testsToExclude>**/*IntegrationTest.java</testsToExclude>
 
 
@@ -448,6 +449,14 @@
                     <artifactId>maven-surefire-plugin</artifactId>
                     <version>2.12</version>
                     <configuration>
+                    <!-- 
+                        <includes>
+                            <include>**/Test*.java</include>
+                            <include>**/*Test.java</include>
+                            <include>**/*TestCase.java</include>
+                            <include>**/*Test_*.java</include>
+                        </includes>
+                     -->
                         <excludes>
                             <exclude>${testsToExclude}</exclude>
                         </excludes>

http://git-wip-us.apache.org/repos/asf/isis/blob/9d6ee1fa/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
index 079bdaa..1d3f6e3 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/system/transaction/IsisTransaction.java
@@ -32,6 +32,8 @@ import java.util.Map.Entry;
 import java.util.Set;
 import java.util.UUID;
 
+import javax.swing.event.ChangeListener;
+
 import com.google.common.base.Objects;
 import com.google.common.base.Predicate;
 import com.google.common.collect.Lists;
@@ -456,12 +458,18 @@ public class IsisTransaction implements TransactionScopedComponent {
         }
     }
 
-    protected void publishedChangedObjectsIfRequired(final String currentUser, final long currentTimestampEpoch) {
+    /**
+     * @return the adapters that were published (if any were).
+     */
+    protected List<ObjectAdapter> publishedChangedObjectsIfRequired(final String currentUser, final long currentTimestampEpoch) {
         if(publishingService == null) {
-            return;
+            return Collections.emptyList();
         }
         
-        for (final ObjectAdapter enlistedAdapter : changeKindByEnlistedAdapter.keySet()) {
+        // take a copy of enlisted adapters ... the JDO implementation of the PublishingService 
+        // creates further entities which would be enlisted; taking copy of the keys avoids ConcurrentModificationException
+        List<ObjectAdapter> enlistedAdapters = Lists.newArrayList(changeKindByEnlistedAdapter.keySet());
+        for (final ObjectAdapter enlistedAdapter : enlistedAdapters) {
             final ChangeKind changeKind = changeKindByEnlistedAdapter.get(enlistedAdapter);
             final PublishedObjectFacet publishedObjectFacet = enlistedAdapter.getSpecification().getFacet(PublishedObjectFacet.class);
             if(publishedObjectFacet == null) {
@@ -477,6 +485,7 @@ public class IsisTransaction implements TransactionScopedComponent {
         
             publishingService.publishObject(payloadFactory, metadata, enlistedAdapter, changeKind, objectStringifier());
         }
+        return enlistedAdapters;
     }
 
     private static EventType eventTypeFor(ChangeKind changeKind) {