Package org.elasticsearch.test.fixture
Class AbstractHttpFixture
java.lang.Object
org.elasticsearch.test.fixture.AbstractHttpFixture
Base class for test fixtures that requires a
HttpServer
to work.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Represents an HTTP Request.static interface
protected static class
Represents an HTTP Response. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static byte[]
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractHttpFixture(String workingDir)
protected
AbstractHttpFixture(String workingDir, int port)
-
Method Summary
Modifier and TypeMethodDescriptioncontentType(String contentType)
protected abstract AbstractHttpFixture.Response
handle(AbstractHttpFixture.Request request)
void
listen()
Opens aHttpServer
and start listening on a provided or random port.void
listen(InetAddress inetAddress, boolean exposePidAndPort)
Opens aHttpServer
and start listening on a provided or random port.
-
Field Details
-
TEXT_PLAIN_CONTENT_TYPE
-
JSON_CONTENT_TYPE
-
EMPTY_BYTE
protected static final byte[] EMPTY_BYTE
-
-
Constructor Details
-
AbstractHttpFixture
-
AbstractHttpFixture
-
-
Method Details
-
listen
Opens aHttpServer
and start listening on a provided or random port.- Throws:
IOException
InterruptedException
-
listen
public final void listen(InetAddress inetAddress, boolean exposePidAndPort) throws IOException, InterruptedExceptionOpens aHttpServer
and start listening on a provided or random port.- Throws:
IOException
InterruptedException
-
handle
protected abstract AbstractHttpFixture.Response handle(AbstractHttpFixture.Request request) throws IOException- Throws:
IOException
-
contentType
-