Search in sources :

Example 1 with MicroZookeeperService

use of org.apache.hadoop.registry.server.services.MicroZookeeperService in project hadoop by apache.

the class AbstractZKRegistryTest method createZKServer.

@BeforeClass
public static void createZKServer() throws Exception {
    File zkDir = new File("target/zookeeper");
    FileUtils.deleteDirectory(zkDir);
    assertTrue(zkDir.mkdirs());
    zookeeper = new MicroZookeeperService("InMemoryZKService");
    YarnConfiguration conf = new YarnConfiguration();
    conf.set(MicroZookeeperServiceKeys.KEY_ZKSERVICE_DIR, zkDir.getAbsolutePath());
    zookeeper.init(conf);
    zookeeper.start();
    addToTeardown(zookeeper);
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) File(java.io.File) MicroZookeeperService(org.apache.hadoop.registry.server.services.MicroZookeeperService) BeforeClass(org.junit.BeforeClass)

Example 2 with MicroZookeeperService

use of org.apache.hadoop.registry.server.services.MicroZookeeperService in project hadoop by apache.

the class AbstractSecureRegistryTest method createSecureZKInstance.

/**
   * Create a secure instance
   * @param name instance name
   * @return the instance
   * @throws Exception
   */
protected static MicroZookeeperService createSecureZKInstance(String name) throws Exception {
    String context = ZOOKEEPER_SERVER_CONTEXT;
    Configuration conf = new Configuration();
    File testdir = new File(System.getProperty("test.dir", "target"));
    File workDir = new File(testdir, name);
    if (!workDir.mkdirs()) {
        assertTrue(workDir.isDirectory());
    }
    System.setProperty(ZookeeperConfigOptions.PROP_ZK_SERVER_MAINTAIN_CONNECTION_DESPITE_SASL_FAILURE, "false");
    RegistrySecurity.validateContext(context);
    conf.set(MicroZookeeperServiceKeys.KEY_REGISTRY_ZKSERVICE_JAAS_CONTEXT, context);
    MicroZookeeperService secureZK = new MicroZookeeperService(name);
    secureZK.init(conf);
    LOG.info(secureZK.getDiagnostics());
    return secureZK;
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) File(java.io.File) MicroZookeeperService(org.apache.hadoop.registry.server.services.MicroZookeeperService)

Example 3 with MicroZookeeperService

use of org.apache.hadoop.registry.server.services.MicroZookeeperService in project hadoop by apache.

the class TestMicroZookeeperService method testTempDirSupport.

@Test
public void testTempDirSupport() throws Throwable {
    YarnConfiguration conf = new YarnConfiguration();
    zookeeper = new MicroZookeeperService("t1");
    zookeeper.init(conf);
    zookeeper.start();
    zookeeper.stop();
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) MicroZookeeperService(org.apache.hadoop.registry.server.services.MicroZookeeperService) Test(org.junit.Test)

Aggregations

MicroZookeeperService (org.apache.hadoop.registry.server.services.MicroZookeeperService)3 File (java.io.File)2 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)2 Configuration (org.apache.hadoop.conf.Configuration)1 BeforeClass (org.junit.BeforeClass)1 Test (org.junit.Test)1