Author: bdelacretaz
Date: Wed Jun 22 12:51:27 2016
New Revision: 1749667

URL: http://svn.apache.org/viewvc?rev=1749667&view=rev
Log:
SLING-5355 - launchpad integration tests for :repoinit statements in the 
provisioning model

Added:
    
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/RepoinitPathTest.java
Modified:
    
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/SystemUsersTest.java
    sling/trunk/launchpad/test-services/src/main/resources/repoinit.txt
    sling/trunk/launchpad/testing/src/main/provisioning/model.txt

Added: 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/RepoinitPathTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/RepoinitPathTest.java?rev=1749667&view=auto
==============================================================================
--- 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/RepoinitPathTest.java
 (added)
+++ 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/RepoinitPathTest.java
 Wed Jun 22 12:51:27 2016
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sling.launchpad.webapp.integrationtest.repository;
+
+import static org.junit.Assert.assertTrue;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.sling.jcr.api.SlingRepository;
+import org.apache.sling.junit.rules.TeleporterRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+/** Verify that a path is created by repoinit statements
+ *  from our provisioning model.
+ */
+public class RepoinitPathTest {
+
+    @Rule
+    public final TeleporterRule teleporter = 
TeleporterRule.forClass(getClass(), "Launchpad");
+
+    @Test
+    public void pathExists() throws RepositoryException {
+        final SlingRepository repo = 
teleporter.getService(SlingRepository.class);
+        final Session s = repo.loginAdministrative(null);
+        try {
+            assertTrue(s.nodeExists("/repoinit/provisioningModelTest"));
+        } finally { 
+            s.logout();
+        }
+    }
+}
\ No newline at end of file

Modified: 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/SystemUsersTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/SystemUsersTest.java?rev=1749667&r1=1749666&r2=1749667&view=diff
==============================================================================
--- 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/SystemUsersTest.java
 (original)
+++ 
sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/repository/SystemUsersTest.java
 Wed Jun 22 12:51:27 2016
@@ -55,4 +55,10 @@ public class SystemUsersTest {
         // test-services bundle
         assertSystemUser("launchpad_testing");
     }
+    
+    @Test
+    public void provisioningModelUser() throws RepositoryException {
+        // This one is created from our provisioning model
+        assertSystemUser("provisioningModelUser");
+    }
 }
\ No newline at end of file

Modified: sling/trunk/launchpad/test-services/src/main/resources/repoinit.txt
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/resources/repoinit.txt?rev=1749667&r1=1749666&r2=1749667&view=diff
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/resources/repoinit.txt 
(original)
+++ sling/trunk/launchpad/test-services/src/main/resources/repoinit.txt Wed Jun 
22 12:51:27 2016
@@ -17,6 +17,8 @@
 #  under the License.
 #
 
-# No tests rely on this so far but we can add
-# more repoinit statements here as needed.
-create service user launchpad_testing
\ No newline at end of file
+# With SLING-5355 we can create system users
+# directly from the provisioning model, this
+# is used by the SystemUsersTest to test the
+# more low-level repository initializer mechanism
+create service user launchpad_testing

Modified: sling/trunk/launchpad/testing/src/main/provisioning/model.txt
URL: 
http://svn.apache.org/viewvc/sling/trunk/launchpad/testing/src/main/provisioning/model.txt?rev=1749667&r1=1749666&r2=1749667&view=diff
==============================================================================
--- sling/trunk/launchpad/testing/src/main/provisioning/model.txt (original)
+++ sling/trunk/launchpad/testing/src/main/provisioning/model.txt Wed Jun 22 
12:51:27 2016
@@ -34,3 +34,11 @@
 
 [settings]
   org.apache.sling.commons.log.julenabled=true
+  
+ # Test repository initialization from provisioning model
+ # No need to test all repoinit statements, this is done
+ # by the repoinit it module
+ [:repoinit]
+create path /repoinit/provisioningModelTest
+
+create service user provisioningModelUser
\ No newline at end of file


Reply via email to