Package com.cloudera.lib.util

Examples of com.cloudera.lib.util.XConfiguration


  @TestHadoop
  public void fileSystemExecutorException() throws Exception {
    String dir = getTestDir().getAbsolutePath();
    String services = StringUtils.toString(Arrays.asList(InstrumentationService.class.getName(),
                                                         HadoopService.class.getName()), ",");
    XConfiguration conf = new XConfiguration();
    conf.set("server.services", services);
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    Hadoop hadoop = server.get(Hadoop.class);

    final FileSystem fsa[] = new FileSystem[1];
View Full Code Here


  @Test(expectedExceptions = RuntimeException.class)
  @TestDir
  public void invalidGroupsMapping() throws Exception {
    String dir = getTestDir().getAbsolutePath();
    XConfiguration conf = new XConfiguration();
    conf.set("server.services", StringUtils.toString(Arrays.asList(GroupsService.class.getName()), ","));
    conf.set("server.groups.hadoop.security.group.mapping", String.class.getName());
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
  }
View Full Code Here

  @TestHadoop
  public void jobClientExecutorNoNameNode() throws Exception {
    String dir = getTestDir().getAbsolutePath();
    String services = StringUtils.toString(Arrays.asList(InstrumentationService.class.getName(),
                                                         HadoopService.class.getName()), ",");
    XConfiguration conf = new XConfiguration();
    conf.set("server.services", services);
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    Hadoop hadoop = server.get(Hadoop.class);

    JobConf jobConf = getHadoopConf();
View Full Code Here

  @TestHadoop
  public void jobClientExecutorNoJobTracker() throws Exception {
    String dir = getTestDir().getAbsolutePath();
    String services = StringUtils.toString(Arrays.asList(InstrumentationService.class.getName(),
                                                         HadoopService.class.getName()), ",");
    XConfiguration conf = new XConfiguration();
    conf.set("server.services", services);
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    Hadoop hadoop = server.get(Hadoop.class);

    JobConf jobConf = getHadoopConf();
View Full Code Here

  @TestHadoop
  public void jobClientExecutor() throws Exception {
    String dir = getTestDir().getAbsolutePath();
    String services = StringUtils.toString(Arrays.asList(InstrumentationService.class.getName(),
                                                         HadoopService.class.getName()), ",");
    XConfiguration conf = new XConfiguration();
    conf.set("server.services", services);
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    Hadoop hadoop = server.get(Hadoop.class);

    final JobClient jca[] = new JobClient[1];
View Full Code Here

  @TestHadoop
  public void jobClientExecutorException() throws Exception {
    String dir = getTestDir().getAbsolutePath();
    String services = StringUtils.toString(Arrays.asList(InstrumentationService.class.getName(),
                                                         HadoopService.class.getName()), ",");
    XConfiguration conf = new XConfiguration();
    conf.set("server.services", services);
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    Hadoop hadoop = server.get(Hadoop.class);

    final JobClient jca[] = new JobClient[1];
View Full Code Here

  @Test
  @TestDir
  @TestServlet
  public void server() throws Exception {
    String dir = getTestDir().getAbsolutePath();
    XConfiguration hoopConf = new XConfiguration();
    HoopServer server = new HoopServer(dir, dir, dir, dir, hoopConf);
    server.init();
    server.destroy();
  }
View Full Code Here

    Assert.assertTrue(new File(homeDir, "log").mkdir());
    Assert.assertTrue(new File(homeDir, "temp").mkdir());
    HoopServer.setHomeDirForCurrentThread(homeDir.getAbsolutePath());

    String fsDefaultName = getHadoopConf().get("fs.default.name");
    XConfiguration conf = new XConfiguration();
    conf.set("hoop.hadoop.conf:fs.default.name", fsDefaultName);
    conf.set("hoop.base.url", getJettyURL().toExternalForm());
    File hoopSite = new File(new File(homeDir, "conf"), "hoop-site.xml");
    OutputStream os = new FileOutputStream(hoopSite);
    conf.writeXml(os);
    os.close();

    File dir = new File("foo").getAbsoluteFile().getParentFile();
    if (!new File(dir, "hoop-webapp").exists()) {
      dir = dir.getParentFile();
View Full Code Here

    Assert.assertNull(service.getInterface());
    Assert.assertEquals(service.getPrefix(), "myservice");
    Assert.assertEquals(service.getServiceDependencies(), new Class[0]);

    Server server = Mockito.mock(Server.class);
    XConfiguration conf = new XConfiguration();
    conf.set("server.myservice.foo", "FOO");
    conf.set("server.myservice1.bar", "BAR");
    Mockito.when(server.getConfig()).thenReturn(conf);
    Mockito.when(server.getPrefixedName("myservice.foo")).thenReturn("server.myservice.foo");
    Mockito.when(server.getPrefixedName("myservice.")).thenReturn("server.myservice.");

    service.init(server);
View Full Code Here

  }

  @Test
  @TestDir
  public void constructorsGetters() throws Exception {
    Server server = new Server("server", "/a", "/b", "/c", "/d", new XConfiguration());
    Assert.assertEquals(server.getHomeDir(), "/a");
    Assert.assertEquals(server.getConfigDir(), "/b");
    Assert.assertEquals(server.getLogDir(), "/c");
    Assert.assertEquals(server.getTempDir(), "/d");
    Assert.assertEquals(server.getName(), "server");
    Assert.assertEquals(server.getPrefix(), "server");
    Assert.assertEquals(server.getPrefixedName("name"), "server.name");
    Assert.assertNotNull(server.getConfig());

    server = new Server("server", "/a", "/b", "/c", "/d");
    Assert.assertEquals(server.getHomeDir(), "/a");
    Assert.assertEquals(server.getConfigDir(), "/b");
    Assert.assertEquals(server.getLogDir(), "/c");
    Assert.assertEquals(server.getTempDir(), "/d");
    Assert.assertEquals(server.getName(), "server");
    Assert.assertEquals(server.getPrefix(), "server");
    Assert.assertEquals(server.getPrefixedName("name"), "server.name");
    Assert.assertNull(server.getConfig());

    server = new Server("server", getTestDir().getAbsolutePath(), new XConfiguration());
    Assert.assertEquals(server.getHomeDir(), getTestDir().getAbsolutePath());
    Assert.assertEquals(server.getConfigDir(), getTestDir() + "/conf");
    Assert.assertEquals(server.getLogDir(), getTestDir() + "/log");
    Assert.assertEquals(server.getTempDir(), getTestDir() + "/temp");
    Assert.assertEquals(server.getName(), "server");
View Full Code Here

TOP

Related Classes of com.cloudera.lib.util.XConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.