sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject svn commit: r1739788 - in /sling/trunk/bundles/extensions/models: impl/ impl/src/main/java/org/apache/sling/models/impl/injectors/ impl/src/test/java/org/apache/sling/models/impl/ integration-tests/ integration-tests/src/main/java/org/apache/sling/mode...
Date Mon, 18 Apr 2016 16:45:18 GMT
Author: kwin
Date: Mon Apr 18 16:45:18 2016
New Revision: 1739788

URL: http://svn.apache.org/viewvc?rev=1739788&view=rev
Log:
SLING-5664 consider service ranking when injecting OSGi services

Added:
    sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ServiceInjectionWithDifferentRankingTest.java
  (with props)
    sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java
  (with props)
    sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/
    sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleService.java
  (with props)
    sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java
  (with props)
Modified:
    sling/trunk/bundles/extensions/models/impl/pom.xml
    sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java
    sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java
    sling/trunk/bundles/extensions/models/integration-tests/pom.xml

Modified: sling/trunk/bundles/extensions/models/impl/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/pom.xml?rev=1739788&r1=1739787&r2=1739788&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/pom.xml (original)
+++ sling/trunk/bundles/extensions/models/impl/pom.xml Mon Apr 18 16:45:18 2016
@@ -99,17 +99,17 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>javax.inject</groupId>
             <artifactId>javax.inject</artifactId>
             <version>1</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
             <version>1.5.0</version>
@@ -122,6 +122,12 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-junit</artifactId>
+            <version>2.0.0.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
             <scope>test</scope>

Modified: sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java?rev=1739788&r1=1739787&r2=1739788&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java
(original)
+++ sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/injectors/OSGiServiceInjector.java
Mon Apr 18 16:45:18 2016
@@ -23,18 +23,16 @@ import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
 import javax.annotation.Nonnull;
-import javax.servlet.ServletRequest;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
-import org.apache.sling.api.scripting.SlingBindings;
-import org.apache.sling.api.scripting.SlingScriptHelper;
 import org.apache.sling.models.annotations.Filter;
 import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
 import org.apache.sling.models.annotations.injectorspecific.OSGiService;
