You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2022/03/09 13:10:02 UTC

[sling-org-apache-sling-jcr-contentloader] branch feature/SLING-11189-content-reader-listener-dependency updated (f76b5f6 -> f9566b1)

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

sseifert pushed a change to branch feature/SLING-11189-content-reader-listener-dependency
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentloader.git.


 discard f76b5f6  SLING-11189 ensure all built-in content readers are registered before processing any bundle in this listener
     new f9566b1  SLING-11189 ensure all built-in content readers are registered before processing any bundle in this listener

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (f76b5f6)
            \
             N -- N -- N   refs/heads/feature/SLING-11189-content-reader-listener-dependency (f9566b1)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 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:
 .../internal/BundleContentLoaderListenerTest.java            |  8 ++++----
 .../jcr/contentloader/internal/BundleContentLoaderTest.java  | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

[sling-org-apache-sling-jcr-contentloader] 01/01: SLING-11189 ensure all built-in content readers are registered before processing any bundle in this listener

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

sseifert pushed a commit to branch feature/SLING-11189-content-reader-listener-dependency
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-contentloader.git

commit f9566b1b6271bf86aec7be8f4e35b52088d4f204
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Wed Mar 9 14:02:13 2022 +0100

    SLING-11189 ensure all built-in content readers are registered before processing any bundle in this listener
---
 .../contentloader/internal/BundleContentLoaderListener.java   | 11 +++++++++++
 .../internal/BundleContentLoaderListenerTest.java             | 10 ++++++++++
 .../jcr/contentloader/internal/BundleContentLoaderTest.java   |  8 +++++---
 .../internal/hc/BundleContentLoadedCheckTest.java             |  8 +++++---
 4 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderListener.java b/src/main/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderListener.java
index 1df747b..5792f15 100644
--- a/src/main/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderListener.java
+++ b/src/main/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderListener.java
@@ -35,6 +35,7 @@ import javax.jcr.lock.LockManager;
 
 import org.apache.sling.commons.mime.MimeTypeService;
 import org.apache.sling.jcr.api.SlingRepository;
+import org.apache.sling.jcr.contentloader.ContentReader;
 import org.apache.sling.serviceusermapping.ServiceUserMapped;
 import org.apache.sling.settings.SlingSettingsService;
 import org.osgi.framework.Bundle;
@@ -122,6 +123,16 @@ public class BundleContentLoaderListener implements SynchronousBundleListener, B
     @Reference
     protected SlingSettingsService settingsService;
 
