Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,15 @@ public void doConfigurationEvent(ConfigurationEvent configurationEvent)
{
try
{
Configuration config = getConfigurationAdmin().getConfiguration(
configurationEvent.getPid(),
"?");
Configuration[] configurations = getConfigurationAdmin().listConfigurations("(service.pid=" + configurationEvent.getPid() + ")");
if (null == configurations) {
return;
}
if (configurations.length < 1) {
return;
}
Configuration config = configurations[0];

Dictionary<?,?> dict = config.getProperties();
String fileName = dict != null ? (String) dict.get( DirectoryWatcher.FILENAME ) : null;
File file = fileName != null ? fromConfigKey(fileName) : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ public void testCreateConfigAndObserveCMDeleted() throws Exception
EasyMock.expect(mockBundleContext.getProperty((String) EasyMock.anyObject()))
.andReturn(null)
.anyTimes();
EasyMock.expect(mockConfigurationAdmin.listConfigurations((String) EasyMock.anyObject()))
EasyMock.expect(mockConfigurationAdmin.listConfigurations("(felix.fileinstall.filename=file:" + file + ")"))
.andReturn(null);
EasyMock.expect(mockConfigurationAdmin.getConfiguration(pid, "?"))
.andReturn(mockConfiguration);
EasyMock.expect(mockConfigurationAdmin.listConfigurations("(service.pid=" + pid + ")"))
.andReturn(new Configuration[] { mockConfiguration });

ServiceReference<ConfigurationAdmin> sr = EasyMock.createMock(ServiceReference.class);
EasyMock.expect(mockConfiguration.updateIfDifferent(EasyMock.capture(props))).andReturn(true);
Expand Down Expand Up @@ -327,8 +327,8 @@ public void testUseExistingConfigWithFileinstallFilenameAndObserveCMDeleted() th
EasyMock.expect(mockBundleContext.getProperty((String) EasyMock.anyObject()))
.andReturn(null)
.anyTimes();
EasyMock.expect(mockConfigurationAdmin.listConfigurations((String) EasyMock.anyObject()))
.andReturn(null);
EasyMock.expect(mockConfigurationAdmin.listConfigurations("(service.pid=" + pid + ")"))
.andReturn(new Configuration[] { mockConfiguration });
EasyMock.expect(mockConfigurationAdmin.getConfiguration(pid, "?"))
.andReturn(mockConfiguration);
EasyMock.expect(mockConfiguration.getPid())
Expand Down Expand Up @@ -386,14 +386,17 @@ public void testDoConfigurationEventSavesUpdatedConfigurationWhenUsingCachingPer
.andReturn(cachingPersistenceConfiguration)
.anyTimes();

EasyMock.expect(mockConfigurationAdmin.listConfigurations("(service.pid=" + pid + ")"))
.andReturn(new Configuration[] { cachingPersistenceConfiguration });

EasyMock.expect(mockConfigurationAdmin.getConfiguration(pid, null))
.andReturn(cachingPersistenceConfiguration)
.anyTimes();

final Configuration newConfiguration = EasyMock.createMock(Configuration.class);
EasyMock.expect(newConfiguration.getAttributes()).andReturn(Collections.emptySet()).times(2);

EasyMock.expect(mockConfigurationAdmin.listConfigurations((String) EasyMock.anyObject()))
EasyMock.expect(mockConfigurationAdmin.listConfigurations("(felix.fileinstall.filename=file:" + file + ")"))
.andReturn(new Configuration[] { newConfiguration });

EasyMock.expect(newConfiguration.getProperties())
Expand Down