public class HttpServerFunctionalTest extends Object
HttpServer
. The methods are static for
other classes to import statically.Modifier and Type | Field and Description |
---|---|
private static String |
BUILD_WEBAPPS_DIR
expected location of the test.build.webapps dir: "src/test/resources/webapps"
|
private static org.slf4j.Logger |
LOG |
private static String |
TEST
name of the test webapp: "test"
|
static String |
TEST_BUILD_WEBAPPS
JVM property for the webapp test dir : "test.build.webapps"
|
Constructor and Description |
---|
HttpServerFunctionalTest() |
Modifier and Type | Method and Description |
---|---|
static void |
access(String urlstring)
access a url, ignoring some IOException such as the page does not exist
|
static org.apache.hadoop.hbase.http.HttpServer |
createAndStartTestServer()
Create and start a server with the test webapp
|
static org.apache.hadoop.hbase.http.HttpServer |
createServer(String webapp)
Create an HttpServer instance for the given webapp
|
static org.apache.hadoop.hbase.http.HttpServer |
createServer(String webapp,
org.apache.hadoop.conf.Configuration conf)
Create an HttpServer instance for the given webapp
|
static org.apache.hadoop.hbase.http.HttpServer |
createServer(String webapp,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.security.authorize.AccessControlList adminsAcl) |
static org.apache.hadoop.hbase.http.HttpServer |
createServer(String webapp,
org.apache.hadoop.conf.Configuration conf,
String[] pathSpecs)
Create an HttpServer instance for the given webapp
|
static org.apache.hadoop.hbase.http.HttpServer |
createServer(String host,
int port)
Create an HttpServer instance on the given address for the given webapp
|
static org.apache.hadoop.hbase.http.HttpServer |
createTestServer()
Create but do not start the test webapp server.
|
static org.apache.hadoop.hbase.http.HttpServer |
createTestServer(org.apache.hadoop.conf.Configuration conf)
Create but do not start the test webapp server.
|
static org.apache.hadoop.hbase.http.HttpServer |
createTestServer(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.security.authorize.AccessControlList adminsAcl) |
static org.apache.hadoop.hbase.http.HttpServer |
createTestServer(org.apache.hadoop.conf.Configuration conf,
String[] pathSpecs)
Create but do not start the test webapp server.
|
static org.apache.hadoop.hbase.http.HttpServer |
createTestServerWithSecurity(org.apache.hadoop.conf.Configuration conf) |
static org.apache.hadoop.hbase.http.HttpServer |
createTestServerWithSecurityAndAcl(org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.security.authorize.AccessControlList acl) |
protected static void |
deleteRecursively(File d)
Recursively deletes a
File . |
protected static int |
getFreePort()
Picks a free port on the host by binding a Socket to '0'.
|
static URL |
getServerURL(org.apache.hadoop.hbase.http.HttpServer server)
Pass in a server, return a URL bound to localhost and its port
|
private static org.apache.hadoop.hbase.http.HttpServer.Builder |
localServerBuilder(String webapp) |
protected static void |
prepareTestWebapp()
Prepare the test webapp by creating the directory from the test properties fail if the
directory cannot be created.
|
protected static String |
readOutput(URL url)
Read in the content from a URL
|
static void |
stop(org.apache.hadoop.hbase.http.HttpServer server)
If the server is non null, stop it
|
private static final org.slf4j.Logger LOG
public static final String TEST_BUILD_WEBAPPS
private static final String BUILD_WEBAPPS_DIR
private static final String TEST
public HttpServerFunctionalTest()
public static org.apache.hadoop.hbase.http.HttpServer createTestServer() throws IOException
IOException
- if a problem occursAssertionError
- if a condition was not metpublic static org.apache.hadoop.hbase.http.HttpServer createTestServer(org.apache.hadoop.conf.Configuration conf) throws IOException
conf
- the server configuration to useIOException
- if a problem occursAssertionError
- if a condition was not metpublic static org.apache.hadoop.hbase.http.HttpServer createTestServer(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.authorize.AccessControlList adminsAcl) throws IOException
IOException
public static org.apache.hadoop.hbase.http.HttpServer createTestServer(org.apache.hadoop.conf.Configuration conf, String[] pathSpecs) throws IOException
conf
- the server configuration to useIOException
- if a problem occursAssertionError
- if a condition was not metpublic static org.apache.hadoop.hbase.http.HttpServer createTestServerWithSecurity(org.apache.hadoop.conf.Configuration conf) throws IOException
IOException
public static org.apache.hadoop.hbase.http.HttpServer createTestServerWithSecurityAndAcl(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.authorize.AccessControlList acl) throws IOException
IOException
protected static void prepareTestWebapp() throws IOException
IOException
- if an error occurredAssertionError
- if a condition was not metpublic static org.apache.hadoop.hbase.http.HttpServer createServer(String host, int port) throws IOException
host
- to bindport
- to bindIOException
- if it could not be createdpublic static org.apache.hadoop.hbase.http.HttpServer createServer(String webapp) throws IOException
webapp
- the webapp to work withIOException
- if it could not be createdpublic static org.apache.hadoop.hbase.http.HttpServer createServer(String webapp, org.apache.hadoop.conf.Configuration conf) throws IOException
webapp
- the webapp to work withconf
- the configuration to use for the serverIOException
- if it could not be createdpublic static org.apache.hadoop.hbase.http.HttpServer createServer(String webapp, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.authorize.AccessControlList adminsAcl) throws IOException
IOException
private static org.apache.hadoop.hbase.http.HttpServer.Builder localServerBuilder(String webapp)
public static org.apache.hadoop.hbase.http.HttpServer createServer(String webapp, org.apache.hadoop.conf.Configuration conf, String[] pathSpecs) throws IOException
webapp
- the webapp to work withconf
- the configuration to use for the serverpathSpecs
- the paths specifications the server will serviceIOException
- if it could not be createdpublic static org.apache.hadoop.hbase.http.HttpServer createAndStartTestServer() throws IOException
IOException
- on any failureAssertionError
- if a condition was not metpublic static void stop(org.apache.hadoop.hbase.http.HttpServer server) throws Exception
server
- to stopException
- on any failurepublic static URL getServerURL(org.apache.hadoop.hbase.http.HttpServer server) throws MalformedURLException
server
- serverMalformedURLException
- if the URL cannot be created.protected static String readOutput(URL url) throws IOException
url
- URL To readIOException
- if something went wrongprotected static void deleteRecursively(File d)
File
.protected static int getFreePort() throws IOException
IOException
public static void access(String urlstring) throws IOException
IOException
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.