use of org.apache.karaf.config.core.ConfigRepository in project karaf by apache.
the class UpdateCommandTest method testupdateRegularConfig.
public void testupdateRegularConfig() throws Exception {
Dictionary<String, Object> props = new Hashtable<>();
UpdateCommand command = new UpdateCommand();
ConfigRepository configRepo = EasyMock.createMock(ConfigRepository.class);
configRepo.update(EasyMock.eq(PID), EasyMock.eq(props));
EasyMock.expectLastCall();
command.setConfigRepository(configRepo);
MockCommandSession session = createMockSessionForFactoryEdit(PID, false, props);
command.setSession(session);
replay(configRepo);
command.execute();
EasyMock.verify(configRepo);
}
use of org.apache.karaf.config.core.ConfigRepository in project karaf by apache.
the class UpdateCommandTest method testupdateOnNewFactoryPid.
public void testupdateOnNewFactoryPid() throws Exception {
Dictionary<String, Object> props = new Hashtable<>();
UpdateCommand command = new UpdateCommand();
ConfigRepository configRepo = EasyMock.createMock(ConfigRepository.class);
expect(configRepo.createFactoryConfiguration(EasyMock.eq(FACTORY_PID), EasyMock.eq(null), EasyMock.eq(props))).andReturn(PID + ".35326647");
command.setConfigRepository(configRepo);
MockCommandSession session = createMockSessionForFactoryEdit(FACTORY_PID, true, props);
command.setSession(session);
replay(configRepo);
command.execute();
EasyMock.verify(configRepo);
}
use of org.apache.karaf.config.core.ConfigRepository in project karaf by apache.
the class Activator method doStart.
protected void doStart() throws Exception {
ConfigurationAdmin configurationAdmin = getTrackedService(ConfigurationAdmin.class);
if (configurationAdmin == null) {
return;
}
ConfigRepository configRepository = new ConfigRepositoryImpl(configurationAdmin, new File(System.getProperty("karaf.etc")));
register(ConfigRepository.class, configRepository);
ConfigMBeanImpl configMBean = new ConfigMBeanImpl();
configMBean.setConfigRepo(configRepository);
registerMBean(configMBean, "type=config");
}
Aggregations