You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2019/10/31 16:27:47 UTC

[sling-org-apache-sling-jcr-repoinit] branch master updated (caf33ea -> 9d87b5c)

This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git.


    from caf33ea  SLING-8766 : AclVisitor.setPrincipalAcl: be more lenient with unsupported principals
     new 01998ae  gitignore
     new bf54ceb  SLING-8740 - remove ProvisioningModelIT (redundant with sling-org-apache-sling-launchpad-integration-tests/RepoinitPathTest) and prepare for moving RepoInitTextIT to paxexam testing
     new 339dc86  SLING-8740 - remove provisioning, not needed anymore
     new ef6a310  SLING-8740 - basic sling.testing.paxexam setup
     new 4c5eea1  SLING-8740 - RepoInitTextIT passes with all tests enabled
     new d8052b5  SLING-8740 - remove customizer, not needed anymore
     new 9d87b5c  SLING-8740 - readd CND/namespace test from the old ProvisioningModelIT

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .gitignore                                         |   1 +
 pom.xml                                            | 124 +++++++++------------
 .../sling/jcr/repoinit/it/ProvisioningModelIT.java |  83 --------------
 .../sling/jcr/repoinit/it/RepoInitTestSupport.java |  53 +++++++++
 .../sling/jcr/repoinit/it/RepoInitTextIT.java      |  36 ++++--
 .../junit/teleporter/customizers/ITCustomizer.java |  35 ------
 src/test/provisioning/oak.txt                      |  51 ---------
 src/test/provisioning/repoinit-tests.txt           |  55 ---------
 src/test/provisioning/sling.txt                    |  47 --------
 src/test/resources/repoinit.txt                    |   6 +
 10 files changed, 139 insertions(+), 352 deletions(-)
 delete mode 100644 src/test/java/org/apache/sling/jcr/repoinit/it/ProvisioningModelIT.java
 create mode 100644 src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java
 delete mode 100644 src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java
 delete mode 100644 src/test/provisioning/oak.txt
 delete mode 100644 src/test/provisioning/repoinit-tests.txt
 delete mode 100644 src/test/provisioning/sling.txt


[sling-org-apache-sling-jcr-repoinit] 06/07: SLING-8740 - remove customizer, not needed anymore

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit d8052b515b44d2daec259ef165e6f1866b852e03
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Oct 31 16:18:26 2019 +0100

    SLING-8740 - remove customizer, not needed anymore
---
 .../junit/teleporter/customizers/ITCustomizer.java | 35 ----------------------
 1 file changed, 35 deletions(-)

diff --git a/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java b/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java
deleted file mode 100644
index 7fd10e7..0000000
--- a/src/test/java/org/apache/sling/junit/teleporter/customizers/ITCustomizer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.junit.teleporter.customizers;
-
-import org.apache.sling.junit.rules.TeleporterRule;
-import org.apache.sling.testing.teleporter.client.ClientSideTeleporter;
-import org.apache.sling.testing.clients.util.TimeoutsProvider;
-
-public class ITCustomizer implements TeleporterRule.Customizer {
-
-    public static final String BASE_URL_PROP = "ClientSideTeleporter.baseUrl";
-
-    @Override
-    public void customize(TeleporterRule t, String options) {
-        final ClientSideTeleporter cst = (ClientSideTeleporter)t;
-        cst.setBaseUrl(System.getProperty(BASE_URL_PROP, BASE_URL_PROP + "_IS_NOT_SET"));
-        cst.setServerCredentials("admin", "admin");
-        cst.includeDependencyPrefix("org.apache.sling.jcr.repoinit.it");
-        cst.setTestReadyTimeoutSeconds(TimeoutsProvider.getInstance().getTimeout(5));
-    }
-}


[sling-org-apache-sling-jcr-repoinit] 03/07: SLING-8740 - remove provisioning, not needed anymore

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 339dc860cd81228c74b6f9d1d60ab687bcc68cb8
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Oct 31 15:08:47 2019 +0100

    SLING-8740 - remove provisioning, not needed anymore
