ServiceReference ref =
calculatorBundle.getBundleContext().getServiceReference(CalculatorService.class.getName());
Assert.assertNotNull(ref);
Object service = context.getService(ref);
Assert.assertNotNull(service);
CalculatorService calculator = OSGiTestBundles.cast(service, CalculatorService.class);
System.out.println("2.0 + 1.0 = " + calculator.add(2.0, 1.0));
System.out.println("2.0 - 1.0 = " + calculator.subtract(2.0, 1.0));
System.out.println("2.0 * 1.0 = " + calculator.multiply(2.0, 1.0));
System.out.println("2.0 / 1.0 = " + calculator.divide(2.0, 1.0));
}
}