TestProxyUtils Class
- java.
lang. Object - com.
azure. core. test. utils. TestProxyUtils
- com.
public class TestProxyUtils
Utility functions for interaction with the test proxy.
Field Summary
Modifier and Type | Field and Description |
---|---|
static final String | HOST_NAME_REGEX |
Constructor Summary
Constructor | Description | |
---|---|---|
TestProxyUtils() |
Method Summary
Modifier and Type | Method and Description |
---|---|
static void |
changeHeaders(HttpRequest request, URL proxyUrl, String xRecordingId, String mode, boolean skipRecordingRequestBody)
Adds headers required for communication with the test proxy. |
static void |
checkForTestProxyErrors(HttpResponse httpResponse)
Checks the return from a request through the test proxy for special error headers. |
static
Http |
createAddSanitizersRequest(List<TestProxySanitizer> sanitizers, URL proxyUrl)
Creates a request to bulk add sanitizers to the test proxy server. |
static String |
getAssetJsonFile(File recordFile, Path testClassPath)
Get the assets json file path if it exists. |
static
List<Http |
getMatcherRequests(List<TestProxyRequestMatcher> matchers, URL proxyUrl)
Creates a List of HttpRequest to be sent to the test proxy to register matchers. |
static String |
getProxyProcessName()
Gets the process name of the test proxy binary. |
static URL |
getProxyUrl()
Gets the current URL for the test proxy. |
static
Http |
getRemoveSanitizerRequest()
Creates a request to remove sanitizers from the request. |
static
List<Http |
getSanitizerRequests(List<TestProxySanitizer> sanitizers, URL proxyUrl)
Deprecated
Use createAddSanitizersRequest(List<TestProxySanitizer> sanitizers, URL proxyUrl) instead as this will create a bulk Http
Creates a list of sanitizer requests to be sent to the test proxy server. |
static String |
getTestProxyVersion(Path testClassPath)
Finds the test proxy version in the source tree. |
static
List<Test |
loadSanitizers()
Registers the default set of sanitizers for sanitizing request and responses |
static
Http |
resetTestProxyData(HttpResponse response)
Sets the response URL back to the original URL before returning it through the pipeline. |
static
Http |
setCompareBodiesMatcher()
Set comparing bodies to false when running in playback and Record |
Methods inherited from java.lang.Object
Field Details
HOST_NAME_REGEX
public static final String HOST_NAME_REGEX
Constructor Details
TestProxyUtils
public TestProxyUtils()
Method Details
changeHeaders
public static void changeHeaders(HttpRequest request, URL proxyUrl, String xRecordingId, String mode, boolean skipRecordingRequestBody)
Adds headers required for communication with the test proxy.
Parameters:
checkForTestProxyErrors
public static void checkForTestProxyErrors(HttpResponse httpResponse)
Checks the return from a request through the test proxy for special error headers.
Parameters:
createAddSanitizersRequest
public static HttpRequest createAddSanitizersRequest(List
Creates a request to bulk add sanitizers to the test proxy server.
For more information about adding bulk sanitizers see the Passing Sanitizers in Bulk wiki.
Parameters:
Returns:
getAssetJsonFile
public static String getAssetJsonFile(File recordFile, Path testClassPath)
Get the assets json file path if it exists.
Parameters:
Returns:
getMatcherRequests
public static List
Creates a List of HttpRequest to be sent to the test proxy to register matchers.
Parameters:
Returns:
getProxyProcessName
public static String getProxyProcessName()
Gets the process name of the test proxy binary.
Returns:
getProxyUrl
public static URL getProxyUrl()
Gets the current URL for the test proxy.
Returns:
getRemoveSanitizerRequest
public static HttpRequest getRemoveSanitizerRequest()
Creates a request to remove sanitizers from the request.
Returns:
getSanitizerRequests
@Deprecated
public static List
Deprecated
Creates a list of sanitizer requests to be sent to the test proxy server.
Parameters:
Returns:
getTestProxyVersion
public static String getTestProxyVersion(Path testClassPath)
Finds the test proxy version in the source tree.
Parameters:
Returns:
loadSanitizers
public static List
Registers the default set of sanitizers for sanitizing request and responses
Returns:
resetTestProxyData
public static HttpResponse resetTestProxyData(HttpResponse response)
Sets the response URL back to the original URL before returning it through the pipeline.
Parameters:
Returns:
setCompareBodiesMatcher
public static HttpRequest setCompareBodiesMatcher()
Set comparing bodies to false when running in playback and RecordWithoutRequestBody is set for the test.
Returns:
Applies to
Azure SDK for Java