---
 src/test/provisioning/oak.txt            | 51 -----------------------------
 src/test/provisioning/repoinit-tests.txt | 55 --------------------------------
 src/test/provisioning/sling.txt          | 47 ---------------------------
 3 files changed, 153 deletions(-)

diff --git a/src/test/provisioning/oak.txt b/src/test/provisioning/oak.txt
deleted file mode 100644
index 74d5537..0000000
--- a/src/test/provisioning/oak.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-#  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.
-#
-
-[feature name=oak]
-
-[variables]
-    oak.version=1.16.0
-
-[artifacts startLevel=15]
-    org.apache.jackrabbit/oak-api/${oak.version}
-    org.apache.jackrabbit/oak-blob/${oak.version}
-    org.apache.jackrabbit/oak-blob-plugins/${oak.version}
-    org.apache.jackrabbit/oak-commons/${oak.version}
-    org.apache.jackrabbit/oak-core/${oak.version}
-    org.apache.jackrabbit/oak-core-spi/${oak.version}
-    org.apache.jackrabbit/oak-lucene/${oak.version}
-    org.apache.jackrabbit/oak-jcr/${oak.version}
-    org.apache.jackrabbit/oak-query-spi/${oak.version}
-    org.apache.jackrabbit/oak-security-spi/${oak.version}
-    org.apache.jackrabbit/oak-store-composite/${oak.version}
-    # OAK-7263 - oak-store-document should be in oak_mongo runmode
-    org.apache.jackrabbit/oak-store-document/${oak.version}
-    org.apache.jackrabbit/oak-store-spi/${oak.version}
-
-[artifacts startLevel=15 runModes=oak_tar]
-    org.apache.jackrabbit/oak-segment-tar/${oak.version}
-
-[artifacts startLevel=15 runModes=oak_mongo]
-    org.mongodb/mongo-java-driver/3.8.2
-    com.h2database/h2-mvstore/1.4.194
-
-# start the Oak server instance after all components have been configured
-# and started to avoid restarting that component ( see SLING-4556 )
-[artifacts startLevel=16]
-    org.apache.sling/org.apache.sling.jcr.oak.server/1.2.2
diff --git a/src/test/provisioning/repoinit-tests.txt b/src/test/provisioning/repoinit-tests.txt
deleted file mode 100644
index 1c881e8..0000000
--- a/src/test/provisioning/repoinit-tests.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-#  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.
-#
-
-[feature name=repoinit-tests]
-
-[artifacts]
-  org.apache.sling/org.apache.sling.repoinit.parser
-  org.apache.sling/org.apache.sling.jcr.repoinit
-
-[configurations]
-  org.apache.sling.jcr.repoinit.impl.RepositoryInitializer
-    references=["model:context:/resources/provisioning/model.txt","model@repoinitTwo:context:/resources/provisioning/model.txt"]
-
-[:repoinit]
-# Test the RepositoryInitializer which reads such sections
-create path /repoinit/fromProvisioningModel
-
-create service user userFromProvisioningModel
-
-set ACL for userFromProvisioningModel
-  allow jcr:read on /repoinit/fromProvisioningModel
-  deny jcr:write on /repoinit/fromProvisioningModel
-end
-
-create service user thirdUserFromProvisioningModel
-
-disable service user thirdUserFromProvisioningModel : "Disabled for testing reason"
-
-register namespace (slingtest) http://sling.apache.org/ns/test/repoinit-it/v1.0
-
-register nodetypes
-<<===
-<< <slingtest='http://sling.apache.org/ns/test/repoinit-it/v1.0'>
-<< [slingtest:unstructured] > nt:unstructured
-===>>
-
-# second section, to test multiple configured URLs supplied in config
-[:repoinitTwo]
-create service user secondUserFromProvisioningModel
diff --git a/src/test/provisioning/sling.txt b/src/test/provisioning/sling.txt
deleted file mode 100644
index fad19c0..0000000
--- a/src/test/provisioning/sling.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-#  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.
-#
-
-[feature name=sling]
-
-[variables]
-    jackrabbit.version=2.18.2
-
-# Dependencies
-[artifacts]
-  org.apache.sling/org.apache.sling.starter/11/slingstart
-  org.apache.sling/org.apache.sling.junit.core/1.0.26
-  # various dependency bumps for Oak
-  commons-codec/commons-codec/1.13
-  org.apache.tika/tika-core/1.22
-  org.apache.tika/tika-parsers/1.22
-
-# additional configuration for testing
-[configurations]
-  org.apache.sling.jcr.base.internal.LoginAdminWhitelist.fragment-testing
-    whitelist.bundles=[ \
-    "org.apache.sling.junit.core" \
-    ]
-    whitelist.name="testing"
-
-  org.apache.sling.servlets.resolver.SlingServletResolver
-    # Set the servlet resolver's cache size to zero for testing
-    servletresolver.cacheSize=I"0"
-
-[settings]
-  org.apache.sling.commons.log.julenabled=true
\ No newline at end of file


[sling-org-apache-sling-jcr-repoinit] 01/07: gitignore

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 01998ae82afaeca3157cce283f2f5627faa4b1ec
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Oct 31 15:04:50 2019 +0100

    gitignore
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitignore b/.gitignore
index 5aee8de..dea9ea5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 /target
+.vscode
 .idea
 .classpath
 .metadata


[sling-org-apache-sling-jcr-repoinit] 02/07: SLING-8740 - remove ProvisioningModelIT (redundant with sling-org-apache-sling-launchpad-integration-tests/RepoinitPathTest) and prepare for moving RepoInitTextIT to paxexam testing

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit bf54cebe5441b27d827fd1fcbfa952adde0de424
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Oct 31 15:07:09 2019 +0100

    SLING-8740 - remove ProvisioningModelIT (redundant with sling-org-apache-sling-launchpad-integration-tests/RepoinitPathTest) and prepare for moving RepoInitTextIT to paxexam testing
---
 pom.xml                                            | 73 -------------------
 .../sling/jcr/repoinit/it/ProvisioningModelIT.java | 83 ----------------------
 .../sling/jcr/repoinit/it/RepoInitTextIT.java      | 19 +++--
 3 files changed, 8 insertions(+), 167 deletions(-)

diff --git a/pom.xml b/pom.xml
index 0f3156f..02a8802 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,8 +38,6 @@
   <properties>
     <jackrabbit.version>2.18.2</jackrabbit.version>
     <oak.version>1.16.0</oak.version>
-    <http.host>localhost</http.host>
-    <sling.default.vm.options>-Xmx1024m -XX:MaxPermSize=256m -Djava.awt.headless=true</sling.default.vm.options>
   </properties>
 
   <scm>
@@ -60,71 +58,6 @@
                     </excludePackageNames>
                 </configuration>
             </plugin>
-             <plugin>
-                <!-- Find free ports to run our server -->
-                <groupId>org.codehaus.mojo</groupId>
-                <artifactId>build-helper-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>reserve-server-port</id>
-                        <goals>
-                            <goal>reserve-network-port</goal>
-                        </goals>
-                        <phase>process-resources</phase>
-                        <configuration>
-                            <portNames>
-                                <!-- used port name must be stored in property because it must be used for the base url -->
-                                <portName>http.port</portName>
-                            </portNames>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.sling</groupId>
-                <artifactId>slingstart-maven-plugin</artifactId>
-                <extensions>true</extensions>
-                <executions>
-                    <execution>
-                        <id>prepare-launchpad-package</id>
-                        <phase>pre-integration-test</phase>
-                        <goals>
-                            <goal>prepare-package</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                        <id>build-launchpad-package</id>
-                        <phase>pre-integration-test</phase>
-                        <goals>
-                            <goal>package</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                         <id>start-container-before-IT</id>
-                        <goals>
-                            <goal>start</goal>
-                        </goals>
-                    </execution>
-                    <execution>
-                         <id>stop-container-after-IT</id>
-                        <goals>
-                            <goal>stop</goal>
-                        </goals>
-                    </execution>
-                </executions>
-                <configuration>
-                    <usePomDependencies>true</usePomDependencies>
-                    <attachArtifact>false</attachArtifact>
-                    <disableExtendingMavenClasspath>true</disableExtendingMavenClasspath>
-                    <servers>
-                        <server>
-                            <id>singleinstance</id>
-                            <port>${http.port}</port>
-                            <vmOpts>${sling.vm.options}</vmOpts>
-                        </server>
-                    </servers>
-                </configuration>
-            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-failsafe-plugin</artifactId>
@@ -144,12 +77,6 @@
                         </goals>
                     </execution>
                 </executions>
