BlueprintMetadata implements BlueprintMetadataMBean { public String[] getComponentIds(long containerServiceId) throws IOException { BlueprintContainer container = getBlueprintContainer(containerServiceId); return (String[]) container.getComponentIds().toArray(new String[0]); } BlueprintMetadata(BundleContext bundleContext); long getBlueprintContainerServiceId(long bundleId); long[] getBlueprintContainerServiceIds(); String[] getComponentIds(long containerServiceId); String[] getComponentIdsByType(long containerServiceId, String type); CompositeData getComponentMetadata(long containerServiceId, String componentId);  }
@Test public void nomalGetComponentIds() throws Exception { final long serviceId = 7117; final Set cidset = getAsSet(new String[]{".component-1", ".component-2", ".component-5"}); mockery.checking(new Expectations(){ { oneOf(mockContext).getServiceReferences(with(any(String.class)), with(any(String.class))); will(returnValue(mockServiceReferences)); oneOf(mockContext).getService(mockServiceReferences[0]); will(returnValue(mockContainer)); } }); mockery.checking(new Expectations(){ { oneOf(mockContainer).getComponentIds(); will(returnValue(cidset)); } }); assertEquals(cidset, getAsSet(metadata.getComponentIds(serviceId))); }