ConfigurationAdmin implements ConfigurationAdminMBean { public void deleteConfigurations(String filter) throws IOException { if (filter == null || filter.length() < 1) { throw new IOException("Argument filter cannot be null or empty"); } Configuration[] configuations = null; try { configuations = configurationAdmin.listConfigurations(filter); } catch (InvalidSyntaxException e) { throw new IOException("Invalid filter [" + filter + "] : " + e); } if (configuations != null) { for (Configuration config : configuations) { config.delete(); } } } 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 testDeleteConfigurations() throws Exception { org.osgi.service.cm.ConfigurationAdmin admin = mock(org.osgi.service.cm.ConfigurationAdmin.class); String filter = "(" + Constants.SERVICE_PID + "=org.apache.aries.jmx.mock)"; Configuration a = mock(Configuration.class); Configuration b = mock(Configuration.class); when(admin.listConfigurations(filter)).thenReturn(new Configuration[] { a, b }); ConfigurationAdmin mbean = new ConfigurationAdmin(admin); mbean.deleteConfigurations(filter); verify(a).delete(); verify(b).delete(); }