List of usage examples for org.apache.zookeeper Login startThreadIfNeeded
public void startThreadIfNeeded()
From source file:org.apache.hadoop.registry.secure.TestSecureRegistry.java
License:Apache License
/** * this is a cut and paste of some of the ZK internal code that was * failing on windows and swallowing its exceptions *//*from ww w . j a v a 2 s . c o m*/ @Test public void testLowlevelZKSaslLogin() throws Throwable { RegistrySecurity.bindZKToServerJAASContext(ZOOKEEPER_SERVER_CONTEXT); String serverSection = System.getProperty(ZooKeeperSaslServer.LOGIN_CONTEXT_NAME_KEY, ZooKeeperSaslServer.DEFAULT_LOGIN_CONTEXT_NAME); assertEquals(ZOOKEEPER_SERVER_CONTEXT, serverSection); AppConfigurationEntry entries[]; entries = javax.security.auth.login.Configuration.getConfiguration() .getAppConfigurationEntry(serverSection); assertNotNull("null entries", entries); SaslServerCallbackHandler saslServerCallbackHandler = new SaslServerCallbackHandler( javax.security.auth.login.Configuration.getConfiguration()); Login login = new Login(serverSection, saslServerCallbackHandler); try { login.startThreadIfNeeded(); } finally { login.shutdown(); } }