sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-org-apache-sling-testing-sling-mock] 25/48: switch to MockOsgi.setConfigForPid
Date Tue, 07 Nov 2017 10:26:46 GMT
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.testing.sling-mock-2.2.10
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-sling-mock.git

commit d5be6529f2fab6e07d951b4d27919b7be9c28a63
Author: Stefan Seifert <sseifert@apache.org>
AuthorDate: Tue Mar 14 22:12:05 2017 +0000

    switch to MockOsgi.setConfigForPid
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/testing/mocks/sling-mock@1786960
13f79535-47bb-0310-9956-ffa450edef68
---
 .../mock/sling/context/SlingContextImpl.java       | 28 ++--------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

diff --git a/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java
b/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java
index a9501e1..dc5e986 100644
--- a/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java
+++ b/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java
@@ -18,9 +18,6 @@
  */
 package org.apache.sling.testing.mock.sling.context;
 
-import java.io.IOException;
-import java.util.Dictionary;
-import java.util.Hashtable;
 import java.util.Map;
 import java.util.Set;
 
@@ -52,6 +49,7 @@ import org.apache.sling.resourcebuilder.impl.ResourceBuilderFactoryService;
 import org.apache.sling.scripting.core.impl.BindingsValuesProvidersByContextImpl;
 import org.apache.sling.scripting.core.impl.ScriptEngineManagerFactory;
 import org.apache.sling.settings.SlingSettingsService;
+import org.apache.sling.testing.mock.osgi.MockOsgi;
 import org.apache.sling.testing.mock.osgi.context.OsgiContextImpl;
 import org.apache.sling.testing.mock.sling.MockSling;
 import org.apache.sling.testing.mock.sling.ResourceResolverType;
@@ -65,10 +63,6 @@ import org.apache.sling.testing.mock.sling.servlet.MockSlingHttpServletResponse;
 import org.osgi.annotation.versioning.ConsumerType;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import com.google.common.base.Function;
 import com.google.common.collect.ImmutableMap;
@@ -87,8 +81,6 @@ public class SlingContextImpl extends OsgiContextImpl {
 
     private static final String RESOURCERESOLVERFACTORYACTIVATOR_PID = "org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl";
     
-    private static final Logger log = LoggerFactory.getLogger(SlingContextImpl.class);
-    
     protected ResourceResolverFactory resourceResolverFactory;
     protected ResourceResolverType resourceResolverType;
     protected ResourceResolver resourceResolver;
@@ -123,23 +115,7 @@ public class SlingContextImpl extends OsgiContextImpl {
         
         if (this.resourceResolverFactoryActivatorProps != null) {
             // use OSGi ConfigurationAdmin to pass over customized configuration to Resource
Resolver Factory Activator service
-            ConfigurationAdmin configAdmin = getService(ConfigurationAdmin.class);
-            if (configAdmin == null) {
-              log.warn("ConfigAdmin not found in osgi-mock context - please make sure osgi-mock
1.7.0 or higher is used.");
-            }
-            else {
-              try {
-                Configuration resourceResolverFactoryActivatorConfig = configAdmin.getConfiguration(RESOURCERESOLVERFACTORYACTIVATOR_PID);
-                Dictionary<String, Object> props = new Hashtable<String, Object>();
-                for (Map.Entry<String, Object> item : this.resourceResolverFactoryActivatorProps.entrySet())
{
-                    props.put(item.getKey(), item.getValue());
-                }
-                resourceResolverFactoryActivatorConfig.update(props);
-              }
-              catch (IOException ex) {
-                throw new RuntimeException(ex);
-              }
-            }
+            MockOsgi.setConfigForPid(bundleContext(), RESOURCERESOLVERFACTORYACTIVATOR_PID,
this.resourceResolverFactoryActivatorProps);
         }
         
         this.resourceResolverFactory = newResourceResolverFactory();

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Mime
View raw message