} catch (InvalidSyntaxException e) { fail("Registry query fail : " + e.getMessage()); }
assertNotNull("Check ref not null", ref);
assertEquals("Check ref count", ref.length, 1);
assertEquals("Test property", ref[0].getProperty("foo"), "bar");
BarService bar = (BarService) registry.getService(im2, ref[0]);
assertTrue("Test invocation", bar.bar());
ref = null;
reg1.unregister();
try {
ref = registry.getServiceReferences(BarService.class.getName(), "(bar=foo)");