BlueprintMetadata implements BlueprintMetadataMBean { public CompositeData getComponentMetadata(long containerServiceId, String componentId) throws IOException { BlueprintContainer container = getBlueprintContainer(containerServiceId); ComponentMetadata componentMetadata = container.getComponentMetadata(componentId); BPMetadata metadata = Util.metadata2BPMetadata(componentMetadata); return metadata.asCompositeData(); } 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 testGetComponentMetadata() throws Exception { final long serviceId = 7117; final String componentId = ".component-1"; final String [] cidarray = new String[]{componentId}; final List emptyList = new ArrayList(); 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).getComponentMetadata(componentId); will(returnValue(mockBeanMetadata)); } }); mockery.checking(new Expectations(){ { allowing(mockBeanMetadata).getDependsOn(); will(returnValue(emptyList)); allowing(mockBeanMetadata).getArguments(); will(returnValue(emptyList)); allowing(mockBeanMetadata).getFactoryComponent(); will(returnValue(null)); allowing(mockBeanMetadata).getProperties(); will(returnValue(emptyList)); ignoring(mockBeanMetadata); } }); metadata.getComponentMetadata(serviceId, componentId); mockery.assertIsSatisfied(); }