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 2016/06/10 15:36:19 UTC
[02/12] isis git commit: ISIS-1414: ensures that
getChangedObjectProperties() is called
ISIS-1414: ensures that getChangedObjectProperties() is called
for the MetricsService, even if not called for auditing (ie were no audited objects changed in the xactn)
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/5d918528
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/5d918528
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/5d918528
Branch: refs/heads/ISIS-1427
Commit: 5d9185285b6f5268fad7807f25fa624a4bfb0c27
Parents: eb6d4a8
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Jun 9 19:21:32 2016 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Jun 9 19:21:32 2016 +0100
----------------------------------------------------------------------
.../services/changes/ChangedObjectsServiceInternal.java | 6 ++----
.../isis/core/runtime/system/ObjectMemberAbstractTest.java | 5 ++++-
2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/5d918528/core/runtime/src/main/java/org/apache/isis/core/runtime/services/changes/ChangedObjectsServiceInternal.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/changes/ChangedObjectsServiceInternal.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/changes/ChangedObjectsServiceInternal.java
index 572bdcc..9aa6d63 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/changes/ChangedObjectsServiceInternal.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/changes/ChangedObjectsServiceInternal.java
@@ -269,13 +269,11 @@ public class ChangedObjectsServiceInternal implements WithTransactionScope {
return changeKindByEnlistedAdapter.size();
}
- /**
- * Must be called only after {@link #getChangedObjectProperties()} has been called at least once.
- */
@Programmatic
public int numberObjectPropertiesModified() {
if(changedObjectProperties == null) {
- throw new IllegalStateException("getChangedObjectProperties() has not yet been called");
+ // normally done during auditing, but in case none of the objects in this xactn are audited...
+ getChangedObjectProperties();
}
return changedObjectProperties.size();
}
http://git-wip-us.apache.org/repos/asf/isis/blob/5d918528/core/runtime/src/test/java/org/apache/isis/core/runtime/system/ObjectMemberAbstractTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/ObjectMemberAbstractTest.java b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/ObjectMemberAbstractTest.java
index 16b0f1e..cc5bdc2 100644
--- a/core/runtime/src/test/java/org/apache/isis/core/runtime/system/ObjectMemberAbstractTest.java
+++ b/core/runtime/src/test/java/org/apache/isis/core/runtime/system/ObjectMemberAbstractTest.java
@@ -51,6 +51,7 @@ import org.apache.isis.core.metamodel.interactions.PropertyVisibilityContext;
import org.apache.isis.core.metamodel.interactions.UsabilityContext;
import org.apache.isis.core.metamodel.interactions.VisibilityContext;
import org.apache.isis.core.metamodel.services.ServicesInjector;
+import org.apache.isis.core.metamodel.services.persistsession.PersistenceSessionServiceInternal;
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
import org.apache.isis.core.metamodel.spec.ObjectSpecification;
import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
@@ -82,6 +83,8 @@ public class ObjectMemberAbstractTest {
@Mock
private AuthenticationSessionProvider mockAuthenticationSessionProvider;
@Mock
+ private PersistenceSessionServiceInternal mockPersistenceSessionServiceInternal;
+ @Mock
private AuthenticationSession mockAuthenticationSession;
@Mock
private SpecificationLoader mockSpecificationLoader;
@@ -101,7 +104,7 @@ public class ObjectMemberAbstractTest {
stubConfiguration = new IsisConfigurationDefault();
stubServicesInjector = new ServicesInjector(Lists.<Object>newArrayList(
- mockSpecificationLoader, mockSpecificationLoader), stubConfiguration);
+ mockSpecificationLoader, mockSpecificationLoader, mockPersistenceSessionServiceInternal), stubConfiguration);
context.checking(new Expectations() {{
allowing(mockAuthenticationSessionProvider).getAuthenticationSession();