public void testWeatherServiceExported() {
ServiceReference ref = bundleContext.getServiceReference("org.springframework.osgi.samples.weather.service.WeatherService");
assertNotNull("Service Reference is null", ref);
try {
WeatherService weather = (WeatherService) bundleContext.getService(ref);
assertNotNull("Cannot find the service", weather);
assertEquals(new Double(15.0), weather.getHistoricalHigh(new GregorianCalendar(2004, 0, 1).getTime()));
}
finally {
bundleContext.ungetService(ref);
}
}