-                <configuration>
-                    <systemPropertyVariables>
-                        <ClientSideTeleporter.baseUrl>http://${http.host}:${http.port}/</ClientSideTeleporter.baseUrl>
-                        <ClientSideTeleporter.testReadyTimeoutSeconds>20</ClientSideTeleporter.testReadyTimeoutSeconds>
-                    </systemPropertyVariables>
-                </configuration>
             </plugin>
         </plugins>
     </build>
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/it/ProvisioningModelIT.java b/src/test/java/org/apache/sling/jcr/repoinit/it/ProvisioningModelIT.java
deleted file mode 100644
index ee95ee9..0000000
--- a/src/test/java/org/apache/sling/jcr/repoinit/it/ProvisioningModelIT.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.jcr.repoinit.it;
-
-import java.util.UUID;
-import javax.jcr.Session;
-import org.apache.sling.jcr.api.SlingRepository;
-import org.apache.sling.junit.rules.TeleporterRule;
-import org.junit.After;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-/** Integration test that verifies that repoinit statements
- *  provided in a provisioning model are correctly applied.
- */
-public class ProvisioningModelIT {
-
-    private Session session;
-    private static final String TEST_PATH = "/repoinit/fromProvisioningModel";
-    private static final String TEST_USER = "userFromProvisioningModel";
-    private static final String SECOND_TEST_USER = "secondUserFromProvisioningModel";
-    private static final String THIRD_TEST_USER = "thirdUserFromProvisioningModel";
-    private final String uniqueID = UUID.randomUUID().toString();
-
-    @Rule
-    public TeleporterRule teleporter = TeleporterRule.forClass(getClass(), "IT");
-
-    @Before
-    public void setup() throws Exception {
-        session = teleporter.getService(SlingRepository.class).loginAdministrative(null);
-    }
-
-    @After
-    public void cleanup() {
-        if(session != null) {
-            session.logout();
-        }
-    }
-
-    @Test
-    public void usersCreated() throws Exception {
-        assertTrue("Expecting user " + TEST_USER, U.userExists(session, TEST_USER));
-        assertTrue("Expecting user " + SECOND_TEST_USER, U.userExists(session, SECOND_TEST_USER));
-        assertTrue("Expecting user " + THIRD_TEST_USER, U.userExists(session, THIRD_TEST_USER));
-    }
-
-    @Test
-    public void userDisabled() throws Exception {
-        assertTrue(String.format("Expecting user %s to be disabled", THIRD_TEST_USER), U.userIsDisabled(session, THIRD_TEST_USER));
-        assertFalse(String.format("Expecting user %s to be enabled", TEST_USER), U.userIsDisabled(session,TEST_USER));
-    }
-
-    @Test
-    public void userAclSet() throws Exception {
-        assertTrue("Expecting read access", U.canRead(session, TEST_USER, TEST_PATH));
-        assertFalse("Expecting no write access",  U.canWrite(session, TEST_USER, TEST_PATH));
-    }
-
-    @Test
-    public void namespaceAndCndRegistered() throws Exception {
-        final String nodeName = "ns-" + uniqueID;
-        session.getRootNode().addNode(nodeName, "slingtest:unstructured");
-        session.save();
-    }
-}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
index e9b35f8..856d040 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
@@ -45,29 +45,24 @@ public class RepoInitTextIT {
 
     public static final String REPO_INIT_FILE = "/repoinit.txt";
 
-    @Rule
-    public TeleporterRule teleporter = TeleporterRule
-        .forClass(getClass(), "IT")
-        .withResources(REPO_INIT_FILE);
-
     @Before
     public void setup() throws Exception {
-        session = teleporter.getService(SlingRepository.class).loginAdministrative(null);
+        session = null; // TODO
 
         // Execute some repoinit statements
         final InputStream is = getClass().getResourceAsStream(REPO_INIT_FILE);
         assertNotNull("Expecting " + REPO_INIT_FILE, is);
         try {
-            final RepoInitParser  parser = teleporter.getService(RepoInitParser.class);
-            final JcrRepoInitOpsProcessor processor = teleporter.getService(JcrRepoInitOpsProcessor.class);
-            processor.apply(session, parser.parse(new InputStreamReader(is, "UTF-8")));
-            session.save();
+            //final RepoInitParser  parser = teleporter.getService(RepoInitParser.class);
+            //final JcrRepoInitOpsProcessor processor = teleporter.getService(JcrRepoInitOpsProcessor.class);
+            //processor.apply(session, parser.parse(new InputStreamReader(is, "UTF-8")));
+            //session.save();
         } finally {
             is.close();
         }
 
         // The repoinit file causes those nodes to be created
-        assertTrue("Expecting test nodes to be created", session.itemExists("/acltest/A/B"));
+        //assertTrue("Expecting test nodes to be created", session.itemExists("/acltest/A/B"));
     }
 
     @After
@@ -77,6 +72,7 @@ public class RepoInitTextIT {
         }
     }
 
