Package com.cloudera.lib.server

Examples of com.cloudera.lib.server.Server


    String services = StringUtils.toString(Arrays.asList(InstrumentationService.class.getName(),
                                                         HadoopService.class.getName()), ",");
    XConfiguration conf = new XConfiguration();
    conf.set("server.services", services);
    conf.set("server.hadoop.job.tracker.whitelist", "JT");
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    HadoopService hadoop = (HadoopService) server.get(Hadoop.class);
    hadoop.validateJobtracker("JTT");
  }
View Full Code Here


    String services = StringUtils.toString(Arrays.asList(InstrumentationService.class.getName(),
                                                         HadoopService.class.getName()), ",");
    XConfiguration conf = new XConfiguration();
    conf.set("server.services", services);
    conf.set("server.hadoop.name.node.whitelist", "NN");
    Server server = new Server("server", dir, dir, dir, dir, conf);
    server.init();
    HadoopService hadoop = (HadoopService) server.get(Hadoop.class);
    hadoop.validateNamenode("NNx");
  }
View Full Code Here

    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);
    FileSystem fs = hadoop.createFileSystem("u", getHadoopConf());
    Assert.assertNotNull(fs);
    fs.mkdirs(new Path("/tmp/foo"));
    hadoop.releaseFileSystem(fs);
    try {
      fs.mkdirs(new Path("/tmp/foo"));
      Assert.fail();
    }
    catch (IOException ex) {
    }
    catch (Exception ex) {
      Assert.fail();
    }
    server.destroy();
  }
View Full Code Here

    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];

    hadoop.execute("u", getHadoopConf(), new Hadoop.FileSystemExecutor<Void>() {
      @Override
      public Void execute(FileSystem fs) throws IOException {
        fs.mkdirs(new Path("/tmp/foo"));
        fsa[0] = fs;
        return null;
      }
    });
    try {
      fsa[0].mkdirs(new Path("/tmp/foo"));
      Assert.fail();
    }
    catch (IOException ex) {
    }
    catch (Exception ex) {
      Assert.fail();
    }
    server.destroy();
  }
View Full Code Here

    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();
    jobConf.set("fs.default.name", "");
    hadoop.execute("u", jobConf, new Hadoop.FileSystemExecutor<Void>() {
      @Override
View Full Code Here

    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];
    try {
      hadoop.execute("u", getHadoopConf(), new Hadoop.FileSystemExecutor<Void>() {
        @Override
        public Void execute(FileSystem fs) throws IOException {
          fsa[0] = fs;
          throw new IOException();
        }
      });
      Assert.fail();
    }
    catch (HadoopException ex) {
      Assert.assertEquals(ex.getError(), HadoopException.ERROR.H03);
    }
    catch (Exception ex) {
      Assert.fail();
    }

    try {
      fsa[0].mkdirs(new Path("/tmp/foo"));
      Assert.fail();
    }
    catch (IOException ex) {
    }
    catch (Exception ex) {
      Assert.fail();
    }
    server.destroy();
  }
View Full Code Here

    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();
    jobConf.set("fs.default.name", "");
    hadoop.execute("u", jobConf, new Hadoop.JobClientExecutor<Void>() {
      @Override
View Full Code Here

    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();
    jobConf.set("mapred.job.tracker", "");
    hadoop.execute("u", jobConf, new Hadoop.JobClientExecutor<Void>() {
      @Override
View Full Code Here

    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];
    final FileSystem fsa[] = new FileSystem[1];

    hadoop.execute("u", getHadoopConf(), new Hadoop.JobClientExecutor<Void>() {
      @Override
      public Void execute(JobClient jc, FileSystem fs) throws IOException {
        fs.mkdirs(new Path("/tmp/foo"));
        jc.getQueues();
        jca[0] = jc;
        fsa[0] = fs;
        return null;
      }
    });
    // NOT testing JobClient as the closed one still connects to the JobTracker successfully
    //        try {
    //            jca[0].submitJob(jobConf);
    //            Assert.fail();
    //        }
    //        catch (IOException ex) {
    //        }
    //        catch (Exception ex) {
    //            Assert.fail();
    //        }
    try {
      fsa[0].mkdirs(new Path("/tmp/foo"));
      Assert.fail();
    }
    catch (IOException ex) {
    }
    catch (Exception ex) {
      Assert.fail();
    }
    server.destroy();
  }
View Full Code Here

    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];
    final FileSystem fsa[] = new FileSystem[1];

    try {
      hadoop.execute("u", getHadoopConf(), new Hadoop.JobClientExecutor<Void>() {
        @Override
        public Void execute(JobClient jc, FileSystem fs) throws IOException {
          jca[0] = jc;
          fsa[0] = fs;
          throw new IOException();
        }
      });
      Assert.fail();
    }
    catch (HadoopException ex) {
      Assert.assertEquals(ex.getError(), HadoopException.ERROR.H04);
    }
    catch (Exception ex) {
      Assert.fail();
    }

    // NOT testing JobClient as the closed one still connects to the JobTracker successfully
    //        try {
    //            jca[0].submitJob(jobConf);
    //            Assert.fail();
    //        }
    //        catch (IOException ex) {
    //        }
    //        catch (Exception ex) {
    //            Assert.fail();
    //        }
    try {
      fsa[0].mkdirs(new Path("/tmp/foo"));
      Assert.fail();
    }
    catch (IOException ex) {
    }
    catch (Exception ex) {
      Assert.fail();
    }
    server.destroy();
  }
View Full Code Here

TOP

Related Classes of com.cloudera.lib.server.Server

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.