use of org.apache.felix.utils.properties.Properties in project karaf by apache.
the class LdapLoginModuleTest method testBadPassword.
@Test
public void testBadPassword() throws Exception {
Properties options = ldapLoginModuleOptions();
LDAPLoginModule module = new LDAPLoginModule();
Subject subject = new Subject();
module.initialize(subject, new NamePasswordCallbackHandler("admin", "blahblah"), null, options);
assertEquals("Precondition", 0, subject.getPrincipals().size());
try {
module.login();
fail("Should have thrown LoginException");
} catch (LoginException e) {
assertTrue(e.getMessage().startsWith("Authentication failed"));
}
}
use of org.apache.felix.utils.properties.Properties in project karaf by apache.
the class BaseJDBCLockIntegrationTest method setUpTestSuite.
@BeforeClass
public static void setUpTestSuite() {
Properties properties = new Properties();
properties.put("karaf.bootstrap.log", "target/karaf.log");
BootstrapLogManager.setProperties(properties);
}
use of org.apache.felix.utils.properties.Properties in project karaf by apache.
the class Main method readBundlesFromStartupProperties.
public List<BundleInfo> readBundlesFromStartupProperties(File startupPropsFile) {
Properties startupProps = PropertiesLoader.loadPropertiesOrFail(startupPropsFile);
List<BundleInfo> bundeList = new ArrayList<>();
for (String key : startupProps.keySet()) {
try {
BundleInfo bi = new BundleInfo();
bi.uri = new URI(key);
String startlevelSt = startupProps.getProperty(key).trim();
bi.startLevel = new Integer(startlevelSt);
bundeList.add(bi);
} catch (Exception e) {
throw new RuntimeException("Error loading startup bundle list from " + startupPropsFile + " at " + key, e);
}
}
return bundeList;
}
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;
}
Aggregations