use of org.apache.felix.http.base.internal.HttpServiceController in project felix by apache.
the class JettyServiceTest method setUp.
@Before
public void setUp() throws Exception {
// Setup Mocks
mockBundleContext = mock(BundleContext.class);
mockBundle = mock(Bundle.class);
// 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>());
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);
jettyService = new JettyService(mockBundleContext, httpServiceController);
jettyService.start();
}
Aggregations