+    // SLING-11189: ensure all built-in content readers are registered before processing any bundle in this listener
+    @Reference(target = "(component.name=org.apache.sling.jcr.contentloader.internal.readers.JsonReader)")
+    private ContentReader mandatoryContentReader1;
+    @Reference(target = "(component.name=org.apache.sling.jcr.contentloader.internal.readers.OrderedJsonReader)")
+    private ContentReader mandatoryContentReader2;
+    @Reference(target = "(component.name=org.apache.sling.jcr.contentloader.internal.readers.XmlReader)")
+    private ContentReader mandatoryContentReader3;
+    @Reference(target = "(component.name=org.apache.sling.jcr.contentloader.internal.readers.ZipReader)")
+    private ContentReader mandatoryContentReader4;
+
     // ---------- BundleListener -----------------------------------------------
 
     /**
diff --git a/src/test/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderListenerTest.java b/src/test/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderListenerTest.java
index 0bdef08..e01f6e8 100644
--- a/src/test/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderListenerTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderListenerTest.java
@@ -41,6 +41,10 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.lock.LockManager;
 
+import org.apache.sling.jcr.contentloader.internal.readers.JsonReader;
+import org.apache.sling.jcr.contentloader.internal.readers.OrderedJsonReader;
+import org.apache.sling.jcr.contentloader.internal.readers.XmlReader;
+import org.apache.sling.jcr.contentloader.internal.readers.ZipReader;
 import org.apache.sling.testing.mock.osgi.MockBundle;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
 import org.apache.sling.testing.mock.sling.junit.SlingContext;
@@ -67,6 +71,12 @@ public class BundleContentLoaderListenerTest {
 
     @Before
     public void setup() throws Exception {
+        // prepare content readers
+        context.registerInjectActivateService(JsonReader.class);
+        context.registerInjectActivateService(OrderedJsonReader.class);
+        context.registerInjectActivateService(XmlReader.class);
+        context.registerInjectActivateService(ZipReader.class);
+
         // whiteboard which holds readers
         context.registerInjectActivateService(new ContentReaderWhiteboard());
 
diff --git a/src/test/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderTest.java b/src/test/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderTest.java
index 40b5a41..888f04b 100644
--- a/src/test/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentloader/internal/BundleContentLoaderTest.java
@@ -49,6 +49,7 @@ import org.apache.jackrabbit.commons.JcrUtils;
 import org.apache.jackrabbit.oak.spi.security.principal.EveryonePrincipal;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.jcr.contentloader.internal.readers.JsonReader;
+import org.apache.sling.jcr.contentloader.internal.readers.OrderedJsonReader;
 import org.apache.sling.jcr.contentloader.internal.readers.XmlReader;
 import org.apache.sling.jcr.contentloader.internal.readers.ZipReader;
 import org.apache.sling.testing.mock.osgi.MockBundle;
@@ -74,9 +75,10 @@ public class BundleContentLoaderTest {
     @Before
     public void prepareContentLoader() throws Exception {
         // prepare content readers
-        context.registerInjectActivateService(new JsonReader());
-        context.registerInjectActivateService(new XmlReader());
-        context.registerInjectActivateService(new ZipReader());
+        context.registerInjectActivateService(JsonReader.class);
+        context.registerInjectActivateService(OrderedJsonReader.class);
+        context.registerInjectActivateService(XmlReader.class);
+        context.registerInjectActivateService(ZipReader.class);
 
         // whiteboard which holds readers
         context.registerInjectActivateService(new ContentReaderWhiteboard());
diff --git a/src/test/java/org/apache/sling/jcr/contentloader/internal/hc/BundleContentLoadedCheckTest.java b/src/test/java/org/apache/sling/jcr/contentloader/internal/hc/BundleContentLoadedCheckTest.java
index cddbd68..5726157 100644
--- a/src/test/java/org/apache/sling/jcr/contentloader/internal/hc/BundleContentLoadedCheckTest.java
+++ b/src/test/java/org/apache/sling/jcr/contentloader/internal/hc/BundleContentLoadedCheckTest.java
@@ -34,6 +34,7 @@ import org.apache.sling.jcr.contentloader.internal.BundleContentLoaderTest;
 import org.apache.sling.jcr.contentloader.internal.BundleHelper;
 import org.apache.sling.jcr.contentloader.internal.ContentReaderWhiteboard;
 import org.apache.sling.jcr.contentloader.internal.readers.JsonReader;
+import org.apache.sling.jcr.contentloader.internal.readers.OrderedJsonReader;
 import org.apache.sling.jcr.contentloader.internal.readers.XmlReader;
 import org.apache.sling.jcr.contentloader.internal.readers.ZipReader;
 import org.apache.sling.testing.mock.osgi.MockBundle;
@@ -61,9 +62,10 @@ public class BundleContentLoadedCheckTest {
         bundle = BundleContentLoaderTest.newBundleWithInitialContent(context, "SLING-INF/libs/app;path:=/libs/app");
 
         // prepare content readers
-        context.registerInjectActivateService(new JsonReader());
-        context.registerInjectActivateService(new XmlReader());
-        context.registerInjectActivateService(new ZipReader());
+        context.registerInjectActivateService(JsonReader.class);
+        context.registerInjectActivateService(OrderedJsonReader.class);
+        context.registerInjectActivateService(XmlReader.class);
+        context.registerInjectActivateService(ZipReader.class);
 
         // whiteboard which holds readers
         context.registerInjectActivateService(new ContentReaderWhiteboard());