karlpauls commented on a change in pull request #43:
URL: 
https://github.com/apache/sling-org-apache-sling-feature-cpconverter/pull/43#discussion_r540337804



##########
File path: 
src/test/java/org/apache/sling/feature/cpconverter/accesscontrol/AclManagerTest.java
##########
@@ -109,7 +101,50 @@ public void 
makeSureAclsAreCreatedOnlyoutsideSytemUsersPaths() throws Exception
                 // "set ACL for 
acs-commons-package-replication-status-event-service\n" +
                 // "allow jcr:read,crx:replicate,jcr:removeNode on 
/asd/public\n" +
                 // "end\n" +
-                "set ACL for acs-commons-ensure-oak-index-service" + 
System.lineSeparator() +
+                "set ACL for 
acs-commons-package-replication-status-event-service" + System.lineSeparator() +
+                "allow jcr:read,rep:write,rep:indexDefinitionManagement on 
/asd/not/system/user/path" + System.lineSeparator() +
+                "end" + System.lineSeparator();
+        String actual = repoinitExtension.getText();
+        assertEquals(expected, actual);
+
+        RepoInitParser repoInitParser = new RepoInitParserService();
+        List<Operation> operations = repoInitParser.parse(new 
StringReader(actual));
+        assertFalse(operations.isEmpty());
+    }
+
+    @Test
+    public void testRest() throws RepoInitParsingException {
+        // We assume this user will not be in the result because of the reset 
in the next line
+        aclManager.addSystemUser(new 
SystemUser("acs-commons-ensure-oak-index-service", new 
RepoPath("/home/users/system/foo"), new RepoPath("/home/users/system")));
+
+        // emulate a second iteration of conversion
+        aclManager.reset();
+
+        aclManager.addSystemUser(new 
SystemUser("acs-commons-package-replication-status-event-service", new 
RepoPath("/home/users/system/foo"), new RepoPath("/home/users/system")));
+        
aclManager.addAcl("acs-commons-package-replication-status-event-service", 
newAcl(true, "jcr:read,rep:write,rep:indexDefinitionManagement", 
"/asd/not/system/user/path"));
+
+        VaultPackageAssembler assembler = mock(VaultPackageAssembler.class);
+        when(assembler.getEntry(anyString())).thenReturn(new 
File(System.getProperty("java.io.tmpdir")));
+        Feature feature = new Feature(new ArtifactId("org.apache.sling", 
"org.apache.sling.cp2fm", "0.0.1", null, null));
+
+        FeaturesManager fm = Mockito.spy(new 
DefaultFeaturesManager(tempDir.toFile()));
+        when(fm.getTargetFeature()).thenReturn(feature);
+
+        aclManager.addRepoinitExtension(Arrays.asList(assembler), fm);
+
+
+        Extension repoinitExtension = 
feature.getExtensions().getByName(Extension.EXTENSION_NAME_REPOINIT);
+        assertNotNull(repoinitExtension);
+
+        // acs-commons-on-deploy-scripts-service will be missed

Review comment:
       true




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to