+    /*
     @Test
     public void serviceUserCreated() throws Exception {
         new Retry() {
@@ -111,4 +107,5 @@ public class RepoInitTextIT {
             }
         };
     }
+    */
 }
\ No newline at end of file


[sling-org-apache-sling-jcr-repoinit] 05/07: SLING-8740 - RepoInitTextIT passes with all tests enabled

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 4c5eea1526efa108b33b9dfb496061478d26783f
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Oct 31 16:17:27 2019 +0100

    SLING-8740 - RepoInitTextIT passes with all tests enabled
---
 .../sling/jcr/repoinit/it/RepoInitTestSupport.java | 53 ++++++++++++++++++++++
 .../sling/jcr/repoinit/it/RepoInitTextIT.java      | 53 ++++------------------
 2 files changed, 63 insertions(+), 43 deletions(-)

diff --git a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java
new file mode 100644
index 0000000..38f761a
--- /dev/null
+++ b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java
@@ -0,0 +1,53 @@
+/*
+ * 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.jcr.repoinit.it;
+
+import org.apache.sling.testing.paxexam.SlingOptions;
+import org.apache.sling.testing.paxexam.TestSupport;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
+
+public abstract class RepoInitTestSupport extends TestSupport {
+
+    @Configuration
+    public Option[] configuration() {
+        SlingOptions.versionResolver.setVersionFromProject("org.apache.jackrabbit", "jackrabbit-api");
+        return new Option[]{
+            baseConfiguration(),
+            slingQuickstart(),
+            testBundle("bundle.filename"),
+            mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.repoinit.parser").versionAsInProject(),
+            junitBundles(),
+            newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
+                .put("whitelist.bundles.regexp", "^PAXEXAM.*$")
+                .asOption(),        
+        };
+    }
+    
+    protected Option slingQuickstart() {
+        final String workingDirectory = workingDirectory();
+        final int httpPort = findFreePort();
+        return composite(
+            slingQuickstartOakTar(workingDirectory, httpPort)
+        );
+    }
+}
\ No newline at end of file
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
index 7ed20db..7127928 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
@@ -29,30 +29,21 @@ import javax.jcr.SimpleCredentials;
 
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.repoinit.JcrRepoInitOpsProcessor;
-import org.apache.sling.junit.rules.TeleporterRule;
 import org.apache.sling.repoinit.parser.RepoInitParser;
-import org.apache.sling.testing.paxexam.TestSupport;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.PaxExam;
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
-import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
-import static org.ops4j.pax.exam.CoreOptions.composite;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
 
 /** Basic integration test of the repoinit parser and execution
  *  services, reading statements from a text file.
  */
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
-public class RepoInitTextIT extends TestSupport {
+public class RepoInitTextIT extends RepoInitTestSupport {
 
     private Session session;
     private static final String FRED_WILMA = "fredWilmaService";
@@ -63,27 +54,12 @@ public class RepoInitTextIT extends TestSupport {
     @Inject
     private SlingRepository repository;
 
-    @Configuration
-    public Option[] configuration() {
-        return new Option[]{
-            baseConfiguration(),
-            slingQuickstart(),
-            //testBundle("bundle.filename"),
-            junitBundles(),
-            newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
-                .put("whitelist.bundles.regexp", "^PAXEXAM.*$")
-                .asOption(),        
-        };
-    }
-    
-    protected Option slingQuickstart() {
-        final String workingDirectory = workingDirectory();
-        final int httpPort = findFreePort();
-        return composite(
-            slingQuickstartOakTar(workingDirectory, httpPort)
-        );
-    }
-    
+    @Inject
+    private RepoInitParser parser;
+
+    @Inject
+    private JcrRepoInitOpsProcessor processor;
+
     @Before
     public void setup() throws Exception {
         session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
@@ -92,16 +68,14 @@ public class RepoInitTextIT extends TestSupport {
         final InputStream is = getClass().getResourceAsStream(REPO_INIT_FILE);
         assertNotNull("Expecting " + REPO_INIT_FILE, is);
         try {
-            //final RepoInitParser  parser = teleporter.getService(RepoInitParser.class);
-            //final JcrRepoInitOpsProcessor processor = teleporter.getService(JcrRepoInitOpsProcessor.class);
-            //processor.apply(session, parser.parse(new InputStreamReader(is, "UTF-8")));
-            //session.save();
+            processor.apply(session, parser.parse(new InputStreamReader(is, "UTF-8")));
+            session.save();
         } finally {
             is.close();
         }
 
         // The repoinit file causes those nodes to be created
-        //assertTrue("Expecting test nodes to be created", session.itemExists("/acltest/A/B"));
+        assertTrue("Expecting test nodes to be created", session.itemExists("/acltest/A/B"));
     }
 
     @After
@@ -112,12 +86,6 @@ public class RepoInitTextIT extends TestSupport {
     }
 
     @Test
-    public void TODO() throws Exception {
-        assertNotNull(session);
-    }
-
-    /*
-    @Test
     public void serviceUserCreated() throws Exception {
         new Retry() {
             @Override
@@ -151,5 +119,4 @@ public class RepoInitTextIT extends TestSupport {
             }
         };
     }
-    */
 }
\ No newline at end of file


[sling-org-apache-sling-jcr-repoinit] 07/07: SLING-8740 - readd CND/namespace test from the old ProvisioningModelIT

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit 9d87b5c94e6b8fc4b3fb9dc5cb2fbcafb28c857d
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Oct 31 16:22:41 2019 +0100

    SLING-8740 - readd CND/namespace test from the old ProvisioningModelIT
---
 .../java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java     | 8 ++++++++
 src/test/resources/repoinit.txt                                   | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
index 7127928..395b342 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertTrue;
 
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.util.UUID;
 
 import javax.inject.Inject;
 import javax.jcr.Session;
@@ -119,4 +120,11 @@ public class RepoInitTextIT extends RepoInitTestSupport {
             }
         };
     }
+
+    @Test
+    public void namespaceAndCndRegistered() throws Exception {
+        final String nodeName = "ns-" + UUID.randomUUID();
+        session.getRootNode().addNode(nodeName, "slingtest:unstructured");
+        session.save();
+    }
 }