@@ -91,71 +89,49 @@ public class OSGiServiceInjector impleme
 
     private <T> Object getService(Object adaptable, Class<T> type, String filter,
             DisposalCallbackRegistry callbackRegistry) {
-        SlingScriptHelper helper = getScriptHelper(adaptable);
-
-        if (helper != null) {
-            T[] services = helper.getServices(type, filter);
-            if (services == null || services.length == 0) {
+        // cannot use SlingScriptHelper since it does not support ordering by service ranking
due to https://issues.apache.org/jira/browse/SLING-5665
+        try {
+            ServiceReference[] refs = bundleContext.getServiceReferences(type.getName(),
filter);
+            if (refs == null || refs.length == 0) {
                 return null;
             } else {
-                return services[0];
-            }
-        } else {
-            try {
-                ServiceReference[] refs = bundleContext.getServiceReferences(type.getName(),
filter);
-                if (refs == null || refs.length == 0) {
-                    return null;
-                } else {
-                    callbackRegistry.addDisposalCallback(new Callback(refs, bundleContext));
-                    return bundleContext.getService(refs[0]);
-                }
-            } catch (InvalidSyntaxException e) {
-                log.error("invalid filter expression", e);
-                return null;
+                // sort by service ranking (lowest first) (see ServiceReference.compareTo)
+                List<ServiceReference> references = Arrays.asList(refs);
+                Collections.sort(references);
+                callbackRegistry.addDisposalCallback(new Callback(refs, bundleContext));
+                return bundleContext.getService(references.get(references.size() - 1));
             }
+        } catch (InvalidSyntaxException e) {
+            log.error("invalid filter expression", e);
+            return null;
         }
     }
 
     private <T> Object[] getServices(Object adaptable, Class<T> type, String
filter,
             DisposalCallbackRegistry callbackRegistry) {
-        SlingScriptHelper helper = getScriptHelper(adaptable);
-
-        if (helper != null) {
-            T[] services = helper.getServices(type, filter);
-            return services;
-        } else {
-            try {
-                ServiceReference[] refs = bundleContext.getServiceReferences(type.getName(),
filter);
-                if (refs == null || refs.length == 0) {
-                    return null;
-                } else {
-                    callbackRegistry.addDisposalCallback(new Callback(refs, bundleContext));
-                    List<Object> services = new ArrayList<Object>();
-                    for (ServiceReference ref : refs) {
-                        Object service = bundleContext.getService(ref);
-                        if (service != null) {
-                            services.add(service);
-                        }
-                    }
-                    return services.toArray();
-                }
-            } catch (InvalidSyntaxException e) {
-                log.error("invalid filter expression", e);
+        // cannot use SlingScriptHelper since it does not support ordering by service ranking
due to https://issues.apache.org/jira/browse/SLING-5665
+        try {
+            ServiceReference[] refs = bundleContext.getServiceReferences(type.getName(),
filter);
+            if (refs == null || refs.length == 0) {
                 return null;
-            }
-        }
-    }
-
-    private SlingScriptHelper getScriptHelper(Object adaptable) {
-        if (adaptable instanceof ServletRequest) {
-            ServletRequest request = (ServletRequest) adaptable;
-            SlingBindings bindings = (SlingBindings) request.getAttribute(SlingBindings.class.getName());
-            if (bindings != null) {
-                return bindings.getSling();
             } else {
-                return null;
+                // sort by service ranking (lowest first) (see ServiceReference.compareTo)
+                List<ServiceReference> references = Arrays.asList(refs);
+                Collections.sort(references);
+                // make highest service ranking being returned first
+                Collections.reverse(references);
+                callbackRegistry.addDisposalCallback(new Callback(refs, bundleContext));
+                List<Object> services = new ArrayList<Object>();
+                for (ServiceReference ref : references) {
+                    Object service = bundleContext.getService(ref);
+                    if (service != null) {
+                        services.add(service);
+                    }
+                }
+                return services.toArray();
             }
-        } else {
+        } catch (InvalidSyntaxException e) {
+            log.error("invalid filter expression", e);
             return null;
         }
     }

Modified: sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java?rev=1739788&r1=1739787&r2=1739788&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java
(original)
+++ sling/trunk/bundles/extensions/models/impl/src/test/java/org/apache/sling/models/impl/OSGiInjectionTest.java
Mon Apr 18 16:45:18 2016
@@ -16,10 +16,18 @@
  */
 package org.apache.sling.models.impl;
 
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.when;
 
+import java.util.Arrays;
 import java.util.Dictionary;
 import java.util.Hashtable;
 
@@ -37,6 +45,7 @@ import org.apache.sling.models.testmodel
 import org.apache.sling.models.testmodels.classes.SetOSGiModel;
 import org.apache.sling.models.testmodels.classes.SimpleOSGiModel;
 import org.apache.sling.models.testmodels.interfaces.ServiceInterface;
+import org.hamcrest.Matchers;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -97,27 +106,6 @@ public class OSGiInjectionTest {
     }
 
     @Test
-    public void testRequestOSGiModelField() throws Exception {
-        ServiceInterface service = mock(ServiceInterface.class);
-
-        SlingHttpServletRequest request = mock(SlingHttpServletRequest.class);
-        when(request.getAttribute(SlingBindings.class.getName())).thenReturn(bindings);
-
-        when(helper.getServices(ServiceInterface.class, null)).thenReturn(new ServiceInterface[]
{ service });
-
-        RequestOSGiModel model = factory.getAdapter(request, RequestOSGiModel.class);
-        assertNotNull(model);
-        assertNotNull(model.getService());
-        assertEquals(service, model.getService());
-
-        verify(bundleContext).registerService(eq(Runnable.class.getName()), eq(factory),
any(Dictionary.class));
-        verify(bundleContext).addBundleListener(any(BundleListener.class));
-        verify(bundleContext).registerService(eq(Object.class.getName()), any(Object.class),
any(Dictionary.class));
-        verify(bundleContext).getBundles();
-        verifyNoMoreInteractions(bundleContext);
-    }
-
-    @Test
     public void testListOSGiModelField() throws Exception {
         ServiceReference ref1 = mock(ServiceReference.class);
         ServiceInterface service1 = mock(ServiceInterface.class);
@@ -134,9 +122,9 @@ public class OSGiInjectionTest {
         ListOSGiModel model = factory.getAdapter(res, ListOSGiModel.class);
         assertNotNull(model);
         assertNotNull(model.getServices());
-        assertEquals(2, model.getServices().size());
-        assertEquals(service1, model.getServices().get(0));
-        assertEquals(service2, model.getServices().get(1));
+        // the order on those is non deterministic as the ServiceReference.compareTo() is
always returning 0
+        // the real order is tested in the IT
+        assertThat(model.getServices(), Matchers.containsInAnyOrder(service1, service2));
 
         verifyNoMoreInteractions(res);
     }
@@ -158,9 +146,9 @@ public class OSGiInjectionTest {
         ArrayOSGiModel model = factory.getAdapter(res, ArrayOSGiModel.class);
         assertNotNull(model);
         assertNotNull(model.getServices());
-        assertEquals(2, model.getServices().length);
-        assertEquals(service1, model.getServices()[0]);
-        assertEquals(service2, model.getServices()[1]);
+        // the order on those is non deterministic as the ServiceReference.compareTo() is
always returning 0
+        // the real order is tested in the IT
+        assertThat(Arrays.asList(model.getServices()), Matchers.containsInAnyOrder(service1,
service2));
 
         verifyNoMoreInteractions(res);
     }
@@ -205,10 +193,9 @@ public class OSGiInjectionTest {
         CollectionOSGiModel model = factory.getAdapter(res, CollectionOSGiModel.class);
         assertNotNull(model);
         assertNotNull(model.getServices());
-        assertEquals(2, model.getServices().size());
-
-        assertTrue(model.getServices().contains(service1));
-        assertTrue(model.getServices().contains(service2));
+        // the order on those is non deterministic as the ServiceReference.compareTo() is
always returning 0
+        // the real order is tested in the IT
+        assertThat(model.getServices(), Matchers.containsInAnyOrder(service1, service2));
 
         verifyNoMoreInteractions(res);
     }
@@ -274,9 +261,9 @@ public class OSGiInjectionTest {
                 = factory.getAdapter(res, org.apache.sling.models.testmodels.classes.constructorinjection.ListOSGiModel.class);
         assertNotNull(model);
         assertNotNull(model.getServices());
-        assertEquals(2, model.getServices().size());
-        assertEquals(service1, model.getServices().get(0));
-        assertEquals(service2, model.getServices().get(1));
+        // the order on those is non deterministic as the ServiceReference.compareTo() is
always returning 0
+        // the real order is tested in the IT
+        assertThat(model.getServices(), Matchers.containsInAnyOrder(service1, service2));
 
         verifyNoMoreInteractions(res);
     }

Modified: sling/trunk/bundles/extensions/models/integration-tests/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/pom.xml?rev=1739788&r1=1739787&r2=1739788&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/pom.xml (original)
+++ sling/trunk/bundles/extensions/models/integration-tests/pom.xml Mon Apr 18 16:45:18 2016
@@ -248,6 +248,17 @@
     </build>
 
     <dependencies>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <scope>provided</scope>
+            <version>4.3.0</version> <!-- newer than specific in parent version
to use FrameworkUtil.getBundle(Class) -->
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <scope>provided</scope>
+        </dependency>
         <!-- Additional bundles needed by the Sling instance under test -->
         <dependency>
             <groupId>org.apache.sling</groupId>
@@ -344,11 +355,6 @@
             <version>1.4</version>
         </dependency>
         <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>org.osgi.core</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
             <scope>test</scope>

Added: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ServiceInjectionWithDifferentRankingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ServiceInjectionWithDifferentRankingTest.java?rev=1739788&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ServiceInjectionWithDifferentRankingTest.java
(added)
+++ sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ServiceInjectionWithDifferentRankingTest.java
Mon Apr 18 16:45:18 2016
@@ -0,0 +1,125 @@
+package org.apache.sling.models.it;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import javax.jcr.Node;
+import javax.jcr.Session;
+
+import org.apache.commons.lang.RandomStringUtils;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.junit.annotations.SlingAnnotationsTestRunner;
+import org.apache.sling.junit.annotations.TestReference;
+import org.apache.sling.models.factory.ModelFactory;
+import org.apache.sling.models.it.models.ServiceInjectionTestModel;
+import org.apache.sling.models.it.services.SimpleService;
+import org.apache.sling.models.it.services.SimpleServiceWithCustomRanking;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+@RunWith(SlingAnnotationsTestRunner.class)
+public class ServiceInjectionWithDifferentRankingTest {
+
+    @TestReference
+    ConfigurationAdmin configAdmin;
+
+    @TestReference
+    private ResourceResolverFactory rrFactory;
+
+    @TestReference
+    private ServiceTracker serviceTracker;
+
+    @TestReference
+    private ModelFactory modelFactory;
+
+    private String value;
+    private ResourceResolver resolver;
+    private Resource resource;
+    private Node createdNode;
+    private BundleContext bundleContext;
+    private Collection<ServiceRegistration<SimpleService>> serviceRegistrations;
+
+    @Before
+    public void setUp() throws Exception {
+        value = RandomStringUtils.randomAlphanumeric(10);
+
+        resolver = rrFactory.getAdministrativeResourceResolver(null);
+        Session session = resolver.adaptTo(Session.class);
+        Node rootNode = session.getRootNode();
+        createdNode = rootNode.addNode("test_" + RandomStringUtils.randomAlphanumeric(10));
+        createdNode.setProperty("testProperty", value);
+        session.save();
+
+        resource = resolver.getResource(createdNode.getPath());
+
+        bundleContext = FrameworkUtil.getBundle(SimpleServiceWithCustomRanking.class).getBundleContext();
+        serviceRegistrations = new ArrayList<ServiceRegistration<SimpleService>>();
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        if (createdNode != null) {
+            createdNode.remove();
+        }
+        if (resolver != null) {
+            resolver.close();
+        }
+
+        for (ServiceRegistration<?> serviceRegistration : serviceRegistrations) {
+            serviceRegistration.unregister();
+        }
+    }
+
+    private void registerSimpleService(int ranking) {
+        Dictionary<String, Object> serviceProps = new Hashtable<String, Object>();
+        serviceProps.put(Constants.SERVICE_RANKING, new Integer(ranking));
+        ServiceRegistration<SimpleService> serviceRegistration = bundleContext.registerService(SimpleService.class,
+                new SimpleServiceWithCustomRanking(ranking), serviceProps);
+        serviceRegistrations.add(serviceRegistration);
+    }
+
+    @Test
+    public void testServiceInjectionConsideringRankingWithResource() throws IOException {
+
+        registerSimpleService(0);
+        // cannot use adaptTo due to adaptersCache
+        ServiceInjectionTestModel model = modelFactory.createModel(resource, ServiceInjectionTestModel.class);
+        assertNotNull("Model is null", model);
+        // only the default service with ranking 0 is known
+        assertEquals("The service with the highest ranking was not returned", 0, model.getSimpleService().getRanking());
+        assertArrayEquals("Order on injected services is wrong", model.getSimpleServicesRankings(),
new Integer[] {0});
+
+        registerSimpleService(-1000);
+        model = modelFactory.createModel(resource, ServiceInjectionTestModel.class);
+        assertNotNull("Model is null", model);
+        // ranking 0 is still the highest one
+        assertEquals("The service with the highest ranking was not returned", 0, model.getSimpleService().getRanking());
+        assertArrayEquals("Order on injected services is wrong", model.getSimpleServicesRankings(),
new Integer[] {0, -1000});
+
+        registerSimpleService(1000);
+        model = modelFactory.createModel(resource, ServiceInjectionTestModel.class);
+        assertNotNull("Model is null", model);
+        // now ranking 1000 is the highest
+        assertEquals("The service with the highest ranking was not returned", 1000, model.getSimpleService().getRanking());
+        assertArrayEquals("Order on injected services is wrong", model.getSimpleServicesRankings(),
new Integer[] {1000, 0, -1000});
+
+    }
+
+}

Propchange: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ServiceInjectionWithDifferentRankingTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java?rev=1739788&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java
(added)
+++ sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java
Mon Apr 18 16:45:18 2016
@@ -0,0 +1,31 @@
+package org.apache.sling.models.it.models;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.models.annotations.Model;
+import org.apache.sling.models.annotations.injectorspecific.OSGiService;
+import org.apache.sling.models.it.services.SimpleService;
+
+@Model(adaptables=Resource.class)
+public class ServiceInjectionTestModel {
+
+    @OSGiService
+    private SimpleService simpleService; // must return the service impl with the highest
ranking
+
+    @OSGiService
+    private List<SimpleService> simpleServices;
+    
+    public SimpleService getSimpleService() {
+        return simpleService;
+    }
+
+    public Integer[] getSimpleServicesRankings() {
+        List<Integer> serviceRankings = new ArrayList<Integer>();
+        for (SimpleService service : simpleServices) {
+            serviceRankings.add(service.getRanking());
+        }
+        return serviceRankings.toArray(new Integer[serviceRankings.size()]);
+    }
+}

Propchange: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleService.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleService.java?rev=1739788&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleService.java
(added)
+++ sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleService.java
Mon Apr 18 16:45:18 2016
@@ -0,0 +1,5 @@
+package org.apache.sling.models.it.services;
+
+public interface SimpleService {
+    int getRanking();
+}

Propchange: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java?rev=1739788&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java
(added)
+++ sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java
Mon Apr 18 16:45:18 2016
@@ -0,0 +1,14 @@
+package org.apache.sling.models.it.services;
+
+public class SimpleServiceWithCustomRanking implements SimpleService {
+
+    private final int ranking;
+    
+    public SimpleServiceWithCustomRanking(int ranking) {
+        this.ranking = ranking;
+    }
+    
+    public int getRanking() {
+        return ranking;
+    }
+}

Propchange: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message