Update tests to mock filter

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1655590 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/http/jetty/pom.xml b/http/jetty/pom.xml
index 67d1387..ff5a574 100644
--- a/http/jetty/pom.xml
+++ b/http/jetty/pom.xml
@@ -83,6 +83,7 @@
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
+            <version>6.0.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -143,12 +144,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-SNAPSHOT</version>
+            <version>3.0.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
 
diff --git a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
index a7d8dc9..446ca8b 100644
--- a/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
+++ b/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
@@ -29,7 +29,6 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
 import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -132,7 +131,7 @@
         // FELIX-4422: start Jetty synchronously...
         startJetty();
 
-        Properties props = new Properties();
+        Dictionary<String, Object> props = new Hashtable<String, Object>();
         props.put(Constants.SERVICE_PID, PID);
         this.configServiceReg = this.context.registerService(ManagedService.class.getName(), new JettyManagedService(this), props);
 
@@ -741,7 +740,7 @@
         if (bundle.getState() == Bundle.ACTIVE || (bundle.getState() == Bundle.STARTING && "Lazy".equals(bundle.getHeaders().get(HEADER_ACTIVATION_POLICY))))
         {
 
-            String contextPath = (String) bundle.getHeaders().get(HEADER_WEB_CONTEXT_PATH);
+            String contextPath = bundle.getHeaders().get(HEADER_WEB_CONTEXT_PATH);
             if (contextPath != null)
             {
                 return startWebAppBundle(bundle, contextPath);
@@ -752,7 +751,7 @@
 
     public void removedBundle(Bundle bundle, BundleEvent event, Object object)
     {
-        String contextPath = (String) bundle.getHeaders().get(HEADER_WEB_CONTEXT_PATH);
+        String contextPath = bundle.getHeaders().get(HEADER_WEB_CONTEXT_PATH);
         if (contextPath == null)
         {
             return;
diff --git a/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java b/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
index 9192d28..caebc67 100644
--- a/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
+++ b/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
@@ -16,6 +16,10 @@
  */
 package org.apache.felix.http.jetty.internal;
 
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -36,6 +40,8 @@
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 
+import junit.framework.TestCase;
+
 import org.apache.felix.http.base.internal.DispatcherServlet;
 import org.apache.felix.http.base.internal.EventDispatcher;
 import org.apache.felix.http.base.internal.HttpServiceController;
@@ -46,9 +52,6 @@
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Version;
 
-import junit.framework.TestCase;
-import static org.mockito.Mockito.*;
-
 public class JettyServiceTest extends TestCase
 {
 
@@ -66,6 +69,7 @@
 
     private Bundle mockBundle;
 
+    @Override
     public void setUp() throws Exception
     {
         //Setup Mocks
@@ -75,6 +79,9 @@
 
         //Setup Behaviors
         when(mockBundleContext.getBundle()).thenReturn(mockBundle);
+        final org.osgi.framework.Filter f = mock(org.osgi.framework.Filter.class);
+        when(f.toString()).thenReturn("(prop=*)");
+        when(mockBundleContext.createFilter(anyString())).thenReturn(f);
         when(mockBundle.getSymbolicName()).thenReturn("main");
         when(mockBundle.getVersion()).thenReturn(new Version("1.0.0"));
         when(mockBundle.getHeaders()).thenReturn(new Hashtable<String, String>());
@@ -92,13 +99,13 @@
     }
 
     /**
-     * 
+     *
      * Tests to ensure the osgi-bundlecontext is available for init methods.
-     * 
+     *
      * @throws MalformedURLException
      * @throws InterruptedException
      */
-    public void testInitBundleContextDeployIT() throws MalformedURLException, InterruptedException
+    public void testInitBundleContextDeployIT() throws Exception
     {
         //Setup mocks
         Deployment mockDeployment = mock(Deployment.class);
@@ -107,6 +114,9 @@
 
         //Setup behaviors
         when(mockDeployment.getBundle()).thenReturn(mockBundle);
+        final org.osgi.framework.Filter f = mock(org.osgi.framework.Filter.class);
+        when(f.toString()).thenReturn("(prop=*)");
+        when(mockBundleContext.createFilter(anyString())).thenReturn(f);
         when(mockBundle.getBundleContext()).thenReturn(mockBundleContext);
         when(mockBundle.getSymbolicName()).thenReturn("test");
         when(mockBundle.getVersion()).thenReturn(new Version("0.0.1"));