Example usage for org.apache.zookeeper Login shutdown

List of usage examples for org.apache.zookeeper Login shutdown

Introduction

In this page you can find the example usage for org.apache.zookeeper Login shutdown.

Prototype

public void shutdown() 

Source Link

Usage

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
 *//*  w  w  w .  jav  a2 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();
    }
}