felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1680835 - in /felix/trunk/http/base/src: main/java/org/apache/felix/http/base/internal/handler/ main/java/org/apache/felix/http/base/internal/registry/ main/java/org/apache/felix/http/base/internal/service/ main/java/org/apache/felix/http/...
Date Thu, 21 May 2015 11:57:02 GMT
Author: cziegeler
Date: Thu May 21 11:57:02 2015
New Revision: 1680835

URL: http://svn.apache.org/r1680835
Log:
FELIX-4899 : Change service id for http service context

Modified:
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServiceFilterHandler.java
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServiceServletHandler.java
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpSessionWrapper.java
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/registry/PerContextHandlerRegistry.java
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceFactory.java
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/PerBundleHttpServiceImpl.java
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/SharedHttpServiceImpl.java
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/util/InternalIdFactory.java
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
    felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/handler/FilterHandlerTest.java
    felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/handler/HttpServiceServletHandlerTest.java
    felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/ErrorPageRegistryTest.java
    felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/FilterRegistryTest.java
    felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/HandlerRegistryTest.java
    felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/ServletRegistryTest.java
    felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/runtime/WhiteboardServiceHelper.java

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServiceFilterHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServiceFilterHandler.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServiceFilterHandler.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServiceFilterHandler.java
Thu May 21 11:57:02 2015
@@ -20,18 +20,18 @@ import javax.servlet.Filter;
 
 import org.apache.felix.http.base.internal.context.ExtServletContext;
 import org.apache.felix.http.base.internal.runtime.FilterInfo;
