Remove deprecated code
Closes gh-387
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -33,7 +33,7 @@ public final class ManualRestDocumentation implements RestDocumentationContextPr
|
||||
|
||||
private final File outputDirectory;
|
||||
|
||||
private RestDocumentationContext context;
|
||||
private StandardRestDocumentationContext context;
|
||||
|
||||
/**
|
||||
* Creates a new {@code ManualRestDocumentation} instance that will generate snippets
|
||||
@@ -67,13 +67,12 @@ public final class ManualRestDocumentation implements RestDocumentationContextPr
|
||||
* @param testMethodName the name of the test method
|
||||
* @throws IllegalStateException if a context has already be created
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public void beforeTest(Class<?> testClass, String testMethodName) {
|
||||
if (this.context != null) {
|
||||
throw new IllegalStateException(
|
||||
"Context already exists. Did you forget to call afterTest()?");
|
||||
}
|
||||
this.context = new RestDocumentationContext(testClass, testMethodName,
|
||||
this.context = new StandardRestDocumentationContext(testClass, testMethodName,
|
||||
this.outputDirectory);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs;
|
||||
|
||||
import org.junit.rules.TestRule;
|
||||
import org.junit.runner.Description;
|
||||
import org.junit.runners.model.Statement;
|
||||
|
||||
/**
|
||||
* A JUnit {@link TestRule} used to bootstrap the generation of REST documentation from
|
||||
* JUnit tests.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @deprecated Since 1.1 in favor of {@link JUnitRestDocumentation}
|
||||
*/
|
||||
@Deprecated
|
||||
public class RestDocumentation implements TestRule, RestDocumentationContextProvider {
|
||||
|
||||
private final JUnitRestDocumentation delegate;
|
||||
|
||||
/**
|
||||
* Creates a new {@code RestDocumentation} instance that will generate snippets to the
|
||||
* to <gradle/maven build path>/generated-snippet.
|
||||
*/
|
||||
public RestDocumentation() {
|
||||
this.delegate = new JUnitRestDocumentation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code RestDocumentation} instance that will generate snippets to the
|
||||
* given {@code outputDirectory}.
|
||||
*
|
||||
* @param outputDirectory the output directory
|
||||
*/
|
||||
public RestDocumentation(String outputDirectory) {
|
||||
this.delegate = new JUnitRestDocumentation(outputDirectory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Statement apply(final Statement base, final Description description) {
|
||||
return this.delegate.apply(base, description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestDocumentationContext beforeOperation() {
|
||||
return this.delegate.beforeOperation();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -17,7 +17,6 @@
|
||||
package org.springframework.restdocs;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* {@code RestDocumentationContext} encapsulates the context in which the documentation of
|
||||
@@ -25,77 +24,34 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public final class RestDocumentationContext {
|
||||
|
||||
private final AtomicInteger stepCount = new AtomicInteger(0);
|
||||
|
||||
private final Class<?> testClass;
|
||||
|
||||
private final String testMethodName;
|
||||
|
||||
private final File outputDirectory;
|
||||
|
||||
/**
|
||||
* Creates a new {@code RestDocumentationContext} for a test on the given
|
||||
* {@code testClass} with given {@code testMethodName} that will generate
|
||||
* documentation to the given {@code outputDirectory}.
|
||||
*
|
||||
* @param testClass the class whose test is being executed
|
||||
* @param testMethodName the name of the test method that is being executed
|
||||
* @param outputDirectory the directory to which documentation should be written.
|
||||
* @deprecated Since 1.1 in favor of {@link ManualRestDocumentation}.
|
||||
*/
|
||||
@Deprecated
|
||||
public RestDocumentationContext(Class<?> testClass, String testMethodName,
|
||||
File outputDirectory) {
|
||||
this.testClass = testClass;
|
||||
this.testMethodName = testMethodName;
|
||||
this.outputDirectory = outputDirectory;
|
||||
}
|
||||
public interface RestDocumentationContext {
|
||||
|
||||
/**
|
||||
* Returns the class whose tests are currently executing.
|
||||
*
|
||||
* @return The test class
|
||||
*/
|
||||
public Class<?> getTestClass() {
|
||||
return this.testClass;
|
||||
}
|
||||
Class<?> getTestClass();
|
||||
|
||||
/**
|
||||
* Returns the name of the test method that is currently executing.
|
||||
*
|
||||
* @return The name of the test method
|
||||
*/
|
||||
public String getTestMethodName() {
|
||||
return this.testMethodName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current step count and then increments it.
|
||||
*
|
||||
* @return The step count prior to it being incremented
|
||||
*/
|
||||
int getAndIncrementStepCount() {
|
||||
return this.stepCount.getAndIncrement();
|
||||
}
|
||||
String getTestMethodName();
|
||||
|
||||
/**
|
||||
* Returns the current step count.
|
||||
*
|
||||
* @return The current step count
|
||||
*/
|
||||
public int getStepCount() {
|
||||
return this.stepCount.get();
|
||||
}
|
||||
int getStepCount();
|
||||
|
||||
/**
|
||||
* Returns the output directory to which generated snippets should be written.
|
||||
*
|
||||
* @return the output directory
|
||||
*/
|
||||
public File getOutputDirectory() {
|
||||
return this.outputDirectory;
|
||||
}
|
||||
File getOutputDirectory();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright 2014-2017 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* Standard implementation of {@link RestDocumentationContext}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
final class StandardRestDocumentationContext implements RestDocumentationContext {
|
||||
|
||||
private final AtomicInteger stepCount = new AtomicInteger(0);
|
||||
|
||||
private final Class<?> testClass;
|
||||
|
||||
private final String testMethodName;
|
||||
|
||||
private final File outputDirectory;
|
||||
|
||||
StandardRestDocumentationContext(Class<?> testClass, String testMethodName,
|
||||
File outputDirectory) {
|
||||
this.testClass = testClass;
|
||||
this.testMethodName = testMethodName;
|
||||
this.outputDirectory = outputDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getTestClass() {
|
||||
return this.testClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTestMethodName() {
|
||||
return this.testMethodName;
|
||||
}
|
||||
|
||||
int getAndIncrementStepCount() {
|
||||
return this.stepCount.getAndIncrement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStepCount() {
|
||||
return this.stepCount.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getOutputDirectory() {
|
||||
return this.outputDirectory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -50,16 +50,6 @@ public class CurlRequestSnippet extends TemplatedSnippet {
|
||||
|
||||
private final CommandFormatter commandFormatter;
|
||||
|
||||
/**
|
||||
* Creates a new {@code CurlRequestSnippet} with no additional attributes.
|
||||
*
|
||||
* @deprecated since 1.2.0 in favor of {@link #CurlRequestSnippet(CommandFormatter)}
|
||||
*/
|
||||
@Deprecated
|
||||
protected CurlRequestSnippet() {
|
||||
this(null, CliDocumentation.DEFAULT_COMMAND_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code CurlRequestSnippet} that will use the given
|
||||
* {@code commandFormatter} to format the curl command.
|
||||
@@ -70,19 +60,6 @@ public class CurlRequestSnippet extends TemplatedSnippet {
|
||||
this(null, commandFormatter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code CurlRequestSnippet} with the given additional
|
||||
* {@code attributes} that will be included in the model during template rendering.
|
||||
*
|
||||
* @param attributes The additional attributes
|
||||
* @deprecated since 1.2.0 in favor of
|
||||
* {@link #CurlRequestSnippet(Map, CommandFormatter)}
|
||||
*/
|
||||
@Deprecated
|
||||
protected CurlRequestSnippet(Map<String, Object> attributes) {
|
||||
this(attributes, CliDocumentation.DEFAULT_COMMAND_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code CurlRequestSnippet} with the given additional
|
||||
* {@code attributes} that will be included in the model during template rendering.
|
||||
|
||||
@@ -51,16 +51,6 @@ public class HttpieRequestSnippet extends TemplatedSnippet {
|
||||
|
||||
private final CommandFormatter commandFormatter;
|
||||
|
||||
/**
|
||||
* Creates a new {@code HttpieRequestSnippet} with no additional attributes.
|
||||
*
|
||||
* @deprecated since 1.2.0 in favor of {@link #HttpieRequestSnippet(CommandFormatter)}
|
||||
*/
|
||||
@Deprecated
|
||||
protected HttpieRequestSnippet() {
|
||||
this(null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code HttpieRequestSnippet} that will use the given
|
||||
* {@code commandFormatter} to format the HTTPie command.
|
||||
@@ -71,19 +61,6 @@ public class HttpieRequestSnippet extends TemplatedSnippet {
|
||||
this(null, commandFormatter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code HttpieRequestSnippet} with the given additional
|
||||
* {@code attributes} that will be included in the model during template rendering.
|
||||
*
|
||||
* @param attributes The additional attributes
|
||||
* @deprecated since 1.2.0 in favor of
|
||||
* {@link #HttpieRequestSnippet(Map, CommandFormatter)}
|
||||
*/
|
||||
@Deprecated
|
||||
protected HttpieRequestSnippet(Map<String, Object> attributes) {
|
||||
this(attributes, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code HttpieRequestSnippet} with the given additional
|
||||
* {@code attributes} that will be included in the model during template rendering.
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs.cli;
|
||||
|
||||
/**
|
||||
* A parser for the query string of a URI.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @deprecated since 1.1.2 in favor of
|
||||
* {@link org.springframework.restdocs.operation.QueryStringParser}
|
||||
*/
|
||||
@Deprecated
|
||||
public class QueryStringParser
|
||||
extends org.springframework.restdocs.operation.QueryStringParser {
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs.curl;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.restdocs.snippet.Snippet;
|
||||
|
||||
/**
|
||||
* Static factory methods for documenting a RESTful API as if it were being driven using
|
||||
* the cURL command-line utility.
|
||||
*
|
||||
* @deprecated Since 1.1 in favor of
|
||||
* {@link org.springframework.restdocs.cli.CliDocumentation}.
|
||||
* @author Andy Wilkinson
|
||||
* @author Yann Le Guern
|
||||
* @author Dmitriy Mayboroda
|
||||
* @author Jonathan Pearlin
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class CurlDocumentation {
|
||||
|
||||
private CurlDocumentation() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@code Snippet} that will document the curl request for the API
|
||||
* operation.
|
||||
*
|
||||
* @return the snippet that will document the curl request
|
||||
*
|
||||
* @deprecated Since 1.1 in favor of
|
||||
* {@link org.springframework.restdocs.cli.CliDocumentation#curlRequest()}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static Snippet curlRequest() {
|
||||
return new CurlRequestSnippet();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@code Snippet} that will document the curl request for the API
|
||||
* operation. The given {@code attributes} will be available during snippet
|
||||
* generation.
|
||||
*
|
||||
* @param attributes the attributes
|
||||
* @return the snippet that will document the curl request
|
||||
*
|
||||
* @deprecated Since 1.1 in favor of
|
||||
* {@link org.springframework.restdocs.cli.CliDocumentation#curlRequest(Map)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public static Snippet curlRequest(Map<String, Object> attributes) {
|
||||
return new CurlRequestSnippet(attributes);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.restdocs.curl;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.restdocs.snippet.Snippet;
|
||||
|
||||
/**
|
||||
* A {@link Snippet} that documents the curl command for a request.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Paul-Christian Volkmer
|
||||
* @author Raman Gupta
|
||||
* @deprecated Since 1.1 in favor of
|
||||
* {@link org.springframework.restdocs.cli.CurlRequestSnippet}.
|
||||
*/
|
||||
@Deprecated
|
||||
public class CurlRequestSnippet
|
||||
extends org.springframework.restdocs.cli.CurlRequestSnippet {
|
||||
|
||||
/**
|
||||
* Creates a new {@code CurlRequestSnippet} with no additional attributes.
|
||||
*
|
||||
* @deprecated Since 1.1 in favor of
|
||||
* {@link org.springframework.restdocs.cli.CurlRequestSnippet}.
|
||||
*/
|
||||
@Deprecated
|
||||
protected CurlRequestSnippet() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code CurlRequestSnippet} with additional attributes.
|
||||
* @param attributes The additional attributes.
|
||||
*
|
||||
* @deprecated Since 1.1 in favor of
|
||||
* {@link org.springframework.restdocs.cli.CurlRequestSnippet}.
|
||||
*/
|
||||
@Deprecated
|
||||
protected CurlRequestSnippet(final Map<String, Object> attributes) {
|
||||
super(attributes);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright 2014-2015 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Documenting the curl command required to make a request to a RESTful API.
|
||||
*
|
||||
* @deprecated Since 1.1 in favor of functionality in
|
||||
* {@code org.springframework.restdocs.cli}
|
||||
*/
|
||||
package org.springframework.restdocs.curl;
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -201,18 +201,6 @@ public final class RestDocumentationGenerator<REQ, RESP> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the given {@code snippets} such that they are documented when this handler is
|
||||
* called.
|
||||
*
|
||||
* @param snippets the snippets to add
|
||||
* @deprecated since 1.1 in favor of {@link #withSnippets(Snippet...)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void addSnippets(Snippet... snippets) {
|
||||
this.additionalSnippets.addAll(Arrays.asList(snippets));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@link RestDocumentationGenerator} with the same configuration as
|
||||
* this one other than its snippets. The new generator will use the given
|
||||
|
||||
@@ -47,24 +47,6 @@ public abstract class AbstractFieldsSnippet extends TemplatedSnippet {
|
||||
|
||||
private final PayloadSubsectionExtractor<?> subsectionExtractor;
|
||||
|
||||
/**
|
||||
* Creates a new {@code AbstractFieldsSnippet} that will produce a snippet named
|
||||
* {@code <type>-fields}. The fields will be documented using the given
|
||||
* {@code descriptors} and the given {@code attributes} will be included in the model
|
||||
* during template rendering. Undocumented fields will trigger a failure.
|
||||
*
|
||||
* @param type the type of the fields
|
||||
* @param descriptors the field descriptors
|
||||
* @param attributes the additional attributes
|
||||
* @deprecated since 1.1 in favor of
|
||||
* {@link #AbstractFieldsSnippet(String, List, Map, boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
protected AbstractFieldsSnippet(String type, List<FieldDescriptor> descriptors,
|
||||
Map<String, Object> attributes) {
|
||||
this(type, descriptors, attributes, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code AbstractFieldsSnippet} that will produce a snippet named
|
||||
* {@code <type>-fields} using a template named {@code <type>-fields}. The fields will
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -43,24 +43,6 @@ public abstract class AbstractParametersSnippet extends TemplatedSnippet {
|
||||
|
||||
private final boolean ignoreUndocumentedParameters;
|
||||
|
||||
/**
|
||||
* Creates a new {@code AbstractParametersSnippet} that will produce a snippet with
|
||||
* the given {@code snippetName} that will document parameters using the given
|
||||
* {@code descriptors}. The given {@code attributes} will be included in the model
|
||||
* during template rendering. Undocumented parameters will trigger a failure.
|
||||
*
|
||||
* @param snippetName The snippet name
|
||||
* @param descriptors The descriptors
|
||||
* @param attributes The additional attributes
|
||||
* @deprecated since 1.1 in favour of
|
||||
* {@link #AbstractParametersSnippet(String, List, Map, boolean)}
|
||||
*/
|
||||
@Deprecated
|
||||
protected AbstractParametersSnippet(String snippetName,
|
||||
List<ParameterDescriptor> descriptors, Map<String, Object> attributes) {
|
||||
this(snippetName, descriptors, attributes, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code AbstractParametersSnippet} that will produce a snippet with
|
||||
* the given {@code snippetName} that will document parameters using the given
|
||||
@@ -154,19 +136,6 @@ public abstract class AbstractParametersSnippet extends TemplatedSnippet {
|
||||
protected abstract void verificationFailed(Set<String> undocumentedParameters,
|
||||
Set<String> missingParameters);
|
||||
|
||||
/**
|
||||
* Returns a {@code Map} of {@link ParameterDescriptor ParameterDescriptors} that will
|
||||
* be used to generate the documentation key by their
|
||||
* {@link ParameterDescriptor#getName()}.
|
||||
*
|
||||
* @return the map of path descriptors
|
||||
* @deprecated since 1.1.0 in favor of {@link #getParameterDescriptors()}
|
||||
*/
|
||||
@Deprecated
|
||||
protected final Map<String, ParameterDescriptor> getFieldDescriptors() {
|
||||
return this.descriptorsByName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@code Map} of {@link ParameterDescriptor ParameterDescriptors} that will
|
||||
* be used to generate the documentation key by their
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -24,7 +24,6 @@ import java.io.Writer;
|
||||
|
||||
import org.springframework.restdocs.RestDocumentationContext;
|
||||
import org.springframework.restdocs.templates.TemplateFormat;
|
||||
import org.springframework.restdocs.templates.TemplateFormats;
|
||||
import org.springframework.util.PropertyPlaceholderHelper;
|
||||
import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver;
|
||||
|
||||
@@ -44,22 +43,6 @@ public final class StandardWriterResolver implements WriterResolver {
|
||||
|
||||
private TemplateFormat templateFormat;
|
||||
|
||||
/**
|
||||
* Creates a new {@code StandardWriterResolver} that will use the given
|
||||
* {@code placeholderResolver} to resolve any placeholders in the
|
||||
* {@code operationName}. Writers will use {@code UTF-8} encoding and, when writing to
|
||||
* a file, will use a filename appropriate for Asciidoctor content.
|
||||
*
|
||||
* @param placeholderResolver the placeholder resolver
|
||||
* @deprecated since 1.1.0 in favor of
|
||||
* {@link #StandardWriterResolver(PlaceholderResolverFactory, String, TemplateFormat)}
|
||||
*/
|
||||
@Deprecated
|
||||
public StandardWriterResolver(PlaceholderResolver placeholderResolver) {
|
||||
this(new SingleInstancePlaceholderResolverFactory(placeholderResolver), "UTF-8",
|
||||
TemplateFormats.asciidoctor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code StandardWriterResolver} that will use a
|
||||
* {@link PlaceholderResolver} created from the given
|
||||
@@ -97,12 +80,6 @@ public final class StandardWriterResolver implements WriterResolver {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public void setEncoding(String encoding) {
|
||||
this.encoding = encoding;
|
||||
}
|
||||
|
||||
File resolveFile(String outputDirectory, String fileName,
|
||||
RestDocumentationContext context) {
|
||||
File outputFile = new File(outputDirectory, fileName);
|
||||
@@ -129,21 +106,4 @@ public final class StandardWriterResolver implements WriterResolver {
|
||||
}
|
||||
}
|
||||
|
||||
private static final class SingleInstancePlaceholderResolverFactory
|
||||
implements PlaceholderResolverFactory {
|
||||
|
||||
private final PlaceholderResolver placeholderResolver;
|
||||
|
||||
private SingleInstancePlaceholderResolverFactory(
|
||||
PlaceholderResolver placeholderResolver) {
|
||||
this.placeholderResolver = placeholderResolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlaceholderResolver create(RestDocumentationContext context) {
|
||||
return this.placeholderResolver;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -42,15 +42,4 @@ public interface WriterResolver {
|
||||
Writer resolve(String operationName, String snippetName,
|
||||
RestDocumentationContext restDocumentationContext) throws IOException;
|
||||
|
||||
/**
|
||||
* Configures the encoding that should be used by any writers produced by this
|
||||
* resolver.
|
||||
*
|
||||
* @param encoding the encoding
|
||||
* @deprecated since 1.1.0 in favour of configuring the encoding when to resolver is
|
||||
* created
|
||||
*/
|
||||
@Deprecated
|
||||
void setEncoding(String encoding);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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,18 +41,6 @@ public class StandardTemplateResourceResolver implements TemplateResourceResolve
|
||||
|
||||
private final TemplateFormat templateFormat;
|
||||
|
||||
/**
|
||||
* Creates a new {@code StandardTemplateResourceResolver} that will produce default
|
||||
* template resources formatted with Asciidoctor.
|
||||
*
|
||||
* @deprecated since 1.1.0 in favour of
|
||||
* {@link #StandardTemplateResourceResolver(TemplateFormat)}
|
||||
*/
|
||||
@Deprecated
|
||||
public StandardTemplateResourceResolver() {
|
||||
this(TemplateFormats.asciidoctor());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code StandardTemplateResourceResolver} that will produce default
|
||||
* template resources formatted with the given {@code templateFormat}.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 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.
|
||||
@@ -107,26 +107,6 @@ public class RestDocumentationGeneratorTests {
|
||||
verifySnippetInvocation(defaultSnippet2, configuration);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Deprecated
|
||||
public void additionalSnippetsAreCalled() throws IOException {
|
||||
given(this.requestConverter.convert(this.request))
|
||||
.willReturn(this.operationRequest);
|
||||
given(this.responseConverter.convert(this.response))
|
||||
.willReturn(this.operationResponse);
|
||||
Snippet additionalSnippet1 = mock(Snippet.class);
|
||||
Snippet additionalSnippet2 = mock(Snippet.class);
|
||||
RestDocumentationGenerator<Object, Object> generator = new RestDocumentationGenerator<>(
|
||||
"id", this.requestConverter, this.responseConverter, this.snippet);
|
||||
generator.addSnippets(additionalSnippet1, additionalSnippet2);
|
||||
HashMap<String, Object> configuration = new HashMap<>();
|
||||
generator.handle(this.request, this.response, configuration);
|
||||
generator.handle(this.request, this.response, configuration);
|
||||
verifySnippetInvocation(this.snippet, configuration, 2);
|
||||
verifySnippetInvocation(additionalSnippet1, configuration);
|
||||
verifySnippetInvocation(additionalSnippet2, configuration);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void newGeneratorOnlyCallsItsSnippets() throws IOException {
|
||||
OperationRequestPreprocessor requestPreprocessor = mock(
|
||||
|
||||
Reference in New Issue
Block a user