Polish "Move UriModifyingOperationPreprocessor to core project"

Closes gh-493
This commit is contained in:
Andy Wilkinson
2018-03-28 11:38:10 +01:00
parent 37f313c766
commit e7d2d44a05
8 changed files with 35 additions and 16 deletions

View File

@@ -143,12 +143,13 @@ parameters.
[[customizing-requests-and-responses-preprocessors-modify-uris]]
==== Modifying URIs
TIP: If you are using MockMvc or WebTestclient, URIs should be customized by
<<configuration-uris, changing the configuration>>.
TIP: If you are using MockMvc or a WebTestClient that is not bound to a server,
URIs should be customized by <<configuration-uris, changing the configuration>>.
`modifyUris` on `RestAssuredPreprocessors` can be used to modify any URIs in a request
or a response. When using REST Assured, this allows you to customize the URIs that appear
in the documentation while testing a local instance of the service.
`modifyUris` on `Preprocessors` can be used to modify any URIs in a request
or a response. When using REST Assured or WebTestClient bound to a server, this
allows you to customize the URIs that appear in the documentation while testing a
local instance of the service.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -151,4 +151,15 @@ public final class Preprocessors {
return new ParametersModifyingOperationPreprocessor();
}
/**
* Returns a {@code UriModifyingOperationPreprocessor} that will modify URIs in the
* request or response by changing one or more of their host, scheme, and port.
*
* @return the preprocessor
* @since 2.0.1
*/
public static UriModifyingOperationPreprocessor modifyUris() {
return new UriModifyingOperationPreprocessor();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ import org.springframework.web.util.UriComponentsBuilder;
* </ul>
*
* @author Andy Wilkinson
* @since 1.2.0
* @since 2.0.1
*/
public class UriModifyingOperationPreprocessor implements OperationPreprocessor {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package org.springframework.restdocs.restassured3.operation.preprocess;
import org.springframework.restdocs.operation.Operation;
import org.springframework.restdocs.operation.OperationRequest;
import org.springframework.restdocs.operation.OperationResponse;
import org.springframework.restdocs.operation.preprocess.Preprocessors;
import org.springframework.restdocs.operation.preprocess.UriModifyingOperationPreprocessor;
/**
@@ -30,7 +31,10 @@ import org.springframework.restdocs.operation.preprocess.UriModifyingOperationPr
*
* @author Andy Wilkinson
* @since 1.1.0
* @deprecated since 2.0.1 in favor of {@link Preprocessors} and, specifically,
* {@link Preprocessors#modifyUris()}
*/
@Deprecated
public abstract class RestAssuredPreprocessors {
private RestAssuredPreprocessors() {
@@ -42,7 +46,9 @@ public abstract class RestAssuredPreprocessors {
* request or response by changing one or more of their host, scheme, and port.
*
* @return the preprocessor
* @deprecated since 2.0.1 in favor of {@link Preprocessors#modifyUris()}
*/
@Deprecated
public static UriModifyingOperationPreprocessor modifyUris() {
return new UriModifyingOperationPreprocessor();
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2017 the original author or authors.
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,9 +37,11 @@ import org.springframework.restdocs.operation.preprocess.OperationPreprocessor;
*
* @author Andy Wilkinson
* @since 1.2.0
* @deprecated use {@link org.springframework.restdocs.operation.preprocess.UriModifyingOperationPreprocessor} instead
* @deprecated since 2.0.1 in favor of
* {@link org.springframework.restdocs.operation.preprocess.UriModifyingOperationPreprocessor}
*/
@Deprecated
public class UriModifyingOperationPreprocessor extends org.springframework.restdocs.operation.preprocess.UriModifyingOperationPreprocessor {
public class UriModifyingOperationPreprocessor extends
org.springframework.restdocs.operation.preprocess.UriModifyingOperationPreprocessor {
}

View File

@@ -43,6 +43,7 @@ import static org.springframework.restdocs.headers.HeaderDocumentation.responseH
import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.linkWithRel;
import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.links;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.maskLinks;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.modifyUris;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
@@ -59,7 +60,6 @@ import static org.springframework.restdocs.request.RequestDocumentation.requestP
import static org.springframework.restdocs.request.RequestDocumentation.requestParts;
import static org.springframework.restdocs.restassured3.RestAssuredRestDocumentation.document;
import static org.springframework.restdocs.restassured3.RestAssuredRestDocumentation.documentationConfiguration;
import static org.springframework.restdocs.restassured3.operation.preprocess.RestAssuredPreprocessors.modifyUris;
import static org.springframework.restdocs.templates.TemplateFormats.asciidoctor;
import static org.springframework.restdocs.test.SnippetMatchers.codeBlock;
import static org.springframework.restdocs.test.SnippetMatchers.httpRequest;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2016 the original author or authors.
* Copyright 2014-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,6 @@ import static org.junit.Assert.assertThat;
* Tests for {@link UriModifyingOperationPreprocessor}.
*
* @author Andy Wilkinson
* @deprecated use {@link org.springframework.restdocs.operation.preprocess.UriModifyingOperationPreprocessorTests} instead
*/
@Deprecated
public class UriModifyingOperationPreprocessorTests {