You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by np...@apache.org on 2018/05/30 12:26:24 UTC
[sling-org-apache-sling-testing-jcr-mock] branch master updated:
SLING-7692 support for MockSession.refresh(false)
This is an automated email from the ASF dual-hosted git repository.
npeltier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-jcr-mock.git
The following commit(s) were added to refs/heads/master by this push:
new f9d837c SLING-7692 support for MockSession.refresh(false)
f9d837c is described below
commit f9d837c0849d3e4aaae7143facf38cc83a608462
Author: Nicolas Peltier <pe...@gmail.com>
AuthorDate: Wed May 30 14:20:05 2018 +0200
SLING-7692 support for MockSession.refresh(false)
---
.../java/org/apache/sling/testing/mock/jcr/MockSession.java | 3 +++
.../org/apache/sling/testing/mock/jcr/MockSessionTest.java | 11 +++++++++++
2 files changed, 14 insertions(+)
diff --git a/src/main/java/org/apache/sling/testing/mock/jcr/MockSession.java b/src/main/java/org/apache/sling/testing/mock/jcr/MockSession.java
index b87396a..16591fa 100644
--- a/src/main/java/org/apache/sling/testing/mock/jcr/MockSession.java
+++ b/src/main/java/org/apache/sling/testing/mock/jcr/MockSession.java
@@ -294,6 +294,9 @@ class MockSession implements Session {
@Override
public void refresh(final boolean keepChanges) throws RepositoryException {
+ if (!keepChanges){
+ this.items.clear();
+ }
// do nothing
checkLive();
}
diff --git a/src/test/java/org/apache/sling/testing/mock/jcr/MockSessionTest.java b/src/test/java/org/apache/sling/testing/mock/jcr/MockSessionTest.java
index be50aff..2554ab1 100644
--- a/src/test/java/org/apache/sling/testing/mock/jcr/MockSessionTest.java
+++ b/src/test/java/org/apache/sling/testing/mock/jcr/MockSessionTest.java
@@ -136,6 +136,17 @@ public class MockSessionTest {
}
@Test
+ public void testRevertFalse() throws RepositoryException {
+ Session session = MockJcr.newSession();
+ Node rootNode = session.getRootNode();
+ rootNode.addNode("node1");
+ assertTrue(session.itemExists("/node1"));
+ session.refresh(false);
+ assertFalse(session.itemExists("/node1"));
+ assertFalse(rootNode.getNodes().hasNext());
+ }
+
+ @Test
public void testNodesWithSpecialNames() throws RepositoryException {
Session session = MockJcr.newSession();
--
To stop receiving notification emails like this one, please contact
npeltier@apache.org.