diff --git a/modules/integration/tests-common/clients/publisher/api/openapi.yaml b/modules/integration/tests-common/clients/publisher/api/openapi.yaml
index 268be810a4..6ebadd6068 100644
--- a/modules/integration/tests-common/clients/publisher/api/openapi.yaml
+++ b/modules/integration/tests-common/clients/publisher/api/openapi.yaml
@@ -798,6 +798,382 @@ paths:
- APIs
x-contentType: application/json
x-accepts: application/json
+ /apis/{apiId}/sequence-backend/{type}/content:
+ get:
+ description: This operation can be used to get Sequence of the Custom Backend
+ operationId: getSequenceBackendContent
+ parameters:
+ - description: |
+ Type of the Endpoint.
+ SANDBOX or PRODUCTION
+ explode: false
+ in: path
+ name: type
+ required: true
+ schema:
+ maxLength: 15
+ type: string
+ style: simple
+ - description: |
+ **API ID** consisting of the **UUID** of the API.
+ explode: false
+ in: path
+ name: apiId
+ required: true
+ schema:
+ type: string
+ style: simple
+ responses:
+ "200":
+ content:
+ application/xml:
+ schema:
+ format: binary
+ type: string
+ description: |
+ OK.
+ Requested API Custom Backend is returned
+ headers:
+ Content-Type:
+ description: |
+ The content type of the body.
+ explode: false
+ schema:
+ type: string
+ style: simple
+ "404":
+ content:
+ application/json:
+ example:
+ code: 404
+ message: Not Found
+ description: The specified resource does not exist
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Not Found. The specified resource does not exist.
+ "406":
+ content:
+ application/json:
+ example:
+ code: 406
+ message: Not Acceptable
+ description: The requested media type is not supported
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Not Acceptable. The requested media type is not supported.
+ security:
+ - OAuth2Security:
+ - apim:api_view
+ - apim:api_manage
+ - apim:api_import_export
+ - apim:api_product_import_export
+ summary: Get Sequence of Custom Backend
+ tags:
+ - APIs
+ x-code-samples:
+ - lang: Curl
+ source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
+ "https://127.0.0.1:9443/api/am/publisher/v4/apis/7a2298c4-c905-403f-8fac-38c73301631f/custom-backend/7a2298c4-c915-483f-8fac-38c73301631f/content"'
+ x-accepts: application/json
+ /apis/{apiId}/sequence-backend/{type}:
+ delete:
+ description: This operation can be used to remove the Sequence Backend of the
+ API
+ operationId: sequenceBackendDelete
+ parameters:
+ - description: |
+ Type of the Endpoint.
+ SANDBOX or PRODUCTION
+ explode: false
+ in: path
+ name: type
+ required: true
+ schema:
+ maxLength: 15
+ type: string
+ style: simple
+ - description: |
+ **API ID** consisting of the **UUID** of the API.
+ explode: false
+ in: path
+ name: apiId
+ required: true
+ schema:
+ type: string
+ style: simple
+ responses:
+ "200":
+ content: {}
+ description: |
+ OK.
+ Resource successfully deleted.
+ "403":
+ content:
+ application/json:
+ example:
+ code: 403
+ message: Forbidden
+ description: The request must be conditional but no condition has
+ been specified
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Forbidden. The request must be conditional but no condition
+ has been specified.
+ "404":
+ content:
+ application/json:
+ example:
+ code: 404
+ message: Not Found
+ description: The specified resource does not exist
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Not Found. The specified resource does not exist.
+ "409":
+ content:
+ application/json:
+ example:
+ code: 409
+ message: Conflict
+ description: Specified resource already exists
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Conflict. Specified resource already exists.
+ "412":
+ content:
+ application/json:
+ example:
+ code: 412
+ message: Precondition Failed
+ description: The request has not been performed because one of the
+ preconditions is not met
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Precondition Failed. The request has not been performed because
+ one of the preconditions is not met.
+ security:
+ - OAuth2Security:
+ - apim:api_delete
+ - apim:api_manage
+ - apim:api_import_export
+ summary: Delete Sequence Backend of the API
+ tags:
+ - APIs
+ x-code-samples:
+ - lang: Curl
+ source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
+ "https://127.0.0.1:9443/api/am/publisher/v4/apis/7a2298c4-c905-403f-8fac-38c73301631f/custom-backend/7a2298c4-c915-483f-8fac-38c73301631f"'
+ x-accepts: application/json
+ /apis/{apiId}/sequence-backend:
+ get:
+ description: This operation can be used to get Sequence Backend data of the
+ API
+ operationId: getSequenceBackendData
+ parameters:
+ - description: |
+ **API ID** consisting of the **UUID** of the API.
+ explode: false
+ in: path
+ name: apiId
+ required: true
+ schema:
+ type: string
+ style: simple
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SequenceBackendList'
+ description: |
+ OK.
+ Requested API Sequence Backend is returned
+ headers:
+ Content-Type:
+ description: |
+ The content type of the body.
+ explode: false
+ schema:
+ type: string
+ style: simple
+ "404":
+ content:
+ application/json:
+ example:
+ code: 404
+ message: Not Found
+ description: The specified resource does not exist
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Not Found. The specified resource does not exist.
+ "406":
+ content:
+ application/json:
+ example:
+ code: 406
+ message: Not Acceptable
+ description: The requested media type is not supported
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Not Acceptable. The requested media type is not supported.
+ security:
+ - OAuth2Security:
+ - apim:api_view
+ - apim:api_manage
+ - apim:api_import_export
+ - apim:api_product_import_export
+ summary: Get Sequence Backends of the API
+ tags:
+ - APIs
+ x-code-samples:
+ - lang: Curl
+ source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
+ "https://127.0.0.1:9443/api/am/publisher/v4/apis/7a2298c4-c905-403f-8fac-38c73301631f/custom-backend/7a2298c4-c915-483f-8fac-38c73301631f"'
+ x-accepts: application/json
+ put:
+ description: This operation can be used to change the endpoint of the API to
+ Sequence Backend
+ operationId: sequenceBackendUpdate
+ parameters:
+ - description: |
+ **API ID** consisting of the **UUID** of the API.
+ explode: false
+ in: path
+ name: apiId
+ required: true
+ schema:
+ type: string
+ style: simple
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ properties:
+ sequence:
+ description: The sequence that needs to be uploaded.
+ format: binary
+ type: string
+ type:
+ description: Type of the Endpoint
+ type: string
+ responses:
+ "200":
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/API'
+ description: |
+ OK.
+ Successful response with updated API object
+ headers:
+ Location:
+ description: |
+ The URL of the newly created resource.
+ explode: false
+ schema:
+ type: string
+ style: simple
+ Content-Type:
+ description: |
+ The content type of the body.
+ explode: false
+ schema:
+ type: string
+ style: simple
+ "400":
+ content:
+ application/json:
+ example:
+ code: 400
+ message: Bad Request
+ description: Invalid request or validation error
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Bad Request. Invalid request or validation error.
+ "403":
+ content:
+ application/json:
+ example:
+ code: 403
+ message: Forbidden
+ description: The request must be conditional but no condition has
+ been specified
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Forbidden. The request must be conditional but no condition
+ has been specified.
+ "404":
+ content:
+ application/json:
+ example:
+ code: 404
+ message: Not Found
+ description: The specified resource does not exist
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Not Found. The specified resource does not exist.
+ "409":
+ content:
+ application/json:
+ example:
+ code: 409
+ message: Conflict
+ description: Specified resource already exists
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Conflict. Specified resource already exists.
+ "412":
+ content:
+ application/json:
+ example:
+ code: 412
+ message: Precondition Failed
+ description: The request has not been performed because one of the
+ preconditions is not met
+ moreInfo: ""
+ error: []
+ schema:
+ $ref: '#/components/schemas/Error'
+ description: Precondition Failed. The request has not been performed because
+ one of the preconditions is not met.
+ security:
+ - OAuth2Security:
+ - apim:api_create
+ - apim:api_manage
+ - apim:api_publish
+ summary: Upload Sequence Sequence as the Endpoint of the API
+ tags:
+ - APIs
+ x-code-samples:
+ - lang: Curl
+ source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
+ -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v4/apis/7a2298c4-c905-403f-8fac-38c73301631f/custom-backend"'
+ x-contentType: multipart/form-data
+ x-accepts: application/json
/apis/{apiId}/reimport-service:
put:
description: This operation can be used to re-import the Service used to create
@@ -17017,6 +17393,55 @@ components:
description: Unsupported Media Type. The entity of the request was not in a
supported format.
schemas:
+ SequenceBackendList:
+ example:
+ count: 1
+ list:
+ - sequence: ""
+ sequenceId: 943d3002-000c-42d3-a1b9-d6559f8a4d49
+ sequenceName: 943d3002-000c-42d3-a1b9-d6559f8a4d49-SANDBOX
+ sequenceType: SANDBOX
+ - sequence: ""
+ sequenceId: 943d3002-000c-42d3-a1b9-d6559f8a4d49
+ sequenceName: 943d3002-000c-42d3-a1b9-d6559f8a4d49-SANDBOX
+ sequenceType: SANDBOX
+ properties:
+ count:
+ description: |
+ Number of Sequence Backends returned.
+ example: 1
+ type: integer
+ list:
+ items:
+ $ref: '#/components/schemas/SequenceBackend'
+ type: array
+ title: Sequence Backend List
+ type: object
+ SequenceBackend:
+ example:
+ sequence: ""
+ sequenceId: 943d3002-000c-42d3-a1b9-d6559f8a4d49
+ sequenceName: 943d3002-000c-42d3-a1b9-d6559f8a4d49-SANDBOX
+ sequenceType: SANDBOX
+ properties:
+ sequenceId:
+ example: 943d3002-000c-42d3-a1b9-d6559f8a4d49
+ readOnly: true
+ type: string
+ sequenceName:
+ example: 943d3002-000c-42d3-a1b9-d6559f8a4d49-SANDBOX
+ readOnly: true
+ type: string
+ sequenceType:
+ example: SANDBOX
+ readOnly: true
+ type: string
+ sequence:
+ format: binary
+ readOnly: true
+ type: string
+ title: Sequence Backend
+ type: object
Comment:
example:
updatedTime: 2021-02-12-19:57:25
diff --git a/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/ApIsApi.java b/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/ApIsApi.java
index 5083d67d4a..e60d855ad3 100644
--- a/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/ApIsApi.java
+++ b/modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/ApIsApi.java
@@ -30,11 +30,11 @@
import org.wso2.am.integration.clients.publisher.api.v1.dto.APIDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.APIKeyDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.APIListDTO;
-import org.wso2.am.integration.clients.publisher.api.v1.dto.ErrorDTO;
import java.io.File;
import org.wso2.am.integration.clients.publisher.api.v1.dto.FileInfoDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.MockResponsePayloadListDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.ResourcePathListDTO;
+import org.wso2.am.integration.clients.publisher.api.v1.dto.SequenceBackendListDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.ThrottlingPolicyDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.TopicListDTO;
import org.wso2.am.integration.clients.publisher.api.v1.dto.WSDLInfoDTO;
@@ -2274,6 +2274,254 @@ public okhttp3.Call getGeneratedMockScriptsOfAPIAsync(String apiId, String ifNon
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
+ /**
+ * Build call for getSequenceBackendContent
+ * @param type Type of the Endpoint. SANDBOX or PRODUCTION (required)
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Requested API Custom Backend is returned | * Content-Type - The content type of the body. |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 406 | Not Acceptable. The requested media type is not supported. | - |
+
+ */
+ public okhttp3.Call getSequenceBackendContentCall(String type, String apiId, final ApiCallback _callback) throws ApiException {
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/apis/{apiId}/sequence-backend/{type}/content"
+ .replaceAll("\\{" + "type" + "\\}", localVarApiClient.escapeString(type.toString()))
+ .replaceAll("\\{" + "apiId" + "\\}", localVarApiClient.escapeString(apiId.toString()));
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap();
+ Map localVarFormParams = new HashMap();
+ final String[] localVarAccepts = {
+ "application/xml", "application/json"
+ };
+ final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) {
+ localVarHeaderParams.put("Accept", localVarAccept);
+ }
+
+ final String[] localVarContentTypes = {
+
+ };
+ final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ String[] localVarAuthNames = new String[] { "OAuth2Security" };
+ return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private okhttp3.Call getSequenceBackendContentValidateBeforeCall(String type, String apiId, final ApiCallback _callback) throws ApiException {
+
+ // verify the required parameter 'type' is set
+ if (type == null) {
+ throw new ApiException("Missing the required parameter 'type' when calling getSequenceBackendContent(Async)");
+ }
+
+ // verify the required parameter 'apiId' is set
+ if (apiId == null) {
+ throw new ApiException("Missing the required parameter 'apiId' when calling getSequenceBackendContent(Async)");
+ }
+
+
+ okhttp3.Call localVarCall = getSequenceBackendContentCall(type, apiId, _callback);
+ return localVarCall;
+
+ }
+
+ /**
+ * Get Sequence of Custom Backend
+ * This operation can be used to get Sequence of the Custom Backend
+ * @param type Type of the Endpoint. SANDBOX or PRODUCTION (required)
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @return File
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Requested API Custom Backend is returned | * Content-Type - The content type of the body. |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 406 | Not Acceptable. The requested media type is not supported. | - |
+
+ */
+ public File getSequenceBackendContent(String type, String apiId) throws ApiException {
+ ApiResponse localVarResp = getSequenceBackendContentWithHttpInfo(type, apiId);
+ return localVarResp.getData();
+ }
+
+ /**
+ * Get Sequence of Custom Backend
+ * This operation can be used to get Sequence of the Custom Backend
+ * @param type Type of the Endpoint. SANDBOX or PRODUCTION (required)
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @return ApiResponse<File>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Requested API Custom Backend is returned | * Content-Type - The content type of the body. |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 406 | Not Acceptable. The requested media type is not supported. | - |
+
+ */
+ public ApiResponse getSequenceBackendContentWithHttpInfo(String type, String apiId) throws ApiException {
+ okhttp3.Call localVarCall = getSequenceBackendContentValidateBeforeCall(type, apiId, null);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ return localVarApiClient.execute(localVarCall, localVarReturnType);
+ }
+
+ /**
+ * Get Sequence of Custom Backend (asynchronously)
+ * This operation can be used to get Sequence of the Custom Backend
+ * @param type Type of the Endpoint. SANDBOX or PRODUCTION (required)
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @param _callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Requested API Custom Backend is returned | * Content-Type - The content type of the body. |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 406 | Not Acceptable. The requested media type is not supported. | - |
+
+ */
+ public okhttp3.Call getSequenceBackendContentAsync(String type, String apiId, final ApiCallback _callback) throws ApiException {
+
+ okhttp3.Call localVarCall = getSequenceBackendContentValidateBeforeCall(type, apiId, _callback);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
+ return localVarCall;
+ }
+ /**
+ * Build call for getSequenceBackendData
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Requested API Sequence Backend is returned | * Content-Type - The content type of the body. |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 406 | Not Acceptable. The requested media type is not supported. | - |
+
+ */
+ public okhttp3.Call getSequenceBackendDataCall(String apiId, final ApiCallback _callback) throws ApiException {
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/apis/{apiId}/sequence-backend"
+ .replaceAll("\\{" + "apiId" + "\\}", localVarApiClient.escapeString(apiId.toString()));
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap();
+ Map localVarFormParams = new HashMap();
+ final String[] localVarAccepts = {
+ "application/json"
+ };
+ final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) {
+ localVarHeaderParams.put("Accept", localVarAccept);
+ }
+
+ final String[] localVarContentTypes = {
+
+ };
+ final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ String[] localVarAuthNames = new String[] { "OAuth2Security" };
+ return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private okhttp3.Call getSequenceBackendDataValidateBeforeCall(String apiId, final ApiCallback _callback) throws ApiException {
+
+ // verify the required parameter 'apiId' is set
+ if (apiId == null) {
+ throw new ApiException("Missing the required parameter 'apiId' when calling getSequenceBackendData(Async)");
+ }
+
+
+ okhttp3.Call localVarCall = getSequenceBackendDataCall(apiId, _callback);
+ return localVarCall;
+
+ }
+
+ /**
+ * Get Sequence Backends of the API
+ * This operation can be used to get Sequence Backend data of the API
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @return SequenceBackendListDTO
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Requested API Sequence Backend is returned | * Content-Type - The content type of the body. |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 406 | Not Acceptable. The requested media type is not supported. | - |
+
+ */
+ public SequenceBackendListDTO getSequenceBackendData(String apiId) throws ApiException {
+ ApiResponse localVarResp = getSequenceBackendDataWithHttpInfo(apiId);
+ return localVarResp.getData();
+ }
+
+ /**
+ * Get Sequence Backends of the API
+ * This operation can be used to get Sequence Backend data of the API
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @return ApiResponse<SequenceBackendListDTO>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Requested API Sequence Backend is returned | * Content-Type - The content type of the body. |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 406 | Not Acceptable. The requested media type is not supported. | - |
+
+ */
+ public ApiResponse getSequenceBackendDataWithHttpInfo(String apiId) throws ApiException {
+ okhttp3.Call localVarCall = getSequenceBackendDataValidateBeforeCall(apiId, null);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ return localVarApiClient.execute(localVarCall, localVarReturnType);
+ }
+
+ /**
+ * Get Sequence Backends of the API (asynchronously)
+ * This operation can be used to get Sequence Backend data of the API
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @param _callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Requested API Sequence Backend is returned | * Content-Type - The content type of the body. |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 406 | Not Acceptable. The requested media type is not supported. | - |
+
+ */
+ public okhttp3.Call getSequenceBackendDataAsync(String apiId, final ApiCallback _callback) throws ApiException {
+
+ okhttp3.Call localVarCall = getSequenceBackendDataValidateBeforeCall(apiId, _callback);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
+ return localVarCall;
+ }
/**
* Build call for getWSDLInfoOfAPI
* @param apiId **API ID** consisting of the **UUID** of the API. (required)
@@ -3321,6 +3569,286 @@ public okhttp3.Call reimportServiceFromCatalogAsync(String apiId, final ApiCallb
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
+ /**
+ * Build call for sequenceBackendDelete
+ * @param type Type of the Endpoint. SANDBOX or PRODUCTION (required)
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Resource successfully deleted. | - |
+ 403 | Forbidden. The request must be conditional but no condition has been specified. | - |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 409 | Conflict. Specified resource already exists. | - |
+ 412 | Precondition Failed. The request has not been performed because one of the preconditions is not met. | - |
+
+ */
+ public okhttp3.Call sequenceBackendDeleteCall(String type, String apiId, final ApiCallback _callback) throws ApiException {
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/apis/{apiId}/sequence-backend/{type}"
+ .replaceAll("\\{" + "type" + "\\}", localVarApiClient.escapeString(type.toString()))
+ .replaceAll("\\{" + "apiId" + "\\}", localVarApiClient.escapeString(apiId.toString()));
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap();
+ Map localVarFormParams = new HashMap();
+ final String[] localVarAccepts = {
+ "application/json"
+ };
+ final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) {
+ localVarHeaderParams.put("Accept", localVarAccept);
+ }
+
+ final String[] localVarContentTypes = {
+
+ };
+ final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ String[] localVarAuthNames = new String[] { "OAuth2Security" };
+ return localVarApiClient.buildCall(localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private okhttp3.Call sequenceBackendDeleteValidateBeforeCall(String type, String apiId, final ApiCallback _callback) throws ApiException {
+
+ // verify the required parameter 'type' is set
+ if (type == null) {
+ throw new ApiException("Missing the required parameter 'type' when calling sequenceBackendDelete(Async)");
+ }
+
+ // verify the required parameter 'apiId' is set
+ if (apiId == null) {
+ throw new ApiException("Missing the required parameter 'apiId' when calling sequenceBackendDelete(Async)");
+ }
+
+
+ okhttp3.Call localVarCall = sequenceBackendDeleteCall(type, apiId, _callback);
+ return localVarCall;
+
+ }
+
+ /**
+ * Delete Sequence Backend of the API
+ * This operation can be used to remove the Sequence Backend of the API
+ * @param type Type of the Endpoint. SANDBOX or PRODUCTION (required)
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Resource successfully deleted. | - |
+ 403 | Forbidden. The request must be conditional but no condition has been specified. | - |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 409 | Conflict. Specified resource already exists. | - |
+ 412 | Precondition Failed. The request has not been performed because one of the preconditions is not met. | - |
+
+ */
+ public void sequenceBackendDelete(String type, String apiId) throws ApiException {
+ sequenceBackendDeleteWithHttpInfo(type, apiId);
+ }
+
+ /**
+ * Delete Sequence Backend of the API
+ * This operation can be used to remove the Sequence Backend of the API
+ * @param type Type of the Endpoint. SANDBOX or PRODUCTION (required)
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @return ApiResponse<Void>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Resource successfully deleted. | - |
+ 403 | Forbidden. The request must be conditional but no condition has been specified. | - |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 409 | Conflict. Specified resource already exists. | - |
+ 412 | Precondition Failed. The request has not been performed because one of the preconditions is not met. | - |
+
+ */
+ public ApiResponse sequenceBackendDeleteWithHttpInfo(String type, String apiId) throws ApiException {
+ okhttp3.Call localVarCall = sequenceBackendDeleteValidateBeforeCall(type, apiId, null);
+ return localVarApiClient.execute(localVarCall);
+ }
+
+ /**
+ * Delete Sequence Backend of the API (asynchronously)
+ * This operation can be used to remove the Sequence Backend of the API
+ * @param type Type of the Endpoint. SANDBOX or PRODUCTION (required)
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @param _callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Resource successfully deleted. | - |
+ 403 | Forbidden. The request must be conditional but no condition has been specified. | - |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 409 | Conflict. Specified resource already exists. | - |
+ 412 | Precondition Failed. The request has not been performed because one of the preconditions is not met. | - |
+
+ */
+ public okhttp3.Call sequenceBackendDeleteAsync(String type, String apiId, final ApiCallback _callback) throws ApiException {
+
+ okhttp3.Call localVarCall = sequenceBackendDeleteValidateBeforeCall(type, apiId, _callback);
+ localVarApiClient.executeAsync(localVarCall, _callback);
+ return localVarCall;
+ }
+ /**
+ * Build call for sequenceBackendUpdate
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @param sequence The sequence that needs to be uploaded. (optional)
+ * @param type Type of the Endpoint (optional)
+ * @param _callback Callback for upload/download progress
+ * @return Call to execute
+ * @throws ApiException If fail to serialize the request body object
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Successful response with updated API object | * Location - The URL of the newly created resource. * Content-Type - The content type of the body. |
+ 400 | Bad Request. Invalid request or validation error. | - |
+ 403 | Forbidden. The request must be conditional but no condition has been specified. | - |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 409 | Conflict. Specified resource already exists. | - |
+ 412 | Precondition Failed. The request has not been performed because one of the preconditions is not met. | - |
+
+ */
+ public okhttp3.Call sequenceBackendUpdateCall(String apiId, File sequence, String type, final ApiCallback _callback) throws ApiException {
+ Object localVarPostBody = null;
+
+ // create path and map variables
+ String localVarPath = "/apis/{apiId}/sequence-backend"
+ .replaceAll("\\{" + "apiId" + "\\}", localVarApiClient.escapeString(apiId.toString()));
+
+ List localVarQueryParams = new ArrayList();
+ List localVarCollectionQueryParams = new ArrayList();
+ Map localVarHeaderParams = new HashMap();
+ Map localVarCookieParams = new HashMap();
+ Map localVarFormParams = new HashMap();
+ if (sequence != null) {
+ localVarFormParams.put("sequence", sequence);
+ }
+
+ if (type != null) {
+ localVarFormParams.put("type", type);
+ }
+
+ final String[] localVarAccepts = {
+ "application/json"
+ };
+ final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
+ if (localVarAccept != null) {
+ localVarHeaderParams.put("Accept", localVarAccept);
+ }
+
+ final String[] localVarContentTypes = {
+ "multipart/form-data"
+ };
+ final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
+ localVarHeaderParams.put("Content-Type", localVarContentType);
+
+ String[] localVarAuthNames = new String[] { "OAuth2Security" };
+ return localVarApiClient.buildCall(localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
+ }
+
+ @SuppressWarnings("rawtypes")
+ private okhttp3.Call sequenceBackendUpdateValidateBeforeCall(String apiId, File sequence, String type, final ApiCallback _callback) throws ApiException {
+
+ // verify the required parameter 'apiId' is set
+ if (apiId == null) {
+ throw new ApiException("Missing the required parameter 'apiId' when calling sequenceBackendUpdate(Async)");
+ }
+
+
+ okhttp3.Call localVarCall = sequenceBackendUpdateCall(apiId, sequence, type, _callback);
+ return localVarCall;
+
+ }
+
+ /**
+ * Upload Sequence Sequence as the Endpoint of the API
+ * This operation can be used to change the endpoint of the API to Sequence Backend
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @param sequence The sequence that needs to be uploaded. (optional)
+ * @param type Type of the Endpoint (optional)
+ * @return APIDTO
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Successful response with updated API object | * Location - The URL of the newly created resource. * Content-Type - The content type of the body. |
+ 400 | Bad Request. Invalid request or validation error. | - |
+ 403 | Forbidden. The request must be conditional but no condition has been specified. | - |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 409 | Conflict. Specified resource already exists. | - |
+ 412 | Precondition Failed. The request has not been performed because one of the preconditions is not met. | - |
+
+ */
+ public APIDTO sequenceBackendUpdate(String apiId, File sequence, String type) throws ApiException {
+ ApiResponse localVarResp = sequenceBackendUpdateWithHttpInfo(apiId, sequence, type);
+ return localVarResp.getData();
+ }
+
+ /**
+ * Upload Sequence Sequence as the Endpoint of the API
+ * This operation can be used to change the endpoint of the API to Sequence Backend
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @param sequence The sequence that needs to be uploaded. (optional)
+ * @param type Type of the Endpoint (optional)
+ * @return ApiResponse<APIDTO>
+ * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Successful response with updated API object | * Location - The URL of the newly created resource. * Content-Type - The content type of the body. |
+ 400 | Bad Request. Invalid request or validation error. | - |
+ 403 | Forbidden. The request must be conditional but no condition has been specified. | - |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 409 | Conflict. Specified resource already exists. | - |
+ 412 | Precondition Failed. The request has not been performed because one of the preconditions is not met. | - |
+
+ */
+ public ApiResponse sequenceBackendUpdateWithHttpInfo(String apiId, File sequence, String type) throws ApiException {
+ okhttp3.Call localVarCall = sequenceBackendUpdateValidateBeforeCall(apiId, sequence, type, null);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ return localVarApiClient.execute(localVarCall, localVarReturnType);
+ }
+
+ /**
+ * Upload Sequence Sequence as the Endpoint of the API (asynchronously)
+ * This operation can be used to change the endpoint of the API to Sequence Backend
+ * @param apiId **API ID** consisting of the **UUID** of the API. (required)
+ * @param sequence The sequence that needs to be uploaded. (optional)
+ * @param type Type of the Endpoint (optional)
+ * @param _callback The callback to be executed when the API call finishes
+ * @return The request call
+ * @throws ApiException If fail to process the API call, e.g. serializing the request body object
+ * @http.response.details
+
+ Status Code | Description | Response Headers |
+ 200 | OK. Successful response with updated API object | * Location - The URL of the newly created resource. * Content-Type - The content type of the body. |
+ 400 | Bad Request. Invalid request or validation error. | - |
+ 403 | Forbidden. The request must be conditional but no condition has been specified. | - |
+ 404 | Not Found. The specified resource does not exist. | - |
+ 409 | Conflict. Specified resource already exists. | - |
+ 412 | Precondition Failed. The request has not been performed because one of the preconditions is not met. | - |
+
+ */
+ public okhttp3.Call sequenceBackendUpdateAsync(String apiId, File sequence, String type, final ApiCallback _callback) throws ApiException {
+
+ okhttp3.Call localVarCall = sequenceBackendUpdateValidateBeforeCall(apiId, sequence, type, _callback);
+ Type localVarReturnType = new TypeToken(){}.getType();
+ localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
+ return localVarCall;
+ }
/**
* Build call for updateAPI
* @param apiId **API ID** consisting of the **UUID** of the API. (required)
diff --git a/modules/integration/tests-common/clients/publisher/src/main/resources/publisher-api.yaml b/modules/integration/tests-common/clients/publisher/src/main/resources/publisher-api.yaml
index dd8ab18773..ada1c11ade 100644
--- a/modules/integration/tests-common/clients/publisher/src/main/resources/publisher-api.yaml
+++ b/modules/integration/tests-common/clients/publisher/src/main/resources/publisher-api.yaml
@@ -482,6 +482,194 @@ paths:
- apim:api_create
- apim:api_manage
- apim:api_import_export
+ /apis/{apiId}/sequence-backend/{type}/content:
+ get:
+ tags:
+ - APIs
+ summary: Get Sequence of Custom Backend
+ description: This operation can be used to get Sequence of the Custom Backend
+ operationId: getSequenceBackendContent
+ parameters:
+ - name: type
+ in: path
+ description: |
+ Type of the Endpoint.
+ SANDBOX or PRODUCTION
+ required: true
+ schema:
+ maxLength: 15
+ type: string
+ - $ref: '#/components/parameters/apiId'
+ responses:
+ 200:
+ description: |
+ OK.
+ Requested API Custom Backend is returned
+ headers:
+ Content-Type:
+ description: |
+ The content type of the body.
+ schema:
+ type: string
+ content:
+ application/xml:
+ schema:
+ type: string
+ format: binary
+ 404:
+ $ref: '#/components/responses/NotFound'
+ 406:
+ $ref: '#/components/responses/NotAcceptable'
+ security:
+ - OAuth2Security:
+ - apim:api_view
+ - apim:api_manage
+ - apim:api_import_export
+ - apim:api_product_import_export
+ x-code-samples:
+ - lang: Curl
+ source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
+ "https://127.0.0.1:9443/api/am/publisher/v4/apis/7a2298c4-c905-403f-8fac-38c73301631f/custom-backend/7a2298c4-c915-483f-8fac-38c73301631f/content"'
+
+ /apis/{apiId}/sequence-backend/{type}:
+ delete:
+ tags:
+ - APIs
+ summary: Delete Sequence Backend of the API
+ description: This operation can be used to remove the Sequence Backend of the API
+ operationId: sequenceBackendDelete
+ parameters:
+ - name: type
+ in: path
+ description: |
+ Type of the Endpoint.
+ SANDBOX or PRODUCTION
+ required: true
+ schema:
+ maxLength: 15
+ type: string
+ - $ref: '#/components/parameters/apiId'
+ responses:
+ 200:
+ description: |
+ OK.
+ Resource successfully deleted.
+ content: { }
+ 403:
+ $ref: '#/components/responses/Forbidden'
+ 404:
+ $ref: '#/components/responses/NotFound'
+ 409:
+ $ref: '#/components/responses/Conflict'
+ 412:
+ $ref: '#/components/responses/PreconditionFailed'
+ security:
+ - OAuth2Security:
+ - apim:api_delete
+ - apim:api_manage
+ - apim:api_import_export
+ x-code-samples:
+ - lang: Curl
+ source: 'curl -k -X DELETE -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
+ "https://127.0.0.1:9443/api/am/publisher/v4/apis/7a2298c4-c905-403f-8fac-38c73301631f/custom-backend/7a2298c4-c915-483f-8fac-38c73301631f"'
+
+ /apis/{apiId}/sequence-backend:
+ get:
+ tags:
+ - APIs
+ summary: Get Sequence Backends of the API
+ description: This operation can be used to get Sequence Backend data of the API
+ operationId: getSequenceBackendData
+ parameters:
+ - $ref: '#/components/parameters/apiId'
+ responses:
+ 200:
+ description: |
+ OK.
+ Requested API Sequence Backend is returned
+ headers:
+ Content-Type:
+ description: |
+ The content type of the body.
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/SequenceBackendList'
+ 404:
+ $ref: '#/components/responses/NotFound'
+ 406:
+ $ref: '#/components/responses/NotAcceptable'
+ security:
+ - OAuth2Security:
+ - apim:api_view
+ - apim:api_manage
+ - apim:api_import_export
+ - apim:api_product_import_export
+ x-code-samples:
+ - lang: Curl
+ source: 'curl -k -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
+ "https://127.0.0.1:9443/api/am/publisher/v4/apis/7a2298c4-c905-403f-8fac-38c73301631f/custom-backend/7a2298c4-c915-483f-8fac-38c73301631f"'
+ put:
+ tags:
+ - APIs
+ summary: Upload Sequence Sequence as the Endpoint of the API
+ description: This operation can be used to change the endpoint of the API to Sequence Backend
+ operationId: sequenceBackendUpdate
+ parameters:
+ - $ref: '#/components/parameters/apiId'
+ requestBody:
+ content:
+ multipart/form-data:
+ schema:
+ properties:
+ sequence:
+ type: string
+ description: The sequence that needs to be uploaded.
+ format: binary
+ type:
+ type: string
+ description: Type of the Endpoint
+ responses:
+ 200:
+ description: |
+ OK.
+ Successful response with updated API object
+ headers:
+ Location:
+ description: |
+ The URL of the newly created resource.
+ schema:
+ type: string
+ Content-Type:
+ description: |
+ The content type of the body.
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/API'
+ 400:
+ $ref: '#/components/responses/BadRequest'
+ 403:
+ $ref: '#/components/responses/Forbidden'
+ 404:
+ $ref: '#/components/responses/NotFound'
+ 409:
+ $ref: '#/components/responses/Conflict'
+ 412:
+ $ref: '#/components/responses/PreconditionFailed'
+ security:
+ - OAuth2Security:
+ - apim:api_create
+ - apim:api_manage
+ - apim:api_publish
+ x-code-samples:
+ - lang: Curl
+ source: 'curl -k -X PUT -H "Authorization: Bearer ae4eae22-3f65-387b-a171-d37eaa366fa8"
+ -H "Content-Type: application/json" -d @data.json "https://127.0.0.1:9443/api/am/publisher/v4/apis/7a2298c4-c905-403f-8fac-38c73301631f/custom-backend"'
/apis/{apiId}/reimport-service:
put:
@@ -9049,6 +9237,39 @@ paths:
operationId: deleteAPIProductLifecycleStatePendingTasks
components:
schemas:
+ SequenceBackendList:
+ title: Sequence Backend List
+ type: object
+ properties:
+ count:
+ type: integer
+ description: |
+ Number of Sequence Backends returned.
+ example: 1
+ list:
+ type: array
+ items:
+ $ref: '#/components/schemas/SequenceBackend'
+ SequenceBackend:
+ title: Sequence Backend
+ type: object
+ properties:
+ sequenceId:
+ type: string
+ readOnly: true
+ example: 943d3002-000c-42d3-a1b9-d6559f8a4d49
+ sequenceName:
+ type: string
+ readOnly: true
+ example: 943d3002-000c-42d3-a1b9-d6559f8a4d49-SANDBOX
+ sequenceType:
+ type: string
+ readOnly: true
+ example: SANDBOX
+ sequence:
+ type: string
+ format: binary
+ readOnly: true
Comment:
title: Comment
required:
diff --git a/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/RestAPIPublisherImpl.java b/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/RestAPIPublisherImpl.java
index bde33b788f..517aad8a11 100644
--- a/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/RestAPIPublisherImpl.java
+++ b/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/impl/RestAPIPublisherImpl.java
@@ -588,6 +588,20 @@ public APIDTO copyAPIWithReturnDTO(String newVersion, String apiId, Boolean isDe
return response.getData();
}
+ /**
+ * Add Sequence Backend to the API Endpoint
+ *
+ * @param file Sequence Backend file
+ * @param apiId APIID
+ * @param type Key Type
+ * @throws ApiException API Exception if an error occurs
+ */
+
+ public void addSequenceBackend(File file, String apiId, String type) throws ApiException {
+ ApiResponse response = apIsApi.sequenceBackendUpdateWithHttpInfo(apiId, file, type);
+ Assert.assertEquals(HttpStatus.SC_OK, response.getStatusCode());
+ }
+
/**
* Facilitate update API
*
diff --git a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/other/APIEndpointTypeUpdateTestCase.java b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/other/APIEndpointTypeUpdateTestCase.java
index 427843439d..efbc9ac3dc 100644
--- a/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/other/APIEndpointTypeUpdateTestCase.java
+++ b/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/other/APIEndpointTypeUpdateTestCase.java
@@ -20,6 +20,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.json.simple.parser.JSONParser;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -30,10 +31,8 @@
import org.wso2.am.integration.clients.store.api.v1.dto.ApplicationKeyGenerateRequestDTO;
import org.wso2.am.integration.clients.store.api.v1.dto.SubscriptionDTO;
import org.wso2.am.integration.clients.store.api.v1.dto.SubscriptionListDTO;
-import org.wso2.am.integration.test.Constants;
import org.wso2.am.integration.test.utils.base.APIMIntegrationConstants;
import org.wso2.am.integration.test.utils.bean.APIRequest;
-import org.wso2.am.integration.test.utils.http.HTTPSClientUtils;
import org.wso2.am.integration.tests.api.lifecycle.APIManagerLifecycleBaseTest;
import org.wso2.carbon.automation.engine.annotations.ExecutionEnvironment;
import org.wso2.carbon.automation.engine.annotations.SetEnvironment;
@@ -42,14 +41,14 @@
import org.wso2.carbon.automation.test.utils.http.client.HttpResponse;
import javax.ws.rs.core.Response;
+import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
+import static org.testng.Assert.*;
@SetEnvironment(executionEnvironments = {ExecutionEnvironment.STANDALONE})
public class APIEndpointTypeUpdateTestCase extends APIManagerLifecycleBaseTest {
@@ -94,7 +93,11 @@ public void testAPICreation() {
String apiName = "APIEndpointTypeUpdateTestCaseAPIName";
String description = "This is test API create by API manager integration test";
String tags = "test, EndpointType";
- apiRequest = new APIRequest(apiName, apiContext, endpointUrl);
+ apiRequest = new APIRequest(apiName, apiContext);
+ String endPointString = "{\n" + " \"endpoint_type\": \"sequence_backend\"\n" + "}";
+
+ JSONParser parser = new JSONParser();
+ apiRequest.setEndpoint((org.json.simple.JSONObject) parser.parse(endPointString));
apiRequest.setTags(tags);
apiRequest.setDescription(description);
apiRequest.setVersion(APIVersion);
@@ -121,83 +124,29 @@ public void testAPICreation() {
}
}
- @Test(groups = {"wso2.am"}, description = "Invoke HTTP before Update", dependsOnMethods = "testAPICreation")
- public void testHTTPTransportBeforeUpdate() {
+ @Test(groups = {
+ "wso2.am" }, description = "Update to only Sequence Backend endpoint and invoke", dependsOnMethods = "testAPICreation")
+ public void testUpdatedSequenceBackendEndpoint() {
try {
- waitForAPIDeploymentSync(apiRequest.getProvider(), apiRequest.getName(), apiRequest.getVersion(),
- APIMIntegrationConstants.IS_API_EXISTS);
- //invoke HTTP transport
- HttpResponse serviceResponse = HttpRequestUtil
- .doGet(getAPIInvocationURLHttp(apiContext, APIVersion), requestHeaders);
- assertEquals(serviceResponse.getResponseCode(), Response.Status.OK.getStatusCode(),
- "Response code mismatched when api http invocation");
-
- serviceResponse = HttpRequestUtil
- .doGet(getAPIInvocationURLHttps(apiContext, APIVersion), requestHeaders);
- assertEquals(serviceResponse.getResponseCode(), Response.Status.OK.getStatusCode(),
- "Response code mismatched when api https invocation");
- } catch (Exception e) {
- log.error("Error while executing test case " + e.getMessage(), e);
- fail(e.getMessage());
- }
-
- }
+ File seqProd = new File(getAMResourceLocation() + File.separator + "sequenceBackend" + File.separator
+ + "sequence_prod.xml");
+ File seqSand = new File(getAMResourceLocation() + File.separator + "sequenceBackend" + File.separator
+ + "sequence_sand.xml");
+ restAPIPublisher.addSequenceBackend(seqProd, apiId, "PRODUCTION");
+ restAPIPublisher.addSequenceBackend(seqSand, apiId, "SANDBOX");
+ final String responseDataExpected = "{\"Response\" : \"Sample Response\"}";
- @Test(groups = {"wso2.am"}, description = "Update to only HTTP transport and invoke",
- dependsOnMethods = "testHTTPTransportBeforeUpdate")
- public void testUpdatedHTTPTransport() {
-
- try {
- apiRequest.setHttps_checked("");
- apiRequest.setHttp_checked(Constants.PROTOCOL_HTTP);
- HttpResponse apiUpdateResponse = restAPIPublisher.updateAPI(apiRequest, apiId);
- assertEquals(apiUpdateResponse.getResponseCode(), Response.Status.OK.getStatusCode(),
- "Response Code miss matched when creating the API");
// Create Revision and Deploy to Gateway
createAPIRevisionAndDeployUsingRest(apiId, restAPIPublisher);
- waitForAPIDeployment();
-
- //invoke HTTP transport
- HttpResponse serviceResponse = HttpRequestUtil
- .doGet(getAPIInvocationURLHttp(apiContext, APIVersion), requestHeaders);
- assertEquals(serviceResponse.getResponseCode(), Response.Status.OK.getStatusCode(),
- "Response code mismatched when api http invocation");
-
- //invoke HTTPS transport
- serviceResponse = HTTPSClientUtils.doGet(getAPIInvocationURLHttps(apiContext, APIVersion), requestHeaders);
- assertEquals(serviceResponse.getResponseCode(), Response.Status.FORBIDDEN.getStatusCode(),
- "Response code mismatched when api https invocation");
- } catch (Exception e) {
- log.error("Error while executing test case " + e.getMessage(), e);
- fail(e.getMessage());
- }
- }
+ waitForAPIDeploymentSync(apiRequest.getProvider(), apiRequest.getName(), apiRequest.getVersion(),
+ APIMIntegrationConstants.IS_API_EXISTS);
- @Test(groups = {"wso2.am"}, description = "Update to only HTTPS transport and invoke",
- dependsOnMethods = "testHTTPTransportBeforeUpdate")
- public void testUpdatedHTTPSTransport() {
- try {
- //create update request for restrict HTTP
- apiRequest.setHttps_checked(Constants.PROTOCOL_HTTPS);
- apiRequest.setHttp_checked("");
- HttpResponse apiUpdateResponse = restAPIPublisher.updateAPI(apiRequest, apiId);
- assertEquals(apiUpdateResponse.getResponseCode(), Response.Status.OK.getStatusCode(),
- "Response Code miss matched when creating the API");
- // Create Revision and Deploy to Gateway
- createAPIRevisionAndDeployUsingRest(apiId, restAPIPublisher);
- waitForAPIDeployment();
-
- //invoke HTTP transport
- HttpResponse serviceResponse = HttpRequestUtil
- .doGet(getAPIInvocationURLHttp(apiContext, APIVersion), requestHeaders);
- assertEquals(serviceResponse.getResponseCode(), Response.Status.FORBIDDEN.getStatusCode(),
- "Response code mismatched when api http invocation");
-
- //invoke HTTPS transport
- serviceResponse = HttpRequestUtil
- .doGet(getAPIInvocationURLHttps(apiContext, APIVersion), requestHeaders);
- assertEquals(serviceResponse.getResponseCode(), Response.Status.OK.getStatusCode(),
+ HttpResponse response = HttpRequestUtil.doGet(getAPIInvocationURLHttps(apiContext, APIVersion),
+ requestHeaders);
+ assertEquals(response.getResponseCode(), Response.Status.OK.getStatusCode(),
"Response code mismatched when api https invocation");
+ assertNotNull(response.getData());
+ assertEquals(response.getData(), responseDataExpected);
} catch (Exception e) {
log.error("Error while executing test case " + e.getMessage(), e);
fail(e.getMessage());
diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/AM/sequenceBackend/sequence_prod.xml b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/AM/sequenceBackend/sequence_prod.xml
new file mode 100644
index 0000000000..3d406a02fd
--- /dev/null
+++ b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/AM/sequenceBackend/sequence_prod.xml
@@ -0,0 +1,5 @@
+
+ {"Response" : "Sample Response"}
+
+
+
\ No newline at end of file
diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/AM/sequenceBackend/sequence_sand.xml b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/AM/sequenceBackend/sequence_sand.xml
new file mode 100644
index 0000000000..3d406a02fd
--- /dev/null
+++ b/modules/integration/tests-integration/tests-backend/src/test/resources/artifacts/AM/sequenceBackend/sequence_sand.xml
@@ -0,0 +1,5 @@
+
+ {"Response" : "Sample Response"}
+
+
+
\ No newline at end of file
diff --git a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml
index 1d5b953712..beb21661c3 100644
--- a/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml
+++ b/modules/integration/tests-integration/tests-backend/src/test/resources/testng.xml
@@ -189,7 +189,7 @@
-
+