Package com.consol.citrus.condition
Class HttpCondition
- java.lang.Object
-
- com.consol.citrus.condition.AbstractCondition
-
- com.consol.citrus.condition.HttpCondition
-
- All Implemented Interfaces:
com.consol.citrus.condition.Condition
public class HttpCondition extends AbstractCondition
Tests if a HTTP Endpoint is reachable. The test is successful if the endpoint responds with the expected response code. By default a HTTP 200 response code is expected.- Since:
- 2.4
- Author:
- Martin Maher
-
-
Constructor Summary
Constructors Constructor Description HttpCondition()
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getErrorMessage(com.consol.citrus.context.TestContext context)
String
getHttpResponseCode()
String
getMethod()
String
getSuccessMessage(com.consol.citrus.context.TestContext context)
String
getTimeout()
String
getUrl()
boolean
isSatisfied(com.consol.citrus.context.TestContext context)
protected HttpURLConnection
openConnection(URL url)
Open Http url connection.void
setHttpResponseCode(String httpResponseCode)
void
setMethod(String method)
void
setTimeout(String timeout)
void
setUrl(String url)
String
toString()
-
Methods inherited from class com.consol.citrus.condition.AbstractCondition
getName
-
-
-
-
Method Detail
-
isSatisfied
public boolean isSatisfied(com.consol.citrus.context.TestContext context)
-
getSuccessMessage
public String getSuccessMessage(com.consol.citrus.context.TestContext context)
-
getErrorMessage
public String getErrorMessage(com.consol.citrus.context.TestContext context)
-
openConnection
protected HttpURLConnection openConnection(URL url) throws IOException
Open Http url connection.- Parameters:
url
- The url to open- Returns:
- The opened connection
- Throws:
IOException
-
getUrl
public String getUrl()
-
setUrl
public void setUrl(String url)
-
getMethod
public String getMethod()
-
setMethod
public void setMethod(String method)
-
getTimeout
public String getTimeout()
-
setTimeout
public void setTimeout(String timeout)
-
getHttpResponseCode
public String getHttpResponseCode()
-
setHttpResponseCode
public void setHttpResponseCode(String httpResponseCode)
-
-