use of org.apache.http.ProtocolVersion in project cdap-ingest by caskdata.
the class RestClientTest method testNotAllowedResponseCodeAnalysis.
@Test
public void testNotAllowedResponseCodeAnalysis() {
StatusLine statusLine = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), HttpStatus.SC_METHOD_NOT_ALLOWED, "Method Not Allowed");
when(response.getStatusLine()).thenReturn(statusLine);
TestUtils.verifyResponse(HttpStatus.SC_METHOD_NOT_ALLOWED, response);
verify(response, new VerificationMode() {
@Override
public void verify(VerificationData verificationData) {
Assert.assertEquals(2, verificationData.getAllInvocations().size());
}
}).getStatusLine();
}
use of org.apache.http.ProtocolVersion in project cdap-ingest by caskdata.
the class RestClientTest method testNotFoundResponseCodeAnalysis.
@Test
public void testNotFoundResponseCodeAnalysis() {
StatusLine statusLine = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), HttpStatus.SC_NOT_FOUND, "Not Found");
when(response.getStatusLine()).thenReturn(statusLine);
TestUtils.verifyResponse(HttpStatus.SC_NOT_FOUND, response);
verify(response).getStatusLine();
}
use of org.apache.http.ProtocolVersion in project cdap-ingest by caskdata.
the class RestClientTest method testForbiddenResponseCodeAnalysis.
@Test
public void testForbiddenResponseCodeAnalysis() {
StatusLine statusLine = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), HttpStatus.SC_FORBIDDEN, "Forbidden");
when(response.getStatusLine()).thenReturn(statusLine);
TestUtils.verifyResponse(HttpStatus.SC_FORBIDDEN, response);
verify(response).getStatusLine();
}
use of org.apache.http.ProtocolVersion in project cdap-ingest by caskdata.
the class RestClientTest method testNotImplementedResponseCodeAnalysis.
@Test
public void testNotImplementedResponseCodeAnalysis() {
StatusLine statusLine = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), HttpStatus.SC_NOT_IMPLEMENTED, "Not Implemented");
when(response.getStatusLine()).thenReturn(statusLine);
try {
RestClient.responseCodeAnalysis(response);
Assert.fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
}
verify(response).getStatusLine();
}
use of org.apache.http.ProtocolVersion in project cdap-ingest by caskdata.
the class RestClientTest method testOkResponseCodeAnalysis.
@Test
public void testOkResponseCodeAnalysis() {
StatusLine statusLine = new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), HttpStatus.SC_OK, "OK");
when(response.getStatusLine()).thenReturn(statusLine);
RestClient.responseCodeAnalysis(response);
verify(response).getStatusLine();
}
Aggregations