ProvisioningService implements ProvisioningServiceMBean { @SuppressWarnings("unchecked") public TabularData listInformation() throws IOException { TabularData propertiesTable = new TabularDataSupport(PROPERTIES_TYPE); Dictionary<String, Object> information = (Dictionary<String, Object>) provisioningService.getInformation(); if (information != null) { Enumeration<String> keys = information.keys(); while (keys.hasMoreElements()) { String key = keys.nextElement(); propertiesTable.put(PropertyData.newInstance(key, information.get(key)).toCompositeData()); } } return propertiesTable; } ProvisioningService(org.osgi.service.provisioning.ProvisioningService provisioningService); void addInformationFromZip(String zipURL); void addInformation(TabularData info); @SuppressWarnings("unchecked") TabularData listInformation(); void setInformation(TabularData info);  }
@Test public void testListInformation() throws Exception { org.osgi.service.provisioning.ProvisioningService provService = mock(org.osgi.service.provisioning.ProvisioningService.class); ProvisioningService mbean = new ProvisioningService(provService); Dictionary<String, Object> info = new Hashtable<String, Object>(); info.put(PROVISIONING_AGENT_CONFIG, new byte[] { 20, 30, 40 }); info.put(PROVISIONING_SPID, "x.test"); info.put(PROVISIONING_REFERENCE, "rsh: info.put(PROVISIONING_RSH_SECRET, new byte[] { 15, 25, 35 }); info.put(PROVISIONING_UPDATE_COUNT, 1); when(provService.getInformation()).thenReturn(info); TabularData provData = mbean.listInformation(); assertNotNull(provData); assertEquals(PROPERTIES_TYPE, provData.getTabularType()); assertEquals(5, provData.values().size()); PropertyData<byte[]> agentConfig = PropertyData.from(provData.get(new Object[]{ PROVISIONING_AGENT_CONFIG })); assertArrayEquals(new byte[] { 20, 30, 40 }, agentConfig.getValue()); PropertyData<String> spid = PropertyData.from(provData.get(new Object[] { PROVISIONING_SPID })); assertEquals("x.test", spid.getValue()); PropertyData<String> ref = PropertyData.from(provData.get(new Object[] { PROVISIONING_REFERENCE })); assertEquals("rsh: PropertyData<byte[]> sec = PropertyData.from(provData.get(new Object[] { PROVISIONING_RSH_SECRET })); assertArrayEquals(new byte[] { 15, 25, 35 }, sec.getValue()); PropertyData<Integer> count = PropertyData.from(provData.get(new Object[] { PROVISIONING_UPDATE_COUNT })); assertEquals(new Integer(1), count.getValue()); }