Author: sseifert
Date: Sat Oct  3 00:36:11 2015
New Revision: 1706513

URL: http://svn.apache.org/viewvc?rev=1706513&view=rev
Log:
SLING-5088 avoid registering ResourceResolverFactory twice

Modified:
    
sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/MockSling.java
    
sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java
    
sling/trunk/testing/mocks/sling-mock/src/test/java/org/apache/sling/testing/mock/sling/context/AbstractSlingContextImplTest.java

Modified: 
sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/MockSling.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/MockSling.java?rev=1706513&r1=1706512&r2=1706513&view=diff
==============================================================================
--- 
sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/MockSling.java
 (original)
+++ 
sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/MockSling.java
 Sat Oct  3 00:36:11 2015
@@ -87,6 +87,9 @@ public final class MockSling {
             SlingRepository repository = adapter.newSlingRepository();
             factory = ResourceResolverFactoryInitializer.setUp(repository, 
bundleContext, type.getNodeTypeMode());
         }
+        else {
+            
bundleContext.registerService(ResourceResolverFactory.class.getName(), factory, 
null);
+        }
         return factory;
     }
 

Modified: 
sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java?rev=1706513&r1=1706512&r2=1706513&view=diff
==============================================================================
--- 
sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java
 (original)
+++ 
sling/trunk/testing/mocks/sling-mock/src/main/java/org/apache/sling/testing/mock/sling/context/SlingContextImpl.java
 Sat Oct  3 00:36:11 2015
@@ -112,9 +112,6 @@ public class SlingContextImpl extends Os
      */
     protected void registerDefaultServices() {
 
-        // resource resolver factory
-        registerService(ResourceResolverFactory.class, 
this.resourceResolverFactory);
-        
         // adapter factories
         registerInjectActivateService(new ModelAdapterFactory());
 

Modified: 
sling/trunk/testing/mocks/sling-mock/src/test/java/org/apache/sling/testing/mock/sling/context/AbstractSlingContextImplTest.java
URL: 
http://svn.apache.org/viewvc/sling/trunk/testing/mocks/sling-mock/src/test/java/org/apache/sling/testing/mock/sling/context/AbstractSlingContextImplTest.java?rev=1706513&r1=1706512&r2=1706513&view=diff
==============================================================================
--- 
sling/trunk/testing/mocks/sling-mock/src/test/java/org/apache/sling/testing/mock/sling/context/AbstractSlingContextImplTest.java
 (original)
+++ 
sling/trunk/testing/mocks/sling-mock/src/test/java/org/apache/sling/testing/mock/sling/context/AbstractSlingContextImplTest.java
 Sat Oct  3 00:36:11 2015
@@ -147,14 +147,6 @@ public abstract class AbstractSlingConte
         assertNotNull(factory);
     }
 
-    @Test
-    public void testWithoutResourceResolverType() {
-        SlingContextImpl contextTest = new SlingContextImpl();
-        contextTest.setUp();
-        ResourceResolverFactory factory = 
contextTest.getService(ResourceResolverFactory.class);
-        assertNotNull(factory);
-    }
-
     @Model(adaptables = SlingHttpServletRequest.class)
     public interface RequestAttributeModel {
         @Inject


Reply via email to