\ No newline at end of file
diff --git a/src/test/resources/repoinit.txt b/src/test/resources/repoinit.txt
index de2286a..17d892d 100644
--- a/src/test/resources/repoinit.txt
+++ b/src/test/resources/repoinit.txt
@@ -41,3 +41,9 @@ end
 set ACL on /acltest/A/B
   deny jcr:write for anotherService
 end
+
+register nodetypes
+<<===
+<< <slingtest='http://sling.apache.org/ns/test/repoinit-it/v1.0'>
+<< [slingtest:unstructured] > nt:unstructured
+===>>


[sling-org-apache-sling-jcr-repoinit] 04/07: SLING-8740 - basic sling.testing.paxexam setup

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git

commit ef6a3108265435e6c6d558ffa2288612b5cfc019
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Oct 31 16:00:17 2019 +0100

    SLING-8740 - basic sling.testing.paxexam setup
---
 pom.xml                                            | 55 ++++++++++++++++++++++
 .../sling/jcr/repoinit/it/RepoInitTextIT.java      | 48 ++++++++++++++++++-
 2 files changed, 101 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 02a8802..b27e4b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,6 +50,10 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.apache.servicemix.tooling</groupId>
+                <artifactId>depends-maven-plugin</artifactId>
+            </plugin>
+              <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-javadoc-plugin</artifactId>
                 <configuration>
