use of org.apache.felix.utils.properties.Properties in project karaf by apache.
the class BootstrapLogManagerTest method testGetLogManagerFromPaxLoggingConfig.
@Test
public void testGetLogManagerFromPaxLoggingConfig() {
new File("target/test.log").delete();
Properties configProps = getConfigProperties();
BootstrapLogManager.setProperties(configProps, "src/test/resources/org.ops4j.pax.logging.cfg");
Handler handler = BootstrapLogManager.getDefaultHandler();
Assert.assertNotNull(handler);
assertExists("target/test.log");
}
use of org.apache.felix.utils.properties.Properties in project karaf by apache.
the class BootstrapLogManagerTest method getConfigProperties.
private Properties getConfigProperties() {
Properties configProps = new Properties();
configProps.put("karaf.data", "target");
return configProps;
}
use of org.apache.felix.utils.properties.Properties in project karaf by apache.
the class BaseJDBCLockTest method setUp.
@Before
public void setUp() throws Exception {
connection = EasyMock.createNiceMock(Connection.class);
metaData = EasyMock.createMock(DatabaseMetaData.class);
resultSet = EasyMock.createMock(ResultSet.class);
preparedStatement = EasyMock.createMock(PreparedStatement.class);
statement = EasyMock.createMock(Statement.class);
props = new Properties();
props.put("karaf.lock.jdbc.url", url);
props.put("karaf.lock.jdbc.driver", driver);
props.put("karaf.lock.jdbc.user", user);
props.put("karaf.lock.jdbc.password", password);
props.put("karaf.lock.jdbc.table", tableName);
props.put("karaf.lock.jdbc.clustername", clustername);
props.put("karaf.lock.jdbc.timeout", Integer.toString(timeout));
}
use of org.apache.felix.utils.properties.Properties in project karaf by apache.
the class AutoEncryptionSupport method run.
@Override
public void run() {
WatchService watchService = null;
try {
watchService = FileSystems.getDefault().newWatchService();
Path dir = Paths.get(System.getProperty("karaf.etc"));
dir.register(watchService, ENTRY_MODIFY);
Path file = dir.resolve("users.properties");
encryptedPassword(new Properties(file.toFile()));
while (running) {
try {
WatchKey key = watchService.poll(1, TimeUnit.SECONDS);
if (key == null) {
continue;
}
for (WatchEvent<?> event : key.pollEvents()) {
@SuppressWarnings("unchecked") WatchEvent<Path> ev = (WatchEvent<Path>) event;
// Context for directory entry event is the file name of entry
Path name = dir.resolve(ev.context());
if (file.equals(name)) {
encryptedPassword(new Properties(file.toFile()));
}
}
key.reset();
} catch (IOException e) {
LOGGER.warn(e.getMessage(), e);
} catch (InterruptedException e) {
// Ignore as this happens on shutdown
}
}
} catch (IOException e) {
LOGGER.warn(e.getMessage(), e);
} finally {
StreamUtils.close(watchService);
}
}
use of org.apache.felix.utils.properties.Properties in project karaf by apache.
the class PropertiesLoader method loadIncludes.
private static void loadIncludes(String propertyName, boolean mandatory, URL configPropURL, Properties configProps) throws Exception {
String includes = configProps.get(propertyName);
if (includes != null) {
StringTokenizer st = new StringTokenizer(includes, "\" ", true);
if (st.countTokens() > 0) {
String location;
do {
location = nextLocation(st);
if (location != null) {
URL url = new URL(configPropURL, location);
Properties props = loadPropertiesFile(url, mandatory);
configProps.putAll(props);
}
} while (location != null);
}
}
configProps.remove(propertyName);
}
Aggregations