Package org.apache.hadoop.hbase.http

Examples of org.apache.hadoop.hbase.http.HttpServer$ListenerInfo


   * @throws Throwable if something went wrong
   */
  @Test
  public void testMissingServerResource() throws Throwable {
    try {
      HttpServer server = createServer("NoSuchWebapp");
      //should not have got here.
      //close the server
      String serverDescription = server.toString();
      stop(server);
      fail("Expected an exception, got " + serverDescription);
    } catch (FileNotFoundException expected) {
      log.debug("Expected exception " + expected, expected);
    }
View Full Code Here


   
    //start a http server with CountingFilter
    conf.set(HttpServer.FILTER_INITIALIZERS_PROPERTY,
        RecordingFilter.Initializer.class.getName());
    String[] pathSpecs = { "/path", "/path/*" };
    HttpServer http = createTestServer(conf, pathSpecs);
    http.start();

    final String baseURL = "/path";
    final String baseSlashURL = "/path/";
    final String addedURL = "/path/nodes";
    final String addedSlashURL = "/path/nodes/";
    final String longURL = "/path/nodes/foo/job";
    final String rootURL = "/";
    final String allURL = "/*";

    final String[] filteredUrls = {baseURL, baseSlashURL, addedURL,
        addedSlashURL, longURL};
    final String[] notFilteredUrls = {rootURL, allURL};

    // access the urls and verify our paths specs got added to the
    // filters
    final String prefix = "http://"
        + NetUtils.getHostPortString(http.getConnectorAddress(0));
    try {
      for(int i = 0; i < filteredUrls.length; i++) {
        access(prefix + filteredUrls[i]);
      }
      for(int i = 0; i < notFilteredUrls.length; i++) {
        access(prefix + notFilteredUrls[i]);
      }
    } finally {
      http.stop();
    }

    LOG.info("RECORDS = " + RECORDS);
   
    //verify records
View Full Code Here

      log.debug("log.debug1");
      log.info("log.info1");
      log.error("log.error1");
      assertTrue(!Level.ERROR.equals(log.getEffectiveLevel()));

      HttpServer server = null;
      try {
        server = new HttpServer.Builder().setName("..")
            .addEndpoint(new URI("http://localhost:0")).setFindPort(true)
            .build();

        server.start();
        String authority = NetUtils.getHostPortString(server
            .getConnectorAddress(0));

        //servlet
        URL url = new URL("http://" + authority + "/logLevel?log=" + logName
            + "&level=" + Level.ERROR);
        out.println("*** Connecting to " + url);
        HttpURLConnection connection = (HttpURLConnection)url.openConnection();
        connection.connect();

        BufferedReader in = new BufferedReader(new InputStreamReader(
            connection.getInputStream()));
        for(String line; (line = in.readLine()) != null; out.println(line));
        in.close();
        connection.disconnect();

        log.debug("log.debug2");
        log.info("log.info2");
        log.error("log.error2");
        assertTrue(Level.ERROR.equals(log.getEffectiveLevel()));

        //command line
        String[] args = {"-setlevel", authority, logName, Level.DEBUG.toString()};
        LogLevel.main(args);
        log.debug("log.debug3");
        log.info("log.info3");
        log.error("log.error3");
        assertTrue(Level.DEBUG.equals(log.getEffectiveLevel()));
      } finally {
        if (server != null) {
          server.stop();
        }
      }
    }
    else {
      out.println(testlog.getClass() + " not tested.");
View Full Code Here

      log.debug("log.debug1");
      log.info("log.info1");
      log.error("log.error1");
      assertTrue(!Level.ERROR.equals(log.getEffectiveLevel()));

      HttpServer server = null;
      try {
        server = new HttpServer.Builder().setName("..")
            .addEndpoint(new URI("http://localhost:0")).setFindPort(true)
            .build();

        server.start();
        String authority = NetUtils.getHostPortString(server
            .getConnectorAddress(0));

        //servlet
        URL url = new URL("http://" + authority + "/logLevel?log=" + logName
            + "&level=" + Level.ERROR);
        out.println("*** Connecting to " + url);
        HttpURLConnection connection = (HttpURLConnection)url.openConnection();
        connection.connect();

        BufferedReader in = new BufferedReader(new InputStreamReader(
            connection.getInputStream()));
        for(String line; (line = in.readLine()) != null; out.println(line));
        in.close();
        connection.disconnect();

        log.debug("log.debug2");
        log.info("log.info2");
        log.error("log.error2");
        assertTrue(Level.ERROR.equals(log.getEffectiveLevel()));

        //command line
        String[] args = {"-setlevel", authority, logName, Level.DEBUG.toString()};
        LogLevel.main(args);
        log.debug("log.debug3");
        log.info("log.info3");
        log.error("log.error3");
        assertTrue(Level.DEBUG.equals(log.getEffectiveLevel()));
      } finally {
        if (server != null) {
          server.stop();
        }
      }
    }
    else {
      out.println(testlog.getClass() + " not tested.");
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.http.HttpServer$ListenerInfo

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.