@@ -77,12 +81,63 @@
                         </goals>
                     </execution>
                 </executions>
+                <configuration>
+                    <redirectTestOutputToFile>true</redirectTestOutputToFile>
+                    <systemProperties>
+                        <property>
+                        <name>bundle.filename</name>
+                        <value>${basedir}/target/${project.build.finalName}.jar</value>
+                        </property>
+                    </systemProperties>
+                </configuration>
             </plugin>
         </plugins>
     </build>
 
     <dependencies>
         <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam</artifactId>
+            <version>4.13.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-cm</artifactId>
+            <version>4.13.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-container-forked</artifactId>
+            <version>4.13.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-junit4</artifactId>
+            <version>4.13.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.exam</groupId>
+            <artifactId>pax-exam-link-mvn</artifactId>
+            <version>4.13.1</version>
+            <scope>test</scope>
+        </dependency>        
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.testing.paxexam</artifactId>
+            <version>3.0.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.framework</artifactId>
+            <version>6.0.3</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
             <version>2.3.6</version>
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
index 856d040..7ed20db 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java
@@ -23,21 +23,36 @@ import static org.junit.Assert.assertTrue;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 
+import javax.inject.Inject;
 import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
 
 import org.apache.sling.jcr.api.SlingRepository;
 import org.apache.sling.jcr.repoinit.JcrRepoInitOpsProcessor;
 import org.apache.sling.junit.rules.TeleporterRule;
 import org.apache.sling.repoinit.parser.RepoInitParser;
+import org.apache.sling.testing.paxexam.TestSupport;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
+import static org.ops4j.pax.exam.CoreOptions.composite;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
 
 /** Basic integration test of the repoinit parser and execution
  *  services, reading statements from a text file.
  */
-public class RepoInitTextIT {
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class RepoInitTextIT extends TestSupport {
 
     private Session session;
     private static final String FRED_WILMA = "fredWilmaService";
@@ -45,9 +60,33 @@ public class RepoInitTextIT {
 
     public static final String REPO_INIT_FILE = "/repoinit.txt";
 
+    @Inject
+    private SlingRepository repository;
+
+    @Configuration
+    public Option[] configuration() {
+        return new Option[]{
+            baseConfiguration(),
+            slingQuickstart(),
+            //testBundle("bundle.filename"),
+            junitBundles(),
+            newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
+                .put("whitelist.bundles.regexp", "^PAXEXAM.*$")
+                .asOption(),        
+        };
+    }
+    
+    protected Option slingQuickstart() {
+        final String workingDirectory = workingDirectory();
+        final int httpPort = findFreePort();
+        return composite(
+            slingQuickstartOakTar(workingDirectory, httpPort)
+        );
+    }
+    
     @Before
     public void setup() throws Exception {
-        session = null; // TODO
+        session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
 
         // Execute some repoinit statements
         final InputStream is = getClass().getResourceAsStream(REPO_INIT_FILE);
@@ -72,6 +111,11 @@ public class RepoInitTextIT {
         }
     }
 
+    @Test
+    public void TODO() throws Exception {
+        assertNotNull(session);
+    }
+
     /*
     @Test
     public void serviceUserCreated() throws Exception {