You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by an...@apache.org on 2021/01/15 10:00:20 UTC
[sling-org-apache-sling-feature-cpconverter] branch SLING-9692
updated: UsersEntryHandler : test handling of regular user nodes
This is an automated email from the ASF dual-hosted git repository.
angela pushed a commit to branch SLING-9692
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-feature-cpconverter.git
The following commit(s) were added to refs/heads/SLING-9692 by this push:
new d02e230 UsersEntryHandler : test handling of regular user nodes
d02e230 is described below
commit d02e230c74030138617efd8e7673005c8e2a8621
Author: angela <an...@adobe.com>
AuthorDate: Fri Jan 15 11:00:04 2021 +0100
UsersEntryHandler : test handling of regular user nodes
---
.../cpconverter/handlers/UsersEntryHandlerTest.java | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/test/java/org/apache/sling/feature/cpconverter/handlers/UsersEntryHandlerTest.java b/src/test/java/org/apache/sling/feature/cpconverter/handlers/UsersEntryHandlerTest.java
index b232330..5ba09b5 100644
--- a/src/test/java/org/apache/sling/feature/cpconverter/handlers/UsersEntryHandlerTest.java
+++ b/src/test/java/org/apache/sling/feature/cpconverter/handlers/UsersEntryHandlerTest.java
@@ -21,13 +21,22 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import java.io.StringReader;
import java.util.List;
import org.apache.sling.feature.Extension;
import org.apache.sling.feature.ExtensionType;
+import org.apache.sling.feature.cpconverter.accesscontrol.AclManager;
import org.apache.sling.feature.cpconverter.accesscontrol.DefaultAclManager;
+import org.apache.sling.feature.cpconverter.accesscontrol.SystemUser;
+import org.apache.sling.feature.cpconverter.accesscontrol.User;
import org.apache.sling.repoinit.parser.RepoInitParser;
import org.apache.sling.repoinit.parser.impl.RepoInitParserService;
import org.apache.sling.repoinit.parser.operations.Operation;
@@ -101,6 +110,15 @@ public class UsersEntryHandlerTest {
assertTrue(actual.contains("/home/users/system/my:feature"));
}
+ @Test
+ public void testUser() throws Exception {
+ String path = "/jcr_root/home/users/a/author/.content.xml";
+ AclManager aclManager = mock(AclManager.class);
+ TestUtils.createRepoInitExtension(usersEntryHandler, aclManager, path, getClass().getResourceAsStream(path.substring(1)));
+ verify(aclManager, times(1)).addUser(any(User.class));
+ verify(aclManager, never()).addSystemUser(any(SystemUser.class));
+ }
+
private Extension parseAndSetRepoinit(String path) throws Exception {
return TestUtils.createRepoInitExtension(usersEntryHandler, new DefaultAclManager(), path, getClass().getResourceAsStream(path.substring(1)));
}