Skip to content

Commit

Permalink
Merge pull request wso2#11162 from TheNiiron/master
Browse files Browse the repository at this point in the history
Add Prototype endpoint test cases
  • Loading branch information
vithu30 authored Jun 23, 2021
2 parents b850b4a + ec2f39f commit ceb8f98
Show file tree
Hide file tree
Showing 8 changed files with 786 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import org.wso2.am.integration.clients.publisher.api.v1.dto.LifecycleHistoryDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.LifecycleStateDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.MediationListDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.MockResponsePayloadListDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.OpenAPIDefinitionValidationResponseDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.PatchRequestBodyDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.PostRequestBodyDTO;
Expand Down Expand Up @@ -611,6 +612,24 @@ public HttpResponse deleteAPI(String apiId) throws ApiException {
return response;
}

public HttpResponse generateMockScript(String apiId) throws ApiException {
ApiResponse<String> mockResponse = apIsApi.generateMockScriptsWithHttpInfo(apiId, null);
HttpResponse response = null;
if (mockResponse.getStatusCode() == 200) {
response = new HttpResponse("Successfully generated MockScript", 200);
}
return response;
}

public HttpResponse getGenerateMockScript(String apiId) throws ApiException {
ApiResponse<MockResponsePayloadListDTO> mockResponse = apIsApi.getGeneratedMockScriptsOfAPIWithHttpInfo(apiId, null);
HttpResponse response = null;
if (mockResponse.getStatusCode() == 200) {
response = new HttpResponse(mockResponse.getData().toString(), 200);
}
return response;
}

/**
* Remove document
*
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"id": "71889e16-773e-471b-bc53-251569efff64",
"name": "SwaggerPetstore_v2_import",
"description": null,
"context": "/SwaggerPetstorev2import",
"version": "1.0.0",
"provider": "admin",
"lifeCycleStatus": "PUBLISHED",
"wsdlInfo": null,
"responseCachingEnabled": false,
"cacheTimeout": 300,
"hasThumbnail": null,
"isDefaultVersion": false,
"enableSchemaValidation": false,
"type": "HTTP",
"transport": ["http", "https"],
"tags": [],
"policies": ["Unlimited"],
"apiThrottlingPolicy": "Unlimited",
"authorizationHeader": null,
"securityScheme": ["oauth2", "oauth_basic_auth_mandatory"],
"maxTps": null,
"visibility": "PUBLIC",
"visibleRoles": [],
"visibleTenants": [],
"mediationPolicies": [],
"subscriptionAvailability": "ALL_TENANTS",
"subscriptionAvailableTenants": [],
"additionalProperties": [],
"monetization": null,
"accessControl": "NONE",
"accessControlRoles": [],
"businessInformation": {
"businessOwner": null,
"businessOwnerEmail": null,
"technicalOwner": null,
"technicalOwnerEmail": null
},
"corsConfiguration": {
"corsConfigurationEnabled": true,
"accessControlAllowOrigins": ["*"],
"accessControlAllowCredentials": false,
"accessControlAllowHeaders": ["authorization", "Access-Control-Allow-Origin", "Content-Type", "SOAPAction"],
"accessControlAllowMethods": ["GET", "PUT", "POST", "DELETE", "PATCH", "OPTIONS"]
},
"workflowStatus": null,
"endpointConfig": {
"endpoint_type": "http",
"sandbox_endpoints": {
"url": "https://localhost:9443/publisher-new/apis/create/openapi"
},
"production_endpoints": {
"url": "https://localhost:9443/publisher-new/apis/create/openapi"
}
},
"endpointImplementationType": "INLINE",
"scopes": [],
"operations": [],
"threatProtectionPolicies": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"swagger" : "2.0",
"info" : {
"version" : "1.0.0",
"title" : "SwaggerPetstore_v2"
},
"security" : [ {
"default" : [ ]
} ],
"paths" : {
"/pets" : {
"get" : {
"parameters" : [ ],
"responses" : {
"200" : {
"description" : "OK"
}
},
"security" : [ {
"default" : [ "SwaggerPetstore_imp_v2" ]
} ],
"x-auth-type" : "Application & Application User",
"x-throttling-tier" : null
}
},
"/pets/{petId}" : {
"get" : {
"parameters" : [ {
"name" : "petId",
"in" : "path",
"required" : true,
"type" : "string"
} ],
"responses" : {
"200" : {
"description" : "OK"
}
},
"security" : [ {
"default" : [ ]
} ],
"x-auth-type" : "Application & Application User",
"x-throttling-tier" : null
}
},
"/oldpets" : {
"delete" : {
"parameters" : [ ],
"responses" : {
"200" : {
"description" : "OK"
}
},
"security" : [ {
"default" : [ "SwaggerPetstore_imp_v2" ]
} ],
"x-auth-type" : "Application & Application User",
"x-throttling-tier" : null
}
}
},
"securityDefinitions" : {
"default" : {
"type" : "oauth2",
"authorizationUrl" : "https://test.com",
"flow" : "implicit",
"scopes" : {
"SwaggerPetstore_imp_v2" : "SwaggerPetstore_imp_v2"
},
"x-scopes-bindings" : {
"SwaggerPetstore_imp_v2" : "admin"
}
}
},
"x-throttling-tier" : "Unlimited",
"x-wso2-cors" : {
"corsConfigurationEnabled" : true,
"accessControlAllowOrigins" : [ "*" ],
"accessControlAllowCredentials" : false,
"accessControlAllowHeaders" : [ "authorization", "Access-Control-Allow-Origin", "Content-Type", "SOAPAction" ],
"accessControlAllowMethods" : [ "GET", "PUT", "POST", "DELETE", "PATCH", "OPTIONS" ]
},
"x-wso2-production-endpoints" : "https://localhost:9443/publisher-new/apis/create/openapi",
"x-wso2-sandbox-endpoints" : "https://localhost:9443/publisher-new/apis/create/openapi",
"x-wso2-basePath" : "/SwaggerPetstorev2/1.0.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"id": "71889e16-773e-471b-bc53-251569efff64",
"name": "SwaggerPetstore_v3_import",
"description": null,
"context": "/SwaggerPetstorev3import",
"version": "1.0.0",
"provider": "admin",
"lifeCycleStatus": "PUBLISHED",
"wsdlInfo": null,
"responseCachingEnabled": false,
"cacheTimeout": 300,
"hasThumbnail": null,
"isDefaultVersion": false,
"enableSchemaValidation": false,
"type": "HTTP",
"transport": ["http", "https"],
"tags": [],
"policies": ["Unlimited"],
"apiThrottlingPolicy": "Unlimited",
"authorizationHeader": null,
"securityScheme": ["oauth2", "oauth_basic_auth_mandatory"],
"maxTps": null,
"visibility": "PUBLIC",
"visibleRoles": [],
"visibleTenants": [],
"mediationPolicies": [],
"subscriptionAvailability": "ALL_TENANTS",
"subscriptionAvailableTenants": [],
"additionalProperties": [],
"monetization": null,
"accessControl": "NONE",
"accessControlRoles": [],
"businessInformation": {
"businessOwner": null,
"businessOwnerEmail": null,
"technicalOwner": null,
"technicalOwnerEmail": null
},
"corsConfiguration": {
"corsConfigurationEnabled": true,
"accessControlAllowOrigins": ["*"],
"accessControlAllowCredentials": false,
"accessControlAllowHeaders": ["authorization", "Access-Control-Allow-Origin", "Content-Type", "SOAPAction"],
"accessControlAllowMethods": ["GET", "PUT", "POST", "DELETE", "PATCH", "OPTIONS"]
},
"workflowStatus": null,
"endpointConfig": {
"endpoint_type": "http",
"sandbox_endpoints": {
"url": "https://localhost:9443/publisher-new/apis/create/openapi"
},
"production_endpoints": {
"url": "https://localhost:9443/publisher-new/apis/create/openapi"
}
},
"endpointImplementationType": "INLINE",
"scopes": [],
"operations": [],
"threatProtectionPolicies": null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"openapi" : "3.0.1",
"info" : {
"title" : "SwaggerPetstore_v3",
"version" : "1.0.0"
},
"servers" : [ {
"url" : "/"
} ],
"security" : [ {
"default" : [ ]
} ],
"paths" : {
"/pets" : {
"get" : {
"responses" : {
"200" : {
"description" : "OK"
}
},
"security" : [ {
"default" : [ "SwaggerPetstore_imp_v3" ]
} ],
"x-auth-type" : "Application & Application User",
"x-throttling-tier" : null
}
},
"/pets/{petId}" : {
"get" : {
"parameters" : [ {
"name" : "petId",
"in" : "path",
"required" : true,
"style" : "simple",
"explode" : false,
"schema" : {
"type" : "string"
}
} ],
"responses" : {
"200" : {
"description" : "OK"
}
},
"security" : [ {
"default" : [ ]
} ],
"x-auth-type" : "Application & Application User",
"x-throttling-tier" : null
}
},
"/oldpets" : {
"delete" : {
"responses" : {
"200" : {
"description" : "OK"
}
},
"security" : [ {
"default" : [ "SwaggerPetstore_imp_v3" ]
} ],
"x-auth-type" : "Application & Application User",
"x-throttling-tier" : null
}
}
},
"components" : {
"securitySchemes" : {
"default" : {
"type" : "oauth2",
"flows" : {
"implicit" : {
"authorizationUrl" : "https://test.com",
"scopes" : {
"SwaggerPetstore_imp_v3" : "SwaggerPetstore_imp_v3"
},
"x-scopes-bindings" : {
"SwaggerPetstore_imp_v3" : "admin"
}
}
}
}
}
},
"x-throttling-tier" : "Unlimited",
"x-wso2-cors" : {
"corsConfigurationEnabled" : true,
"accessControlAllowOrigins" : [ "*" ],
"accessControlAllowCredentials" : false,
"accessControlAllowHeaders" : [ "authorization", "Access-Control-Allow-Origin", "Content-Type", "SOAPAction" ],
"accessControlAllowMethods" : [ "GET", "PUT", "POST", "DELETE", "PATCH", "OPTIONS" ]
},
"x-wso2-production-endpoints" : "https://localhost:9443/publisher-new/apis/create/openapi",
"x-wso2-sandbox-endpoints" : "https://localhost:9443/publisher-new/apis/create/openapi",
"x-wso2-basePath" : "/SwaggerPetstorev3/1.0.0"
}
Loading

0 comments on commit ceb8f98

Please sign in to comment.