Removed most of deprecations; fixes gh-1570

This commit is contained in:
Marcin Grzejszczak
2020-11-26 12:58:36 +01:00
parent 1deb643be5
commit d8f6e17af5
49 changed files with 32 additions and 2906 deletions

View File

@@ -5,9 +5,6 @@ buildscript {
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/release" }
maven { url 'https://repo.spring.io/plugins-snapshot' }
maven { url "https://repo.spring.io/plugins-release-local" }
maven { url "https://repo.spring.io/plugins-staging-local/" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${findProperty('bootVersion') ?: bootVersion}"

View File

@@ -52,15 +52,6 @@ public class BodyMatchers {
this.matchers.add(new PathBodyMatcher(xPath, matchingTypeValue));
}
/**
* @deprecated use{@link #matchers()}
* @return json path matchers
*/
@Deprecated
public List<BodyMatcher> jsonPathMatchers() {
return matchers();
}
public boolean hasMatchers() {
return !this.matchers.isEmpty();
}

View File

@@ -433,653 +433,4 @@ public final class HttpHeaders {
*/
public static final String WWW_AUTHENTICATE = "WWW-Authenticate";
/**
* @return The HTTP {@code Accept} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.3.2">Section 5.3.2 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.ACCEPT}.
*/
@Deprecated
public String accept() {
return ACCEPT;
}
/**
* @return The HTTP {@code Accept-Charset} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.3.3">Section 5.3.3 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.ACCEPT_CHARSET}.
*/
@Deprecated
public String acceptCharset() {
return ACCEPT_CHARSET;
}
/**
* @return The HTTP {@code Accept-Encoding} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.3.4">Section 5.3.4 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.ACCEPT_ENCODING}.
*/
@Deprecated
public String acceptEncoding() {
return ACCEPT_ENCODING;
}
/**
* @return The HTTP {@code Accept-Language} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.3.5">Section 5.3.5 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.ACCEPT_LANGUAGE}.
*/
@Deprecated
public String acceptLanguage() {
return ACCEPT_LANGUAGE;
}
/**
* @return The HTTP {@code Accept-Ranges} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7233#section-2.3">Section 5.3.5 of RFC
* 7233</a>
* @deprecated Replaced by {@code HttpHeaders.ACCEPT_RANGES}.
*/
@Deprecated
public String acceptRanges() {
return ACCEPT_RANGES;
}
/**
* @return The CORS {@code Access-Control-Allow-Credentials} response header field
* name.
* @see <a href="https://www.w3.org/TR/cors/">CORS W3C recommendation</a>
* @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS}.
*/
@Deprecated
public String accessControlAllowCredentials() {
return ACCESS_CONTROL_ALLOW_CREDENTIALS;
}
/**
* @return The CORS {@code Access-Control-Allow-Headers} response header field name.
* @see <a href="https://www.w3.org/TR/cors/">CORS W3C recommendation</a>
* @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS}.
*/
@Deprecated
public String accessControlAllowHeaders() {
return ACCESS_CONTROL_ALLOW_HEADERS;
}
/**
* @return The CORS {@code Access-Control-Allow-Methods} response header field name.
* @see <a href="https://www.w3.org/TR/cors/">CORS W3C recommendation</a>
* @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS}.
*/
@Deprecated
public String accessControlAllowMethods() {
return ACCESS_CONTROL_ALLOW_METHODS;
}
/**
* @return The CORS {@code Access-Control-Allow-Origin} response header field name.
* @see <a href="https://www.w3.org/TR/cors/">CORS W3C recommendation</a>
* @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN}.
*/
@Deprecated
public String accessControlAllowOrigin() {
return ACCESS_CONTROL_ALLOW_ORIGIN;
}
/**
* @return The CORS {@code Access-Control-Expose-Headers} response header field name.
* @see <a href="https://www.w3.org/TR/cors/">CORS W3C recommendation</a>
* @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS}.
*/
@Deprecated
public String accessControlExposeHeaders() {
return ACCESS_CONTROL_EXPOSE_HEADERS;
}
/**
* @return The CORS {@code Access-Control-Max-Age} response header field name.
* @see <a href="https://www.w3.org/TR/cors/">CORS W3C recommendation</a>
* @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_MAX_AGE}.
*/
@Deprecated
public String accessControlMaxAge() {
return ACCESS_CONTROL_MAX_AGE;
}
/**
* @return The CORS {@code Access-Control-Request-Headers} request header field name.
* @see <a href="https://www.w3.org/TR/cors/">CORS W3C recommendation</a>
* @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS}.
*/
@Deprecated
public String accessControlRequestHeaders() {
return ACCESS_CONTROL_REQUEST_HEADERS;
}
/**
* @return The CORS {@code Access-Control-Request-Method} request header field name.
* @see <a href="https://www.w3.org/TR/cors/">CORS W3C recommendation</a>
* @deprecated Replaced by {@code HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD}.
*/
@Deprecated
public String accessControlRequestMethod() {
return ACCESS_CONTROL_REQUEST_METHOD;
}
/**
* @return The HTTP {@code Age} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.1">Section 5.1 of RFC
* 7234</a>
* @deprecated Replaced by {@code HttpHeaders.AGE}.
*/
@Deprecated
public String age() {
return AGE;
}
/**
* @return The HTTP {@code Allow} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.4.1">Section 7.4.1 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.ALLOW}.
*/
@Deprecated
public String allow() {
return ALLOW;
}
/**
* @return The HTTP {@code Authorization} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7235#section-4.2">Section 4.2 of RFC
* 7235</a>
* @deprecated Replaced by {@code HttpHeaders.AUTHORIZATION}.
*/
@Deprecated
public String authorization() {
return AUTHORIZATION;
}
/**
* @return The HTTP {@code Cache-Control} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.2">Section 5.2 of RFC
* 7234</a>
* @deprecated Replaced by {@code HttpHeaders.CACHE_CONTROL}.
*/
@Deprecated
public String cacheControl() {
return CACHE_CONTROL;
}
/**
* @return The HTTP {@code Connection} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7230#section-6.1">Section 6.1 of RFC
* 7230</a>
* @deprecated Replaced by {@code HttpHeaders.CONNECTION}.
*/
@Deprecated
public String connection() {
return CONNECTION;
}
/**
* @return The HTTP {@code Content-Encoding} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-3.1.2.2">Section 3.1.2.2
* of RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.CONTENT_ENCODING}.
*/
@Deprecated
public String contentEncoding() {
return CONTENT_ENCODING;
}
/**
* @return The HTTP {@code Content-Disposition} header field name
* @see <a href="https://tools.ietf.org/html/rfc6266">RFC 6266</a>
* @deprecated Replaced by {@code HttpHeaders.CONTENT_DISPOSITION}.
*/
@Deprecated
public String contentDisposition() {
return CONTENT_DISPOSITION;
}
/**
* @return The HTTP {@code Content-Language} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-3.1.3.2">Section 3.1.3.2
* of RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.CONTENT_LANGUAGE}.
*/
@Deprecated
public String contentLanguage() {
return CONTENT_LANGUAGE;
}
/**
* @return The HTTP {@code Content-Length} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7230#section-3.3.2">Section 3.3.2 of
* RFC 7230</a>
* @deprecated Replaced by {@code HttpHeaders.CONTENT_LENGTH}.
*/
@Deprecated
public String contentLength() {
return CONTENT_LENGTH;
}
/**
* @return The HTTP {@code Content-Location} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-3.1.4.2">Section 3.1.4.2
* of RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.CONTENT_LOCATION}.
*/
@Deprecated
public String contentLocation() {
return CONTENT_LOCATION;
}
/**
* @return The HTTP {@code Content-Range} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7233#section-4.2">Section 4.2 of RFC
* 7233</a>
* @deprecated Replaced by {@code HttpHeaders.CONTENT_RANGE}.
*/
@Deprecated
public String contentRange() {
return CONTENT_RANGE;
}
/**
* @return The HTTP {@code Content-Type} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-3.1.1.5">Section 3.1.1.5
* of RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.CONTENT_TYPE}.
*/
@Deprecated
public String contentType() {
return CONTENT_TYPE;
}
/**
* @return The HTTP {@code Cookie} header field name.
* @see <a href="https://tools.ietf.org/html/rfc2109#section-4.3.4">Section 4.3.4 of
* RFC 2109</a>
* @deprecated Replaced by {@code HttpHeaders.COOKIE}.
*/
@Deprecated
public String cookie() {
return COOKIE;
}
/**
* @return The HTTP {@code Date} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.1.2">Section 7.1.1.2
* of RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.DATE}.
*/
@Deprecated
public String date() {
return DATE;
}
/**
* @return The HTTP {@code ETag} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7232#section-2.3">Section 2.3 of RFC
* 7232</a>
* @deprecated Replaced by {@code HttpHeaders.ETAG}.
*/
@Deprecated
public String etag() {
return ETAG;
}
/**
* @return The HTTP {@code Expect} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.1.1">Section 5.1.1 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.EXPECT}.
*/
@Deprecated
public String expect() {
return EXPECT;
}
/**
* @return The HTTP {@code Expires} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.3">Section 5.3 of RFC
* 7234</a>
* @deprecated Replaced by {@code HttpHeaders.EXPIRES}.
*/
@Deprecated
public String expires() {
return EXPIRES;
}
/**
* @return The HTTP {@code From} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.5.1">Section 5.5.1 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.FROM}.
*/
@Deprecated
public String from() {
return FROM;
}
/**
* @return The HTTP {@code Host} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7230#section-5.4">Section 5.4 of RFC
* 7230</a>
* @deprecated Replaced by {@code HttpHeaders.HOST}.
*/
@Deprecated
public String host() {
return HOST;
}
/**
* @return The HTTP {@code If-Match} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7232#section-3.1">Section 3.1 of RFC
* 7232</a>
* @deprecated Replaced by {@code HttpHeaders.IF_MATCH}.
*/
@Deprecated
public String ifMatch() {
return IF_MATCH;
}
/**
* @return The HTTP {@code If-Modified-Since} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7232#section-3.3">Section 3.3 of RFC
* 7232</a>
* @deprecated Replaced by {@code HttpHeaders.IF_MODIFIED_SINCE}.
*/
@Deprecated
public String ifModifiedSince() {
return IF_MODIFIED_SINCE;
}
/**
* @return The HTTP {@code If-None-Match} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7232#section-3.2">Section 3.2 of RFC
* 7232</a>
* @deprecated Replaced by {@code HttpHeaders.IF_NONE_MATCH}.
*/
@Deprecated
public String ifNoneMatch() {
return IF_NONE_MATCH;
}
/**
* @return The HTTP {@code If-Range} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7233#section-3.2">Section 3.2 of RFC
* 7233</a>
* @deprecated Replaced by {@code HttpHeaders.IF_RANGE}.
*/
@Deprecated
public String ifRange() {
return IF_RANGE;
}
/**
* @return The HTTP {@code If-Unmodified-Since} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7232#section-3.4">Section 3.4 of RFC
* 7232</a>
* @deprecated Replaced by {@code HttpHeaders.IF_UNMODIFIED_SINCE}.
*/
@Deprecated
public String ifUnmodifiedSince() {
return IF_UNMODIFIED_SINCE;
}
/**
* @return The HTTP {@code Last-Modified} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7232#section-2.2">Section 2.2 of RFC
* 7232</a>
* @deprecated Replaced by {@code HttpHeaders.LAST_MODIFIED}.
*/
@Deprecated
public String lastModified() {
return LAST_MODIFIED;
}
/**
* @return The HTTP {@code Link} header field name.
* @see <a href="https://tools.ietf.org/html/rfc5988">RFC 5988</a>
* @deprecated Replaced by {@code HttpHeaders.LINK}.
*/
@Deprecated
public String link() {
return LINK;
}
/**
* @return The HTTP {@code Location} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.2">Section 7.1.2 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.LOCATION}.
*/
@Deprecated
public String location() {
return LOCATION;
}
/**
* @return The HTTP {@code Max-Forwards} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.1.2">Section 5.1.2 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.MAX_FORWARDS}.
*/
@Deprecated
public String max_forwards() {
return MAX_FORWARDS;
}
/**
* @return The HTTP {@code Origin} header field name.
* @see <a href="https://tools.ietf.org/html/rfc6454">RFC 6454</a>
* @deprecated Replaced by {@code HttpHeaders.ORIGIN}.
*/
@Deprecated
public String origin() {
return ORIGIN;
}
/**
* @return The HTTP {@code Pragma} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.4">Section 5.4 of RFC
* 7234</a>
* @deprecated Replaced by {@code HttpHeaders.PRAGMA}.
*/
@Deprecated
public String pragma() {
return PRAGMA;
}
/**
* @return The HTTP {@code Proxy-Authenticate} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7235#section-4.3">Section 4.3 of RFC
* 7235</a>
* @deprecated Replaced by {@code HttpHeaders.PROXY_AUTHENTICATE}.
*/
@Deprecated
public String proxyAuthenticate() {
return PROXY_AUTHENTICATE;
}
/**
* @return The HTTP {@code Proxy-Authorization} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7235#section-4.4">Section 4.4 of RFC
* 7235</a>
* @deprecated Replaced by {@code HttpHeaders.PROXY_AUTHORIZATION}.
*/
@Deprecated
public String proxyAuthorization() {
return PROXY_AUTHORIZATION;
}
/**
* @return The HTTP {@code Range} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7233#section-3.1">Section 3.1 of RFC
* 7233</a>
* @deprecated Replaced by {@code HttpHeaders.RANGE}.
*/
@Deprecated
public String range() {
return RANGE;
}
/**
* @return The HTTP {@code Referer} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.5.2">Section 5.5.2 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.REFERER}.
*/
@Deprecated
public String referer() {
return REFERER;
}
/**
* @return The HTTP {@code Retry-After} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.3">Section 7.1.3 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.RETRY_AFTER}.
*/
@Deprecated
public String retryAfter() {
return RETRY_AFTER;
}
/**
* @return The HTTP {@code Server} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.4.2">Section 7.4.2 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.server}.
*/
@Deprecated
public String server() {
return SERVER;
}
/**
* @return The HTTP {@code Set-Cookie} header field name.
* @see <a href="https://tools.ietf.org/html/rfc2109#section-4.2.2">Section 4.2.2 of
* RFC 2109</a>
* @deprecated Replaced by {@code HttpHeaders.SET_COOKIE}.
*/
@Deprecated
public String setCookie() {
return SET_COOKIE;
}
/**
* @return The HTTP {@code Set-Cookie2} header field name.
* @see <a href="https://tools.ietf.org/html/rfc2965">RFC 2965</a>
* @deprecated Replaced by {@code HttpHeaders.SET_COOKIE_2}.
*/
@Deprecated
public String setCookie2() {
return SET_COOKIE_2;
}
/**
* @return The HTTP {@code TE} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7230#section-4.3">Section 4.3 of RFC
* 7230</a>
* @deprecated Replaced by {@code HttpHeaders.TE}.
*/
@Deprecated
public String te() {
return TE;
}
/**
* @return The HTTP {@code Trailer} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7230#section-4.4">Section 4.4 of RFC
* 7230</a>
* @deprecated Replaced by {@code HttpHeaders.TRAILER}.
*/
@Deprecated
public String trailer() {
return TRAILER;
}
/**
* @return The HTTP {@code Transfer-Encoding} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7230#section-3.3.1">Section 3.3.1 of
* RFC 7230</a>
* @deprecated Replaced by {@code HttpHeaders.TRANSFER_ENCODING}.
*/
@Deprecated
public String transferEncoding() {
return TRANSFER_ENCODING;
}
/**
* @return The HTTP {@code Upgrade} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7230#section-6.7">Section 6.7 of RFC
* 7230</a>
* @deprecated Replaced by {@code HttpHeaders.UPGRADE}.
*/
@Deprecated
public String upgrade() {
return UPGRADE;
}
/**
* @return The HTTP {@code User-Agent} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-5.5.3">Section 5.5.3 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.USER_AGENT}.
*/
@Deprecated
public String user_agent() {
return USER_AGENT;
}
/**
* @return The HTTP {@code Vary} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-7.1.4">Section 7.1.4 of
* RFC 7231</a>
* @deprecated Replaced by {@code HttpHeaders.VARY}.
*/
@Deprecated
public String vary() {
return VARY;
}
/**
* @return The HTTP {@code Via} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7230#section-5.7.1">Section 5.7.1 of
* RFC 7230</a>
* @deprecated Replaced by {@code HttpHeaders.VIA}.
*/
@Deprecated
public String via() {
return VIA;
}
/**
* @return The HTTP {@code Warning} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7234#section-5.5">Section 5.5 of RFC
* 7234</a>
* @deprecated Replaced by {@code HttpHeaders.WARNING}.
*/
@Deprecated
public String warning() {
return WARNING;
}
/**
* @return The HTTP {@code WWW-Authenticate} header field name.
* @see <a href="https://tools.ietf.org/html/rfc7235#section-4.1">Section 4.1 of RFC
* 7235</a>
* @deprecated Replaced by {@code HttpHeaders.WWW_AUTHENTICATE}.
*/
@Deprecated
public String wwwAuthenticate() {
return WWW_AUTHENTICATE;
}
}

View File

@@ -74,78 +74,6 @@ public final class HttpMethods {
*/
public static String TRACE = "TRACE";
/**
* @return {@code GET}.
* @deprecated Replaced by {@code HttpMethods.GET}.
*/
@Deprecated
public HttpMethod GET() {
return HttpMethod.GET;
}
/**
* @return {@code HEAD}.
* @deprecated Replaced by {@code HttpMethods.HEAD}.
*/
@Deprecated
public HttpMethod HEAD() {
return HttpMethod.HEAD;
}
/**
* @return {@code POST}.
* @deprecated Replaced by {@code HttpMethods.POST}.
*/
@Deprecated
public HttpMethod POST() {
return HttpMethod.POST;
}
/**
* @return {@code PUT}.
* @deprecated Replaced by {@code HttpMethods.PUT}.
*/
@Deprecated
public HttpMethod PUT() {
return HttpMethod.PUT;
}
/**
* @return {@code PATCH}.
* @deprecated Replaced by {@code HttpMethods.PATCH}.
*/
@Deprecated
public HttpMethod PATCH() {
return HttpMethod.PATCH;
}
/**
* @return {@code DELETE}.
* @deprecated Replaced by {@code HttpMethods.DELETE}.
*/
@Deprecated
public HttpMethod DELETE() {
return HttpMethod.DELETE;
}
/**
* @return {@code OPTIONS}.
* @deprecated Replaced by {@code HttpMethods.OPTIONS}.
*/
@Deprecated
public HttpMethod OPTIONS() {
return HttpMethod.OPTIONS;
}
/**
* @return {@code TRACE}.
* @deprecated Replaced by {@code HttpMethods.TRACE}.
*/
@Deprecated
public HttpMethod TRACE() {
return HttpMethod.TRACE;
}
public enum HttpMethod {
GET(HttpMethods.GET), HEAD(HttpMethods.HEAD), POST(HttpMethods.POST), PUT(HttpMethods.PUT), PATCH(

View File

@@ -151,15 +151,6 @@ public final class HttpStatus {
*/
public static final int FOUND = 302;
/**
* The HTTP {@code 302 Moved Temporarily} status code.
* @see <a href="https://tools.ietf.org/html/rfc1945#section-9.3">HTTP/1.0, section
* 9.3</a>
* @deprecated in favor of {@link #FOUND} which will be returned from
*/
@Deprecated
public static final int MOVED_TEMPORARILY = 302;
/**
* The HTTP {@code 303 See Other} status code.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.4.4">HTTP/1.1:
@@ -174,15 +165,6 @@ public final class HttpStatus {
*/
public static final int NOT_MODIFIED = 304;
/**
* The HTTP {@code 305 Use Proxy} status code.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.4.5">HTTP/1.1:
* Semantics and Content, section 6.4.5</a>
* @deprecated due to security concerns regarding in-band configuration of a proxy
*/
@Deprecated
public static final int USE_PROXY = 305;
/**
* The HTTP {@code 307 Temporary Redirect} status code.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.4.7">HTTP/1.1:
@@ -294,15 +276,6 @@ public final class HttpStatus {
*/
public static final int PAYLOAD_TOO_LARGE = 413;
/**
* The HTTP {@code 413 Request Entity Too Large} status code.
* @see <a href="https://tools.ietf.org/html/rfc2616#section-10.4.14">HTTP/1.1,
* section 10.4.14</a>
* @deprecated in favor of {@link #PAYLOAD_TOO_LARGE} which will be returned from
*/
@Deprecated
public static final int REQUEST_ENTITY_TOO_LARGE = 413;
/**
* The HTTP {@code 414 URI Too Long} status code.
* @since 4.1* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.12" >
@@ -310,15 +283,6 @@ public final class HttpStatus {
*/
public static final int URI_TOO_LONG = 414;
/**
* The HTTP {@code 414 Request-URI Too Long} status code.
* @see <a href="https://tools.ietf.org/html/rfc2616#section-10.4.15">HTTP/1.1,
* section 10.4.15</a>
* @deprecated in favor of {@link #URI_TOO_LONG} which will be returned from
*/
@Deprecated
public static final int REQUEST_URI_TOO_LONG = 414;
/**
* The HTTP {@code 415 Unsupported Media Type} status code.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.13">HTTP/1.1:
@@ -346,33 +310,6 @@ public final class HttpStatus {
*/
public static final int I_AM_A_TEAPOT = 418;
/**
* The HTTP {@code 419 Insufficient Space} status code.
* @deprecated See <a href=
* "https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt">WebDAV
* Draft Changes</a>
*/
@Deprecated
public static final int INSUFFICIENT_SPACE_ON_RESOURCE = 419;
/**
* The HTTP {@code 420 Method Failure} status code.
* @deprecated See <a href=
* "https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt">WebDAV
* Draft Changes</a>
*/
@Deprecated
public static final int METHOD_FAILURE = 420;
/**
* The HTTP {@code 421 Destination Locked} status code.
* @deprecated See <a href=
* "https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt">WebDAV
* Draft Changes</a>
*/
@Deprecated
public static final int DESTINATION_LOCKED = 421;
/**
* The HTTP {@code 422 Unprocessable Entity} status code.
* @see <a href="https://tools.ietf.org/html/rfc4918#section-11.2">WebDAV</a>
@@ -508,732 +445,4 @@ public final class HttpStatus {
*/
public static final int NETWORK_AUTHENTICATION_REQUIRED = 511;
/**
* @return {@code 100 Continue}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.2.1">HTTP/1.1:
* Semantics and Content, section 6.2.1</a>
* @deprecated Replaced by {@code HttpStatus.CONTINUE}.
*/
@Deprecated
public int CONTINUE() {
return HttpStatus.CONTINUE;
}
/**
* @return {@code 101 Switching Protocols}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.2.2">HTTP/1.1:
* Semantics and Content, section 6.2.2</a>
* @deprecated Replaced by {@code HttpStatus.SWITCHING_PROTOCOLS}.
*/
@Deprecated
public int SWITCHING_PROTOCOLS() {
return HttpStatus.SWITCHING_PROTOCOLS;
}
/**
* @return {@code 102 Processing}.
* @see <a href="https://tools.ietf.org/html/rfc2518#section-10.1">WebDAV</a>
* @deprecated Replaced by {@code HttpStatus.PROCESSING}.
*/
@Deprecated
public int PROCESSING() {
return HttpStatus.PROCESSING;
}
/**
* @return {@code 103 Checkpoint}.
* @see <a href="https://code.google.com/p/gears/wiki/ResumableHttpRequestsProposal" >
* A proposal for supporting resumable POST/PUT HTTP requests in HTTP/1.0</a>
* @deprecated Replaced by {@code HttpStatus.CHECKPOINT}.
*/
@Deprecated
public int CHECKPOINT() {
return HttpStatus.CHECKPOINT;
}
/**
* @return {@code 200 OK}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.3.1">HTTP/1.1:
* Semantics and Content, section 6.3.1</a>
* @deprecated Replaced by {@code HttpStatus.OK}.
*/
@Deprecated
public int OK() {
return HttpStatus.OK;
}
/**
* @return {@code 201 Created}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.3.2">HTTP/1.1:
* Semantics and Content, section 6.3.2</a>
* @deprecated Replaced by {@code HttpStatus.CREATED}.
*/
@Deprecated
public int CREATED() {
return HttpStatus.CREATED;
}
/**
* @return {@code 202 Accepted}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.3.3">HTTP/1.1:
* Semantics and Content, section 6.3.3</a>
* @deprecated Replaced by {@code HttpStatus.ACCEPTED}.
*/
@Deprecated
public int ACCEPTED() {
return HttpStatus.ACCEPTED;
}
/**
* @return {@code 203 Non-Authoritative Information}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.3.4">HTTP/1.1:
* Semantics and Content, section 6.3.4</a>
* @deprecated Replaced by {@code HttpStatus.NON_AUTHORITATIVE_INFORMATION}.
*/
@Deprecated
public int NON_AUTHORITATIVE_INFORMATION() {
return HttpStatus.NON_AUTHORITATIVE_INFORMATION;
}
/**
* @return {@code 204 No Content}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.3.5">HTTP/1.1:
* Semantics and Content, section 6.3.5</a>
* @deprecated Replaced by {@code HttpStatus.NO_CONTENT}.
*/
@Deprecated
public int NO_CONTENT() {
return HttpStatus.NO_CONTENT;
}
/**
* @return {@code 205 Reset Content}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.3.6">HTTP/1.1:
* Semantics and Content, section 6.3.6</a>
* @deprecated Replaced by {@code HttpStatus.RESET_CONTENT}.
*/
@Deprecated
public int RESET_CONTENT() {
return HttpStatus.RESET_CONTENT;
}
/**
* @return {@code 206 Partial Content}.
* @see <a href="https://tools.ietf.org/html/rfc7233#section-4.1">HTTP/1.1: Range
* Requests, section 4.1</a>
* @deprecated Replaced by {@code HttpStatus.PARTIAL_CONTENT}.
*/
@Deprecated
public int PARTIAL_CONTENT() {
return HttpStatus.PARTIAL_CONTENT;
}
/**
* @return {@code 207 Multi-Status}.
* @see <a href="https://tools.ietf.org/html/rfc4918#section-13">WebDAV</a>
* @deprecated Replaced by {@code HttpStatus.MULTI_STATUS}.
*/
@Deprecated
public int MULTI_STATUS() {
return HttpStatus.MULTI_STATUS;
}
/**
* @return {@code 208 Already Reported}.
* @see <a href="https://tools.ietf.org/html/rfc5842#section-7.1">WebDAV Binding
* Extensions</a>
* @deprecated Replaced by {@code HttpStatus.ALREADY_REPORTED}.
*/
@Deprecated
public int ALREADY_REPORTED() {
return HttpStatus.ALREADY_REPORTED;
}
/**
* @return {@code 226 IM Used}.
* @see <a href="https://tools.ietf.org/html/rfc3229#section-10.4.1">Delta encoding in
* HTTP</a>
* @deprecated Replaced by {@code HttpStatus.IM_USED}.
*/
@Deprecated
public int IM_USED() {
return HttpStatus.IM_USED;
}
/**
* @return {@code 300 Multiple Choices}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.4.1">HTTP/1.1:
* Semantics and Content, section 6.4.1</a>
* @deprecated Replaced by {@code HttpStatus.MULTIPLE_CHOICES}.
*/
@Deprecated
public int MULTIPLE_CHOICES() {
return HttpStatus.MULTIPLE_CHOICES;
}
/**
* @return {@code 301 Moved Permanently}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.4.2">HTTP/1.1:
* Semantics and Content, section 6.4.2</a>
* @deprecated Replaced by {@code HttpStatus.MOVED_PERMANENTLY}.
*/
@Deprecated
public int MOVED_PERMANENTLY() {
return HttpStatus.MOVED_PERMANENTLY;
}
/**
* @return {@code 302 Found}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.4.3">HTTP/1.1:
* Semantics and Content, section 6.4.3</a>
* @deprecated Replaced by {@code HttpStatus.FOUND}.
*/
@Deprecated
public int FOUND() {
return HttpStatus.FOUND;
}
/**
* @return {@code 302 Moved Temporarily}.
* @see <a href="https://tools.ietf.org/html/rfc1945#section-9.3">HTTP/1.0, section
* 9.3</a>
* @deprecated in favor of {@link #FOUND} which will be returned from
*/
@Deprecated
public int MOVED_TEMPORARILY() {
return HttpStatus.MOVED_TEMPORARILY;
}
/**
* @return {@code 303 See Other}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.4.4">HTTP/1.1:
* Semantics and Content, section 6.4.4</a>
* @deprecated Replaced by {@code HttpStatus.SEE_OTHER}.
*/
@Deprecated
public int SEE_OTHER() {
return HttpStatus.SEE_OTHER;
}
/**
* @return {@code 304 Not Modified}.
* @see <a href="https://tools.ietf.org/html/rfc7232#section-4.1">HTTP/1.1:
* Conditional Requests, section 4.1</a>
* @deprecated Replaced by {@code HttpStatus.NOT_MODIFIED}.
*/
@Deprecated
public int NOT_MODIFIED() {
return HttpStatus.NOT_MODIFIED;
}
/**
* @return {@code 305 Use Proxy}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.4.5">HTTP/1.1:
* Semantics and Content, section 6.4.5</a>
* @deprecated due to security concerns regarding in-band configuration of a proxy
*/
@Deprecated
public int USE_PROXY() {
return HttpStatus.USE_PROXY;
}
/**
* @return {@code 307 Temporary Redirect}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.4.7">HTTP/1.1:
* Semantics and Content, section 6.4.7</a>
* @deprecated Replaced by {@code HttpStatus.TEMPORARY_REDIRECT}.
*/
@Deprecated
public int TEMPORARY_REDIRECT() {
return HttpStatus.TEMPORARY_REDIRECT;
}
/**
* @return {@code 308 Permanent Redirect}.
* @see <a href="https://tools.ietf.org/html/rfc7238">RFC 7238</a>
* @deprecated Replaced by {@code HttpStatus.PERMANENT_REDIRECT}.
*/
@Deprecated
public int PERMANENT_REDIRECT() {
return HttpStatus.PERMANENT_REDIRECT;
}
/**
* @return {@code 400 Bad Request}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.1">HTTP/1.1:
* Semantics and Content, section 6.5.1</a>
* @deprecated Replaced by {@code HttpStatus.BAD_REQUEST}.
*/
@Deprecated
public int BAD_REQUEST() {
return HttpStatus.BAD_REQUEST;
}
/**
* @return {@code 401 Unauthorized}.
* @see <a href="https://tools.ietf.org/html/rfc7235#section-3.1">HTTP/1.1:
* Authentication, section 3.1</a>
* @deprecated Replaced by {@code HttpStatus.UNAUTHORIZED}.
*/
@Deprecated
public int UNAUTHORIZED() {
return HttpStatus.UNAUTHORIZED;
}
/**
* @return {@code 402 Payment Required}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.2">HTTP/1.1:
* Semantics and Content, section 6.5.2</a>
* @deprecated Replaced by {@code HttpStatus.PAYMENT_REQUIRED}.
*/
@Deprecated
public int PAYMENT_REQUIRED() {
return HttpStatus.PAYMENT_REQUIRED;
}
/**
* @return {@code 403 Forbidden}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.3">HTTP/1.1:
* Semantics and Content, section 6.5.3</a>
* @deprecated Replaced by {@code HttpStatus.FORBIDDEN}.
*/
@Deprecated
public int FORBIDDEN() {
return HttpStatus.FORBIDDEN;
}
/**
* @return {@code 404 Not Found}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.4">HTTP/1.1:
* Semantics and Content, section 6.5.4</a>
* @deprecated Replaced by {@code HttpStatus.NOT_FOUND}.
*/
@Deprecated
public int NOT_FOUND() {
return HttpStatus.NOT_FOUND;
}
/**
* @return {@code 405 Method Not Allowed}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.5">HTTP/1.1:
* Semantics and Content, section 6.5.5</a>
* @deprecated Replaced by {@code HttpStatus.METHOD_NOT_ALLOWED}.
*/
@Deprecated
public int METHOD_NOT_ALLOWED() {
return HttpStatus.METHOD_NOT_ALLOWED;
}
/**
* @return {@code 406 Not Acceptable}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.6">HTTP/1.1:
* Semantics and Content, section 6.5.6</a>
* @deprecated Replaced by {@code HttpStatus.NOT_ACCEPTABLE}.
*/
@Deprecated
public int NOT_ACCEPTABLE() {
return HttpStatus.NOT_ACCEPTABLE;
}
/**
* @return {@code 407 Proxy Authentication Required}.
* @see <a href="https://tools.ietf.org/html/rfc7235#section-3.2">HTTP/1.1:
* Authentication, section 3.2</a>
* @deprecated Replaced by {@code HttpStatus.PROXY_AUTHENTICATION_REQUIRED}.
*/
@Deprecated
public int PROXY_AUTHENTICATION_REQUIRED() {
return HttpStatus.PROXY_AUTHENTICATION_REQUIRED;
}
/**
* @return {@code 408 Request Timeout}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.7">HTTP/1.1:
* Semantics and Content, section 6.5.7</a>
* @deprecated Replaced by {@code HttpStatus.REQUEST_TIMEOUT}.
*/
@Deprecated
public int REQUEST_TIMEOUT() {
return HttpStatus.REQUEST_TIMEOUT;
}
/**
* @return {@code 409 Conflict}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.8">HTTP/1.1:
* Semantics and Content, section 6.5.8</a>
* @deprecated Replaced by {@code HttpStatus.CONFLICT}.
*/
@Deprecated
public int CONFLICT() {
return HttpStatus.CONFLICT;
}
/**
* @return {@code 410 Gone}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.9">HTTP/1.1:
* Semantics and Content, section 6.5.9</a>
* @deprecated Replaced by {@code HttpStatus.GONE}.
*/
@Deprecated
public int GONE() {
return HttpStatus.GONE;
}
/**
* @return {@code 411 Length Required}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.10">HTTP/1.1:
* Semantics and Content, section 6.5.10</a>
* @deprecated Replaced by {@code HttpStatus.LENGTH_REQUIRED}.
*/
@Deprecated
public int LENGTH_REQUIRED() {
return HttpStatus.LENGTH_REQUIRED;
}
/**
* @return {@code 412 Precondition failed}.
* @see <a href="https://tools.ietf.org/html/rfc7232#section-4.2">HTTP/1.1:
* Conditional Requests, section 4.2</a>
* @deprecated Replaced by {@code HttpStatus.PRECONDITION_FAILED}.
*/
@Deprecated
public int PRECONDITION_FAILED() {
return HttpStatus.PRECONDITION_FAILED;
}
/**
* @return {@code 413 Payload Too Large}.
* @since 4.1* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.11" >
* HTTP/1.1: Semantics and Content, section 6.5.11</a>
* @deprecated Replaced by {@code HttpStatus.PAYLOAD_TOO_LARGE}.
*/
@Deprecated
public int PAYLOAD_TOO_LARGE() {
return HttpStatus.PAYLOAD_TOO_LARGE;
}
/**
* @return {@code 413 Request Entity Too Large}.
* @see <a href="https://tools.ietf.org/html/rfc2616#section-10.4.14">HTTP/1.1,
* section 10.4.14</a>
* @deprecated in favor of {@link #PAYLOAD_TOO_LARGE} which will be returned from
*/
@Deprecated
public int REQUEST_ENTITY_TOO_LARGE() {
return HttpStatus.REQUEST_ENTITY_TOO_LARGE;
}
/**
* @return {@code 414 URI Too Long}.
* @since 4.1* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.12" >
* HTTP/1.1: Semantics and Content, section 6.5.12</a>
* @deprecated Replaced by {@code HttpStatus.URI_TOO_LONG}.
*/
@Deprecated
public int URI_TOO_LONG() {
return HttpStatus.URI_TOO_LONG;
}
/**
* @return {@code 414 Request-URI Too Long}.
* @see <a href="https://tools.ietf.org/html/rfc2616#section-10.4.15">HTTP/1.1,
* section 10.4.15</a>
* @deprecated in favor of {@link #URI_TOO_LONG} which will be returned from
*/
@Deprecated
public int REQUEST_URI_TOO_LONG() {
return HttpStatus.REQUEST_URI_TOO_LONG;
}
/**
* @return {@code 415 Unsupported Media Type}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.13">HTTP/1.1:
* Semantics and Content, section 6.5.13</a>
* @deprecated Replaced by {@code HttpStatus.UNSUPPORTED_MEDIA_TYPE}.
*/
@Deprecated
public int UNSUPPORTED_MEDIA_TYPE() {
return HttpStatus.UNSUPPORTED_MEDIA_TYPE;
}
/**
* @return {@code 416 Requested Range Not Satisfiable}.
* @see <a href="https://tools.ietf.org/html/rfc7233#section-4.4">HTTP/1.1: Range
* Requests, section 4.4</a>
* @deprecated Replaced by {@code HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE}.
*/
@Deprecated
public int REQUESTED_RANGE_NOT_SATISFIABLE() {
return HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE;
}
/**
* @return {@code 417 Expectation Failed}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.5.14">HTTP/1.1:
* Semantics and Content, section 6.5.14</a>
* @deprecated Replaced by {@code HttpStatus.EXPECTATION_FAILED}.
*/
@Deprecated
public int EXPECTATION_FAILED() {
return HttpStatus.EXPECTATION_FAILED;
}
/**
* @return {@code 418 I'm a teapot}.
* @see <a href="https://tools.ietf.org/html/rfc2324#section-2.3.2">HTCPCP/1.0</a>
* @deprecated Replaced by {@code HttpStatus.I_AM_A_TEAPOT}.
*/
@Deprecated
public int I_AM_A_TEAPOT() {
return HttpStatus.I_AM_A_TEAPOT;
}
/**
* @return {@code 419 Insufficient Space}.
* @deprecated See <a href=
* "https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt">WebDAV
* Draft Changes</a>
*/
@Deprecated
public int INSUFFICIENT_SPACE_ON_RESOURCE() {
return HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE;
}
/**
* @return {@code 420 Method Failure}.
* @deprecated See <a href=
* "https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt">WebDAV
* Draft Changes</a>
*/
@Deprecated
public int METHOD_FAILURE() {
return HttpStatus.METHOD_FAILURE;
}
/**
* @return {@code 421 Destination Locked}.
* @deprecated See <a href=
* "https://tools.ietf.org/rfcdiff?difftype=--hwdiff&url2=draft-ietf-webdav-protocol-06.txt">WebDAV
* Draft Changes</a>
*/
@Deprecated
public int DESTINATION_LOCKED() {
return HttpStatus.DESTINATION_LOCKED;
}
/**
* @return {@code 422 Unprocessable Entity}.
* @see <a href="https://tools.ietf.org/html/rfc4918#section-11.2">WebDAV</a>
* @deprecated Replaced by {@code HttpStatus.UNPROCESSABLE_ENTITY}.
*/
@Deprecated
public int UNPROCESSABLE_ENTITY() {
return HttpStatus.UNPROCESSABLE_ENTITY;
}
/**
* @return {@code 423 Locked}.
* @see <a href="https://tools.ietf.org/html/rfc4918#section-11.3">WebDAV</a>
* @deprecated Replaced by {@code HttpStatus.LOCKED}.
*/
@Deprecated
public int LOCKED() {
return HttpStatus.LOCKED;
}
/**
* @return {@code 424 Failed Dependency}.
* @see <a href="https://tools.ietf.org/html/rfc4918#section-11.4">WebDAV</a>
* @deprecated Replaced by {@code HttpStatus.FAILED_DEPENDENCY}.
*/
@Deprecated
public int FAILED_DEPENDENCY() {
return HttpStatus.FAILED_DEPENDENCY;
}
/**
* @return {@code 426 Upgrade Required}.
* @see <a href="https://tools.ietf.org/html/rfc2817#section-6">Upgrading to TLS
* Within HTTP/1.1</a>
* @deprecated Replaced by {@code HttpStatus.UPGRADE_REQUIRED}.
*/
@Deprecated
public int UPGRADE_REQUIRED() {
return HttpStatus.UPGRADE_REQUIRED;
}
/**
* @return {@code 428 Precondition Required}.
* @see <a href="https://tools.ietf.org/html/rfc6585#section-3">Additional HTTP Status
* Codes</a>
* @deprecated Replaced by {@code HttpStatus.PRECONDITION_REQUIRED}.
*/
@Deprecated
public int PRECONDITION_REQUIRED() {
return HttpStatus.PRECONDITION_REQUIRED;
}
/**
* @return {@code 429 Too Many Requests}.
* @see <a href="https://tools.ietf.org/html/rfc6585#section-4">Additional HTTP Status
* Codes</a>
* @deprecated Replaced by {@code HttpStatus.TOO_MANY_REQUESTS}.
*/
@Deprecated
public int TOO_MANY_REQUESTS() {
return HttpStatus.TOO_MANY_REQUESTS;
}
/**
* @return {@code 431 Request Header Fields Too Large}.
* @see <a href="https://tools.ietf.org/html/rfc6585#section-5">Additional HTTP Status
* Codes</a>
* @deprecated Replaced by {@code HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE}.
*/
@Deprecated
public int REQUEST_HEADER_FIELDS_TOO_LARGE() {
return HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE;
}
/**
* @return {@code 451 Unavailable For Legal Reasons}.
* @see <a href=
* "https://tools.ietf.org/html/draft-ietf-httpbis-legally-restricted-status-04" > An
* HTTP Status Code to Report Legal Obstacles</a>
* @deprecated Replaced by {@code HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS}.
*/
@Deprecated
public int UNAVAILABLE_FOR_LEGAL_REASONS() {
return HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS;
}
/**
* @return {@code 500 Internal Server Error}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.6.1">HTTP/1.1:
* Semantics and Content, section 6.6.1</a>
* @deprecated Replaced by {@code HttpStatus.INTERNAL_SERVER_ERROR}.
*/
@Deprecated
public int INTERNAL_SERVER_ERROR() {
return HttpStatus.INTERNAL_SERVER_ERROR;
}
/**
* @return {@code 501 Not Implemented}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.6.2">HTTP/1.1:
* Semantics and Content, section 6.6.2</a>
* @deprecated Replaced by {@code HttpStatus.NOT_IMPLEMENTED}.
*/
@Deprecated
public int NOT_IMPLEMENTED() {
return HttpStatus.NOT_IMPLEMENTED;
}
/**
* @return {@code 502 Bad Gateway}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.6.3">HTTP/1.1:
* Semantics and Content, section 6.6.3</a>
* @deprecated Replaced by {@code HttpStatus.BAD_GATEWAY}.
*/
@Deprecated
public int BAD_GATEWAY() {
return HttpStatus.BAD_GATEWAY;
}
/**
* @return {@code 503 Service Unavailable}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.6.4">HTTP/1.1:
* Semantics and Content, section 6.6.4</a>
* @deprecated Replaced by {@code HttpStatus.SERVICE_UNAVAILABLE}.
*/
@Deprecated
public int SERVICE_UNAVAILABLE() {
return HttpStatus.SERVICE_UNAVAILABLE;
}
/**
* @return {@code 504 Gateway Timeout}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.6.5">HTTP/1.1:
* Semantics and Content, section 6.6.5</a>
* @deprecated Replaced by {@code HttpStatus.GATEWAY_TIMEOUT}.
*/
@Deprecated
public int GATEWAY_TIMEOUT() {
return HttpStatus.GATEWAY_TIMEOUT;
}
/**
* @return {@code 505 HTTP Version Not Supported}.
* @see <a href="https://tools.ietf.org/html/rfc7231#section-6.6.6">HTTP/1.1:
* Semantics and Content, section 6.6.6</a>
* @deprecated Replaced by {@code HttpStatus.HTTP_VERSION_NOT_SUPPORTED}.
*/
@Deprecated
public int HTTP_VERSION_NOT_SUPPORTED() {
return HttpStatus.HTTP_VERSION_NOT_SUPPORTED;
}
/**
* @return {@code 506 Variant Also Negotiates}
* @see <a href="https://tools.ietf.org/html/rfc2295#section-8.1">Transparent Content
* Negotiation</a>
* @deprecated Replaced by {@code HttpStatus.VARIANT_ALSO_NEGOTIATES}.
*/
@Deprecated
public int VARIANT_ALSO_NEGOTIATES() {
return HttpStatus.VARIANT_ALSO_NEGOTIATES;
}
/**
* @return {@code 507 Insufficient Storage}
* @see <a href="https://tools.ietf.org/html/rfc4918#section-11.5">WebDAV</a>
* @deprecated Replaced by {@code HttpStatus.INSUFFICIENT_STORAGE}.
*/
@Deprecated
public int INSUFFICIENT_STORAGE() {
return HttpStatus.INSUFFICIENT_STORAGE;
}
/**
* @return {@code 508 Loop Detected}
* @see <a href="https://tools.ietf.org/html/rfc5842#section-7.2">WebDAV Binding
* Extensions</a>
* @deprecated Replaced by {@code HttpStatus.LOOP_DETECTED}.
*/
@Deprecated
public int LOOP_DETECTED() {
return HttpStatus.LOOP_DETECTED;
}
/**
* @return {@code 509 Bandwidth Limit Exceeded}
* @deprecated Replaced by {@code HttpStatus.BANDWIDTH_LIMIT_EXCEEDED}.
*/
@Deprecated
public int BANDWIDTH_LIMIT_EXCEEDED() {
return HttpStatus.BANDWIDTH_LIMIT_EXCEEDED;
}
/**
* @return {@code 510 Not Extended}
* @see <a href="https://tools.ietf.org/html/rfc2774#section-7">HTTP Extension
* Framework</a>
* @deprecated Replaced by {@code HttpStatus.NOT_EXTENDED}.
*/
@Deprecated
public int NOT_EXTENDED() {
return HttpStatus.NOT_EXTENDED;
}
/**
* @return {@code 511 Network Authentication Required}.
* @see <a href="https://tools.ietf.org/html/rfc6585#section-6">Additional HTTP Status
* Codes</a>
* @deprecated Replaced by {@code HttpStatus.NETWORK_AUTHENTICATION_REQUIRED}.
*/
@Deprecated
public int NETWORK_AUTHENTICATION_REQUIRED() {
return HttpStatus.NETWORK_AUTHENTICATION_REQUIRED;
}
}

View File

@@ -291,18 +291,6 @@ public class Input extends Common implements RegexCreatingProperty<ClientDslProp
consumer.accept(this.messageHeaders);
}
/**
* The stub matchers part of the contract.
* @param consumer function to manipulate the body headers
* @deprecated Deprecated in favor of bodyMatchers to support other future
* bodyMatchers too
*/
@Deprecated
public void stubMatchers(Consumer<BodyMatchers> consumer) {
log.warn("stubMatchers method is deprecated. Please use bodyMatchers instead");
bodyMatchers(consumer);
}
/**
* The stub matchers part of the contract.
* @param consumer function to manipulate the message headers
@@ -324,18 +312,6 @@ public class Input extends Common implements RegexCreatingProperty<ClientDslProp
consumer.call();
}
/**
* The stub matchers part of the contract.
* @param consumer function to manipulate the body headers
* @deprecated Deprecated in favor of bodyMatchers to support other future
* bodyMatchers too
*/
@Deprecated
public void stubMatchers(@DelegatesTo(BodyMatchers.class) Closure consumer) {
log.warn("stubMatchers method is deprecated. Please use bodyMatchers instead");
bodyMatchers(consumer);
}
/**
* The stub matchers part of the contract.
* @param consumer function to manipulate the message headers

View File

@@ -26,12 +26,12 @@ import org.apache.commons.logging.LogFactory;
* @author Tim Ysewyn
* @since 1.0.2
*/
public class MediaTypes {
public final class MediaTypes {
private static final Log log = LogFactory.getLog(MediaTypes.class);
public MediaTypes() {
log.warn("WARNING: MediaTypes shouldn't be instantiated. Use its static methods instead.");
private MediaTypes() {
throw new IllegalStateException("You can't instantiate an utility class");
}
/**
@@ -119,157 +119,4 @@ public class MediaTypes {
*/
public static final String TEXT_XML = "text/xml";
/**
* @deprecated Replaced by {@code MediaTypes.ALL_VALUE}.
* @return {@code MediaTypes.ALL_VALUE}
*/
@Deprecated
public String allValue() {
return ALL_VALUE;
}
/**
* @deprecated Replaced by {@code MediaTypes.APPLICATION_ATOM_XML}.
* @return {@code MediaTypes.APPLICATION_ATOM_XML}
*/
@Deprecated
public String applicationAtomXml() {
return APPLICATION_ATOM_XML;
}
/**
* @deprecated Replaced by {@code MediaTypes.APPLICATION_FORM_URLENCODED}.
* @return {@code MediaTypes.APPLICATION_FORM_URLENCODED}
*/
@Deprecated
public String applicationFormUrlencoded() {
return APPLICATION_FORM_URLENCODED;
}
/**
* @deprecated Replaced by {@code MediaTypes.APPLICATION_JSON}.
* @return {@code MediaTypes.APPLICATION_JSON}
*/
@Deprecated
public String applicationJson() {
return APPLICATION_JSON;
}
/**
* @deprecated Replaced by {@code MediaTypes.APPLICATION_JSON_UTF8}.
* @return {@code MediaTypes.APPLICATION_JSON_UTF8}
*/
@Deprecated
public String applicationJsonUtf8() {
return APPLICATION_JSON_UTF8;
}
/**
* @deprecated Replaced by {@code MediaTypes.APPLICATION_OCTET_STREAM}.
* @return {@code MediaTypes.APPLICATION_OCTET_STREAM}
*/
@Deprecated
public String applicationOctetStream() {
return APPLICATION_OCTET_STREAM;
}
/**
* @deprecated Replaced by {@code MediaTypes.APPLICATION_PDF}.
* @return {@code MediaTypes.APPLICATION_PDF}
*/
@Deprecated
public String applicationPdf() {
return APPLICATION_PDF;
}
/**
* @deprecated Replaced by {@code MediaTypes.APPLICATION_XHTML_XML}.
* @return {@code MediaTypes.APPLICATION_XHTML_XML}
*/
@Deprecated
public String applicationXhtmlXml() {
return APPLICATION_XHTML_XML;
}
/**
* @deprecated Replaced by {@code MediaTypes.APPLICATION_XML}.
* @return {@code MediaTypes.APPLICATION_XML}
*/
@Deprecated
public String applicationXml() {
return APPLICATION_XML;
}
/**
* @deprecated Replaced by {@code MediaTypes.IMAGE_GIF}.
* @return {@code MediaTypes.IMAGE_GIF}
*/
@Deprecated
public String imageGif() {
return IMAGE_GIF;
}
/**
* @deprecated Replaced by {@code MediaTypes.IMAGE_JPEG}.
* @return {@code MediaTypes.IMAGE_JPEG}
*/
@Deprecated
public String imageJpeg() {
return IMAGE_JPEG;
}
/**
* @deprecated Replaced by {@code MediaTypes.IMAGE_PNG}.
* @return {@code MediaTypes.IMAGE_PNG}
*/
@Deprecated
public String imagePng() {
return IMAGE_PNG;
}
/**
* @deprecated Replaced by {@code MediaTypes.MULTIPART_FORM_DATA}.
* @return {@code MediaTypes.MULTIPART_FORM_DATA}
*/
@Deprecated
public String multipartFormData() {
return MULTIPART_FORM_DATA;
}
/**
* @deprecated Replaced by {@code MediaTypes.TEXT_HTML}.
* @return {@code MediaTypes.TEXT_HTML}
*/
@Deprecated
public String textHtml() {
return TEXT_HTML;
}
/**
* @deprecated Replaced by {@code MediaTypes.TEXT_MARKDOWN}.
* @return {@code MediaTypes.TEXT_MARKDOWN}
*/
@Deprecated
public String textMarkdown() {
return TEXT_MARKDOWN;
}
/**
* @deprecated Replaced by {@code MediaTypes.TEXT_PLAIN}.
* @return {@code MediaTypes.TEXT_PLAIN}
*/
@Deprecated
public String textPlain() {
return TEXT_PLAIN;
}
/**
* @deprecated Replaced by {@code MediaTypes.TEXT_XML}.
* @return {@code MediaTypes.TEXT_XML}
*/
@Deprecated
public String textXml() {
return TEXT_XML;
}
}

View File

@@ -16,9 +16,6 @@
package org.springframework.cloud.contract.spec.internal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Contains most commonly used messaging headers.
*
@@ -26,12 +23,10 @@ import org.apache.commons.logging.LogFactory;
* @author Tim Ysewyn
* @since 1.1.2
*/
public class MessagingHeaders {
public final class MessagingHeaders {
private static final Log log = LogFactory.getLog(MessagingHeaders.class);
public MessagingHeaders() {
log.warn("WARNING: MessagingHeaders shouldn't be instantiated. Use its static methods instead.");
private MessagingHeaders() {
throw new IllegalStateException("You can't instantiate an utility class");
}
/**
@@ -39,14 +34,4 @@ public class MessagingHeaders {
*/
public static final String MESSAGING_CONTENT_TYPE = "contentType";
/**
* The Content-Type header name of a message.
* @return the Content-Type header name
* @deprecated Replaced by {@code MessagingHeaders.MESSAGING_CONTENT_TYPE}.
*/
@Deprecated
public String messagingContentType() {
return MESSAGING_CONTENT_TYPE;
}
}

View File

@@ -78,16 +78,6 @@ public class OutputMessage extends Common implements RegexCreatingProperty<Serve
this.assertThat = new ExecutionProperty(assertThat);
}
/**
* @deprecated - use the server dsl property
* @param clientDslProperty client property
* @return dsl property
*/
@Deprecated
public DslProperty value(ClientDslProperty clientDslProperty) {
return value(new ServerDslProperty(clientDslProperty.getServerValue(), clientDslProperty.getClientValue()));
}
public DslProperty value(ServerDslProperty serverDslProperty) {
Object concreteValue = serverDslProperty.getClientValue();
Object dynamicValue = serverDslProperty.getServerValue();
@@ -100,16 +90,6 @@ public class OutputMessage extends Common implements RegexCreatingProperty<Serve
return new DslProperty(concreteValue, dynamicValue);
}
/**
* @deprecated - use the server dsl property
* @param client client value
* @return dsl proprty
*/
@Deprecated
public DslProperty $(ClientDslProperty client) {
return value(client);
}
public DslProperty $(ServerDslProperty property) {
return value(property);
}
@@ -297,18 +277,6 @@ public class OutputMessage extends Common implements RegexCreatingProperty<Serve
consumer.accept(this.headers);
}
/**
* The message headers part of the contract.
* @param consumer function to manipulate the message headers
* @deprecated Deprecated in favor of bodyMatchers to support other future
* bodyMatchers too
*/
@Deprecated
public void testMatchers(Consumer<ResponseBodyMatchers> consumer) {
log.warn("testMatchers method is deprecated. Please use bodyMatchers instead");
bodyMatchers(consumer);
}
/**
* The stub matchers part of the contract.
* @param consumer function to manipulate the body matchers
@@ -328,18 +296,6 @@ public class OutputMessage extends Common implements RegexCreatingProperty<Serve
consumer.call();
}
/**
* The message headers part of the contract.
* @param consumer function to manipulate the message headers
* @deprecated Deprecated in favor of bodyMatchers to support other future
* bodyMatchers too
*/
@Deprecated
public void testMatchers(@DelegatesTo(ResponseBodyMatchers.class) Closure consumer) {
log.warn("testMatchers method is deprecated. Please use bodyMatchers instead");
bodyMatchers(consumer);
}
/**
* The stub matchers part of the contract.
* @param consumer function to manipulate the body matchers

View File

@@ -79,16 +79,6 @@ public class Request extends Common implements RegexCreatingProperty<ClientDslPr
this.method = toDslProperty(method);
}
/**
* Name of the HTTP method.
* @param httpMethod HTTP method name
* @deprecated In favor of {@code method(String method)}
*/
@Deprecated
public void method(HttpMethods.HttpMethod httpMethod) {
this.method = toDslProperty(httpMethod.getMethodName());
}
/**
* Name of the HTTP method.
* @param method HTTP method name
@@ -668,17 +658,6 @@ public class Request extends Common implements RegexCreatingProperty<ClientDslPr
consumer.accept(this.cookies);
}
/**
* @param consumer function to manipulate the body matchers
* @deprecated Deprecated in favor of bodyMatchers to support other future
* bodyMatchers too
*/
@Deprecated
public void stubMatchers(Consumer<BodyMatchers> consumer) {
log.warn("stubMatchers method is deprecated. Please use bodyMatchers instead");
bodyMatchers(consumer);
}
/**
* Allows to set matchers for the body.
* @param consumer function to manipulate the URL
@@ -755,17 +734,6 @@ public class Request extends Common implements RegexCreatingProperty<ClientDslPr
consumer.call();
}
/**
* @param consumer function to manipulate the body matchers
* @deprecated Deprecated in favor of bodyMatchers to support other future
* bodyMatchers too
*/
@Deprecated
public void stubMatchers(@DelegatesTo(BodyMatchers.class) Closure consumer) {
log.warn("stubMatchers method is deprecated. Please use bodyMatchers instead");
bodyMatchers(consumer);
}
/**
* Allows to set matchers for the body.
* @param consumer function to manipulate the URL

View File

@@ -479,11 +479,6 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
return HttpStatus.FOUND;
}
@Deprecated
public int MOVED_TEMPORARILY() {
return HttpStatus.MOVED_TEMPORARILY;
}
public int SEE_OTHER() {
return HttpStatus.SEE_OTHER;
}
@@ -492,11 +487,6 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
return HttpStatus.NOT_MODIFIED;
}
@Deprecated
public int USE_PROXY() {
return HttpStatus.USE_PROXY;
}
public int TEMPORARY_REDIRECT() {
return HttpStatus.TEMPORARY_REDIRECT;
}
@@ -561,20 +551,10 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
return HttpStatus.PAYLOAD_TOO_LARGE;
}
@Deprecated
public int REQUEST_ENTITY_TOO_LARGE() {
return HttpStatus.REQUEST_ENTITY_TOO_LARGE;
}
public int URI_TOO_LONG() {
return HttpStatus.URI_TOO_LONG;
}
@Deprecated
public int REQUEST_URI_TOO_LONG() {
return HttpStatus.REQUEST_URI_TOO_LONG;
}
public int UNSUPPORTED_MEDIA_TYPE() {
return HttpStatus.UNSUPPORTED_MEDIA_TYPE;
}
@@ -591,21 +571,6 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
return HttpStatus.I_AM_A_TEAPOT;
}
@Deprecated
public int INSUFFICIENT_SPACE_ON_RESOURCE() {
return HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE;
}
@Deprecated
public int METHOD_FAILURE() {
return HttpStatus.METHOD_FAILURE;
}
@Deprecated
public int DESTINATION_LOCKED() {
return HttpStatus.DESTINATION_LOCKED;
}
public int UNPROCESSABLE_ENTITY() {
return HttpStatus.UNPROCESSABLE_ENTITY;
}
@@ -731,17 +696,6 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
consumer.accept(this.cookies);
}
/**
* @deprecated Deprecated in favor of bodyMatchers to support other future
* bodyMatchers too
* @param consumer function to manipulate the URL
*/
@Deprecated
public void testMatchers(Consumer<ResponseBodyMatchers> consumer) {
log.warn("testMatchers method is deprecated. Please use bodyMatchers instead");
bodyMatchers(consumer);
}
/**
* Allows to set matchers for the body.
* @param consumer function to manipulate the URL
@@ -771,17 +725,6 @@ public class Response extends Common implements RegexCreatingProperty<ServerDslP
consumer.call();
}
/**
* @deprecated Deprecated in favor of bodyMatchers to support other future
* bodyMatchers too
* @param consumer function to manipulate the URL
*/
@Deprecated
public void testMatchers(@DelegatesTo(ResponseBodyMatchers.class) Closure consumer) {
log.warn("testMatchers method is deprecated. Please use bodyMatchers instead");
bodyMatchers(consumer);
}
/**
* Allows to set matchers for the body.
* @param consumer function to manipulate the URL

View File

@@ -27,368 +27,301 @@ class HttpHeadersTests {
@Test
public void ACCEPT() {
BDDAssertions.then(HttpHeaders.ACCEPT).isEqualTo("Accept");
BDDAssertions.then(new HttpHeaders().accept()).isEqualTo(HttpHeaders.ACCEPT);
}
@Test
public void ACCEPT_CHARSET() {
BDDAssertions.then(HttpHeaders.ACCEPT_CHARSET).isEqualTo("Accept-Charset");
BDDAssertions.then(new HttpHeaders().acceptCharset()).isEqualTo(HttpHeaders.ACCEPT_CHARSET);
}
@Test
public void ACCEPT_ENCODING() {
BDDAssertions.then(HttpHeaders.ACCEPT_ENCODING).isEqualTo("Accept-Encoding");
BDDAssertions.then(new HttpHeaders().acceptEncoding()).isEqualTo(HttpHeaders.ACCEPT_ENCODING);
}
@Test
public void ACCEPT_LANGUAGE() {
BDDAssertions.then(HttpHeaders.ACCEPT_LANGUAGE).isEqualTo("Accept-Language");
BDDAssertions.then(new HttpHeaders().acceptLanguage()).isEqualTo(HttpHeaders.ACCEPT_LANGUAGE);
}
@Test
public void ACCEPT_RANGES() {
BDDAssertions.then(HttpHeaders.ACCEPT_RANGES).isEqualTo("Accept-Ranges");
BDDAssertions.then(new HttpHeaders().acceptRanges()).isEqualTo(HttpHeaders.ACCEPT_RANGES);
}
@Test
public void ACCESS_CONTROL_ALLOW_CREDENTIALS() {
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS).isEqualTo("Access-Control-Allow-Credentials");
BDDAssertions.then(new HttpHeaders().accessControlAllowCredentials())
.isEqualTo(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS);
}
@Test
public void ACCESS_CONTROL_ALLOW_HEADERS() {
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS).isEqualTo("Access-Control-Allow-Headers");
BDDAssertions.then(new HttpHeaders().accessControlAllowHeaders())
.isEqualTo(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS);
}
@Test
public void ACCESS_CONTROL_ALLOW_METHODS() {
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS).isEqualTo("Access-Control-Allow-Methods");
BDDAssertions.then(new HttpHeaders().accessControlAllowMethods())
.isEqualTo(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS);
}
@Test
public void ACCESS_CONTROL_ALLOW_ORIGIN() {
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN).isEqualTo("Access-Control-Allow-Origin");
BDDAssertions.then(new HttpHeaders().accessControlAllowOrigin())
.isEqualTo(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN);
}
@Test
public void ACCESS_CONTROL_EXPOSE_HEADERS() {
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS).isEqualTo("Access-Control-Expose-Headers");
BDDAssertions.then(new HttpHeaders().accessControlExposeHeaders())
.isEqualTo(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS);
}
@Test
public void ACCESS_CONTROL_MAX_AGE() {
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_MAX_AGE).isEqualTo("Access-Control-Max-Age");
BDDAssertions.then(new HttpHeaders().accessControlMaxAge()).isEqualTo(HttpHeaders.ACCESS_CONTROL_MAX_AGE);
}
@Test
public void ACCESS_CONTROL_REQUEST_HEADERS() {
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS).isEqualTo("Access-Control-Request-Headers");
BDDAssertions.then(new HttpHeaders().accessControlRequestHeaders())
.isEqualTo(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS);
}
@Test
public void ACCESS_CONTROL_REQUEST_METHOD() {
BDDAssertions.then(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD).isEqualTo("Access-Control-Request-Method");
BDDAssertions.then(new HttpHeaders().accessControlRequestMethod())
.isEqualTo(HttpHeaders.ACCESS_CONTROL_REQUEST_METHOD);
}
@Test
public void AGE() {
BDDAssertions.then(HttpHeaders.AGE).isEqualTo("Age");
BDDAssertions.then(new HttpHeaders().age()).isEqualTo(HttpHeaders.AGE);
}
@Test
public void ALLOW() {
BDDAssertions.then(HttpHeaders.ALLOW).isEqualTo("Allow");
BDDAssertions.then(new HttpHeaders().allow()).isEqualTo(HttpHeaders.ALLOW);
}
@Test
public void AUTHORIZATION() {
BDDAssertions.then(HttpHeaders.AUTHORIZATION).isEqualTo("Authorization");
BDDAssertions.then(new HttpHeaders().authorization()).isEqualTo(HttpHeaders.AUTHORIZATION);
}
@Test
public void CACHE_CONTROL() {
BDDAssertions.then(HttpHeaders.CACHE_CONTROL).isEqualTo("Cache-Control");
BDDAssertions.then(new HttpHeaders().cacheControl()).isEqualTo(HttpHeaders.CACHE_CONTROL);
}
@Test
public void CONNECTION() {
BDDAssertions.then(HttpHeaders.CONNECTION).isEqualTo("Connection");
BDDAssertions.then(new HttpHeaders().connection()).isEqualTo(HttpHeaders.CONNECTION);
}
@Test
public void CONTENT_ENCODING() {
BDDAssertions.then(HttpHeaders.CONTENT_ENCODING).isEqualTo("Content-Encoding");
BDDAssertions.then(new HttpHeaders().contentEncoding()).isEqualTo(HttpHeaders.CONTENT_ENCODING);
}
@Test
public void CONTENT_DISPOSITION() {
BDDAssertions.then(HttpHeaders.CONTENT_DISPOSITION).isEqualTo("Content-Disposition");
BDDAssertions.then(new HttpHeaders().contentDisposition()).isEqualTo(HttpHeaders.CONTENT_DISPOSITION);
}
@Test
public void CONTENT_LANGUAGE() {
BDDAssertions.then(HttpHeaders.CONTENT_LANGUAGE).isEqualTo("Content-Language");
BDDAssertions.then(new HttpHeaders().contentLanguage()).isEqualTo(HttpHeaders.CONTENT_LANGUAGE);
}
@Test
public void CONTENT_LENGTH() {
BDDAssertions.then(HttpHeaders.CONTENT_LENGTH).isEqualTo("Content-Length");
BDDAssertions.then(new HttpHeaders().contentLength()).isEqualTo(HttpHeaders.CONTENT_LENGTH);
}
@Test
public void CONTENT_LOCATION() {
BDDAssertions.then(HttpHeaders.CONTENT_LOCATION).isEqualTo("Content-Location");
BDDAssertions.then(new HttpHeaders().contentLocation()).isEqualTo(HttpHeaders.CONTENT_LOCATION);
}
@Test
public void CONTENT_RANGE() {
BDDAssertions.then(HttpHeaders.CONTENT_RANGE).isEqualTo("Content-Range");
BDDAssertions.then(new HttpHeaders().contentRange()).isEqualTo(HttpHeaders.CONTENT_RANGE);
}
@Test
public void CONTENT_TYPE() {
BDDAssertions.then(HttpHeaders.CONTENT_TYPE).isEqualTo("Content-Type");
BDDAssertions.then(new HttpHeaders().contentType()).isEqualTo(HttpHeaders.CONTENT_TYPE);
}
@Test
public void COOKIE() {
BDDAssertions.then(HttpHeaders.COOKIE).isEqualTo("Cookie");
BDDAssertions.then(new HttpHeaders().cookie()).isEqualTo(HttpHeaders.COOKIE);
}
@Test
public void DATE() {
BDDAssertions.then(HttpHeaders.DATE).isEqualTo("Date");
BDDAssertions.then(new HttpHeaders().date()).isEqualTo(HttpHeaders.DATE);
}
@Test
public void ETAG() {
BDDAssertions.then(HttpHeaders.ETAG).isEqualTo("ETag");
BDDAssertions.then(new HttpHeaders().etag()).isEqualTo(HttpHeaders.ETAG);
}
@Test
public void EXPECT() {
BDDAssertions.then(HttpHeaders.EXPECT).isEqualTo("Expect");
BDDAssertions.then(new HttpHeaders().expect()).isEqualTo(HttpHeaders.EXPECT);
}
@Test
public void EXPIRES() {
BDDAssertions.then(HttpHeaders.EXPIRES).isEqualTo("Expires");
BDDAssertions.then(new HttpHeaders().expires()).isEqualTo(HttpHeaders.EXPIRES);
}
@Test
public void FROM() {
BDDAssertions.then(HttpHeaders.FROM).isEqualTo("From");
BDDAssertions.then(new HttpHeaders().from()).isEqualTo(HttpHeaders.FROM);
}
@Test
public void HOST() {
BDDAssertions.then(HttpHeaders.HOST).isEqualTo("Host");
BDDAssertions.then(new HttpHeaders().host()).isEqualTo(HttpHeaders.HOST);
}
@Test
public void IF_MATCH() {
BDDAssertions.then(HttpHeaders.IF_MATCH).isEqualTo("If-Match");
BDDAssertions.then(new HttpHeaders().ifMatch()).isEqualTo(HttpHeaders.IF_MATCH);
}
@Test
public void IF_MODIFIED_SINCE() {
BDDAssertions.then(HttpHeaders.IF_MODIFIED_SINCE).isEqualTo("If-Modified-Since");
BDDAssertions.then(new HttpHeaders().ifModifiedSince()).isEqualTo(HttpHeaders.IF_MODIFIED_SINCE);
}
@Test
public void IF_NONE_MATCH() {
BDDAssertions.then(HttpHeaders.IF_NONE_MATCH).isEqualTo("If-None-Match");
BDDAssertions.then(new HttpHeaders().ifNoneMatch()).isEqualTo(HttpHeaders.IF_NONE_MATCH);
}
@Test
public void IF_RANGE() {
BDDAssertions.then(HttpHeaders.IF_RANGE).isEqualTo("If-Range");
BDDAssertions.then(new HttpHeaders().ifRange()).isEqualTo(HttpHeaders.IF_RANGE);
}
@Test
public void IF_UNMODIFIED_SINCE() {
BDDAssertions.then(HttpHeaders.IF_UNMODIFIED_SINCE).isEqualTo("If-Unmodified-Since");
BDDAssertions.then(new HttpHeaders().ifUnmodifiedSince()).isEqualTo(HttpHeaders.IF_UNMODIFIED_SINCE);
}
@Test
public void LAST_MODIFIED() {
BDDAssertions.then(HttpHeaders.LAST_MODIFIED).isEqualTo("Last-Modified");
BDDAssertions.then(new HttpHeaders().lastModified()).isEqualTo(HttpHeaders.LAST_MODIFIED);
}
@Test
public void LINK() {
BDDAssertions.then(HttpHeaders.LINK).isEqualTo("Link");
BDDAssertions.then(new HttpHeaders().link()).isEqualTo(HttpHeaders.LINK);
}
@Test
public void LOCATION() {
BDDAssertions.then(HttpHeaders.LOCATION).isEqualTo("Location");
BDDAssertions.then(new HttpHeaders().location()).isEqualTo(HttpHeaders.LOCATION);
}
@Test
public void MAX_FORWARDS() {
BDDAssertions.then(HttpHeaders.MAX_FORWARDS).isEqualTo("Max-Forwards");
BDDAssertions.then(new HttpHeaders().max_forwards()).isEqualTo(HttpHeaders.MAX_FORWARDS);
}
@Test
public void ORIGIN() {
BDDAssertions.then(HttpHeaders.ORIGIN).isEqualTo("Origin");
BDDAssertions.then(new HttpHeaders().origin()).isEqualTo(HttpHeaders.ORIGIN);
}
@Test
public void PRAGMA() {
BDDAssertions.then(HttpHeaders.PRAGMA).isEqualTo("Pragma");
BDDAssertions.then(new HttpHeaders().pragma()).isEqualTo(HttpHeaders.PRAGMA);
}
@Test
public void PROXY_AUTHENTICATE() {
BDDAssertions.then(HttpHeaders.PROXY_AUTHENTICATE).isEqualTo("Proxy-Authenticate");
BDDAssertions.then(new HttpHeaders().proxyAuthenticate()).isEqualTo(HttpHeaders.PROXY_AUTHENTICATE);
}
@Test
public void PROXY_AUTHORIZATION() {
BDDAssertions.then(HttpHeaders.PROXY_AUTHORIZATION).isEqualTo("Proxy-Authorization");
BDDAssertions.then(new HttpHeaders().proxyAuthorization()).isEqualTo(HttpHeaders.PROXY_AUTHORIZATION);
}
@Test
public void RANGE() {
BDDAssertions.then(HttpHeaders.RANGE).isEqualTo("Range");
BDDAssertions.then(new HttpHeaders().range()).isEqualTo(HttpHeaders.RANGE);
}
@Test
public void REFERER() {
BDDAssertions.then(HttpHeaders.REFERER).isEqualTo("Referer");
BDDAssertions.then(new HttpHeaders().referer()).isEqualTo(HttpHeaders.REFERER);
}
@Test
public void RETRY_AFTER() {
BDDAssertions.then(HttpHeaders.RETRY_AFTER).isEqualTo("Retry-After");
BDDAssertions.then(new HttpHeaders().retryAfter()).isEqualTo(HttpHeaders.RETRY_AFTER);
}
@Test
public void SERVER() {
BDDAssertions.then(HttpHeaders.SERVER).isEqualTo("Server");
BDDAssertions.then(new HttpHeaders().server()).isEqualTo(HttpHeaders.SERVER);
}
@Test
public void SET_COOKIE() {
BDDAssertions.then(HttpHeaders.SET_COOKIE).isEqualTo("Set-Cookie");
BDDAssertions.then(new HttpHeaders().setCookie()).isEqualTo(HttpHeaders.SET_COOKIE);
}
@Test
public void SET_COOKIE_2() {
BDDAssertions.then(HttpHeaders.SET_COOKIE_2).isEqualTo("Set-Cookie2");
BDDAssertions.then(new HttpHeaders().setCookie2()).isEqualTo(HttpHeaders.SET_COOKIE_2);
}
@Test
public void TE() {
BDDAssertions.then(HttpHeaders.TE).isEqualTo("TE");
BDDAssertions.then(new HttpHeaders().te()).isEqualTo(HttpHeaders.TE);
}
@Test
public void TRAILER() {
BDDAssertions.then(HttpHeaders.TRAILER).isEqualTo("Trailer");
BDDAssertions.then(new HttpHeaders().trailer()).isEqualTo(HttpHeaders.TRAILER);
}
@Test
public void TRANSFER_ENCODING() {
BDDAssertions.then(HttpHeaders.TRANSFER_ENCODING).isEqualTo("Transfer-Encoding");
BDDAssertions.then(new HttpHeaders().transferEncoding()).isEqualTo(HttpHeaders.TRANSFER_ENCODING);
}
@Test
public void UPGRADE() {
BDDAssertions.then(HttpHeaders.UPGRADE).isEqualTo("Upgrade");
BDDAssertions.then(new HttpHeaders().upgrade()).isEqualTo(HttpHeaders.UPGRADE);
}
@Test
public void USER_AGENT() {
BDDAssertions.then(HttpHeaders.USER_AGENT).isEqualTo("User-Agent");
BDDAssertions.then(new HttpHeaders().user_agent()).isEqualTo(HttpHeaders.USER_AGENT);
}
@Test
public void VARY() {
BDDAssertions.then(HttpHeaders.VARY).isEqualTo("Vary");
BDDAssertions.then(new HttpHeaders().vary()).isEqualTo(HttpHeaders.VARY);
}
@Test
public void VIA() {
BDDAssertions.then(HttpHeaders.VIA).isEqualTo("Via");
BDDAssertions.then(new HttpHeaders().via()).isEqualTo(HttpHeaders.VIA);
}
@Test
public void WARNING() {
BDDAssertions.then(HttpHeaders.WARNING).isEqualTo("Warning");
BDDAssertions.then(new HttpHeaders().warning()).isEqualTo(HttpHeaders.WARNING);
}
@Test
public void WWW_AUTHENTICATE() {
BDDAssertions.then(HttpHeaders.WWW_AUTHENTICATE).isEqualTo("WWW-Authenticate");
BDDAssertions.then(new HttpHeaders().wwwAuthenticate()).isEqualTo(HttpHeaders.WWW_AUTHENTICATE);
}
}

View File

@@ -27,49 +27,41 @@ class HttpMethodsTests {
@Test
public void GET() {
BDDAssertions.then(HttpMethods.GET).isEqualTo("GET");
BDDAssertions.then(new HttpMethods().GET().getMethodName()).isEqualTo(HttpMethods.GET);
}
@Test
public void HEAD() {
BDDAssertions.then(HttpMethods.HEAD).isEqualTo("HEAD");
BDDAssertions.then(new HttpMethods().HEAD().getMethodName()).isEqualTo(HttpMethods.HEAD);
}
@Test
public void POST() {
BDDAssertions.then(HttpMethods.POST).isEqualTo("POST");
BDDAssertions.then(new HttpMethods().POST().getMethodName()).isEqualTo(HttpMethods.POST);
}
@Test
public void PUT() {
BDDAssertions.then(HttpMethods.PUT).isEqualTo("PUT");
BDDAssertions.then(new HttpMethods().PUT().getMethodName()).isEqualTo(HttpMethods.PUT);
}
@Test
public void PATCH() {
BDDAssertions.then(HttpMethods.PATCH).isEqualTo("PATCH");
BDDAssertions.then(new HttpMethods().PATCH().getMethodName()).isEqualTo(HttpMethods.PATCH);
}
@Test
public void DELETE() {
BDDAssertions.then(HttpMethods.DELETE).isEqualTo("DELETE");
BDDAssertions.then(new HttpMethods().DELETE().getMethodName()).isEqualTo(HttpMethods.DELETE);
}
@Test
public void OPTIONS() {
BDDAssertions.then(HttpMethods.OPTIONS).isEqualTo("OPTIONS");
BDDAssertions.then(new HttpMethods().OPTIONS().getMethodName()).isEqualTo(HttpMethods.OPTIONS);
}
@Test
public void TRACE() {
BDDAssertions.then(HttpMethods.TRACE).isEqualTo("TRACE");
BDDAssertions.then(new HttpMethods().TRACE().getMethodName()).isEqualTo(HttpMethods.TRACE);
}
}

View File

@@ -27,104 +27,86 @@ class MediaTypesTests {
@Test
public void ALL_VALUE() {
BDDAssertions.then(MediaTypes.ALL_VALUE).isEqualTo("*/*");
BDDAssertions.then(new MediaTypes().allValue()).isEqualTo(MediaTypes.ALL_VALUE);
}
@Test
public void APPLICATION_ATOM_XML() {
BDDAssertions.then(MediaTypes.APPLICATION_ATOM_XML).isEqualTo("application/atom+xml");
BDDAssertions.then(new MediaTypes().applicationAtomXml()).isEqualTo(MediaTypes.APPLICATION_ATOM_XML);
}
@Test
public void APPLICATION_FORM_URLENCODED() {
BDDAssertions.then(MediaTypes.APPLICATION_FORM_URLENCODED).isEqualTo("application/x-www-form-urlencoded");
BDDAssertions.then(new MediaTypes().applicationFormUrlencoded())
.isEqualTo(MediaTypes.APPLICATION_FORM_URLENCODED);
}
@Test
public void APPLICATION_JSON() {
BDDAssertions.then(MediaTypes.APPLICATION_JSON).isEqualTo("application/json");
BDDAssertions.then(new MediaTypes().applicationJson()).isEqualTo(MediaTypes.APPLICATION_JSON);
}
@Test
public void APPLICATION_JSON_UTF8() {
BDDAssertions.then(MediaTypes.APPLICATION_JSON_UTF8).isEqualTo("application/json;charset=UTF-8");
BDDAssertions.then(new MediaTypes().applicationJsonUtf8()).isEqualTo(MediaTypes.APPLICATION_JSON_UTF8);
}
@Test
public void APPLICATION_OCTET_STREAM() {
BDDAssertions.then(MediaTypes.APPLICATION_OCTET_STREAM).isEqualTo("application/octet-stream");
BDDAssertions.then(new MediaTypes().applicationOctetStream()).isEqualTo(MediaTypes.APPLICATION_OCTET_STREAM);
}
@Test
public void APPLICATION_PDF() {
BDDAssertions.then(MediaTypes.APPLICATION_PDF).isEqualTo("application/pdf");
BDDAssertions.then(new MediaTypes().applicationPdf()).isEqualTo(MediaTypes.APPLICATION_PDF);
}
@Test
public void APPLICATION_XHTML_XML() {
BDDAssertions.then(MediaTypes.APPLICATION_XHTML_XML).isEqualTo("application/xhtml+xml");
BDDAssertions.then(new MediaTypes().applicationXhtmlXml()).isEqualTo(MediaTypes.APPLICATION_XHTML_XML);
}
@Test
public void APPLICATION_XML() {
BDDAssertions.then(MediaTypes.APPLICATION_XML).isEqualTo("application/xml");
BDDAssertions.then(new MediaTypes().applicationXml()).isEqualTo(MediaTypes.APPLICATION_XML);
}
@Test
public void IMAGE_GIF() {
BDDAssertions.then(MediaTypes.IMAGE_GIF).isEqualTo("image/gif");
BDDAssertions.then(new MediaTypes().imageGif()).isEqualTo(MediaTypes.IMAGE_GIF);
}
@Test
public void IMAGE_JPEG() {
BDDAssertions.then(MediaTypes.IMAGE_JPEG).isEqualTo("image/jpeg");
BDDAssertions.then(new MediaTypes().imageJpeg()).isEqualTo(MediaTypes.IMAGE_JPEG);
}
@Test
public void IMAGE_PNG() {
BDDAssertions.then(MediaTypes.IMAGE_PNG).isEqualTo("image/png");
BDDAssertions.then(new MediaTypes().imagePng()).isEqualTo(MediaTypes.IMAGE_PNG);
}
@Test
public void MULTIPART_FORM_DATA() {
BDDAssertions.then(MediaTypes.MULTIPART_FORM_DATA).isEqualTo("multipart/form-data");
BDDAssertions.then(new MediaTypes().multipartFormData()).isEqualTo(MediaTypes.MULTIPART_FORM_DATA);
}
@Test
public void TEXT_HTML() {
BDDAssertions.then(MediaTypes.TEXT_HTML).isEqualTo("text/html");
BDDAssertions.then(new MediaTypes().textHtml()).isEqualTo(MediaTypes.TEXT_HTML);
}
@Test
public void TEXT_MARKDOWN() {
BDDAssertions.then(MediaTypes.TEXT_MARKDOWN).isEqualTo("text/markdown");
BDDAssertions.then(new MediaTypes().textMarkdown()).isEqualTo(MediaTypes.TEXT_MARKDOWN);
}
@Test
public void TEXT_PLAIN() {
BDDAssertions.then(MediaTypes.TEXT_PLAIN).isEqualTo("text/plain");
BDDAssertions.then(new MediaTypes().textPlain()).isEqualTo(MediaTypes.TEXT_PLAIN);
}
@Test
public void TEXT_XML() {
BDDAssertions.then(MediaTypes.TEXT_XML).isEqualTo("text/xml");
BDDAssertions.then(new MediaTypes().textXml()).isEqualTo(MediaTypes.TEXT_XML);
}
}

View File

@@ -27,8 +27,6 @@ class MessagingHeadersTests {
@Test
public void MESSAGING_CONTENT_TYPE() {
BDDAssertions.then(MessagingHeaders.MESSAGING_CONTENT_TYPE).isEqualTo("contentType");
BDDAssertions.then(new MessagingHeaders().messagingContentType())
.isEqualTo(MessagingHeaders.MESSAGING_CONTENT_TYPE);
}
}

View File

@@ -20,8 +20,6 @@ import spock.lang.Issue
import spock.lang.Specification
import org.springframework.cloud.contract.spec.Contract
import static org.assertj.core.api.Assertions.assertThat
/**
* @author Marcin Grzejszczak
*/
@@ -388,40 +386,6 @@ then:
a == b
}
def 'should support deprecated testMatchers and stubMatchers'() {
given:
def contract = Contract.make {
request {
method 'GET'
url '/path'
body(
id: [value: '132']
)
stubMatchers {
jsonPath('$.id.value', byRegex(anInteger()))
}
}
response {
status OK()
body(
id: [value: '132'],
surname: 'Kowalsky',
name: 'Jan',
created: '2014-02-02 12:23:43'
)
headers {
contentType(applicationJson())
}
testMatchers {
jsonPath('$.created', byTimestamp())
}
}
}
expect:
assertThat(contract.request.bodyMatchers.hasMatchers()).isTrue()
assertThat(contract.response.bodyMatchers.hasMatchers()).isTrue()
}
def 'should work with optional and null value of a field'() {
given:
def contract = Contract.make {

View File

@@ -28,411 +28,301 @@ public class HttpStatusTests {
@Test
public void CONTINUE() {
BDDAssertions.then(HttpStatus.CONTINUE).isEqualTo(100);
BDDAssertions.then(new HttpStatus().CONTINUE()).isEqualTo(HttpStatus.CONTINUE);
}
@Test
public void SWITCHING_PROTOCOLS() {
BDDAssertions.then(HttpStatus.SWITCHING_PROTOCOLS).isEqualTo(101);
BDDAssertions.then(new HttpStatus().SWITCHING_PROTOCOLS()).isEqualTo(HttpStatus.SWITCHING_PROTOCOLS);
}
@Test
public void PROCESSING() {
BDDAssertions.then(HttpStatus.PROCESSING).isEqualTo(102);
BDDAssertions.then(new HttpStatus().PROCESSING()).isEqualTo(HttpStatus.PROCESSING);
}
@Test
public void CHECKPOINT() {
BDDAssertions.then(HttpStatus.CHECKPOINT).isEqualTo(103);
BDDAssertions.then(new HttpStatus().CHECKPOINT()).isEqualTo(HttpStatus.CHECKPOINT);
}
@Test
public void OK() {
BDDAssertions.then(HttpStatus.OK).isEqualTo(200);
BDDAssertions.then(new HttpStatus().OK()).isEqualTo(HttpStatus.OK);
}
@Test
public void CREATED() {
BDDAssertions.then(HttpStatus.CREATED).isEqualTo(201);
BDDAssertions.then(new HttpStatus().CREATED()).isEqualTo(HttpStatus.CREATED);
}
@Test
public void ACCEPTED() {
BDDAssertions.then(HttpStatus.ACCEPTED).isEqualTo(202);
BDDAssertions.then(new HttpStatus().ACCEPTED()).isEqualTo(HttpStatus.ACCEPTED);
}
@Test
public void NON_AUTHORITATIVE_INFORMATION() {
BDDAssertions.then(HttpStatus.NON_AUTHORITATIVE_INFORMATION).isEqualTo(203);
BDDAssertions.then(new HttpStatus().NON_AUTHORITATIVE_INFORMATION())
.isEqualTo(HttpStatus.NON_AUTHORITATIVE_INFORMATION);
}
@Test
public void NO_CONTENT() {
BDDAssertions.then(HttpStatus.NO_CONTENT).isEqualTo(204);
BDDAssertions.then(new HttpStatus().NO_CONTENT()).isEqualTo(HttpStatus.NO_CONTENT);
}
@Test
public void RESET_CONTENT() {
BDDAssertions.then(HttpStatus.RESET_CONTENT).isEqualTo(205);
BDDAssertions.then(new HttpStatus().RESET_CONTENT()).isEqualTo(HttpStatus.RESET_CONTENT);
}
@Test
public void PARTIAL_CONTENT() {
BDDAssertions.then(HttpStatus.PARTIAL_CONTENT).isEqualTo(206);
BDDAssertions.then(new HttpStatus().PARTIAL_CONTENT()).isEqualTo(HttpStatus.PARTIAL_CONTENT);
}
@Test
public void MULTI_STATUS() {
BDDAssertions.then(HttpStatus.MULTI_STATUS).isEqualTo(207);
BDDAssertions.then(new HttpStatus().MULTI_STATUS()).isEqualTo(HttpStatus.MULTI_STATUS);
}
@Test
public void ALREADY_REPORTED() {
BDDAssertions.then(HttpStatus.ALREADY_REPORTED).isEqualTo(208);
BDDAssertions.then(new HttpStatus().ALREADY_REPORTED()).isEqualTo(HttpStatus.ALREADY_REPORTED);
}
@Test
public void IM_USED() {
BDDAssertions.then(HttpStatus.IM_USED).isEqualTo(226);
BDDAssertions.then(new HttpStatus().IM_USED()).isEqualTo(HttpStatus.IM_USED);
}
@Test
public void MULTIPLE_CHOICES() {
BDDAssertions.then(HttpStatus.MULTIPLE_CHOICES).isEqualTo(300);
BDDAssertions.then(new HttpStatus().MULTIPLE_CHOICES()).isEqualTo(HttpStatus.MULTIPLE_CHOICES);
}
@Test
public void MOVED_PERMANENTLY() {
BDDAssertions.then(HttpStatus.MOVED_PERMANENTLY).isEqualTo(301);
BDDAssertions.then(new HttpStatus().MOVED_PERMANENTLY()).isEqualTo(HttpStatus.MOVED_PERMANENTLY);
}
@Test
public void FOUND() {
BDDAssertions.then(HttpStatus.FOUND).isEqualTo(302);
BDDAssertions.then(new HttpStatus().FOUND()).isEqualTo(HttpStatus.FOUND);
}
@Test
public void MOVED_TEMPORARILY() {
BDDAssertions.then(HttpStatus.MOVED_TEMPORARILY).isEqualTo(302);
BDDAssertions.then(new HttpStatus().MOVED_TEMPORARILY()).isEqualTo(HttpStatus.MOVED_TEMPORARILY);
}
@Test
public void SEE_OTHER() {
BDDAssertions.then(HttpStatus.SEE_OTHER).isEqualTo(303);
BDDAssertions.then(new HttpStatus().SEE_OTHER()).isEqualTo(HttpStatus.SEE_OTHER);
}
@Test
public void NOT_MODIFIED() {
BDDAssertions.then(HttpStatus.NOT_MODIFIED).isEqualTo(304);
BDDAssertions.then(new HttpStatus().NOT_MODIFIED()).isEqualTo(HttpStatus.NOT_MODIFIED);
}
@Test
public void USE_PROXY() {
BDDAssertions.then(HttpStatus.USE_PROXY).isEqualTo(305);
BDDAssertions.then(new HttpStatus().USE_PROXY()).isEqualTo(HttpStatus.USE_PROXY);
}
@Test
public void TEMPORARY_REDIRECT() {
BDDAssertions.then(HttpStatus.TEMPORARY_REDIRECT).isEqualTo(307);
BDDAssertions.then(new HttpStatus().TEMPORARY_REDIRECT()).isEqualTo(HttpStatus.TEMPORARY_REDIRECT);
}
@Test
public void PERMANENT_REDIRECT() {
BDDAssertions.then(HttpStatus.PERMANENT_REDIRECT).isEqualTo(308);
BDDAssertions.then(new HttpStatus().PERMANENT_REDIRECT()).isEqualTo(HttpStatus.PERMANENT_REDIRECT);
}
@Test
public void BAD_REQUEST() {
BDDAssertions.then(HttpStatus.BAD_REQUEST).isEqualTo(400);
BDDAssertions.then(new HttpStatus().BAD_REQUEST()).isEqualTo(HttpStatus.BAD_REQUEST);
}
@Test
public void UNAUTHORIZED() {
BDDAssertions.then(HttpStatus.UNAUTHORIZED).isEqualTo(401);
BDDAssertions.then(new HttpStatus().UNAUTHORIZED()).isEqualTo(HttpStatus.UNAUTHORIZED);
}
@Test
public void PAYMENT_REQUIRED() {
BDDAssertions.then(HttpStatus.PAYMENT_REQUIRED).isEqualTo(402);
BDDAssertions.then(new HttpStatus().PAYMENT_REQUIRED()).isEqualTo(HttpStatus.PAYMENT_REQUIRED);
}
@Test
public void FORBIDDEN() {
BDDAssertions.then(HttpStatus.FORBIDDEN).isEqualTo(403);
BDDAssertions.then(new HttpStatus().FORBIDDEN()).isEqualTo(HttpStatus.FORBIDDEN);
}
@Test
public void NOT_FOUND() {
BDDAssertions.then(HttpStatus.NOT_FOUND).isEqualTo(404);
BDDAssertions.then(new HttpStatus().NOT_FOUND()).isEqualTo(HttpStatus.NOT_FOUND);
}
@Test
public void METHOD_NOT_ALLOWED() {
BDDAssertions.then(HttpStatus.METHOD_NOT_ALLOWED).isEqualTo(405);
BDDAssertions.then(new HttpStatus().METHOD_NOT_ALLOWED()).isEqualTo(HttpStatus.METHOD_NOT_ALLOWED);
}
@Test
public void NOT_ACCEPTABLE() {
BDDAssertions.then(HttpStatus.NOT_ACCEPTABLE).isEqualTo(406);
BDDAssertions.then(new HttpStatus().NOT_ACCEPTABLE()).isEqualTo(HttpStatus.NOT_ACCEPTABLE);
}
@Test
public void PROXY_AUTHENTICATION_REQUIRED() {
BDDAssertions.then(HttpStatus.PROXY_AUTHENTICATION_REQUIRED).isEqualTo(407);
BDDAssertions.then(new HttpStatus().PROXY_AUTHENTICATION_REQUIRED())
.isEqualTo(HttpStatus.PROXY_AUTHENTICATION_REQUIRED);
}
@Test
public void REQUEST_TIMEOUT() {
BDDAssertions.then(HttpStatus.REQUEST_TIMEOUT).isEqualTo(408);
BDDAssertions.then(new HttpStatus().REQUEST_TIMEOUT()).isEqualTo(HttpStatus.REQUEST_TIMEOUT);
}
@Test
public void CONFLICT() {
BDDAssertions.then(HttpStatus.CONFLICT).isEqualTo(409);
BDDAssertions.then(new HttpStatus().CONFLICT()).isEqualTo(HttpStatus.CONFLICT);
}
@Test
public void GONE() {
BDDAssertions.then(HttpStatus.GONE).isEqualTo(410);
BDDAssertions.then(new HttpStatus().GONE()).isEqualTo(HttpStatus.GONE);
}
@Test
public void LENGTH_REQUIRED() {
BDDAssertions.then(HttpStatus.LENGTH_REQUIRED).isEqualTo(411);
BDDAssertions.then(new HttpStatus().LENGTH_REQUIRED()).isEqualTo(HttpStatus.LENGTH_REQUIRED);
}
@Test
public void PRECONDITION_FAILED() {
BDDAssertions.then(HttpStatus.PRECONDITION_FAILED).isEqualTo(412);
BDDAssertions.then(new HttpStatus().PRECONDITION_FAILED()).isEqualTo(HttpStatus.PRECONDITION_FAILED);
}
@Test
public void PAYLOAD_TOO_LARGE() {
BDDAssertions.then(HttpStatus.PAYLOAD_TOO_LARGE).isEqualTo(413);
BDDAssertions.then(new HttpStatus().PAYLOAD_TOO_LARGE()).isEqualTo(HttpStatus.PAYLOAD_TOO_LARGE);
}
@Test
public void REQUEST_ENTITY_TOO_LARGE() {
BDDAssertions.then(HttpStatus.REQUEST_ENTITY_TOO_LARGE).isEqualTo(413);
BDDAssertions.then(new HttpStatus().REQUEST_ENTITY_TOO_LARGE()).isEqualTo(HttpStatus.REQUEST_ENTITY_TOO_LARGE);
}
@Test
public void URI_TOO_LONG() {
BDDAssertions.then(HttpStatus.URI_TOO_LONG).isEqualTo(414);
BDDAssertions.then(new HttpStatus().URI_TOO_LONG()).isEqualTo(HttpStatus.URI_TOO_LONG);
}
@Test
public void REQUEST_URI_TOO_LONG() {
BDDAssertions.then(HttpStatus.REQUEST_URI_TOO_LONG).isEqualTo(414);
BDDAssertions.then(new HttpStatus().REQUEST_URI_TOO_LONG()).isEqualTo(HttpStatus.REQUEST_URI_TOO_LONG);
}
@Test
public void UNSUPPORTED_MEDIA_TYPE() {
BDDAssertions.then(HttpStatus.UNSUPPORTED_MEDIA_TYPE).isEqualTo(415);
BDDAssertions.then(new HttpStatus().UNSUPPORTED_MEDIA_TYPE()).isEqualTo(HttpStatus.UNSUPPORTED_MEDIA_TYPE);
}
@Test
public void REQUESTED_RANGE_NOT_SATISFIABLE() {
BDDAssertions.then(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE).isEqualTo(416);
BDDAssertions.then(new HttpStatus().REQUESTED_RANGE_NOT_SATISFIABLE())
.isEqualTo(HttpStatus.REQUESTED_RANGE_NOT_SATISFIABLE);
}
@Test
public void EXPECTATION_FAILED() {
BDDAssertions.then(HttpStatus.EXPECTATION_FAILED).isEqualTo(417);
BDDAssertions.then(new HttpStatus().EXPECTATION_FAILED()).isEqualTo(HttpStatus.EXPECTATION_FAILED);
}
@Test
public void I_AM_A_TEAPOT() {
BDDAssertions.then(HttpStatus.I_AM_A_TEAPOT).isEqualTo(418);
BDDAssertions.then(new HttpStatus().I_AM_A_TEAPOT()).isEqualTo(HttpStatus.I_AM_A_TEAPOT);
}
@Test
public void INSUFFICIENT_SPACE_ON_RESOURCE() {
BDDAssertions.then(HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE).isEqualTo(419);
BDDAssertions.then(new HttpStatus().INSUFFICIENT_SPACE_ON_RESOURCE())
.isEqualTo(HttpStatus.INSUFFICIENT_SPACE_ON_RESOURCE);
}
@Test
public void METHOD_FAILURE() {
BDDAssertions.then(HttpStatus.METHOD_FAILURE).isEqualTo(420);
BDDAssertions.then(new HttpStatus().METHOD_FAILURE()).isEqualTo(HttpStatus.METHOD_FAILURE);
}
@Test
public void DESTINATION_LOCKED() {
BDDAssertions.then(HttpStatus.DESTINATION_LOCKED).isEqualTo(421);
BDDAssertions.then(new HttpStatus().DESTINATION_LOCKED()).isEqualTo(HttpStatus.DESTINATION_LOCKED);
}
@Test
public void UNPROCESSABLE_ENTITY() {
BDDAssertions.then(HttpStatus.UNPROCESSABLE_ENTITY).isEqualTo(422);
BDDAssertions.then(new HttpStatus().UNPROCESSABLE_ENTITY()).isEqualTo(HttpStatus.UNPROCESSABLE_ENTITY);
}
@Test
public void LOCKED() {
BDDAssertions.then(HttpStatus.LOCKED).isEqualTo(423);
BDDAssertions.then(new HttpStatus().LOCKED()).isEqualTo(HttpStatus.LOCKED);
}
@Test
public void FAILED_DEPENDENCY() {
BDDAssertions.then(HttpStatus.FAILED_DEPENDENCY).isEqualTo(424);
BDDAssertions.then(new HttpStatus().FAILED_DEPENDENCY()).isEqualTo(HttpStatus.FAILED_DEPENDENCY);
}
@Test
public void UPGRADE_REQUIRED() {
BDDAssertions.then(HttpStatus.UPGRADE_REQUIRED).isEqualTo(426);
BDDAssertions.then(new HttpStatus().UPGRADE_REQUIRED()).isEqualTo(HttpStatus.UPGRADE_REQUIRED);
}
@Test
public void PRECONDITION_REQUIRED() {
BDDAssertions.then(HttpStatus.PRECONDITION_REQUIRED).isEqualTo(428);
BDDAssertions.then(new HttpStatus().PRECONDITION_REQUIRED()).isEqualTo(HttpStatus.PRECONDITION_REQUIRED);
}
@Test
public void TOO_MANY_REQUESTS() {
BDDAssertions.then(HttpStatus.TOO_MANY_REQUESTS).isEqualTo(429);
BDDAssertions.then(new HttpStatus().TOO_MANY_REQUESTS()).isEqualTo(HttpStatus.TOO_MANY_REQUESTS);
}
@Test
public void REQUEST_HEADER_FIELDS_TOO_LARGE() {
BDDAssertions.then(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE).isEqualTo(431);
BDDAssertions.then(new HttpStatus().REQUEST_HEADER_FIELDS_TOO_LARGE())
.isEqualTo(HttpStatus.REQUEST_HEADER_FIELDS_TOO_LARGE);
}
@Test
public void UNAVAILABLE_FOR_LEGAL_REASONS() {
BDDAssertions.then(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS).isEqualTo(451);
BDDAssertions.then(new HttpStatus().UNAVAILABLE_FOR_LEGAL_REASONS())
.isEqualTo(HttpStatus.UNAVAILABLE_FOR_LEGAL_REASONS);
}
@Test
public void INTERNAL_SERVER_ERROR() {
BDDAssertions.then(HttpStatus.INTERNAL_SERVER_ERROR).isEqualTo(500);
BDDAssertions.then(new HttpStatus().INTERNAL_SERVER_ERROR()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
}
@Test
public void NOT_IMPLEMENTED() {
BDDAssertions.then(HttpStatus.NOT_IMPLEMENTED).isEqualTo(501);
BDDAssertions.then(new HttpStatus().NOT_IMPLEMENTED()).isEqualTo(HttpStatus.NOT_IMPLEMENTED);
}
@Test
public void BAD_GATEWAY() {
BDDAssertions.then(HttpStatus.BAD_GATEWAY).isEqualTo(502);
BDDAssertions.then(new HttpStatus().BAD_GATEWAY()).isEqualTo(HttpStatus.BAD_GATEWAY);
}
@Test
public void SERVICE_UNAVAILABLE() {
BDDAssertions.then(HttpStatus.SERVICE_UNAVAILABLE).isEqualTo(503);
BDDAssertions.then(new HttpStatus().SERVICE_UNAVAILABLE()).isEqualTo(HttpStatus.SERVICE_UNAVAILABLE);
}
@Test
public void GATEWAY_TIMEOUT() {
BDDAssertions.then(HttpStatus.GATEWAY_TIMEOUT).isEqualTo(504);
BDDAssertions.then(new HttpStatus().GATEWAY_TIMEOUT()).isEqualTo(HttpStatus.GATEWAY_TIMEOUT);
}
@Test
public void HTTP_VERSION_NOT_SUPPORTED() {
BDDAssertions.then(HttpStatus.HTTP_VERSION_NOT_SUPPORTED).isEqualTo(505);
BDDAssertions.then(new HttpStatus().HTTP_VERSION_NOT_SUPPORTED())
.isEqualTo(HttpStatus.HTTP_VERSION_NOT_SUPPORTED);
}
@Test
public void VARIANT_ALSO_NEGOTIATES() {
BDDAssertions.then(HttpStatus.VARIANT_ALSO_NEGOTIATES).isEqualTo(506);
BDDAssertions.then(new HttpStatus().VARIANT_ALSO_NEGOTIATES()).isEqualTo(HttpStatus.VARIANT_ALSO_NEGOTIATES);
}
@Test
public void INSUFFICIENT_STORAGE() {
BDDAssertions.then(HttpStatus.INSUFFICIENT_STORAGE).isEqualTo(507);
BDDAssertions.then(new HttpStatus().INSUFFICIENT_STORAGE()).isEqualTo(HttpStatus.INSUFFICIENT_STORAGE);
}
@Test
public void LOOP_DETECTED() {
BDDAssertions.then(HttpStatus.LOOP_DETECTED).isEqualTo(508);
BDDAssertions.then(new HttpStatus().LOOP_DETECTED()).isEqualTo(HttpStatus.LOOP_DETECTED);
}
@Test
public void BANDWIDTH_LIMIT_EXCEEDED() {
BDDAssertions.then(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED).isEqualTo(509);
BDDAssertions.then(new HttpStatus().BANDWIDTH_LIMIT_EXCEEDED()).isEqualTo(HttpStatus.BANDWIDTH_LIMIT_EXCEEDED);
}
@Test
public void NOT_EXTENDED() {
BDDAssertions.then(HttpStatus.NOT_EXTENDED).isEqualTo(510);
BDDAssertions.then(new HttpStatus().NOT_EXTENDED()).isEqualTo(HttpStatus.NOT_EXTENDED);
}
@Test
public void NETWORK_AUTHENTICATION_REQUIRED() {
BDDAssertions.then(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED).isEqualTo(511);
BDDAssertions.then(new HttpStatus().NETWORK_AUTHENTICATION_REQUIRED())
.isEqualTo(HttpStatus.NETWORK_AUTHENTICATION_REQUIRED);
}
}

View File

@@ -59,33 +59,6 @@ public class ContractDownloader {
this.projectVersion = projectVersion;
}
/**
* Downloads JAR containing all the contracts. Plugin configuration gets updated with
* the inclusion pattern for the downloaded contracts. The JAR with the contracts
* contains all the contracts for all the projects. We're interested only in its
* subset.
* @param config - Plugin configuration that will get updated with the inclusion
* pattern
* @return location of the unpacked downloaded stubs
*/
// Use unpackAndDownloadContracts() and createNewInclusionProperties() instead
@Deprecated
public File unpackedDownloadedContracts(ContractVerifierConfigProperties config) {
File contractsDirectory = unpackAndDownloadContracts();
updatePropertiesWithInclusion(contractsDirectory, config);
return contractsDirectory;
}
// Use createNewInclusionProperties() instead
@Deprecated
public ContractVerifierConfigProperties updatePropertiesWithInclusion(File contractsDirectory,
ContractVerifierConfigProperties config) {
final InclusionProperties newInclusionProperties = createNewInclusionProperties(contractsDirectory);
config.setIncludedContracts(newInclusionProperties.getIncludedContracts());
config.setIncludedRootFolderAntPattern(newInclusionProperties.getIncludedRootFolderAntPattern());
return config;
}
/**
* Downloads JAR containing all the contracts. The JAR with the contracts contains all
* the contracts for all the projects. We're interested only in its subset.

View File

@@ -86,7 +86,6 @@ class GitRepo {
}
// for tests
@Deprecated
GitRepo(File basedir) {
this.basedir = basedir;
this.gitFactory = new JGitFactory();
@@ -94,7 +93,6 @@ class GitRepo {
}
// for tests
@Deprecated
GitRepo(File basedir, boolean ensureGitSuffix) {
this.basedir = basedir;
this.gitFactory = new JGitFactory();
@@ -102,7 +100,6 @@ class GitRepo {
}
// for tests
@Deprecated
GitRepo(File basedir, JGitFactory factory) {
this.basedir = basedir;
this.gitFactory = factory;

View File

@@ -45,34 +45,12 @@ public interface HttpServerStub {
*/
boolean isRunning();
/**
* Starts the server on a random port. Should return itself to allow chaining.
* @deprecated use {@link HttpServerStub#start(HttpServerStubConfiguration)}
* @return this
*/
@Deprecated
HttpServerStub start();
/**
* Starts the server on a given port. Should return itself to allow chaining.
* @deprecated use {@link HttpServerStub#start(HttpServerStubConfiguration)}
* @param port port on which the server should be ran
* @return this
*/
@Deprecated
HttpServerStub start(int port);
/**
* Starts the server. Should return itself to allow chaining.
* @param configuration - setup for the given stub
* @return this
*/
default HttpServerStub start(HttpServerStubConfiguration configuration) {
if (configuration.isRandomPort()) {
return start();
}
return start(configuration.port);
};
HttpServerStub start(HttpServerStubConfiguration configuration);
/**
* Stops the server. Should return itself to allow chaining.

View File

@@ -35,12 +35,7 @@ class NoOpHttpServerStub implements HttpServerStub {
}
@Override
public HttpServerStub start() {
return this;
}
@Override
public HttpServerStub start(int port) {
public HttpServerStub start(HttpServerStubConfiguration configuration) {
return this;
}

View File

@@ -1,142 +0,0 @@
/*
* Copyright 2013-2020 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
*
* https://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.cloud.contract.stubrunner;
import java.io.IOException;
import java.util.Arrays;
import joptsimple.ArgumentAcceptingOptionSpec;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties;
/**
* Class to run stub runner as a standalone process.
*
* @author Marcin Grzejszczak
* @deprecated - use Stub Runner Boot server
*/
@Deprecated
public class StubRunnerMain {
private static final Log log = LogFactory.getLog(StubRunnerMain.class);
private final Arguments arguments;
private StubRunnerMain(String[] args) throws Exception {
OptionParser parser = new OptionParser();
try {
ArgumentAcceptingOptionSpec<Integer> minPortValueOpt = parser
.acceptsAll(Arrays.asList("minp", "minPort"),
"Minimum port value to be assigned to the WireMock instance. Defaults to 10000")
.withRequiredArg().ofType(Integer.class).defaultsTo(10000);
ArgumentAcceptingOptionSpec<Integer> maxPortValueOpt = parser
.acceptsAll(Arrays.asList("maxp", "maxPort"),
"Maximum port value to be assigned to the WireMock instance. Defaults to 15000")
.withRequiredArg().ofType(Integer.class).defaultsTo(15000);
ArgumentAcceptingOptionSpec<String> stubsOpt = parser
.acceptsAll(Arrays.asList("s", "stubs"),
"Comma separated list of Ivy representation "
+ "of jars with stubs. Eg. groupid:artifactid1,groupid2:artifactid2:classifier")
.withRequiredArg();
ArgumentAcceptingOptionSpec<String> classifierOpt = parser
.acceptsAll(Arrays.asList("c", "classifier"), "Suffix for the jar containing stubs (e.g. 'stubs' "
+ "if the stub jar would have a 'stubs' classifier for stubs: foobar-stubs ). Defaults to 'stubs'")
.withRequiredArg().defaultsTo("stubs");
ArgumentAcceptingOptionSpec<String> rootOpt = parser
.acceptsAll(Arrays.asList("r", "root"),
"Location of a Jar containing server where you keep "
+ "your stubs (e.g. https://nexus.net/content/repositories/repository)")
.withRequiredArg();
ArgumentAcceptingOptionSpec<String> usernameOpt = parser
.acceptsAll(Arrays.asList("u", "username"), "Username to user when connecting to repository")
.withOptionalArg();
ArgumentAcceptingOptionSpec<String> passwordOpt = parser
.acceptsAll(Arrays.asList("p", "password"), "Password to user when connecting to repository")
.withOptionalArg();
ArgumentAcceptingOptionSpec<String> proxyHostOpt = parser
.acceptsAll(Arrays.asList("phost", "proxyHost"), "Proxy host to use for repository requests")
.withOptionalArg();
ArgumentAcceptingOptionSpec<Integer> proxyPortOpt = parser
.acceptsAll(Arrays.asList("pport", "proxyPort"), "Proxy port to use for repository requests")
.withOptionalArg().ofType(Integer.class);
ArgumentAcceptingOptionSpec<String> stubsMode = parser
.acceptsAll(Arrays.asList("sm", "stubsMode"),
"Stubs mode to be used. Acceptable values "
+ Arrays.toString(StubRunnerProperties.StubsMode.values()))
.withRequiredArg().defaultsTo(StubRunnerProperties.StubsMode.CLASSPATH.toString());
OptionSet options = parser.parse(args);
String stubs = options.valueOf(stubsOpt);
StubRunnerProperties.StubsMode stubsModeValue = StubRunnerProperties.StubsMode
.valueOf(options.valueOf(stubsMode));
Integer minPortValue = options.valueOf(minPortValueOpt);
Integer maxPortValue = options.valueOf(maxPortValueOpt);
String stubRepositoryRoot = options.valueOf(rootOpt);
String stubsSuffix = options.valueOf(classifierOpt);
final String username = options.valueOf(usernameOpt);
final String password = options.valueOf(passwordOpt);
final String proxyHost = options.valueOf(proxyHostOpt);
final Integer proxyPort = options.valueOf(proxyPortOpt);
final StubRunnerOptionsBuilder builder = new StubRunnerOptionsBuilder()
.withMinMaxPort(minPortValue, maxPortValue).withStubRepositoryRoot(stubRepositoryRoot)
.withStubsMode(stubsModeValue).withStubsClassifier(stubsSuffix).withUsername(username)
.withPassword(password).withStubs(stubs);
if (proxyHost != null) {
builder.withProxy(proxyHost, proxyPort);
}
StubRunnerOptions stubRunnerOptions = builder.build();
this.arguments = new Arguments(stubRunnerOptions);
}
catch (Exception e) {
printErrorMessage(e, parser);
throw e;
}
}
public static void main(String[] args) throws Exception {
new StubRunnerMain(args).execute();
}
private void printErrorMessage(Exception e, OptionParser parser) throws IOException {
System.err.println(e.getMessage());
System.err.println("java -jar stub-runner.jar [options...] ");
parser.printHelpOn(System.err);
System.err.println();
System.err.println("Example: java -jar stub-runner.jar ${parser.printExample(ALL)}");
}
private void execute() {
try {
if (log.isDebugEnabled()) {
log.debug("Launching StubRunner with args: " + this.arguments);
}
// TODO: Pass StubsToRun either from String or File
BatchStubRunner stubRunner = new BatchStubRunnerFactory(this.arguments.getStubRunnerOptions())
.buildBatchStubRunner();
RunningStubs runningCollaborators = stubRunner.runStubs();
log.info(runningCollaborators.toString());
}
catch (Exception e) {
log.error("An exception occurred while trying to execute the stubs", e);
throw e;
}
}
}

View File

@@ -293,20 +293,10 @@ public class StubRunnerOptions {
return this.stubsPerConsumer;
}
@Deprecated
public void setStubsPerConsumer(boolean stubsPerConsumer) {
this.stubsPerConsumer = stubsPerConsumer;
}
public String getConsumerName() {
return this.consumerName;
}
@Deprecated
public void setConsumerName(String consumerName) {
this.consumerName = consumerName;
}
public boolean hasMappingsOutputFolder() {
return StringUtils.hasText(this.mappingsOutputFolder);
}
@@ -315,20 +305,10 @@ public class StubRunnerOptions {
return this.mappingsOutputFolder;
}
@Deprecated
public void setMappingsOutputFolder(String mappingsOutputFolder) {
this.mappingsOutputFolder = mappingsOutputFolder;
}
public boolean isDeleteStubsAfterTest() {
return this.deleteStubsAfterTest;
}
@Deprecated
public void setDeleteStubsAfterTest(boolean deleteStubsAfterTest) {
this.deleteStubsAfterTest = deleteStubsAfterTest;
}
public boolean isGenerateStubs() {
return this.generateStubs;
}
@@ -341,11 +321,6 @@ public class StubRunnerOptions {
return this.properties;
}
@Deprecated
public void setProperties(Map<String, String> properties) {
this.properties = properties;
}
public String getServerId() {
return this.serverId;
}

View File

@@ -53,7 +53,6 @@ import org.springframework.cloud.contract.verifier.dsl.wiremock.WireMockExtensio
import org.springframework.cloud.contract.wiremock.WireMockSpring;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.util.ClassUtils;
import org.springframework.util.SocketUtils;
import org.springframework.util.StreamUtils;
import org.springframework.util.StringUtils;
@@ -100,14 +99,7 @@ public class WireMockHttpServerStub implements HttpServerStub {
return extensions.toArray(new Extension[extensions.size()]);
}
/**
* Override this if you want to register your own helpers.
* @deprecated - please use the {@link WireMockExtensions} mechanism and pass the
* helpers in your implementation
* @return a mapping of helper names to its implementations
*/
@Deprecated
protected Map<String, Helper> helpers() {
private Map<String, Helper> helpers() {
Map<String, Helper> helpers = new HashMap<>();
helpers.put(HandlebarsJsonPathHelper.NAME, new HandlebarsJsonPathHelper());
helpers.put(HandlebarsEscapeHelper.NAME, new HandlebarsEscapeHelper());
@@ -124,36 +116,6 @@ public class WireMockHttpServerStub implements HttpServerStub {
return this.wireMockServer != null && this.wireMockServer.isRunning();
}
@Override
public HttpServerStub start() {
if (isRunning()) {
if (log.isTraceEnabled()) {
log.trace("The server is already running at port [" + port() + "]");
}
return this;
}
HttpServerStubConfiguration configuration = defaultConfiguration();
HttpServerStub serverStub = start(configuration);
cacheStubServer(configuration.randomPort, configuration.port);
return serverStub;
}
private HttpServerStubConfiguration defaultConfiguration(int port) {
return new HttpServerStubConfiguration(HttpServerStubConfigurer.NoOpHttpServerStubConfigurer.INSTANCE, null,
null, port);
}
private HttpServerStubConfiguration defaultConfiguration() {
int port = SocketUtils.findAvailableTcpPort();
return new HttpServerStubConfiguration(HttpServerStubConfigurer.NoOpHttpServerStubConfigurer.INSTANCE, null,
null, port, true);
}
@Override
public HttpServerStub start(int port) {
return start(defaultConfiguration(port));
}
@Override
public HttpServerStub start(HttpServerStubConfiguration configuration) {
if (isRunning()) {

View File

@@ -137,7 +137,7 @@ class StubRunnerCamelPredicateSpec extends Specification {
header("foo", 123)
}
messageBody(foo: 123)
stubMatchers {
bodyMatchers {
jsonPath('$.foo', byRegex("[0-9]{3}"))
}
}

View File

@@ -23,8 +23,11 @@ import spock.lang.Specification
import org.springframework.boot.test.system.OutputCaptureRule
import org.springframework.boot.test.web.client.TestRestTemplate
import org.springframework.cloud.contract.stubrunner.HttpServerStubConfiguration
import org.springframework.cloud.contract.stubrunner.HttpServerStubConfigurer
import org.springframework.http.HttpEntity
import org.springframework.http.HttpMethod
import org.springframework.util.SocketUtils
import org.springframework.web.client.RestTemplate
class WireMockHttpServerStubSpec extends Specification {
@@ -39,7 +42,8 @@ class WireMockHttpServerStubSpec extends Specification {
def 'should describe stub mapping'() {
given:
WireMockHttpServerStub mappingDescriptor = new WireMockHttpServerStub().start() as WireMockHttpServerStub
WireMockHttpServerStub mappingDescriptor = new WireMockHttpServerStub().start(new HttpServerStubConfiguration(HttpServerStubConfigurer.NoOpHttpServerStubConfigurer.INSTANCE, null,
null, SocketUtils.findAvailableTcpPort())) as WireMockHttpServerStub
when:
StubMapping mapping = mappingDescriptor.getMapping(MAPPING_DESCRIPTOR)
then:
@@ -64,7 +68,8 @@ class WireMockHttpServerStubSpec extends Specification {
def 'should make WireMock print out logs on INFO'() {
given:
WireMockHttpServerStub mappingDescriptor = new WireMockHttpServerStub().start() as WireMockHttpServerStub
WireMockHttpServerStub mappingDescriptor = new WireMockHttpServerStub().start(new HttpServerStubConfiguration(HttpServerStubConfigurer.NoOpHttpServerStubConfigurer.INSTANCE, null,
null, SocketUtils.findAvailableTcpPort())) as WireMockHttpServerStub
mappingDescriptor.registerMappings([
new File(WireMockHttpServerStubSpec.classLoader.getResource("simple.json").toURI())
])

View File

@@ -35,7 +35,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.contract.spec.Contract;
import org.springframework.cloud.contract.verifier.config.ContractVerifierConfigProperties;
import org.springframework.cloud.contract.verifier.file.ContractFileScanner;
import org.springframework.cloud.contract.verifier.file.ContractFileScannerBuilder;
import org.springframework.cloud.contract.verifier.file.ContractMetadata;
@@ -65,31 +64,6 @@ public class RecursiveFilesConverter {
private final boolean excludeBuildFolders;
@Deprecated
public RecursiveFilesConverter(ContractVerifierConfigProperties props, StubGeneratorProvider holder) {
this(props.getStubsOutputDir(), props.getContractsDslDir(), props.getExcludedFiles(),
props.getIncludedContracts(), props.getExcludeBuildFolders(), holder);
}
@Deprecated
public RecursiveFilesConverter(ContractVerifierConfigProperties props) {
this(props.getStubsOutputDir(), props.getContractsDslDir(), props.getExcludedFiles(),
props.getIncludedContracts(), props.getExcludeBuildFolders(), null);
}
@Deprecated
public RecursiveFilesConverter(ContractVerifierConfigProperties props, File stubsOutputDir) {
this(stubsOutputDir, props.getContractsDslDir(), props.getExcludedFiles(), props.getIncludedContracts(),
props.getExcludeBuildFolders(), null);
}
@Deprecated
public RecursiveFilesConverter(ContractVerifierConfigProperties props, File stubsOutputDir,
StubGeneratorProvider holder) {
this(stubsOutputDir, props.getContractsDslDir(), props.getExcludedFiles(), props.getIncludedContracts(),
props.getExcludeBuildFolders(), holder);
}
public RecursiveFilesConverter(File stubsOutputDir, File contractsDslDir, List<String> excludedFiles,
String includedContracts, boolean excludeBuildFolders, StubGeneratorProvider holder) {
this.outMappingsDir = stubsOutputDir;

View File

@@ -2,7 +2,6 @@ buildscript {
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://repo.spring.io/plugins-release' }
if (project.hasProperty('fatJar')) {
jcenter()
}

View File

@@ -151,15 +151,6 @@ public class ConvertMojo extends AbstractMojo {
@Parameter(property = "contractsRepositoryProxyPort")
private Integer contractsRepositoryProxyPort;
/**
* If {@code true} then will not assert whether a stub / contract JAR was downloaded
* from local or remote location.
* @deprecated - with 2.1.0 this option is redundant
*/
@Parameter(property = "contractsSnapshotCheckSkip", defaultValue = "false")
@Deprecated
private boolean contractsSnapshotCheckSkip;
/**
* If set to {@code false} will NOT delete stubs from a temporary folder after running
* tests.

View File

@@ -205,15 +205,6 @@ public class GenerateTestsMojo extends AbstractMojo {
@Parameter(property = "contractsRepositoryProxyPort")
private Integer contractsRepositoryProxyPort;
/**
* If {@code true} then will not assert whether a stub / contract JAR was downloaded
* from local or remote location.
* @deprecated - with 2.1.0 this option is redundant
*/
@Parameter(property = "contractsSnapshotCheckSkip", defaultValue = "false")
@Deprecated
private boolean contractsSnapshotCheckSkip;
/**
* If set to {@code false} will NOT delete stubs from a temporary folder after running
* tests.

View File

@@ -20,15 +20,12 @@ import java.util.Arrays;
import org.springframework.cloud.contract.verifier.config.TestMode;
class ExplicitRestAssuredImports implements Imports, RestAssuredVerifier {
class ExplicitRestAssuredImports implements Imports {
private final BlockBuilder blockBuilder;
private final GeneratedClassMetaData generatedClassMetaData;
private static final String[] REST_ASSURED_2_IMPORTS = {
"com.jayway.restassured.specification.RequestSpecification", "com.jayway.restassured.response.Response" };
private static final String[] REST_ASSURED_3_IMPORTS = { "io.restassured.specification.RequestSpecification",
"io.restassured.response.Response" };
@@ -39,8 +36,7 @@ class ExplicitRestAssuredImports implements Imports, RestAssuredVerifier {
@Override
public Imports call() {
Arrays.stream(isRestAssured2Present() ? REST_ASSURED_2_IMPORTS : REST_ASSURED_3_IMPORTS)
.forEach(s -> this.blockBuilder.addLineWithEnding("import " + s));
Arrays.stream(REST_ASSURED_3_IMPORTS).forEach(s -> this.blockBuilder.addLineWithEnding("import " + s));
return this;
}

View File

@@ -20,14 +20,12 @@ import java.util.Arrays;
import org.springframework.cloud.contract.verifier.config.TestMode;
class ExplicitRestAssuredStaticImports implements Imports, RestAssuredVerifier {
class ExplicitRestAssuredStaticImports implements Imports {
private final BlockBuilder blockBuilder;
private final GeneratedClassMetaData generatedClassMetaData;
private static final String[] REST_ASSURED_2_IMPORTS = { "com.jayway.restassured.RestAssured.*" };
private static final String[] REST_ASSURED_3_IMPORTS = { "io.restassured.RestAssured.*" };
ExplicitRestAssuredStaticImports(BlockBuilder blockBuilder, GeneratedClassMetaData generatedClassMetaData) {
@@ -37,8 +35,7 @@ class ExplicitRestAssuredStaticImports implements Imports, RestAssuredVerifier {
@Override
public Imports call() {
Arrays.stream(isRestAssured2Present() ? REST_ASSURED_2_IMPORTS : REST_ASSURED_3_IMPORTS)
.forEach(s -> this.blockBuilder.addLineWithEnding("import static " + s));
Arrays.stream(REST_ASSURED_3_IMPORTS).forEach(s -> this.blockBuilder.addLineWithEnding("import static " + s));
return this;
}

View File

@@ -18,9 +18,6 @@ package org.springframework.cloud.contract.verifier.builder;
import java.util.Collection;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.contract.verifier.config.ContractVerifierConfigProperties;
import org.springframework.cloud.contract.verifier.file.ContractMetadata;
@@ -31,14 +28,6 @@ import org.springframework.cloud.contract.verifier.file.ContractMetadata;
*/
public class JavaTestGenerator implements SingleTestGenerator {
private static final Log log = LogFactory.getLog(JavaTestGenerator.class);
@Override
public String buildClass(ContractVerifierConfigProperties properties, Collection<ContractMetadata> listOfFiles,
String className, String classPackage, String includedDirectoryRelativePath) {
throw new UnsupportedOperationException("Deprecated method");
}
@Override
public String buildClass(ContractVerifierConfigProperties properties, Collection<ContractMetadata> listOfFiles,
String includedDirectoryRelativePath, GeneratedClassData generatedClassData) {

View File

@@ -20,17 +20,12 @@ import java.util.Arrays;
import org.springframework.cloud.contract.verifier.config.TestMode;
class MockMvcRestAssuredImports implements Imports, RestAssuredVerifier {
class MockMvcRestAssuredImports implements Imports {
private final BlockBuilder blockBuilder;
private final GeneratedClassMetaData generatedClassMetaData;
@Deprecated
private static final String[] REST_ASSURED_2_IMPORTS = {
"com.jayway.restassured.module.mockmvc.specification.MockMvcRequestSpecification",
"com.jayway.restassured.response.ResponseOptions" };
private static final String[] REST_ASSURED_3_IMPORTS = {
"io.restassured.module.mockmvc.specification.MockMvcRequestSpecification",
"io.restassured.response.ResponseOptions" };
@@ -42,8 +37,7 @@ class MockMvcRestAssuredImports implements Imports, RestAssuredVerifier {
@Override
public Imports call() {
Arrays.stream(isRestAssured2Present() ? REST_ASSURED_2_IMPORTS : REST_ASSURED_3_IMPORTS)
.forEach(s -> this.blockBuilder.addLineWithEnding("import " + s));
Arrays.stream(REST_ASSURED_3_IMPORTS).forEach(s -> this.blockBuilder.addLineWithEnding("import " + s));
return this;
}

View File

@@ -20,15 +20,12 @@ import java.util.Arrays;
import org.springframework.cloud.contract.verifier.config.TestMode;
class MockMvcRestAssuredStaticImports implements Imports, RestAssuredVerifier {
class MockMvcRestAssuredStaticImports implements Imports {
private final BlockBuilder blockBuilder;
private final GeneratedClassMetaData generatedClassMetaData;
private static final String[] REST_ASSURED_2_IMPORTS = {
"com.jayway.restassured.module.mockmvc.RestAssuredMockMvc.*" };
private static final String[] REST_ASSURED_3_IMPORTS = { "io.restassured.module.mockmvc.RestAssuredMockMvc.*" };
MockMvcRestAssuredStaticImports(BlockBuilder blockBuilder, GeneratedClassMetaData generatedClassMetaData) {
@@ -38,8 +35,7 @@ class MockMvcRestAssuredStaticImports implements Imports, RestAssuredVerifier {
@Override
public Imports call() {
Arrays.stream(isRestAssured2Present() ? REST_ASSURED_2_IMPORTS : REST_ASSURED_3_IMPORTS)
.forEach(s -> this.blockBuilder.addLineWithEnding("import static " + s));
Arrays.stream(REST_ASSURED_3_IMPORTS).forEach(s -> this.blockBuilder.addLineWithEnding("import static " + s));
return this;
}

View File

@@ -1,60 +0,0 @@
/*
* Copyright 2013-2020 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
*
* https://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.cloud.contract.verifier.builder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
interface RestAssuredVerifier {
Log log = LogFactory.getLog(RestAssuredVerifier.class);
// TODO: Remove in next major
String REST_ASSURED_2_0_CLASS = "com.jayway.restassured.RestAssured";
ClassPresenceChecker checker = new ClassPresenceChecker();
@Deprecated
default boolean isRestAssured2Present() {
boolean restAssured2Present = checker.isClassPresent(REST_ASSURED_2_0_CLASS);
if (restAssured2Present) {
log.warn("Rest Assured 2 found on the classpath. Please upgrade to the latest version of Rest Assured");
}
return restAssured2Present;
}
}
class ClassPresenceChecker {
private static final Log log = LogFactory.getLog(ClassPresenceChecker.class);
boolean isClassPresent(String className) {
try {
Class.forName(className);
return true;
}
catch (ClassNotFoundException ex) {
if (log.isTraceEnabled()) {
log.trace("[" + className + "] is not present on classpath");
}
return false;
}
}
}

View File

@@ -29,22 +29,6 @@ import org.springframework.cloud.contract.verifier.file.ContractMetadata;
*/
public interface SingleTestGenerator {
/**
* Creates contents of a single test class in which all test scenarios from the
* contract metadata should be placed.
* @param properties - properties passed to the plugin
* @param listOfFiles - list of parsed contracts with additional metadata
* @param className - the name of the generated test class
* @param classPackage - the name of the package in which the test class should be
* stored
* @param includedDirectoryRelativePath - relative path to the included directory
* @return contents of a single test class
* @deprecated use{@link SingleTestGenerator#buildClass(ContractVerifierConfigProperties, Collection, String, GeneratedClassData)}
*/
@Deprecated
String buildClass(ContractVerifierConfigProperties properties, Collection<ContractMetadata> listOfFiles,
String className, String classPackage, String includedDirectoryRelativePath);
/**
* Creates contents of a single test class in which all test scenarios from the
* contract metadata should be placed.

View File

@@ -20,16 +20,12 @@ import java.util.Arrays;
import org.springframework.cloud.contract.verifier.config.TestMode;
class WebTestClientRestAssuredImports implements Imports, RestAssuredVerifier {
class WebTestClientRestAssuredImports implements Imports {
private final BlockBuilder blockBuilder;
private final GeneratedClassMetaData generatedClassMetaData;
private static final String[] REST_ASSURED_2_IMPORTS = {
"com.jayway.restassured.module.webtestclient.specification.WebTestClientRequestSpecification",
"com.jayway.restassured.module.webtestclient.response.WebTestClientResponse" };
private static final String[] REST_ASSURED_3_IMPORTS = {
"io.restassured.module.webtestclient.specification.WebTestClientRequestSpecification",
"io.restassured.module.webtestclient.response.WebTestClientResponse" };
@@ -41,8 +37,7 @@ class WebTestClientRestAssuredImports implements Imports, RestAssuredVerifier {
@Override
public Imports call() {
Arrays.stream(isRestAssured2Present() ? REST_ASSURED_2_IMPORTS : REST_ASSURED_3_IMPORTS)
.forEach(s -> this.blockBuilder.addLineWithEnding("import " + s));
Arrays.stream(REST_ASSURED_3_IMPORTS).forEach(s -> this.blockBuilder.addLineWithEnding("import " + s));
return this;
}

View File

@@ -34,13 +34,6 @@ public class ContractVerifierConfigProperties {
private static final Log log = LogFactory.getLog(ContractVerifierConfigProperties.class);
/**
* For which unit test library tests should be generated.
* @deprecated - use {@code testFramework}
*/
@Deprecated
private TestFramework targetFramework;
/**
* For which unit test library tests should be generated.
*/
@@ -182,17 +175,6 @@ public class ContractVerifierConfigProperties {
*/
private boolean failOnInProgress = true;
@Deprecated
public void setTargetFramework(TestFramework targetFramework) {
log.warn("Please use the [testFramework] field. [targetFramework] is deprecated");
setTestFramework(targetFramework);
}
@Deprecated
public TestFramework getTargetFramework() {
return getTestFramework();
}
public TestFramework getTestFramework() {
return testFramework;
}

View File

@@ -16,8 +16,6 @@
package org.springframework.cloud.contract.verifier.config;
import java.util.List;
import org.springframework.cloud.contract.verifier.config.framework.CustomDefinition;
import org.springframework.cloud.contract.verifier.config.framework.JUnit5Definition;
import org.springframework.cloud.contract.verifier.config.framework.JUnitDefinition;
@@ -62,92 +60,6 @@ public enum TestFramework {
this.testFrameworkDefinition = testFrameworkDefinition;
}
/**
* @deprecated use{@link #TestFramework(TestFrameworkDefinition)}
* @param classModifier class modifier
* @param methodModifier method modifier
* @param lineSuffix line suffix
* @param classExtension class extension
* @param classNameSuffix class name suffix
* @param ignoreClass ignore class
* @param orderAnnotationImports order annotation imports
* @param orderAnnotation order annotation
*/
@Deprecated
TestFramework(final String classModifier, final String methodModifier, final String lineSuffix,
final String classExtension, final String classNameSuffix, final String ignoreClass,
final List<String> orderAnnotationImports, final String orderAnnotation) {
testFrameworkDefinition = new TestFrameworkDefinition() {
@Override
public String getClassModifier() {
return classModifier;
}
@Override
public String getMethodModifier() {
return methodModifier;
}
@Override
public String getLineSuffix() {
return lineSuffix;
}
@Override
public String getClassExtension() {
return classExtension;
}
@Override
public String getClassNameSuffix() {
return classNameSuffix;
}
@Override
public String getIgnoreClass() {
return ignoreClass;
}
@Override
public List<String> getOrderAnnotationImports() {
return orderAnnotationImports;
}
@Override
public String getOrderAnnotation() {
return orderAnnotation;
}
@Override
public String getIgnoreAnnotation() {
return "@Ignore";
}
@Override
public boolean annotationLevelRules() {
return false;
}
@Override
public String getRuleAnnotation(String annotationValue) {
throw new UnsupportedOperationException("Not available in framework.");
}
};
}
public String getClassModifier() {
return this.testFrameworkDefinition.getClassModifier();
}
public String getMethodModifier() {
return this.testFrameworkDefinition.getMethodModifier();
}
public String getLineSuffix() {
return this.testFrameworkDefinition.getLineSuffix();
}
public String getClassExtension() {
return this.testFrameworkDefinition.getClassExtension();
}
@@ -160,24 +72,8 @@ public enum TestFramework {
return this.testFrameworkDefinition.getIgnoreClass();
}
public List<String> getOrderAnnotationImports() {
return this.testFrameworkDefinition.getOrderAnnotationImports();
}
public String getOrderAnnotation() {
return this.testFrameworkDefinition.getOrderAnnotation();
}
public String getIgnoreAnnotation() {
return this.testFrameworkDefinition.getIgnoreAnnotation();
}
public boolean annotationLevelRules() {
return this.testFrameworkDefinition.annotationLevelRules();
}
public String getRuleAnnotation(String annotationValue) {
return this.testFrameworkDefinition.getRuleAnnotation(annotationValue);
}
}

View File

@@ -16,9 +16,6 @@
package org.springframework.cloud.contract.verifier.config.framework;
import java.util.ArrayList;
import java.util.List;
/**
* Defines elements characteristic of Custom test framework to be used during test class
* construction.
@@ -28,21 +25,6 @@ import java.util.List;
*/
public class CustomDefinition implements TestFrameworkDefinition {
@Override
public String getClassModifier() {
return "";
}
@Override
public String getMethodModifier() {
return "";
}
@Override
public String getLineSuffix() {
return "";
}
@Override
public String getClassExtension() {
return "";
@@ -58,29 +40,9 @@ public class CustomDefinition implements TestFrameworkDefinition {
return "";
}
@Override
public List<String> getOrderAnnotationImports() {
return new ArrayList<String>();
}
@Override
public String getOrderAnnotation() {
return "";
}
@Override
public String getIgnoreAnnotation() {
return "@Ignore";
}
@Override
public boolean annotationLevelRules() {
return false;
}
@Override
public String getRuleAnnotation(String annotationValue) {
throw new UnsupportedOperationException("Not available in framework.");
}
}

View File

@@ -16,9 +16,6 @@
package org.springframework.cloud.contract.verifier.config.framework;
import java.util.Arrays;
import java.util.List;
/**
* Defines elements characteristic of JUnit5 test framework to be used during test class
* construction.
@@ -28,21 +25,6 @@ import java.util.List;
*/
public class JUnit5Definition implements TestFrameworkDefinition {
@Override
public String getClassModifier() {
return "public ";
}
@Override
public String getMethodModifier() {
return "public void ";
}
@Override
public String getLineSuffix() {
return ";";
}
@Override
public String getClassExtension() {
return ".java";
@@ -58,29 +40,9 @@ public class JUnit5Definition implements TestFrameworkDefinition {
return "org.junit.jupiter.api.Disabled";
}
@Override
public List<String> getOrderAnnotationImports() {
return Arrays.asList("org.junit.jupiter.api.TestMethodOrder", "org.junit.jupiter.api.MethodOrderer");
}
@Override
public String getOrderAnnotation() {
return "@TestMethodOrder(MethodOrderer.Alphanumeric.class)";
}
@Override
public String getIgnoreAnnotation() {
return "@Disabled";
}
@Override
public boolean annotationLevelRules() {
return true;
}
@Override
public String getRuleAnnotation(final String annotationValue) {
return ("@ExtendWith(" + annotationValue + ".class)");
}
}

View File

@@ -16,10 +16,6 @@
package org.springframework.cloud.contract.verifier.config.framework;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Defines elements characteristic of JUnit test framework to be used during test class
* construction.
@@ -29,21 +25,6 @@ import java.util.List;
*/
public class JUnitDefinition implements TestFrameworkDefinition {
@Override
public String getClassModifier() {
return "public ";
}
@Override
public String getMethodModifier() {
return "public void ";
}
@Override
public String getLineSuffix() {
return ";";
}
@Override
public String getClassExtension() {
return ".java";
@@ -59,29 +40,9 @@ public class JUnitDefinition implements TestFrameworkDefinition {
return "org.junit.Ignore";
}
@Override
public List<String> getOrderAnnotationImports() {
return new ArrayList<String>(Arrays.asList("org.junit.FixMethodOrder", "org.junit.runners.MethodSorters"));
}
@Override
public String getOrderAnnotation() {
return "@FixMethodOrder(MethodSorters.NAME_ASCENDING)";
}
@Override
public String getIgnoreAnnotation() {
return "@Ignore";
}
@Override
public boolean annotationLevelRules() {
return false;
}
@Override
public String getRuleAnnotation(String annotationValue) {
throw new UnsupportedOperationException("Not available in JUnit.");
}
}

View File

@@ -16,10 +16,6 @@
package org.springframework.cloud.contract.verifier.config.framework;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* Defines elements characteristic of Spock test framework to be used during test class
* construction.
@@ -29,21 +25,6 @@ import java.util.List;
*/
public class SpockDefinition implements TestFrameworkDefinition {
@Override
public String getClassModifier() {
return "";
}
@Override
public String getMethodModifier() {
return "def ";
}
@Override
public String getLineSuffix() {
return "";
}
@Override
public String getClassExtension() {
return ".groovy";
@@ -59,29 +40,9 @@ public class SpockDefinition implements TestFrameworkDefinition {
return "spock.lang.Ignore";
}
@Override
public List<String> getOrderAnnotationImports() {
return new ArrayList<String>(Arrays.asList("spock.lang.Stepwise"));
}
@Override
public String getOrderAnnotation() {
return "@Stepwise";
}
@Override
public String getIgnoreAnnotation() {
return "@Ignore";
}
@Override
public boolean annotationLevelRules() {
return false;
}
@Override
public String getRuleAnnotation(String annotationValue) {
throw new UnsupportedOperationException("Not available in Spock.");
}
}

View File

@@ -16,8 +16,6 @@
package org.springframework.cloud.contract.verifier.config.framework;
import java.util.List;
/**
* @deprecated appropriate implementations of
* <code>org.springframework.cloud.contract.verifier.builder.Visitor</code> should be used
@@ -31,24 +29,6 @@ import java.util.List;
@Deprecated
public interface TestFrameworkDefinition {
/**
* @return the class access level modifier. E.g. for Java tests that would mean
* {@code public}
*/
String getClassModifier();
/**
* @return the method access level modifier along with the return type. E.g. for Java
* tests that would mean {@code public void}
*/
String getMethodModifier();
/**
* @return the characters that should end each line. E.g. for Java tests that would
* mean {@code ;}
*/
String getLineSuffix();
/**
* @return the file extension. E.g. for Java tests that would be {@code .java}
*/
@@ -65,36 +45,10 @@ public interface TestFrameworkDefinition {
*/
String getIgnoreClass();
/**
* @return the qualified names of the classes that are used for arranging tests into
* scenarios. E.g. for JUnit 4 tests that would be {@code 'org.junit.FixMethodOrder'},
* {@code 'org.junit.runners.MethodSorters'}
*/
List<String> getOrderAnnotationImports();
/**
* @return the annotation used for arranging tests into scenarios. E.g. for JUnit test
* that would be {@code @FixMethodOrder(MethodSorters.NAME_ASCENDING)}
*/
String getOrderAnnotation();
/**
* @return the annotation used for ignoring or disabling tests. E.g. for JUnit tests
* that would mean {@code @Ignore}
*/
String getIgnoreAnnotation();
/**
* @return a boolean indicating whether an annotation-type rule or extension is being
* used or not. E.g. for JUnit 5 tests that would return {@code true}
*/
boolean annotationLevelRules();
/**
* @param annotationValue value of the annotation
* @return the test rule or extension annotation with the annotationValue passed as an
* argument. E.g. for JUnit 5 tests that could be {@code @ExtendWith(Example.class)}
*/
String getRuleAnnotation(String annotationValue);
}

View File

@@ -16,8 +16,6 @@
package org.springframework.cloud.contract.verifier.config.framework;
import java.util.List;
/**
* Defines elements characteristic of TestNG test framework to be used during test class
* construction.
@@ -27,21 +25,6 @@ import java.util.List;
*/
public class TestNGDefinition implements TestFrameworkDefinition {
@Override
public String getClassModifier() {
return "public ";
}
@Override
public String getMethodModifier() {
return "public void ";
}
@Override
public String getLineSuffix() {
return ";";
}
@Override
public String getClassExtension() {
return ".java";
@@ -58,30 +41,10 @@ public class TestNGDefinition implements TestFrameworkDefinition {
"There is no @Ignore annotation for TestNG. A test can be disabled directly in the @Test annotation");
}
@Override
public List<String> getOrderAnnotationImports() {
throw new UnsupportedOperationException("Not implemented yet in TestNG");
}
@Override
public String getOrderAnnotation() {
throw new UnsupportedOperationException("Not implemented yet in TestNG");
}
@Override
public String getIgnoreAnnotation() {
throw new UnsupportedOperationException(
"There is no @Ignore annotation for TestNG. A test can be disabled directly in the @Test annotation");
}
@Override
public boolean annotationLevelRules() {
return false;
}
@Override
public String getRuleAnnotation(String annotationValue) {
throw new UnsupportedOperationException("Not available in TestNG.");
}
}

View File

@@ -73,15 +73,6 @@ public class SpringAmqpStubMessages implements MessageVerifier<Message> {
private RabbitProperties rabbitProperties;
@Deprecated
public SpringAmqpStubMessages(RabbitTemplate rabbitTemplate, MessageListenerAccessor messageListenerAccessor) {
Assert.notNull(rabbitTemplate, "RabbitTemplate must be set");
Assert.isTrue(mockingDetails(rabbitTemplate).isSpy() || mockingDetails(rabbitTemplate).isMock(),
"StubRunner AMQP will work only if RabbiTemplate is a spy");
this.rabbitTemplate = rabbitTemplate;
this.messageListenerAccessor = messageListenerAccessor;
}
@Autowired
public SpringAmqpStubMessages(RabbitTemplate rabbitTemplate, MessageListenerAccessor messageListenerAccessor,
RabbitProperties rabbitProperties) {

View File

@@ -29,7 +29,7 @@ User's information should be update if has appropriate age
firstName: "asd",
lastName : "asd"
])
stubMatchers {
bodyMatchers {
jsonPath('$.userId', byRegex("[1-9]{1}([0-9]{7})"))
jsonPath('$.age', byRegex("(1[89]|[2-9][0-9])"))
jsonPath('$.firstName', byRegex("[a-zA-Z]{2,20}"))
@@ -47,7 +47,7 @@ User's information should be update if has appropriate age
firstName: fromRequest().body("firstName"),
lastName : fromRequest().body("lastName")
])
testMatchers {
bodyMatchers {
jsonPath('$.userId', byEquality())
jsonPath('$.age', byEquality())
jsonPath('$.firstName', byEquality())

View File

@@ -23,7 +23,7 @@ import groovy.transform.CompileStatic
import groovy.util.logging.Commons
import org.springframework.cloud.contract.stubrunner.HttpServerStub
import org.springframework.util.SocketUtils
import org.springframework.cloud.contract.stubrunner.HttpServerStubConfiguration
@Commons
@CompileStatic
@@ -47,13 +47,8 @@ class MocoHttpServerStub implements HttpServerStub {
}
@Override
HttpServerStub start() {
return start(SocketUtils.findAvailableTcpPort())
}
@Override
HttpServerStub start(int port) {
this.port = port
HttpServerStub start(HttpServerStubConfiguration configuration) {
this.port = configuration.port
return this
}