You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2015/03/01 15:20:44 UTC

svn commit: r1663118 - in /felix/trunk/http/jetty: pom.xml src/main/java/org/apache/felix/http/jetty/internal/JettyService.java src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java

Author: cziegeler
Date: Sun Mar  1 14:20:43 2015
New Revision: 1663118

URL: http://svn.apache.org/r1663118
Log:
Revert changes for 3.0.2 releases

Modified:
    felix/trunk/http/jetty/pom.xml
    felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
    felix/trunk/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java

Modified: felix/trunk/http/jetty/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/http/jetty/pom.xml?rev=1663118&r1=1663117&r2=1663118&view=diff
==============================================================================
--- felix/trunk/http/jetty/pom.xml (original)
+++ felix/trunk/http/jetty/pom.xml Sun Mar  1 14:20:43 2015
@@ -22,7 +22,7 @@
     <parent>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.http.parent</artifactId>
-        <version>6</version>
+        <version>7-SNAPSHOT</version>
         <relativePath>../parent/pom.xml</relativePath>
     </parent>
 
@@ -89,7 +89,7 @@
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
-            <version>5.0.0</version>
+            <version>6.0.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -150,12 +150,12 @@
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.http.api</artifactId>
-            <version>2.3.2</version>
+            <version>3.0.0-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.http.base</artifactId>
-            <version>2.4.0</version>
+            <version>3.0.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
 

Modified: felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java?rev=1663118&r1=1663117&r2=1663118&view=diff
==============================================================================
--- felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java (original)
+++ felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java Sun Mar  1 14:20:43 2015
@@ -70,6 +70,7 @@ import org.osgi.framework.ServiceRegistr
 import org.osgi.service.cm.ManagedService;
 import org.osgi.service.event.Event;
 import org.osgi.service.event.EventAdmin;
+import org.osgi.service.http.runtime.HttpServiceRuntimeConstants;
 import org.osgi.util.tracker.BundleTracker;
 import org.osgi.util.tracker.BundleTrackerCustomizer;
 import org.osgi.util.tracker.ServiceTracker;
@@ -79,8 +80,6 @@ public final class JettyService extends
 {
     /** PID for configuration of the HTTP service. */
     public static final String PID = "org.apache.felix.http";
-    /** Endpoint service registration property from RFC 189 */
-    private static final String REG_PROPERTY_ENDPOINTS = "osgi.http.service.endpoints";
 
     private static final String HEADER_WEB_CONTEXT_PATH = "Web-ContextPath";
     private static final String HEADER_ACTIVATION_POLICY = "Bundle-ActivationPolicy";
@@ -599,7 +598,7 @@ public final class JettyService extends
                 }
             }
         }
-        props.put(REG_PROPERTY_ENDPOINTS,
+        props.put(HttpServiceRuntimeConstants.HTTP_SERVICE_ENDPOINT_ATTRIBUTE,
                 endpoints.toArray(new String[endpoints.size()]));
     }
 

Modified: felix/trunk/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java?rev=1663118&r1=1663117&r2=1663118&view=diff
==============================================================================
--- felix/trunk/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java (original)
+++ felix/trunk/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java Sun Mar  1 14:20:43 2015
@@ -48,9 +48,16 @@ import org.apache.felix.http.base.intern
 import org.apache.felix.http.jetty.internal.JettyService.Deployment;
 import org.eclipse.jetty.servlet.FilterHolder;
 import org.eclipse.jetty.servlet.ServletHolder;
+import org.mockito.Matchers;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
 import org.osgi.framework.Version;
+import org.osgi.service.http.context.ServletContextHelper;
+import org.osgi.service.http.runtime.HttpServiceRuntime;
 
 public class JettyServiceTest extends TestCase
 {
@@ -85,6 +92,19 @@ public class JettyServiceTest extends Te
         when(mockBundle.getSymbolicName()).thenReturn("main");
         when(mockBundle.getVersion()).thenReturn(new Version("1.0.0"));
         when(mockBundle.getHeaders()).thenReturn(new Hashtable<String, String>());
+        final ServiceReference ref = mock(ServiceReference.class);
+        when(ref.getProperty(Constants.SERVICE_ID)).thenReturn(1L);
+        final ServiceRegistration reg = mock(ServiceRegistration.class);
+        when(reg.getReference()).thenReturn(ref);
+        when(mockBundleContext.registerService((Class<ServletContextHelper>)Matchers.isNotNull(),
+                (ServiceFactory<ServletContextHelper>)Matchers.any(ServiceFactory.class),
+                Matchers.any(Dictionary.class))).thenReturn(reg);
+        when(mockBundleContext.registerService(Matchers.<String[]>any(),
+                Matchers.any(ServiceFactory.class),
+                Matchers.any(Dictionary.class))).thenReturn(reg);
+        when(mockBundleContext.registerService((Class<HttpServiceRuntime>)Matchers.isNotNull(),
+                Matchers.any(HttpServiceRuntime.class),
+                Matchers.any(Dictionary.class))).thenReturn(reg);
 
         httpServiceController = new HttpServiceController(mockBundleContext);
         dispatcherServlet = new DispatcherServlet(httpServiceController);
@@ -138,11 +158,13 @@ public class JettyServiceTest extends Te
         //Add a Filter to test whether the osgi-bundlecontext is available at init
         webAppBundleContext.addServlet(new ServletHolder(new Servlet()
         {
+            @Override
             public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
             {
                 // Do Nothing
             }
 
+            @Override
             public void init(ServletConfig config) throws ServletException
             {
                 ServletContext context = config.getServletContext();
@@ -152,16 +174,19 @@ public class JettyServiceTest extends Te
                 testLatch.countDown();
             }
 
+            @Override
             public String getServletInfo()
             {
                 return null;
             }
 
+            @Override
             public ServletConfig getServletConfig()
             {
                 return null;
             }
 
+            @Override
             public void destroy()
             {
                 // Do Nothing
@@ -170,6 +195,7 @@ public class JettyServiceTest extends Te
 
         webAppBundleContext.addFilter(new FilterHolder(new Filter()
         {
+            @Override
             public void init(FilterConfig filterConfig) throws ServletException
             {
                 ServletContext context = filterConfig.getServletContext();
@@ -179,11 +205,13 @@ public class JettyServiceTest extends Te
                 testLatch.countDown();
             }
 
+            @Override
             public void doFilter(ServletRequest arg0, ServletResponse response, FilterChain chain) throws IOException, ServletException
             {
                 // Do Nothing
             }
 
+            @Override
             public void destroy()
             {
                 // Do Nothing
@@ -200,4 +228,4 @@ public class JettyServiceTest extends Te
             fail("Test Was not asserted");
         }
     }
-}
+}
\ No newline at end of file