+import org.apache.felix.http.base.internal.service.HttpServiceFactory;
 
 /**
  * Servlet holder for filters registered through the ext http service.
  */
 public final class HttpServiceFilterHandler extends FilterHandler
 {
-    public HttpServiceFilterHandler(final long contextServiceId,
-            final ExtServletContext context,
+    public HttpServiceFilterHandler(final ExtServletContext context,
             final FilterInfo filterInfo,
             final Filter filter)
     {
-        super(contextServiceId, context, filterInfo);
+        super(HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID, context, filterInfo);
         this.setFilter(filter);
     }
 }

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServiceServletHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServiceServletHandler.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServiceServletHandler.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpServiceServletHandler.java
Thu May 21 11:57:02 2015
@@ -20,12 +20,20 @@ import javax.servlet.Servlet;
 
 import org.apache.felix.http.base.internal.context.ExtServletContext;
 import org.apache.felix.http.base.internal.runtime.ServletInfo;
+import org.apache.felix.http.base.internal.service.HttpServiceFactory;
 
 /**
  * Servlet handler for servlets registered through the http service.
  */
 public final class HttpServiceServletHandler extends ServletHandler
 {
+    public HttpServiceServletHandler(final ExtServletContext context,
+            final ServletInfo servletInfo,
+            final Servlet servlet)
+    {
+        this(HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID, context, servletInfo, servlet);
+    }
+
     public HttpServiceServletHandler(final long contextServiceId,
             final ExtServletContext context,
             final ServletInfo servletInfo,

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpSessionWrapper.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpSessionWrapper.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpSessionWrapper.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/handler/HttpSessionWrapper.java
Thu May 21 11:57:02 2015
@@ -35,6 +35,7 @@ import javax.servlet.http.HttpSessionCon
 import javax.servlet.http.HttpSessionEvent;
 
 import org.apache.felix.http.base.internal.context.ExtServletContext;
+import org.apache.felix.http.base.internal.service.HttpServiceFactory;
 
 /**
  * The session wrapper keeps track of the internal session, manages their attributes
@@ -90,7 +91,7 @@ public class HttpSessionWrapper implemen
 
     public static boolean hasSession(final Long contextId, final HttpSession session)
     {
-        final String sessionId = contextId == null ? "0" : String.valueOf(contextId);
+        final String sessionId = contextId == null ? String.valueOf(HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID)
: String.valueOf(contextId);
         return session.getAttribute(ATTR_CREATED + sessionId) != null;
     }
 
@@ -144,7 +145,7 @@ public class HttpSessionWrapper implemen
     {
         this.delegate = session;
         this.context = context;
-        this.sessionId = contextId == null ? "0" : String.valueOf(contextId);
+        this.sessionId = contextId == null ? String.valueOf(HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID)
: String.valueOf(contextId);
         this.keyPrefix = contextId == null ? null : ATTR_PREFIX + this.sessionId + ".";
 
         if ( this.keyPrefix != null )

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/registry/PerContextHandlerRegistry.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/registry/PerContextHandlerRegistry.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/registry/PerContextHandlerRegistry.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/registry/PerContextHandlerRegistry.java
Thu May 21 11:57:02 2015
@@ -26,6 +26,7 @@ import org.apache.felix.http.base.intern
 import org.apache.felix.http.base.internal.runtime.ServletContextHelperInfo;
 import org.apache.felix.http.base.internal.runtime.ServletInfo;
 import org.apache.felix.http.base.internal.runtime.dto.FailedDTOHolder;
+import org.apache.felix.http.base.internal.service.HttpServiceFactory;
 import org.osgi.service.http.runtime.dto.ServletContextDTO;
 
 /**
@@ -59,7 +60,7 @@ public final class PerContextHandlerRegi
      */
     public PerContextHandlerRegistry()
     {
-        this.serviceId = 0;
+        this.serviceId = HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID;
         this.ranking = Integer.MAX_VALUE;
         this.path = "/";
         this.prefix = null;

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceFactory.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceFactory.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceFactory.java
Thu May 21 11:57:02 2015
@@ -40,6 +40,11 @@ import org.osgi.service.http.runtime.Htt
 public final class HttpServiceFactory
     implements ServiceFactory<HttpService>
 {
+    public static final String HTTP_SERVICE_CONTEXT_NAME = "Http Service context";
+
+    public static final long HTTP_SERVICE_CONTEXT_SERVICE_ID = -1;
+
+
     /**
      * Name of the Framework property indicating whether the servlet context
      * attributes of the ServletContext objects created for each HttpContext

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/PerBundleHttpServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/PerBundleHttpServiceImpl.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/PerBundleHttpServiceImpl.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/PerBundleHttpServiceImpl.java
Thu May 21 11:57:02 2015
@@ -123,7 +123,7 @@ public final class PerBundleHttpServiceI
         }
 
         final ExtServletContext httpContext = getServletContext(context);
-        final FilterHandler holder = new HttpServiceFilterHandler(0, httpContext, filterInfo,
filter);
+        final FilterHandler holder = new HttpServiceFilterHandler(httpContext, filterInfo,
filter);
 
         if ( this.sharedHttpService.registerFilter(holder) )
         {

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/SharedHttpServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/SharedHttpServiceImpl.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/SharedHttpServiceImpl.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/service/SharedHttpServiceImpl.java
Thu May 21 11:57:02 2015
@@ -65,7 +65,7 @@ public final class SharedHttpServiceImpl
             @Nonnull final Servlet servlet,
             @Nonnull final ServletInfo servletInfo) throws ServletException, NamespaceException
     {
-        final ServletHandler holder = new HttpServiceServletHandler(0, httpContext, servletInfo,
servlet);
+        final ServletHandler holder = new HttpServiceServletHandler(httpContext, servletInfo,
servlet);
 
         synchronized (this.aliasMap)
         {
@@ -93,7 +93,7 @@ public final class SharedHttpServiceImpl
             }
 
             final Servlet s = holder.getServlet();
-            this.handlerRegistry.removeServlet(0, holder.getServletInfo(), true);
+            this.handlerRegistry.removeServlet(HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID,
holder.getServletInfo(), true);
             return s;
         }
     }
@@ -110,7 +110,7 @@ public final class SharedHttpServiceImpl
                     final Map.Entry<String, ServletHandler> entry = i.next();
                     if (entry.getValue().getServlet() == servlet)
                     {
-                        this.handlerRegistry.removeServlet(0, entry.getValue().getServletInfo(),
destroy);
+                        this.handlerRegistry.removeServlet(HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID,
entry.getValue().getServletInfo(), destroy);
 
                         i.remove();
                         break;

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/util/InternalIdFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/util/InternalIdFactory.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/util/InternalIdFactory.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/util/InternalIdFactory.java
Thu May 21 11:57:02 2015
@@ -29,7 +29,8 @@ public enum InternalIdFactory
 {
     INSTANCE;
 
-    private final AtomicLong idCounter = new AtomicLong();
+    /** -1 is reserved for the http service servlet context. */
+    private final AtomicLong idCounter = new AtomicLong(-1);
 
     public long next()
     {

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/whiteboard/WhiteboardManager.java
Thu May 21 11:57:02 2015
@@ -740,7 +740,6 @@ public final class WhiteboardManager
          return handlers;
     }
 
-    private static final String HTTP_SERVICE_CONTEXT_NAME = "Http Service context";
 
     public RegistryRuntime getRuntime(final HandlerRegistry registry)
     {
@@ -748,7 +747,9 @@ public final class WhiteboardManager
 
         final Collection<ServletContextDTO> contextDTOs = new ArrayList<ServletContextDTO>();
         // add the context for the http service
-        final ServletContextHelperInfo info = new ServletContextHelperInfo(Integer.MAX_VALUE,
0, HTTP_SERVICE_CONTEXT_NAME, "/", null);
+        final ServletContextHelperInfo info = new ServletContextHelperInfo(Integer.MAX_VALUE,
+                HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID,
+                HttpServiceFactory.HTTP_SERVICE_CONTEXT_NAME, "/", null);
         final ServletContextDTO dto = ServletContextDTOBuilder.build(info, webContext, -1);
         if ( registry.getRuntime(dto, failedDTOHolder) )
         {

Modified: felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/handler/FilterHandlerTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/handler/FilterHandlerTest.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/handler/FilterHandlerTest.java
(original)
+++ felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/handler/FilterHandlerTest.java
Thu May 21 11:57:02 2015
@@ -246,7 +246,7 @@ public class FilterHandlerTest
             initParams = Collections.emptyMap();
         }
         final FilterInfo info = new FilterInfo(null, pattern, ranking, initParams);
-        return new HttpServiceFilterHandler(0, this.context, info, this.filter);
+        return new HttpServiceFilterHandler(this.context, info, this.filter);
     }
 
     private HttpServletRequest createServletRequest()

Modified: felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/handler/HttpServiceServletHandlerTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/handler/HttpServiceServletHandlerTest.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/handler/HttpServiceServletHandlerTest.java
(original)
+++ felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/handler/HttpServiceServletHandlerTest.java
Thu May 21 11:57:02 2015
@@ -221,6 +221,6 @@ public class HttpServiceServletHandlerTe
             map = Collections.emptyMap();
         }
         final ServletInfo info = new ServletInfo(null, alias, 0, map);
-        return new HttpServiceServletHandler(3, this.context, info, this.servlet);
+        return new HttpServiceServletHandler(this.context, info, this.servlet);
     }
 }

Modified: felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/ErrorPageRegistryTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/ErrorPageRegistryTest.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/ErrorPageRegistryTest.java
(original)
+++ felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/ErrorPageRegistryTest.java
Thu May 21 11:57:02 2015
@@ -17,6 +17,7 @@
 package org.apache.felix.http.base.internal.registry;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -26,7 +27,9 @@ import static org.mockito.Mockito.when;
 
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
 
 import javax.servlet.Servlet;
 import javax.servlet.ServletConfig;
@@ -45,13 +48,12 @@ import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.http.runtime.dto.DTOConstants;
+import org.osgi.service.http.runtime.dto.FailedErrorPageDTO;
 import org.osgi.service.http.runtime.dto.ServletContextDTO;
 import org.osgi.service.http.whiteboard.HttpWhiteboardConstants;
 
 public class ErrorPageRegistryTest {
 
-    private final ErrorPageRegistry reg = new ErrorPageRegistry();
-
     private void assertEmpty(final ServletContextDTO dto, final FailedDTOHolder holder)
     {
         assertNull(dto.servletDTOs);
@@ -70,6 +72,8 @@ public class ErrorPageRegistryTest {
 
     @Test public void testSingleErrorPage() throws InvalidSyntaxException, ServletException
     {
+        final ErrorPageRegistry reg = new ErrorPageRegistry();
+
         final FailedDTOHolder holder = new FailedDTOHolder();
         final ServletContextDTO dto = new ServletContextDTO();
 
@@ -127,6 +131,8 @@ public class ErrorPageRegistryTest {
 
     @Test public void testSimpleHiding() throws InvalidSyntaxException, ServletException
     {
+        final ErrorPageRegistry reg = new ErrorPageRegistry();
+
         final FailedDTOHolder holder = new FailedDTOHolder();
         final ServletContextDTO dto = new ServletContextDTO();
 
@@ -223,6 +229,88 @@ public class ErrorPageRegistryTest {
         assertEmpty(dto, holder);
     }
 
+    @Test public void testRangeRegistration() throws InvalidSyntaxException
+    {
+        final ErrorPageRegistry reg = new ErrorPageRegistry();
+        final FailedDTOHolder holder = new FailedDTOHolder();
+        final ServletContextDTO dto = new ServletContextDTO();
+
+        final ServletHandler handler4 = createServletHandler(1L, 0, "4xx");
+        final ServletHandler handler5 = createServletHandler(2L, 0, "5xx");
+
+        reg.addServlet(handler4);
+        reg.addServlet(handler5);
+
+        // check DTO
+        reg.getRuntimeInfo(dto, holder.failedErrorPageDTOs);
+
+        assertTrue(holder.failedErrorPageDTOs.isEmpty());
+        assertEquals(2, dto.errorPageDTOs.length);
+        assertEquals(100, dto.errorPageDTOs[0].errorCodes.length);
+        final Set<Long> codes4 = new HashSet<Long>();
+        for(final long c : dto.errorPageDTOs[0].errorCodes)
+        {
+            assertTrue(c >= 400 && c < 500);
+            codes4.add(c);
+        }
+        assertEquals(100, codes4.size());
+        assertEquals(100, dto.errorPageDTOs[1].errorCodes.length);
+        final Set<Long> codes5 = new HashSet<Long>();
+        for(final long c : dto.errorPageDTOs[1].errorCodes)
+        {
+            assertTrue(c >= 500 && c < 600);
+            codes5.add(c);
+        }
+        assertEquals(100, codes5.size());
+    }
+
+    @Test public void testRangeRegistrationOverlay() throws InvalidSyntaxException
+    {
+        final ErrorPageRegistry reg = new ErrorPageRegistry();
+        final FailedDTOHolder holder = new FailedDTOHolder();
+        final ServletContextDTO dto = new ServletContextDTO();
+
+        final ServletHandler handler4 = createServletHandler(1L, 0, "4xx");
+        final ServletHandler handler = createServletHandler(2L, 10, "404", "403");
+
+        reg.addServlet(handler4);
+        reg.addServlet(handler);
+
+        // check DTO
+        reg.getRuntimeInfo(dto, holder.failedErrorPageDTOs);
+
+        assertEquals(1, holder.failedErrorPageDTOs.size());
+        assertEquals(2, dto.errorPageDTOs.length);
+        assertEquals(98, dto.errorPageDTOs[0].errorCodes.length);
+        final Set<Long> codes4 = new HashSet<Long>();
+        for(final long c : dto.errorPageDTOs[0].errorCodes)
+        {
+            assertTrue(c >= 400 && c < 500);
+            codes4.add(c);
+        }
+        assertEquals(98, codes4.size());
+        assertFalse(codes4.contains(404L));
+        assertFalse(codes4.contains(403L));
+        assertEquals(2, dto.errorPageDTOs[1].errorCodes.length);
+        final Set<Long> codes = new HashSet<Long>();
+        for(final long c : dto.errorPageDTOs[1].errorCodes)
+        {
+            assertTrue(c >= 403 && c < 405);
+            codes.add(c);
+        }
+        assertEquals(2, codes.size());
+
+        final FailedErrorPageDTO fep = holder.failedErrorPageDTOs.iterator().next();
+        assertEquals(2, fep.errorCodes.length);
+        codes.clear();
+        for(final long c : fep.errorCodes)
+        {
+            assertTrue(c >= 403 && c < 405);
+            codes.add(c);
+        }
+        assertEquals(2, codes.size());
+    }
+
     private static ServletInfo createServletInfo(final long id, final int ranking, final
String... codes) throws InvalidSyntaxException
     {
         final BundleContext bCtx = mock(BundleContext.class);
@@ -248,6 +336,6 @@ public class ErrorPageRegistryTest {
         final ExtServletContext ctx = mock(ExtServletContext.class);
         final Servlet servlet = mock(Servlet.class);
 
-        return new HttpServiceServletHandler(7, ctx, si, servlet);
+        return new HttpServiceServletHandler(ctx, si, servlet);
     }
 }

Modified: felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/FilterRegistryTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/FilterRegistryTest.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/FilterRegistryTest.java
(original)
+++ felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/FilterRegistryTest.java
Thu May 21 11:57:02 2015
@@ -147,6 +147,6 @@ public class FilterRegistryTest {
         final ExtServletContext ctx = mock(ExtServletContext.class);
         final Filter filter = mock(Filter.class);
 
-        return new HttpServiceFilterHandler(7, ctx, si, filter);
+        return new HttpServiceFilterHandler(ctx, si, filter);
     }
 }

Modified: felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/HandlerRegistryTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/HandlerRegistryTest.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/HandlerRegistryTest.java
(original)
+++ felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/HandlerRegistryTest.java
Thu May 21 11:57:02 2015
@@ -29,6 +29,7 @@ import org.apache.felix.http.base.intern
 import org.apache.felix.http.base.internal.handler.ServletHandler;
 import org.apache.felix.http.base.internal.runtime.ServletInfo;
 import org.apache.felix.http.base.internal.runtime.dto.FailedDTOHolder;
+import org.apache.felix.http.base.internal.service.HttpServiceFactory;
 import org.junit.Test;
 import org.mockito.Mockito;
 import org.osgi.service.http.runtime.dto.ServletContextDTO;
@@ -43,6 +44,8 @@ public class HandlerRegistryTest
     {
         final FailedDTOHolder holder = new FailedDTOHolder();
         final ServletContextDTO dto = new ServletContextDTO();
+        dto.serviceId = HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID;
+
         assertFalse(registry.getRuntime(dto, holder));
 
         registry.init();
@@ -60,11 +63,12 @@ public class HandlerRegistryTest
 
         final FailedDTOHolder holder = new FailedDTOHolder();
         final ServletContextDTO dto = new ServletContextDTO();
+        dto.serviceId = HttpServiceFactory.HTTP_SERVICE_CONTEXT_SERVICE_ID;
         dto.servletDTOs = new ServletDTO[0];
 
         Servlet servlet = Mockito.mock(Servlet.class);
         final ServletInfo info = new ServletInfo("foo", "/foo", 0, Collections.EMPTY_MAP);
-        ServletHandler handler = new HttpServiceServletHandler(0, null, info, servlet);
+        ServletHandler handler = new HttpServiceServletHandler(null, info, servlet);
 
         assertTrue(registry.getRuntime(dto, holder));
         assertEquals("Precondition", 0, dto.servletDTOs.length);
@@ -76,13 +80,13 @@ public class HandlerRegistryTest
         assertEquals(info.getServiceId(), dto.servletDTOs[0].serviceId);
 
         final ServletInfo info2 = new ServletInfo("bar", "/bar", 0, Collections.EMPTY_MAP);
-        ServletHandler handler2 = new HttpServiceServletHandler(0, null, info2, Mockito.mock(Servlet.class));
+        ServletHandler handler2 = new HttpServiceServletHandler(null, info2, Mockito.mock(Servlet.class));
         registry.addServlet(handler2);
         assertTrue(registry.getRuntime(dto, holder));
         assertEquals(2, dto.servletDTOs.length);
 
         final ServletInfo info3 = new ServletInfo("zar", "/foo", 0, Collections.EMPTY_MAP);
-        ServletHandler handler3 = new HttpServiceServletHandler(0, null,info3, Mockito.mock(Servlet.class));
+        ServletHandler handler3 = new HttpServiceServletHandler(null,info3, Mockito.mock(Servlet.class));
         registry.addServlet(handler3);
         assertTrue(registry.getRuntime(dto, holder));
         assertEquals(2, dto.servletDTOs.length);

Modified: felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/ServletRegistryTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/ServletRegistryTest.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/ServletRegistryTest.java
(original)
+++ felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/registry/ServletRegistryTest.java
Thu May 21 11:57:02 2015
@@ -284,6 +284,6 @@ public class ServletRegistryTest {
         final ExtServletContext ctx = mock(ExtServletContext.class);
         final Servlet servlet = mock(Servlet.class);
 
-        return new HttpServiceServletHandler(7, ctx, si, servlet);
+        return new HttpServiceServletHandler(ctx, si, servlet);
     }
 }

Modified: felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/runtime/WhiteboardServiceHelper.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/runtime/WhiteboardServiceHelper.java?rev=1680835&r1=1680834&r2=1680835&view=diff
==============================================================================
--- felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/runtime/WhiteboardServiceHelper.java
(original)
+++ felix/trunk/http/base/src/test/java/org/apache/felix/http/base/internal/runtime/WhiteboardServiceHelper.java
Thu May 21 11:57:02 2015
@@ -57,7 +57,7 @@ public final class WhiteboardServiceHelp
             Long serviceId)
     {
         FilterInfo filterInfo = createFilterInfo(identifier, serviceId);
-        return new HttpServiceFilterHandler(0, context, filterInfo, mock(Filter.class));
+        return new HttpServiceFilterHandler(context, filterInfo, mock(Filter.class));
     }
 
     private static FilterInfo createFilterInfo(String identifier,
@@ -114,7 +114,7 @@ public final class WhiteboardServiceHelp
         ServletInfo servletInfo = createServletInfo(identifier, serviceId);
         Servlet servlet = mock(Servlet.class);
         when(servlet.getServletInfo()).thenReturn("info_" + identifier);
-        final ServletHandler h = new HttpServiceServletHandler(contextServiceId, context,
servletInfo, servlet);
+        final ServletHandler h = new HttpServiceServletHandler(context, servletInfo, servlet);
 
         return h;
     }



Mime
View raw message