你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
HttpClientTests 类
- java.
lang. Object - com.
azure. core. test. http. HttpClientTests
- com.
public abstract class HttpClientTests
的 HttpClient通用测试套件。
字段摘要
修饰符和类型 | 字段和描述 |
---|---|
protected static final String | ECHO_RESPONSE |
构造函数摘要
构造函数 | 说明 | |
---|---|---|
HttpClientTests() |
方法摘要
方法继承自 java.lang.Object
字段详细信息
ECHO_RESPONSE
protected static final String ECHO_RESPONSE
构造函数详细信息
HttpClientTests
public HttpClientTests()
方法详细信息
createService
protected T
Parameters:
createService
protected T
Parameters:
asyncCompletableHeadRequest
public void asyncCompletableHeadRequest()
asyncDeleteRequest
public void asyncDeleteRequest()
asyncGetRequestWithAnything
public void asyncGetRequestWithAnything()
asyncGetRequestWithHeaderParametersAndAnything
public void asyncGetRequestWithHeaderParametersAndAnything()
asyncGetRequestWithNoReturn
public void asyncGetRequestWithNoReturn()
测试是否正确处理了没有返回类型的响应。
asyncGetRequestWithQueryParametersAndAnything
public void asyncGetRequestWithQueryParametersAndAnything()
asyncHeadBooleanRequest
public void asyncHeadBooleanRequest()
asyncHeadRequest
public void asyncHeadRequest()
asyncHeadersRequest
public void asyncHeadersRequest()
asyncHttpsHeadersRequest
public void asyncHttpsHeadersRequest()
asyncPatchRequest
public void asyncPatchRequest()
asyncPostRequestWithStringBody
public void asyncPostRequestWithStringBody()
asyncPutRequestWithBinaryDataBodyAndEqualContentLength
public void asyncPutRequestWithBinaryDataBodyAndEqualContentLength()
asyncPutRequestWithBinaryDataBodyAndLessThanContentLength
public void asyncPutRequestWithBinaryDataBodyAndLessThanContentLength()
asyncPutRequestWithBinaryDataBodyAndMoreThanContentLength
public void asyncPutRequestWithBinaryDataBodyAndMoreThanContentLength()
asyncPutRequestWithBodyAndEqualContentLength
public void asyncPutRequestWithBodyAndEqualContentLength()
asyncPutRequestWithBodyAndLessThanContentLength
public void asyncPutRequestWithBodyAndLessThanContentLength()
asyncPutRequestWithBodyAndMoreThanContentLength
public void asyncPutRequestWithBodyAndMoreThanContentLength()
asyncPutRequestWithIntBody
public void asyncPutRequestWithIntBody()
asyncPutRequestWithStreamBinaryDataBodyAndLessThanContentLength
public void asyncPutRequestWithStreamBinaryDataBodyAndLessThanContentLength()
rest 代理中的 LengthValidatingInputStream 依赖于访问 EOF 的读取器。 此测试专门针对 InputStream 来断言此行为。
asyncPutRequestWithStreamBinaryDataBodyAndMoreThanContentLength
public void asyncPutRequestWithStreamBinaryDataBodyAndMoreThanContentLength()
rest 代理中的 LengthValidatingInputStream 依赖于访问 EOF 的读取器。 此测试专门针对 InputStream 来断言此行为。
asyncPutRequestWithUnexpectedResponse
public void asyncPutRequestWithUnexpectedResponse()
asyncPutRequestWithUnexpectedResponseAndDeterminedExceptionType
public void asyncPutRequestWithUnexpectedResponseAndDeterminedExceptionType()
asyncPutRequestWithUnexpectedResponseAndExceptionType
public void asyncPutRequestWithUnexpectedResponseAndExceptionType()
asyncPutRequestWithUnexpectedResponseAndFallthroughExceptionType
public void asyncPutRequestWithUnexpectedResponseAndFallthroughExceptionType()
asyncPutRequestWithUnexpectedResponseAndNoFallthroughExceptionType
public void asyncPutRequestWithUnexpectedResponseAndNoFallthroughExceptionType()
asyncRequestWithByteArrayReturnType
public void asyncRequestWithByteArrayReturnType()
测试响应正文是否以字节数组的形式正确返回。
asyncRequestWithByteArrayReturnTypeAndParameterizedHostAndPath
public void asyncRequestWithByteArrayReturnTypeAndParameterizedHostAndPath()
测试响应正文是否以字节数组的形式正确返回。
asyncRequestWithMultipleHostParams
public void asyncRequestWithMultipleHostParams()
binaryDataUploadTest
bomWithDifferentHeader
public void bomWithDifferentHeader()
测试具有字节顺序标记和“Content-Type”标头的响应是否遵循使用 BOM 编码。
bomWithSameHeader
public void bomWithSameHeader()
测试具有字节顺序标记和“Content-Type”标头的响应是否遵循使用 BOM 编码。
bufferedResponseCanBeReadMultipleTimes
public void bufferedResponseCanBeReadMultipleTimes()
测试缓冲响应确实已缓冲,即内容可以多次访问。
Throws:
canAccessResponseBody
canSendBinaryData
public void canSendBinaryData(BinaryData requestBody, byte[] expectedResponseBody)
将各种形式的随机字节发送到终结点的测试,该终结点将字节回显给发送方。
Parameters:
canSendBinaryDataSync
public void canSendBinaryDataSync(BinaryData requestBody, byte[] expectedResponseBody)
将各种形式的随机字节发送到终结点的测试,该终结点将字节回显给发送方。
Parameters:
canSendBinaryDataWithProgressReporting
public void canSendBinaryDataWithProgressReporting(BinaryData requestBody, byte[] expectedResponseBody)
将各种形式的随机字节发送到终结点的测试,该终结点将字节回显给发送方。
Parameters:
canSendBinaryDataWithProgressReportingSync
public void canSendBinaryDataWithProgressReportingSync(BinaryData requestBody, byte[] expectedResponseBody)
将各种形式的随机字节发送到终结点的测试,该终结点将字节回显给发送方。
Parameters:
createHttpClient
protected abstract HttpClient createHttpClient()
获取将用于每个测试的 HTTP 客户端。 这将在每个测试中调用一次。
Returns:
downloadTestArgumentProvider
public static Stream
eagerlyConvertedHeadersAreHttpHeaders
public void eagerlyConvertedHeadersAreHttpHeaders()
已完成将实现 HTTP 标头转换为 azure 核心 HttpHeaders 的测试。
fluxUploadTest
getByteArrayAsyncWithNoExpectedResponses
public void getByteArrayAsyncWithNoExpectedResponses()
测试响应正文是否正确返回为字节数组。
getPort
getRequestUrl
protected URL getRequestUrl(String requestPath)
获取给定路径的请求 URL。
Parameters:
Returns:
getServerUri
protected abstract String getServerUri(boolean secure)
获取服务器用于正确路由请求的动态 URI。
Parameters:
Returns:
headerResponse
public void headerResponse()
测试具有“Content-Type”标头的响应使用指定的字符集进行编码。
invalidHeaderResponse
public void invalidHeaderResponse()
使用 UTF-8 测试包含无效或不受支持的字符集的“Content-Type”的响应是否编码。
isSecure
protected boolean isSecure()
获取一个标志,指示是否应保护通信 (https 或 http) 。
Returns:
plainResponse
public void plainResponse()
测试没有字节顺序标记或“Content-Type”标头的响应是否使用 UTF-8 进行编码。
postUrlForm
public void postUrlForm()
postUrlFormEncoded
public void postUrlFormEncoded()
rawFluxDownloadTest
public void rawFluxDownloadTest()
requestOptionsAddAHeader
public void requestOptionsAddAHeader()
requestOptionsChangesBody
public void requestOptionsChangesBody()
requestOptionsChangesBodyAndContentLength
public void requestOptionsChangesBodyAndContentLength()
requestOptionsSetsAHeader
public void requestOptionsSetsAHeader()
segmentUploadTest
service16Put
public void service16Put()
service16PutAsync
public void service16PutAsync()
service18GetStatus200
public void service18GetStatus200()
service18GetStatus200WithExpectedResponse200
public void service18GetStatus200WithExpectedResponse200()
service18GetStatus300
public void service18GetStatus300()
service18GetStatus300WithExpectedResponse300
public void service18GetStatus300WithExpectedResponse300()
service18GetStatus400
public void service18GetStatus400()
service18GetStatus400WithExpectedResponse400
public void service18GetStatus400WithExpectedResponse400()
service18GetStatus500
public void service18GetStatus500()
service18GetStatus500WithExpectedResponse500
public void service18GetStatus500WithExpectedResponse500()
service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithEmptyBody
public void service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithEmptyBody()
service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithNonEmptyBody
public void service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithNonEmptyBody()
service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithNullBody
public void service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithNullBody()
service19PutWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBodyWithEmptyBody
public void service19PutWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBodyWithEmptyBody()
service19PutWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBodyWithNonEmptyBody
public void service19PutWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBodyWithNonEmptyBody()
service19PutWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBodyWithNullBody
public void service19PutWithBodyParamApplicationJsonContentTypeAndCharsetAndStringBodyWithNullBody()
service19PutWithBodyParamApplicationJsonContentTypeAndStringBodyWithEmptyBody
public void service19PutWithBodyParamApplicationJsonContentTypeAndStringBodyWithEmptyBody()
service19PutWithBodyParamApplicationJsonContentTypeAndStringBodyWithNonEmptyBody
public void service19PutWithBodyParamApplicationJsonContentTypeAndStringBodyWithNonEmptyBody()
service19PutWithBodyParamApplicationJsonContentTypeAndStringBodyWithNullBody
public void service19PutWithBodyParamApplicationJsonContentTypeAndStringBodyWithNullBody()
service19PutWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBodyWithEmptyBody
public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBodyWithEmptyBody()
service19PutWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBodyWithNonEmptyBody
public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBodyWithNonEmptyBody()
service19PutWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBodyWithNullBody
public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndByteArrayBodyWithNullBody()
service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithEmptyBody
public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithEmptyBody()
service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithNonEmptyBody
public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithNonEmptyBody()
service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithNullBody
public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithNullBody()
service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithEmptyBody
public void service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithEmptyBody()
service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithNonEmptyBody
public void service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithNonEmptyBody()
service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithNullBody
public void service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithNullBody()
service19PutWithHeaderApplicationJsonContentTypeAndCharsetAndStringBodyWithEmptyBody
public void service19PutWithHeaderApplicationJsonContentTypeAndCharsetAndStringBodyWithEmptyBody()
service19PutWithHeaderApplicationJsonContentTypeAndCharsetAndStringBodyWithNonEmptyBody
public void service19PutWithHeaderApplicationJsonContentTypeAndCharsetAndStringBodyWithNonEmptyBody()
service19PutWithHeaderApplicationJsonContentTypeAndCharsetAndStringBodyWithNullBody
public void service19PutWithHeaderApplicationJsonContentTypeAndCharsetAndStringBodyWithNullBody()
service19PutWithHeaderApplicationJsonContentTypeAndStringBodyWithEmptyBody
public void service19PutWithHeaderApplicationJsonContentTypeAndStringBodyWithEmptyBody()
service19PutWithHeaderApplicationJsonContentTypeAndStringBodyWithNonEmptyBody
public void service19PutWithHeaderApplicationJsonContentTypeAndStringBodyWithNonEmptyBody()
service19PutWithHeaderApplicationJsonContentTypeAndStringBodyWithNullBody
public void service19PutWithHeaderApplicationJsonContentTypeAndStringBodyWithNullBody()
service19PutWithHeaderApplicationOctetStreamContentTypeAndByteArrayBodyWithEmptyBody
public void service19PutWithHeaderApplicationOctetStreamContentTypeAndByteArrayBodyWithEmptyBody()
service19PutWithHeaderApplicationOctetStreamContentTypeAndByteArrayBodyWithNonEmptyBody
public void service19PutWithHeaderApplicationOctetStreamContentTypeAndByteArrayBodyWithNonEmptyBody()
service19PutWithHeaderApplicationOctetStreamContentTypeAndByteArrayBodyWithNullBody
public void service19PutWithHeaderApplicationOctetStreamContentTypeAndByteArrayBodyWithNullBody()
service19PutWithHeaderApplicationOctetStreamContentTypeAndStringBodyWithEmptyBody
public void service19PutWithHeaderApplicationOctetStreamContentTypeAndStringBodyWithEmptyBody()
service19PutWithHeaderApplicationOctetStreamContentTypeAndStringBodyWithNonEmptyBody
public void service19PutWithHeaderApplicationOctetStreamContentTypeAndStringBodyWithNonEmptyBody()
service19PutWithHeaderApplicationOctetStreamContentTypeAndStringBodyWithNullBody
public void service19PutWithHeaderApplicationOctetStreamContentTypeAndStringBodyWithNullBody()
service19PutWithNoContentTypeAndByteArrayBodyWithEmptyBody
public void service19PutWithNoContentTypeAndByteArrayBodyWithEmptyBody()
service19PutWithNoContentTypeAndByteArrayBodyWithNonEmptyBody
public void service19PutWithNoContentTypeAndByteArrayBodyWithNonEmptyBody()
service19PutWithNoContentTypeAndByteArrayBodyWithNullBody
public void service19PutWithNoContentTypeAndByteArrayBodyWithNullBody()
service19PutWithNoContentTypeAndStringBodyWithEmptyBody
public void service19PutWithNoContentTypeAndStringBodyWithEmptyBody()
service19PutWithNoContentTypeAndStringBodyWithNonEmptyBody
public void service19PutWithNoContentTypeAndStringBodyWithNonEmptyBody()
service19PutWithNoContentTypeAndStringBodyWithNullBody
public void service19PutWithNoContentTypeAndStringBodyWithNullBody()
service20GetBytes100BodyAndHeaders
public void service20GetBytes100BodyAndHeaders()
service20GetBytes100OnlyHeaders
public void service20GetBytes100OnlyHeaders()
service20GetBytesOnlyHeaders
public void service20GetBytesOnlyHeaders()
service20GetBytesOnlyStatus
public void service20GetBytesOnlyStatus()
service20GetResponseBody
public void service20GetResponseBody()
service20GetVoidResponse
public void service20GetVoidResponse()
service20PutBodyAndHeaders
public void service20PutBodyAndHeaders()
service20PutOnlyHeaders
public void service20PutOnlyHeaders()
service21GetBytes100
public void service21GetBytes100()
service22GetBytes
public void service22GetBytes()
service23GetBytes
public void service23GetBytes()
service24Put
public void service24Put()
shouldBufferResponse
public void shouldBufferResponse()
测试客户端在通过 azure-eagerly-read-response 上下文标志请求时返回缓冲响应。
simpleDownloadTest
public void simpleDownloadTest(Context context)
Parameters:
simpleDownloadTestAsync
public void simpleDownloadTestAsync(Context context)
Parameters:
streamResponseCanTransferBody
streamResponseCanTransferBodyAsync
public void streamResponseCanTransferBodyAsync(Context context)
Parameters:
Throws:
syncDeleteRequest
public void syncDeleteRequest()
syncGetRequestWithAnything
public void syncGetRequestWithAnything()
syncGetRequestWithAnythingWithEncodedPathParam
public void syncGetRequestWithAnythingWithEncodedPathParam()
syncGetRequestWithAnythingWithEncodedPathParamWithPercent20
public void syncGetRequestWithAnythingWithEncodedPathParamWithPercent20()
syncGetRequestWithAnythingWithEncodedPathParamWithPlus
public void syncGetRequestWithAnythingWithEncodedPathParamWithPlus()
syncGetRequestWithAnythingWithPathParam
public void syncGetRequestWithAnythingWithPathParam()
syncGetRequestWithAnythingWithPathParamWithPlus
public void syncGetRequestWithAnythingWithPathParamWithPlus()
syncGetRequestWithAnythingWithPathParamWithSpace
public void syncGetRequestWithAnythingWithPathParamWithSpace()
syncGetRequestWithAnythingWithPlus
public void syncGetRequestWithAnythingWithPlus()
syncGetRequestWithHeaderParametersAndAnythingReturn
public void syncGetRequestWithHeaderParametersAndAnythingReturn()
syncGetRequestWithNoReturn
public void syncGetRequestWithNoReturn()
测试是否正确处理了没有返回类型的响应。
syncGetRequestWithNullHeader
public void syncGetRequestWithNullHeader()
syncGetRequestWithNullQueryParameter
public void syncGetRequestWithNullQueryParameter()
syncGetRequestWithQueryParametersAndAnything
public void syncGetRequestWithQueryParametersAndAnything()
syncGetRequestWithQueryParametersAndAnythingWithEncodedWithPercent20
public void syncGetRequestWithQueryParametersAndAnythingWithEncodedWithPercent20()
syncGetRequestWithQueryParametersAndAnythingWithPercent20
public void syncGetRequestWithQueryParametersAndAnythingWithPercent20()
syncHeadBooleanRequest
public void syncHeadBooleanRequest()
syncHeadRequest
public void syncHeadRequest()
syncHeadersRequest
public void syncHeadersRequest()
syncPatchRequest
public void syncPatchRequest()
syncPostRequestWithNullBody
public void syncPostRequestWithNullBody()
syncPostRequestWithStringBody
public void syncPostRequestWithStringBody()
syncPutRequestWithBodyAndEqualContentLength
public void syncPutRequestWithBodyAndEqualContentLength()
syncPutRequestWithBodyLessThanContentLength
public void syncPutRequestWithBodyLessThanContentLength()
syncPutRequestWithBodyMoreThanContentLength
public void syncPutRequestWithBodyMoreThanContentLength()
syncPutRequestWithIntBody
public void syncPutRequestWithIntBody()
syncPutRequestWithUnexpectedResponse
public void syncPutRequestWithUnexpectedResponse()
syncPutRequestWithUnexpectedResponseAndDeterminedExceptionType
public void syncPutRequestWithUnexpectedResponseAndDeterminedExceptionType()
syncPutRequestWithUnexpectedResponseAndExceptionType
public void syncPutRequestWithUnexpectedResponseAndExceptionType()
syncPutRequestWithUnexpectedResponseAndFallthroughExceptionType
public void syncPutRequestWithUnexpectedResponseAndFallthroughExceptionType()
syncPutRequestWithUnexpectedResponseAndNoFallthroughExceptionType
public void syncPutRequestWithUnexpectedResponseAndNoFallthroughExceptionType()
syncRequestWithByteArrayReturnType
public void syncRequestWithByteArrayReturnType()
测试响应正文是否正确返回为字节数组。
syncRequestWithByteArrayReturnTypeAndParameterizedHostAndPath
public void syncRequestWithByteArrayReturnTypeAndParameterizedHostAndPath()
测试响应正文是否正确返回为字节数组。
syncRequestWithEmptyByteArrayReturnTypeAndParameterizedHostAndPath
public void syncRequestWithEmptyByteArrayReturnTypeAndParameterizedHostAndPath()
测试响应正文是否正确返回为字节数组。
syncRequestWithMultipleHostParams
public void syncRequestWithMultipleHostParams()
syncVoidHeadRequest
public void syncVoidHeadRequest()
unexpectedHTTPOK
public void unexpectedHTTPOK()
utf16BeBomResponse
public void utf16BeBomResponse()
测试具有字节顺序标记的响应使用指定的字符集进行编码。
utf16LeBomResponse
public void utf16LeBomResponse()
测试具有字节顺序标记的响应使用指定的字符集进行编码。
utf32BeBomResponse
public void utf32BeBomResponse()
测试具有字节顺序标记的响应使用指定的字符集进行编码。
utf32LeBomResponse
public void utf32LeBomResponse()
测试具有字节顺序标记的响应使用指定的字符集进行编码。
utf8BomResponse
public void utf8BomResponse()
测试具有字节顺序标记的响应使用指定的字符集进行编码。
voidDoesNotEagerlyReadResponse
public void voidDoesNotEagerlyReadResponse(BiConsumer
Parameters:
voidErrorReturnsErrorBody
public void voidErrorReturnsErrorBody(BiConsumer
Parameters: