forked from loafle/openapi-generator-original
[JAVA][Rest-assured] add more information about operations (#815)
Add swagger annotations to client and set default baseReqSpec and baseContextConsumer in ApiClient
This commit is contained in:
parent
79b993e6d5
commit
7b8f51a465
@ -6,22 +6,20 @@ import {{apiPackage}}.*;
|
||||
|
||||
{{#imports}}import {{import}};
|
||||
{{/imports}}
|
||||
|
||||
{{^fullJavaUtil}}
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.builder.RequestSpecBuilder;
|
||||
import io.restassured.builder.ResponseSpecBuilder;
|
||||
import io.restassured.response.Response;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static io.restassured.config.ObjectMapperConfig.objectMapperConfig;
|
||||
import static io.restassured.config.RestAssuredConfig.config;
|
||||
import static org.openapitools.client.GsonObjectMapper.gson;
|
||||
{{/fullJavaUtil}}
|
||||
|
||||
public class ApiClient {
|
||||
{{#basePath}}
|
||||
public static final String BASE_URI = "{{basePath}}";
|
||||
{{/basePath}}
|
||||
|
||||
private final Config config;
|
||||
|
||||
@ -42,7 +40,9 @@ public class ApiClient {
|
||||
{{/apiInfo}}
|
||||
|
||||
public static class Config {
|
||||
private Supplier<RequestSpecBuilder> baseReqSpec;
|
||||
private Supplier<RequestSpecBuilder> baseReqSpec = () -> new RequestSpecBuilder()
|
||||
{{#basePath}}.setBaseUri(BASE_URI){{/basePath}}
|
||||
.setConfig(config().objectMapperConfig(objectMapperConfig().defaultObjectMapper(gson())));
|
||||
|
||||
/**
|
||||
* Use common specification for all operations
|
||||
|
@ -15,7 +15,9 @@ import java.util.Map;
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.builder.RequestSpecBuilder;
|
||||
import io.restassured.builder.ResponseSpecBuilder;
|
||||
import io.restassured.http.Method;
|
||||
import io.restassured.response.Response;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.function.Consumer;
|
||||
@ -41,6 +43,15 @@ public class {{classname}} {
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
|
||||
@ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}"{{#hasAuthMethods}}, authorizations = {
|
||||
{{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = {
|
||||
{{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}},
|
||||
{{/hasMore}}{{/scopes}}
|
||||
}{{/isOAuth}}){{#hasMore}},
|
||||
{{/hasMore}}{{/authMethods}}
|
||||
}{{/hasAuthMethods}}, tags={ {{#tags}}{{#name}}"{{{name}}}"{{/name}}{{^-last}}, {{/-last}}{{/tags}} })
|
||||
@ApiResponses(value = { {{#responses}}
|
||||
@ApiResponse(code = {{{code}}}, message = "{{{message}}}") {{#hasMore}},{{/hasMore}}{{/responses}} })
|
||||
{{#isDeprecated}}
|
||||
@Deprecated
|
||||
{{/isDeprecated}}
|
||||
@ -83,29 +94,14 @@ public class {{classname}} {
|
||||
{{#isDeprecated}}
|
||||
@Deprecated
|
||||
{{/isDeprecated}}
|
||||
public class {{operationIdCamelCase}}Oper {
|
||||
public static class {{operationIdCamelCase}}Oper {
|
||||
|
||||
public static final String REQ_METHOD = "{{httpMethod}}";
|
||||
public static final Method REQ_METHOD = {{httpMethod}};
|
||||
public static final String REQ_URI = "{{path}}";
|
||||
public static final String SUMMARY = "{{{summary}}}";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public {{operationIdCamelCase}}Oper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
{{#vendorExtensions}}
|
||||
{{#x-contentType}}
|
||||
reqSpec.setContentType("{{x-contentType}}");
|
||||
{{/x-contentType}}
|
||||
{{#x-accepts}}
|
||||
reqSpec.setAccept("{{x-accepts}}");
|
||||
{{/x-accepts}}
|
||||
{{/vendorExtensions}}
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public {{operationIdCamelCase}}Oper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
{{#vendorExtensions}}
|
||||
@ -126,7 +122,7 @@ public class {{classname}} {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request({{httpMethod}}, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
{{#returnType}}
|
||||
|
||||
|
@ -15,20 +15,16 @@ package org.openapitools.client;
|
||||
|
||||
import org.openapitools.client.api.*;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.builder.RequestSpecBuilder;
|
||||
import io.restassured.builder.ResponseSpecBuilder;
|
||||
import io.restassured.response.Response;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static io.restassured.config.ObjectMapperConfig.objectMapperConfig;
|
||||
import static io.restassured.config.RestAssuredConfig.config;
|
||||
import static org.openapitools.client.GsonObjectMapper.gson;
|
||||
|
||||
public class ApiClient {
|
||||
public static final String BASE_URI = "http://petstore.swagger.io:80/v2";
|
||||
|
||||
private final Config config;
|
||||
|
||||
@ -60,7 +56,9 @@ public class ApiClient {
|
||||
}
|
||||
|
||||
public static class Config {
|
||||
private Supplier<RequestSpecBuilder> baseReqSpec;
|
||||
private Supplier<RequestSpecBuilder> baseReqSpec = () -> new RequestSpecBuilder()
|
||||
.setBaseUri(BASE_URI)
|
||||
.setConfig(config().objectMapperConfig(objectMapperConfig().defaultObjectMapper(gson())));
|
||||
|
||||
/**
|
||||
* Use common specification for all operations
|
||||
|
@ -24,7 +24,9 @@ import java.util.Map;
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.builder.RequestSpecBuilder;
|
||||
import io.restassured.builder.ResponseSpecBuilder;
|
||||
import io.restassured.http.Method;
|
||||
import io.restassured.response.Response;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.function.Consumer;
|
||||
@ -47,6 +49,9 @@ public class AnotherFakeApi {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", tags={ "$another-fake?" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") })
|
||||
public Call123testSpecialTagsOper call123testSpecialTags() {
|
||||
return new Call123testSpecialTagsOper(reqSpec);
|
||||
}
|
||||
@ -68,23 +73,14 @@ public class AnotherFakeApi {
|
||||
* @see #body client model (required)
|
||||
* return Client
|
||||
*/
|
||||
public class Call123testSpecialTagsOper {
|
||||
public static class Call123testSpecialTagsOper {
|
||||
|
||||
public static final String REQ_METHOD = "PATCH";
|
||||
public static final Method REQ_METHOD = PATCH;
|
||||
public static final String REQ_URI = "/another-fake/dummy";
|
||||
public static final String SUMMARY = "To test special tags";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public Call123testSpecialTagsOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/json");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public Call123testSpecialTagsOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/json");
|
||||
@ -99,7 +95,7 @@ public class AnotherFakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(PATCH, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -31,7 +31,9 @@ import java.util.Map;
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.builder.RequestSpecBuilder;
|
||||
import io.restassured.builder.ResponseSpecBuilder;
|
||||
import io.restassured.http.Method;
|
||||
import io.restassured.response.Response;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.function.Consumer;
|
||||
@ -54,46 +56,83 @@ public class FakeApi {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "", notes = "Test serialization of outer boolean types", tags={ "fake" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Output boolean") })
|
||||
public FakeOuterBooleanSerializeOper fakeOuterBooleanSerialize() {
|
||||
return new FakeOuterBooleanSerializeOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "", notes = "Test serialization of object with outer number type", tags={ "fake" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Output composite") })
|
||||
public FakeOuterCompositeSerializeOper fakeOuterCompositeSerialize() {
|
||||
return new FakeOuterCompositeSerializeOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "", notes = "Test serialization of outer number types", tags={ "fake" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Output number") })
|
||||
public FakeOuterNumberSerializeOper fakeOuterNumberSerialize() {
|
||||
return new FakeOuterNumberSerializeOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "", notes = "Test serialization of outer string types", tags={ "fake" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Output string") })
|
||||
public FakeOuterStringSerializeOper fakeOuterStringSerialize() {
|
||||
return new FakeOuterStringSerializeOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", tags={ "fake" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Success") })
|
||||
public TestBodyWithFileSchemaOper testBodyWithFileSchema() {
|
||||
return new TestBodyWithFileSchemaOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "", notes = "", tags={ "fake" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "Success") })
|
||||
public TestBodyWithQueryParamsOper testBodyWithQueryParams() {
|
||||
return new TestBodyWithQueryParamsOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", tags={ "fake" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") })
|
||||
public TestClientModelOper testClientModel() {
|
||||
return new TestClientModelOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", authorizations = {
|
||||
@Authorization(value = "http_basic_test")
|
||||
}, tags={ "fake" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied") ,
|
||||
@ApiResponse(code = 404, message = "User not found") })
|
||||
public TestEndpointParametersOper testEndpointParameters() {
|
||||
return new TestEndpointParametersOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", tags={ "fake" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid request") ,
|
||||
@ApiResponse(code = 404, message = "Not found") })
|
||||
public TestEnumParametersOper testEnumParameters() {
|
||||
return new TestEnumParametersOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "test inline additionalProperties", notes = "", tags={ "fake" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") })
|
||||
public TestInlineAdditionalPropertiesOper testInlineAdditionalProperties() {
|
||||
return new TestInlineAdditionalPropertiesOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "test json serialization of form data", notes = "", tags={ "fake" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") })
|
||||
public TestJsonFormDataOper testJsonFormData() {
|
||||
return new TestJsonFormDataOper(reqSpec);
|
||||
}
|
||||
@ -115,23 +154,14 @@ public class FakeApi {
|
||||
* @see #body Input boolean as post body (optional)
|
||||
* return Boolean
|
||||
*/
|
||||
public class FakeOuterBooleanSerializeOper {
|
||||
public static class FakeOuterBooleanSerializeOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/fake/outer/boolean";
|
||||
public static final String SUMMARY = "";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public FakeOuterBooleanSerializeOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("*/*");
|
||||
reqSpec.setAccept("*/*");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public FakeOuterBooleanSerializeOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("*/*");
|
||||
@ -146,7 +176,7 @@ public class FakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -195,23 +225,14 @@ public class FakeApi {
|
||||
* @see #body Input composite as post body (optional)
|
||||
* return OuterComposite
|
||||
*/
|
||||
public class FakeOuterCompositeSerializeOper {
|
||||
public static class FakeOuterCompositeSerializeOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/fake/outer/composite";
|
||||
public static final String SUMMARY = "";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public FakeOuterCompositeSerializeOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("*/*");
|
||||
reqSpec.setAccept("*/*");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public FakeOuterCompositeSerializeOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("*/*");
|
||||
@ -226,7 +247,7 @@ public class FakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -275,23 +296,14 @@ public class FakeApi {
|
||||
* @see #body Input number as post body (optional)
|
||||
* return BigDecimal
|
||||
*/
|
||||
public class FakeOuterNumberSerializeOper {
|
||||
public static class FakeOuterNumberSerializeOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/fake/outer/number";
|
||||
public static final String SUMMARY = "";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public FakeOuterNumberSerializeOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("*/*");
|
||||
reqSpec.setAccept("*/*");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public FakeOuterNumberSerializeOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("*/*");
|
||||
@ -306,7 +318,7 @@ public class FakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -355,23 +367,14 @@ public class FakeApi {
|
||||
* @see #body Input string as post body (optional)
|
||||
* return String
|
||||
*/
|
||||
public class FakeOuterStringSerializeOper {
|
||||
public static class FakeOuterStringSerializeOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/fake/outer/string";
|
||||
public static final String SUMMARY = "";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public FakeOuterStringSerializeOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("*/*");
|
||||
reqSpec.setAccept("*/*");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public FakeOuterStringSerializeOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("*/*");
|
||||
@ -386,7 +389,7 @@ public class FakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -434,23 +437,14 @@ public class FakeApi {
|
||||
*
|
||||
* @see #body (required)
|
||||
*/
|
||||
public class TestBodyWithFileSchemaOper {
|
||||
public static class TestBodyWithFileSchemaOper {
|
||||
|
||||
public static final String REQ_METHOD = "PUT";
|
||||
public static final Method REQ_METHOD = PUT;
|
||||
public static final String REQ_URI = "/fake/body-with-file-schema";
|
||||
public static final String SUMMARY = "";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public TestBodyWithFileSchemaOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/json");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public TestBodyWithFileSchemaOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/json");
|
||||
@ -465,7 +459,7 @@ public class FakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(PUT, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -504,23 +498,14 @@ public class FakeApi {
|
||||
* @see #queryQuery (required)
|
||||
* @see #body (required)
|
||||
*/
|
||||
public class TestBodyWithQueryParamsOper {
|
||||
public static class TestBodyWithQueryParamsOper {
|
||||
|
||||
public static final String REQ_METHOD = "PUT";
|
||||
public static final Method REQ_METHOD = PUT;
|
||||
public static final String REQ_URI = "/fake/body-with-query-params";
|
||||
public static final String SUMMARY = "";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public TestBodyWithQueryParamsOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/json");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public TestBodyWithQueryParamsOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/json");
|
||||
@ -535,7 +520,7 @@ public class FakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(PUT, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -585,23 +570,14 @@ public class FakeApi {
|
||||
* @see #body client model (required)
|
||||
* return Client
|
||||
*/
|
||||
public class TestClientModelOper {
|
||||
public static class TestClientModelOper {
|
||||
|
||||
public static final String REQ_METHOD = "PATCH";
|
||||
public static final Method REQ_METHOD = PATCH;
|
||||
public static final String REQ_URI = "/fake";
|
||||
public static final String SUMMARY = "To test \"client\" model";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public TestClientModelOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/json");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public TestClientModelOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/json");
|
||||
@ -616,7 +592,7 @@ public class FakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(PATCH, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -677,23 +653,14 @@ public class FakeApi {
|
||||
* @see #passwordForm None (optional, default to null)
|
||||
* @see #paramCallbackForm None (optional, default to null)
|
||||
*/
|
||||
public class TestEndpointParametersOper {
|
||||
public static class TestEndpointParametersOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/fake";
|
||||
public static final String SUMMARY = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public TestEndpointParametersOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/x-www-form-urlencoded");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public TestEndpointParametersOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/x-www-form-urlencoded");
|
||||
@ -708,7 +675,7 @@ public class FakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
public static final String INTEGER_FORM = "integer";
|
||||
@ -898,23 +865,14 @@ public class FakeApi {
|
||||
* @see #enumFormStringArrayForm Form parameter enum test (string array) (optional, default to $)
|
||||
* @see #enumFormStringForm Form parameter enum test (string) (optional, default to -efg)
|
||||
*/
|
||||
public class TestEnumParametersOper {
|
||||
public static class TestEnumParametersOper {
|
||||
|
||||
public static final String REQ_METHOD = "GET";
|
||||
public static final Method REQ_METHOD = GET;
|
||||
public static final String REQ_URI = "/fake";
|
||||
public static final String SUMMARY = "To test enum parameters";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public TestEnumParametersOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/x-www-form-urlencoded");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public TestEnumParametersOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/x-www-form-urlencoded");
|
||||
@ -929,7 +887,7 @@ public class FakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
public static final String ENUM_HEADER_STRING_ARRAY_HEADER = "enum_header_string_array";
|
||||
@ -1046,23 +1004,14 @@ public class FakeApi {
|
||||
*
|
||||
* @see #body request body (required)
|
||||
*/
|
||||
public class TestInlineAdditionalPropertiesOper {
|
||||
public static class TestInlineAdditionalPropertiesOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/fake/inline-additionalProperties";
|
||||
public static final String SUMMARY = "test inline additionalProperties";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public TestInlineAdditionalPropertiesOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/json");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public TestInlineAdditionalPropertiesOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/json");
|
||||
@ -1077,7 +1026,7 @@ public class FakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1116,23 +1065,14 @@ public class FakeApi {
|
||||
* @see #paramForm field1 (required)
|
||||
* @see #param2Form field2 (required)
|
||||
*/
|
||||
public class TestJsonFormDataOper {
|
||||
public static class TestJsonFormDataOper {
|
||||
|
||||
public static final String REQ_METHOD = "GET";
|
||||
public static final Method REQ_METHOD = GET;
|
||||
public static final String REQ_URI = "/fake/jsonFormData";
|
||||
public static final String SUMMARY = "test json serialization of form data";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public TestJsonFormDataOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/x-www-form-urlencoded");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public TestJsonFormDataOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/x-www-form-urlencoded");
|
||||
@ -1147,7 +1087,7 @@ public class FakeApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
public static final String PARAM_FORM = "param";
|
||||
|
@ -24,7 +24,9 @@ import java.util.Map;
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.builder.RequestSpecBuilder;
|
||||
import io.restassured.builder.ResponseSpecBuilder;
|
||||
import io.restassured.http.Method;
|
||||
import io.restassured.response.Response;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.function.Consumer;
|
||||
@ -47,6 +49,11 @@ public class FakeClassnameTags123Api {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "To test class name in snake case", notes = "To test class name in snake case", authorizations = {
|
||||
@Authorization(value = "api_key_query")
|
||||
}, tags={ "fake_classname_tags 123#$%^" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") })
|
||||
public TestClassnameOper testClassname() {
|
||||
return new TestClassnameOper(reqSpec);
|
||||
}
|
||||
@ -68,23 +75,14 @@ public class FakeClassnameTags123Api {
|
||||
* @see #body client model (required)
|
||||
* return Client
|
||||
*/
|
||||
public class TestClassnameOper {
|
||||
public static class TestClassnameOper {
|
||||
|
||||
public static final String REQ_METHOD = "PATCH";
|
||||
public static final Method REQ_METHOD = PATCH;
|
||||
public static final String REQ_URI = "/fake_classname_test";
|
||||
public static final String SUMMARY = "To test class name in snake case";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public TestClassnameOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/json");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public TestClassnameOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/json");
|
||||
@ -99,7 +97,7 @@ public class FakeClassnameTags123Api {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(PATCH, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,7 +26,9 @@ import java.util.Map;
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.builder.RequestSpecBuilder;
|
||||
import io.restassured.builder.ResponseSpecBuilder;
|
||||
import io.restassured.http.Method;
|
||||
import io.restassured.response.Response;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.function.Consumer;
|
||||
@ -49,39 +51,114 @@ public class PetApi {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "Add a new pet to the store", notes = "", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 405, message = "Invalid input") })
|
||||
public AddPetOper addPet() {
|
||||
return new AddPetOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Deletes a pet", notes = "", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid pet value") })
|
||||
public DeletePetOper deletePet() {
|
||||
return new DeletePetOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") ,
|
||||
@ApiResponse(code = 400, message = "Invalid status value") })
|
||||
public FindPetsByStatusOper findPetsByStatus() {
|
||||
return new FindPetsByStatusOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") ,
|
||||
@ApiResponse(code = 400, message = "Invalid tag value") })
|
||||
@Deprecated
|
||||
public FindPetsByTagsOper findPetsByTags() {
|
||||
return new FindPetsByTagsOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", authorizations = {
|
||||
@Authorization(value = "api_key")
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") ,
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied") ,
|
||||
@ApiResponse(code = 404, message = "Pet not found") })
|
||||
public GetPetByIdOper getPetById() {
|
||||
return new GetPetByIdOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Update an existing pet", notes = "", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied") ,
|
||||
@ApiResponse(code = 404, message = "Pet not found") ,
|
||||
@ApiResponse(code = 405, message = "Validation exception") })
|
||||
public UpdatePetOper updatePet() {
|
||||
return new UpdatePetOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Updates a pet in the store with form data", notes = "", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 405, message = "Invalid input") })
|
||||
public UpdatePetWithFormOper updatePetWithForm() {
|
||||
return new UpdatePetWithFormOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "uploads an image", notes = "", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") })
|
||||
public UploadFileOper uploadFile() {
|
||||
return new UploadFileOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "uploads an image (required)", notes = "", authorizations = {
|
||||
@Authorization(value = "petstore_auth", scopes = {
|
||||
@AuthorizationScope(scope = "write:pets", description = "modify pets in your account"),
|
||||
@AuthorizationScope(scope = "read:pets", description = "read your pets")
|
||||
})
|
||||
}, tags={ "pet" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") })
|
||||
public UploadFileWithRequiredFileOper uploadFileWithRequiredFile() {
|
||||
return new UploadFileWithRequiredFileOper(reqSpec);
|
||||
}
|
||||
@ -102,23 +179,14 @@ public class PetApi {
|
||||
*
|
||||
* @see #body Pet object that needs to be added to the store (required)
|
||||
*/
|
||||
public class AddPetOper {
|
||||
public static class AddPetOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/pet";
|
||||
public static final String SUMMARY = "Add a new pet to the store";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public AddPetOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/json");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public AddPetOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/json");
|
||||
@ -133,7 +201,7 @@ public class PetApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -172,22 +240,14 @@ public class PetApi {
|
||||
* @see #petIdPath Pet id to delete (required)
|
||||
* @see #apiKeyHeader (optional)
|
||||
*/
|
||||
public class DeletePetOper {
|
||||
public static class DeletePetOper {
|
||||
|
||||
public static final String REQ_METHOD = "DELETE";
|
||||
public static final Method REQ_METHOD = DELETE;
|
||||
public static final String REQ_URI = "/pet/{petId}";
|
||||
public static final String SUMMARY = "Deletes a pet";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public DeletePetOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public DeletePetOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setAccept("application/json");
|
||||
@ -201,7 +261,7 @@ public class PetApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(DELETE, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
public static final String API_KEY_HEADER = "api_key";
|
||||
@ -253,22 +313,14 @@ public class PetApi {
|
||||
* @see #statusQuery Status values that need to be considered for filter (required)
|
||||
* return List<Pet>
|
||||
*/
|
||||
public class FindPetsByStatusOper {
|
||||
public static class FindPetsByStatusOper {
|
||||
|
||||
public static final String REQ_METHOD = "GET";
|
||||
public static final Method REQ_METHOD = GET;
|
||||
public static final String REQ_URI = "/pet/findByStatus";
|
||||
public static final String SUMMARY = "Finds Pets by status";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public FindPetsByStatusOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public FindPetsByStatusOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setAccept("application/json");
|
||||
@ -282,7 +334,7 @@ public class PetApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -335,22 +387,14 @@ public class PetApi {
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public class FindPetsByTagsOper {
|
||||
public static class FindPetsByTagsOper {
|
||||
|
||||
public static final String REQ_METHOD = "GET";
|
||||
public static final Method REQ_METHOD = GET;
|
||||
public static final String REQ_URI = "/pet/findByTags";
|
||||
public static final String SUMMARY = "Finds Pets by tags";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public FindPetsByTagsOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public FindPetsByTagsOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setAccept("application/json");
|
||||
@ -364,7 +408,7 @@ public class PetApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -415,22 +459,14 @@ public class PetApi {
|
||||
* @see #petIdPath ID of pet to return (required)
|
||||
* return Pet
|
||||
*/
|
||||
public class GetPetByIdOper {
|
||||
public static class GetPetByIdOper {
|
||||
|
||||
public static final String REQ_METHOD = "GET";
|
||||
public static final Method REQ_METHOD = GET;
|
||||
public static final String REQ_URI = "/pet/{petId}";
|
||||
public static final String SUMMARY = "Find pet by ID";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public GetPetByIdOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public GetPetByIdOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setAccept("application/json");
|
||||
@ -444,7 +480,7 @@ public class PetApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -494,23 +530,14 @@ public class PetApi {
|
||||
*
|
||||
* @see #body Pet object that needs to be added to the store (required)
|
||||
*/
|
||||
public class UpdatePetOper {
|
||||
public static class UpdatePetOper {
|
||||
|
||||
public static final String REQ_METHOD = "PUT";
|
||||
public static final Method REQ_METHOD = PUT;
|
||||
public static final String REQ_URI = "/pet";
|
||||
public static final String SUMMARY = "Update an existing pet";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public UpdatePetOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/json");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public UpdatePetOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/json");
|
||||
@ -525,7 +552,7 @@ public class PetApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(PUT, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -565,23 +592,14 @@ public class PetApi {
|
||||
* @see #nameForm Updated name of the pet (optional, default to null)
|
||||
* @see #statusForm Updated status of the pet (optional, default to null)
|
||||
*/
|
||||
public class UpdatePetWithFormOper {
|
||||
public static class UpdatePetWithFormOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/pet/{petId}";
|
||||
public static final String SUMMARY = "Updates a pet in the store with form data";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public UpdatePetWithFormOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("application/x-www-form-urlencoded");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public UpdatePetWithFormOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("application/x-www-form-urlencoded");
|
||||
@ -596,7 +614,7 @@ public class PetApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
public static final String PET_ID_PATH = "petId";
|
||||
@ -661,23 +679,14 @@ public class PetApi {
|
||||
* @see #fileMultiPart file to upload (optional, default to null)
|
||||
* return ModelApiResponse
|
||||
*/
|
||||
public class UploadFileOper {
|
||||
public static class UploadFileOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/pet/{petId}/uploadImage";
|
||||
public static final String SUMMARY = "uploads an image";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public UploadFileOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("multipart/form-data");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public UploadFileOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("multipart/form-data");
|
||||
@ -692,7 +701,7 @@ public class PetApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -767,23 +776,14 @@ public class PetApi {
|
||||
* @see #additionalMetadataForm Additional data to pass to server (optional, default to null)
|
||||
* return ModelApiResponse
|
||||
*/
|
||||
public class UploadFileWithRequiredFileOper {
|
||||
public static class UploadFileWithRequiredFileOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/fake/{petId}/uploadImageWithRequiredFile";
|
||||
public static final String SUMMARY = "uploads an image (required)";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public UploadFileWithRequiredFileOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("multipart/form-data");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public UploadFileWithRequiredFileOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("multipart/form-data");
|
||||
@ -798,7 +798,7 @@ public class PetApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,7 +24,9 @@ import java.util.Map;
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.builder.RequestSpecBuilder;
|
||||
import io.restassured.builder.ResponseSpecBuilder;
|
||||
import io.restassured.http.Method;
|
||||
import io.restassured.response.Response;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.function.Consumer;
|
||||
@ -47,18 +49,36 @@ public class StoreApi {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", tags={ "store" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied") ,
|
||||
@ApiResponse(code = 404, message = "Order not found") })
|
||||
public DeleteOrderOper deleteOrder() {
|
||||
return new DeleteOrderOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", authorizations = {
|
||||
@Authorization(value = "api_key")
|
||||
}, tags={ "store" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") })
|
||||
public GetInventoryOper getInventory() {
|
||||
return new GetInventoryOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", tags={ "store" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") ,
|
||||
@ApiResponse(code = 400, message = "Invalid ID supplied") ,
|
||||
@ApiResponse(code = 404, message = "Order not found") })
|
||||
public GetOrderByIdOper getOrderById() {
|
||||
return new GetOrderByIdOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Place an order for a pet", notes = "", tags={ "store" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") ,
|
||||
@ApiResponse(code = 400, message = "Invalid Order") })
|
||||
public PlaceOrderOper placeOrder() {
|
||||
return new PlaceOrderOper(reqSpec);
|
||||
}
|
||||
@ -79,22 +99,14 @@ public class StoreApi {
|
||||
*
|
||||
* @see #orderIdPath ID of the order that needs to be deleted (required)
|
||||
*/
|
||||
public class DeleteOrderOper {
|
||||
public static class DeleteOrderOper {
|
||||
|
||||
public static final String REQ_METHOD = "DELETE";
|
||||
public static final Method REQ_METHOD = DELETE;
|
||||
public static final String REQ_URI = "/store/order/{order_id}";
|
||||
public static final String SUMMARY = "Delete purchase order by ID";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public DeleteOrderOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public DeleteOrderOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setAccept("application/json");
|
||||
@ -108,7 +120,7 @@ public class StoreApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(DELETE, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
public static final String ORDER_ID_PATH = "order_id";
|
||||
@ -148,22 +160,14 @@ public class StoreApi {
|
||||
*
|
||||
* return Map<String, Integer>
|
||||
*/
|
||||
public class GetInventoryOper {
|
||||
public static class GetInventoryOper {
|
||||
|
||||
public static final String REQ_METHOD = "GET";
|
||||
public static final Method REQ_METHOD = GET;
|
||||
public static final String REQ_URI = "/store/inventory";
|
||||
public static final String SUMMARY = "Returns pet inventories by status";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public GetInventoryOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public GetInventoryOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setAccept("application/json");
|
||||
@ -177,7 +181,7 @@ public class StoreApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -217,22 +221,14 @@ public class StoreApi {
|
||||
* @see #orderIdPath ID of pet that needs to be fetched (required)
|
||||
* return Order
|
||||
*/
|
||||
public class GetOrderByIdOper {
|
||||
public static class GetOrderByIdOper {
|
||||
|
||||
public static final String REQ_METHOD = "GET";
|
||||
public static final Method REQ_METHOD = GET;
|
||||
public static final String REQ_URI = "/store/order/{order_id}";
|
||||
public static final String SUMMARY = "Find purchase order by ID";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public GetOrderByIdOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public GetOrderByIdOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setAccept("application/json");
|
||||
@ -246,7 +242,7 @@ public class StoreApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -297,23 +293,14 @@ public class StoreApi {
|
||||
* @see #body order placed for purchasing the pet (required)
|
||||
* return Order
|
||||
*/
|
||||
public class PlaceOrderOper {
|
||||
public static class PlaceOrderOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/store/order";
|
||||
public static final String SUMMARY = "Place an order for a pet";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public PlaceOrderOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("*/*");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public PlaceOrderOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("*/*");
|
||||
@ -328,7 +315,7 @@ public class StoreApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -24,7 +24,9 @@ import java.util.Map;
|
||||
import io.restassured.RestAssured;
|
||||
import io.restassured.builder.RequestSpecBuilder;
|
||||
import io.restassured.builder.ResponseSpecBuilder;
|
||||
import io.restassured.http.Method;
|
||||
import io.restassured.response.Response;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.function.Consumer;
|
||||
@ -47,34 +49,63 @@ public class UserApi {
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", tags={ "user" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 0, message = "successful operation") })
|
||||
public CreateUserOper createUser() {
|
||||
return new CreateUserOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Creates list of users with given input array", notes = "", tags={ "user" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 0, message = "successful operation") })
|
||||
public CreateUsersWithArrayInputOper createUsersWithArrayInput() {
|
||||
return new CreateUsersWithArrayInputOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Creates list of users with given input array", notes = "", tags={ "user" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 0, message = "successful operation") })
|
||||
public CreateUsersWithListInputOper createUsersWithListInput() {
|
||||
return new CreateUsersWithListInputOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", tags={ "user" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied") ,
|
||||
@ApiResponse(code = 404, message = "User not found") })
|
||||
public DeleteUserOper deleteUser() {
|
||||
return new DeleteUserOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Get user by user name", notes = "", tags={ "user" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") ,
|
||||
@ApiResponse(code = 400, message = "Invalid username supplied") ,
|
||||
@ApiResponse(code = 404, message = "User not found") })
|
||||
public GetUserByNameOper getUserByName() {
|
||||
return new GetUserByNameOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Logs user into the system", notes = "", tags={ "user" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 200, message = "successful operation") ,
|
||||
@ApiResponse(code = 400, message = "Invalid username/password supplied") })
|
||||
public LoginUserOper loginUser() {
|
||||
return new LoginUserOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Logs out current logged in user session", notes = "", tags={ "user" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 0, message = "successful operation") })
|
||||
public LogoutUserOper logoutUser() {
|
||||
return new LogoutUserOper(reqSpec);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", tags={ "user" })
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(code = 400, message = "Invalid user supplied") ,
|
||||
@ApiResponse(code = 404, message = "User not found") })
|
||||
public UpdateUserOper updateUser() {
|
||||
return new UpdateUserOper(reqSpec);
|
||||
}
|
||||
@ -95,23 +126,14 @@ public class UserApi {
|
||||
*
|
||||
* @see #body Created user object (required)
|
||||
*/
|
||||
public class CreateUserOper {
|
||||
public static class CreateUserOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/user";
|
||||
public static final String SUMMARY = "Create user";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public CreateUserOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("*/*");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public CreateUserOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("*/*");
|
||||
@ -126,7 +148,7 @@ public class UserApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -164,23 +186,14 @@ public class UserApi {
|
||||
*
|
||||
* @see #body List of user object (required)
|
||||
*/
|
||||
public class CreateUsersWithArrayInputOper {
|
||||
public static class CreateUsersWithArrayInputOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/user/createWithArray";
|
||||
public static final String SUMMARY = "Creates list of users with given input array";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public CreateUsersWithArrayInputOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("*/*");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public CreateUsersWithArrayInputOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("*/*");
|
||||
@ -195,7 +208,7 @@ public class UserApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -233,23 +246,14 @@ public class UserApi {
|
||||
*
|
||||
* @see #body List of user object (required)
|
||||
*/
|
||||
public class CreateUsersWithListInputOper {
|
||||
public static class CreateUsersWithListInputOper {
|
||||
|
||||
public static final String REQ_METHOD = "POST";
|
||||
public static final Method REQ_METHOD = POST;
|
||||
public static final String REQ_URI = "/user/createWithList";
|
||||
public static final String SUMMARY = "Creates list of users with given input array";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public CreateUsersWithListInputOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("*/*");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public CreateUsersWithListInputOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("*/*");
|
||||
@ -264,7 +268,7 @@ public class UserApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -302,22 +306,14 @@ public class UserApi {
|
||||
*
|
||||
* @see #usernamePath The name that needs to be deleted (required)
|
||||
*/
|
||||
public class DeleteUserOper {
|
||||
public static class DeleteUserOper {
|
||||
|
||||
public static final String REQ_METHOD = "DELETE";
|
||||
public static final Method REQ_METHOD = DELETE;
|
||||
public static final String REQ_URI = "/user/{username}";
|
||||
public static final String SUMMARY = "Delete user";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public DeleteUserOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public DeleteUserOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setAccept("application/json");
|
||||
@ -331,7 +327,7 @@ public class UserApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(DELETE, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
public static final String USERNAME_PATH = "username";
|
||||
@ -372,22 +368,14 @@ public class UserApi {
|
||||
* @see #usernamePath The name that needs to be fetched. Use user1 for testing. (required)
|
||||
* return User
|
||||
*/
|
||||
public class GetUserByNameOper {
|
||||
public static class GetUserByNameOper {
|
||||
|
||||
public static final String REQ_METHOD = "GET";
|
||||
public static final Method REQ_METHOD = GET;
|
||||
public static final String REQ_URI = "/user/{username}";
|
||||
public static final String SUMMARY = "Get user by user name";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public GetUserByNameOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public GetUserByNameOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setAccept("application/json");
|
||||
@ -401,7 +389,7 @@ public class UserApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -453,22 +441,14 @@ public class UserApi {
|
||||
* @see #passwordQuery The password for login in clear text (required)
|
||||
* return String
|
||||
*/
|
||||
public class LoginUserOper {
|
||||
public static class LoginUserOper {
|
||||
|
||||
public static final String REQ_METHOD = "GET";
|
||||
public static final Method REQ_METHOD = GET;
|
||||
public static final String REQ_URI = "/user/login";
|
||||
public static final String SUMMARY = "Logs user into the system";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public LoginUserOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public LoginUserOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setAccept("application/json");
|
||||
@ -482,7 +462,7 @@ public class UserApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -542,22 +522,14 @@ public class UserApi {
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class LogoutUserOper {
|
||||
public static class LogoutUserOper {
|
||||
|
||||
public static final String REQ_METHOD = "GET";
|
||||
public static final Method REQ_METHOD = GET;
|
||||
public static final String REQ_URI = "/user/logout";
|
||||
public static final String SUMMARY = "Logs out current logged in user session";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public LogoutUserOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public LogoutUserOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setAccept("application/json");
|
||||
@ -571,7 +543,7 @@ public class UserApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -601,23 +573,14 @@ public class UserApi {
|
||||
* @see #usernamePath name that need to be deleted (required)
|
||||
* @see #body Updated user object (required)
|
||||
*/
|
||||
public class UpdateUserOper {
|
||||
public static class UpdateUserOper {
|
||||
|
||||
public static final String REQ_METHOD = "PUT";
|
||||
public static final Method REQ_METHOD = PUT;
|
||||
public static final String REQ_URI = "/user/{username}";
|
||||
public static final String SUMMARY = "Updated user";
|
||||
|
||||
private RequestSpecBuilder reqSpec;
|
||||
|
||||
private ResponseSpecBuilder respSpec;
|
||||
|
||||
public UpdateUserOper() {
|
||||
this.reqSpec = new RequestSpecBuilder();
|
||||
reqSpec.setContentType("*/*");
|
||||
reqSpec.setAccept("application/json");
|
||||
this.respSpec = new ResponseSpecBuilder();
|
||||
}
|
||||
|
||||
public UpdateUserOper(RequestSpecBuilder reqSpec) {
|
||||
this.reqSpec = reqSpec;
|
||||
reqSpec.setContentType("*/*");
|
||||
@ -632,7 +595,7 @@ public class UserApi {
|
||||
* @return type
|
||||
*/
|
||||
public <T> T execute(Function<Response, T> handler) {
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(PUT, REQ_URI));
|
||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(REQ_METHOD, REQ_URI));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user