public class SimpleHttpSource extends AbstractModuleFixture<SimpleHttpSource>
label
Constructor and Description |
---|
SimpleHttpSource()
Construct a new SimpleHttpSource, given a host.
|
SimpleHttpSource(java.lang.String host)
Construct a new SimpleHttpSource, given a host.
|
SimpleHttpSource(java.lang.String host,
int port)
Construct a new SimpleHttpSource, given a host and a port connect to.
|
Modifier and Type | Method and Description |
---|---|
SimpleHttpSource |
ensureReady()
Ensure that the source is ready to take requests by sending http header requests to the source for up to 2
seconds.
|
SimpleHttpSource |
ensureReady(int timeoutInMillis)
Ensure that the source is ready to take requests by sending http header requests for up to the timeout specified
in millisecionds, sleeping 100 ms between attempts.
|
void |
postData(java.lang.String payload)
Make a HTTP POST request using the provided string in the http body.
|
void |
postFromFile(java.io.File file)
Generate a http request from the contents of a file
|
protected java.lang.String |
toDSL()
Returns a representation of the module suitable for inclusion in a stream definition, e.g.
file --dir=xxxx --name=yyyy |
label, toString
public SimpleHttpSource()
public SimpleHttpSource(java.lang.String host)
host
- the host to connect topublic SimpleHttpSource(java.lang.String host, int port)
host
- The host to connect toport
- The port to connect topublic SimpleHttpSource ensureReady()
java.lang.IllegalStateException
- if can't connect to the source within the given timeout.public SimpleHttpSource ensureReady(int timeoutInMillis)
timeoutInMillis
- java.lang.IllegalStateException
- if can't connect to the source within the given timeout.protected java.lang.String toDSL()
AbstractModuleFixture
file --dir=xxxx --name=yyyy
toDSL
in class AbstractModuleFixture<SimpleHttpSource>
public void postData(java.lang.String payload)
payload
- String to send in the http body.public void postFromFile(java.io.File file)
file
- the File that contains the data to postGeneratorException
- If there was an error related to file handling.