ConfigurationAdmin implements ConfigurationAdminMBean { public String createFactoryConfiguration(String factoryPid) throws IOException { return createFactoryConfigurationForLocation(factoryPid, null); } ConfigurationAdmin(org.osgi.service.cm.ConfigurationAdmin configurationAdmin); String createFactoryConfiguration(String factoryPid); String createFactoryConfigurationForLocation(String factoryPid, String location); void delete(String pid); void deleteForLocation(String pid, String location); void deleteConfigurations(String filter); String getBundleLocation(String pid); String[][] getConfigurations(String filter); String getFactoryPid(String pid); String getFactoryPidForLocation(String pid, String location); TabularData getProperties(String pid); TabularData getPropertiesForLocation(String pid, String location); void setBundleLocation(String pid, String location); void update(String pid, TabularData configurationTable); @SuppressWarnings("unchecked") void updateForLocation(String pid, String location, TabularData configurationTable);  }
@Test public void testCreateFactoryConfiguration() throws Exception { org.osgi.service.cm.ConfigurationAdmin admin = mock(org.osgi.service.cm.ConfigurationAdmin.class); String fpid = "org.apache.aries.jmx.mock.factory"; Configuration config = mock(Configuration.class); when(admin.createFactoryConfiguration(eq(fpid))).thenReturn(config); when(admin.createFactoryConfiguration(eq(fpid), anyString())).thenReturn(config); when(config.getPid()).thenReturn(fpid + "-1260133982371-0"); ConfigurationAdmin mbean = new ConfigurationAdmin(admin); assertEquals(fpid + "-1260133982371-0", mbean.createFactoryConfiguration(fpid)); assertEquals(fpid + "-1260133982371-0", mbean.createFactoryConfigurationForLocation(fpid, "/bundlex")); }