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/01/30 19:11:31 UTC
svn commit: r1656079 -
/felix/trunk/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
Author: cziegeler
Date: Fri Jan 30 18:11:31 2015
New Revision: 1656079
URL: http://svn.apache.org/r1656079
Log:
Fix test case
Modified:
felix/trunk/http/jetty/src/test/java/org/apache/felix/http/jetty/internal/JettyServiceTest.java
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=1656079&r1=1656078&r2=1656079&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 Fri Jan 30 18:11:31 2015
@@ -48,8 +48,11 @@ 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.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.Version;
public class JettyServiceTest extends TestCase
@@ -85,6 +88,10 @@ 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 ServiceRegistration reg = mock(ServiceRegistration.class);
+ when(mockBundleContext.registerService((Class)Matchers.isNotNull(),
+ Matchers.any(ServiceFactory.class),
+ Matchers.any(Dictionary.class))).thenReturn(reg);
httpServiceController = new HttpServiceController(mockBundleContext);
dispatcherServlet = new DispatcherServlet(httpServiceController);
@@ -138,11 +145,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 +161,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 +182,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 +192,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