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/08/18 11:34:17 UTC

[sling-org-apache-sling-testing-sling-mock] 02/02: SLING-11455 use ResourceProvider implementation from resourceresolver-mock

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

sseifert pushed a commit to branch feature/SLING-11455-resource-provider
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit 8e56c5eb4b2b384d9b763a7650c24eef3eded9f9
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Thu Aug 18 13:33:59 2022 +0200

    SLING-11455 use ResourceProvider implementation from resourceresolver-mock
---
 .../mock/sling/RRMockMockResourceResolverAdapter.java      | 14 +++++---------
 parent/pom.xml                                             |  2 +-
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/core/src/main/java/org/apache/sling/testing/mock/sling/RRMockMockResourceResolverAdapter.java b/core/src/main/java/org/apache/sling/testing/mock/sling/RRMockMockResourceResolverAdapter.java
index ccb2c2e..3108609 100644
--- a/core/src/main/java/org/apache/sling/testing/mock/sling/RRMockMockResourceResolverAdapter.java
+++ b/core/src/main/java/org/apache/sling/testing/mock/sling/RRMockMockResourceResolverAdapter.java
@@ -20,9 +20,9 @@ package org.apache.sling.testing.mock.sling;
 
 import org.apache.sling.api.resource.ResourceResolverFactory;
 import org.apache.sling.jcr.api.SlingRepository;
+import org.apache.sling.testing.mock.osgi.MockOsgi;
 import org.apache.sling.testing.mock.sling.spi.ResourceResolverTypeAdapter;
-import org.apache.sling.testing.resourceresolver.MockResourceResolverFactory;
-import org.apache.sling.testing.resourceresolver.MockResourceResolverFactoryOptions;
+import org.apache.sling.testing.resourceresolver.MockResourceProvider;
 import org.osgi.framework.BundleContext;
 
 /**
@@ -30,21 +30,17 @@ import org.osgi.framework.BundleContext;
  */
 class RRMockMockResourceResolverAdapter implements ResourceResolverTypeAdapter {
 
-    private final MockResourceResolverFactoryOptions options;
-    private final BundleContext bundleContext;
-
     /**
      * Constructor
      */
     public RRMockMockResourceResolverAdapter(BundleContext bundleContext) {
-        this.options = new MockResourceResolverFactoryOptions();
-        this.options.setMangleNamespacePrefixes(true);
-        this.bundleContext = bundleContext;
+        // register resource provider from resourceresolver-mock and use Sling ResourceResolver implementation
+        MockOsgi.registerInjectActivateService(MockResourceProvider.class, bundleContext);
     }
 
     @Override
     public ResourceResolverFactory newResourceResolverFactory() {
-        return new RRMockResourceResolverFactoryWrapper(new MockResourceResolverFactory(options), bundleContext);
+        return null;
     }
 
     @Override
diff --git a/parent/pom.xml b/parent/pom.xml
index ceab26a..e4df0ef 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -37,7 +37,7 @@
     <properties>
         <osgi-mock.version>3.3.0</osgi-mock.version>
         <jcr-mock.version>1.6.0</jcr-mock.version>
-        <resourceresolver-mock.version>1.3.0</resourceresolver-mock.version>
+        <resourceresolver-mock.version>1.4.0-SNAPSHOT</resourceresolver-mock.version>
         <logging-mock.version>2.0.0</logging-mock.version>
         <servlet-helpers.version>1.4.2</servlet-helpers.version>
         <resourcebuilder.version>1.0.4</resourcebuilder.version>