ServiceReference httpSvcSR = EasyMock.createNiceMock(ServiceReference.class);
EasyMock.replay(httpSvcSR);
EasyMock.expect(dswContext.getService(httpSvcSR)).andReturn(httpService).anyTimes();
EasyMock.replay(dswContext);
final ServerFactoryBean sfb = createMockServerFactoryBean();
// RemoteServiceAdminCore dp = new RemoteServiceAdminCore(dswContext);
Map<String, Object> handlerProps = new HashMap<String, Object>();
HttpServiceConfigurationTypeHandler h =
new HttpServiceConfigurationTypeHandler(dswContext, handlerProps) {
@Override
ServerFactoryBean createServerFactoryBean(String frontend) {
return sfb;
}
@Override
String[] applyIntents(BundleContext dswContext, BundleContext callingContext,
List<AbstractFeature> features, AbstractEndpointFactory factory,
Map sd) {
return new String [] {"a.b.c"};
}
};
h.httpServiceReferences.add(httpSvcSR);
Runnable myService = new Runnable() {
public void run() {
System.out.println("blah");
}
};
ServiceReference sr = EasyMock.createNiceMock(ServiceReference.class);
BundleContext callingContext = EasyMock.createNiceMock(BundleContext.class);
EasyMock.replay(sr);
EasyMock.replay(callingContext);
Map<String, Object> props = new HashMap<String, Object>();
props.put(Constants.WS_HTTP_SERVICE_CONTEXT, "/myRunnable");
//ServiceEndpointDescription sd = new ServiceEndpointDescriptionImpl(Runnable.class.getName(), props);
ExportRegistrationImpl exReg = new ExportRegistrationImpl(sr,null,null);
// assertEquals("Precondition failed", 0, dp.getExposedServices().size());
assertEquals("Precondition failed", "", sfb.getAddress());
h.createServer(exReg, dswContext, callingContext, props, Runnable.class, myService);
assertEquals("The address should be set to '/'. The Servlet context dictates the actual location.", "/", sfb.getAddress());
//assertEquals(1, dp.getExposedServices().size());
//assertSame(sr, dp.getExposedServices().iterator().next());
String hostName;
try {