TestProxyRecordPolicy Class

  • java.lang.Object
    • com.azure.core.test.policy.TestProxyRecordPolicy

Implements

public class TestProxyRecordPolicy
implements HttpPipelinePolicy

A HttpPipelinePolicy for redirecting traffic through the test proxy for recording.

Field Summary

Modifier and Type Field and Description
static final String RECORD_MODE

Constructor Summary

Constructor Description
TestProxyRecordPolicy(HttpClient httpClient, boolean skipRecordingRequestBody)

Create an instance of TestProxyRecordPolicy with a list of custom sanitizers.

Method Summary

Modifier and Type Method and Description
void addProxySanitization(List<TestProxySanitizer> sanitizers)

Add a list of TestProxySanitizer to the current recording session.

Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)
HttpResponse processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next)
void removeProxySanitization(List<String> sanitizers)

Removes the list of sanitizers from the current playback session.

void setRecordingOptions(TestProxyRecordingOptions testProxyRecordingOptions)

Set transport layer test proxy recording options

void startRecording(File recordFile, Path testClassPath)

Starts a recording of test traffic.

void stopRecording(Queue<String> variables)

Stops recording of test traffic.

Methods inherited from java.lang.Object

Field Details

RECORD_MODE

public static final String RECORD_MODE

Constructor Details

TestProxyRecordPolicy

public TestProxyRecordPolicy(HttpClient httpClient, boolean skipRecordingRequestBody)

Create an instance of TestProxyRecordPolicy with a list of custom sanitizers.

Parameters:

httpClient - The HttpClient to use. If none is passed HttpURLConnectionHttpClient is the default.
skipRecordingRequestBody - Flag indicating to skip recording request bodies when tests run in Record mode.

Method Details

addProxySanitization

public void addProxySanitization(List sanitizers)

Add a list of TestProxySanitizer to the current recording session.

Parameters:

sanitizers - The sanitizers to add.

process

public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)

Parameters:

context
next

processSync

public HttpResponse processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next)

Parameters:

context
next

removeProxySanitization

public void removeProxySanitization(List sanitizers)

Removes the list of sanitizers from the current playback session.

Parameters:

sanitizers - The sanitizers to remove.

setRecordingOptions

public void setRecordingOptions(TestProxyRecordingOptions testProxyRecordingOptions)

Set transport layer test proxy recording options

Parameters:

testProxyRecordingOptions - the transport layer test proxy recording options to set

startRecording

public void startRecording(File recordFile, Path testClassPath)

Starts a recording of test traffic.

Parameters:

recordFile - The name of the file to save the recording to.
testClassPath - the test class path

stopRecording

public void stopRecording(Queue variables)

Stops recording of test traffic.

Parameters:

variables - A list of random variables generated during the test which is saved in the recording.

Applies to