Class APIPublisherRestClient
- java.lang.Object
-
- org.wso2.am.integration.test.utils.clients.APIPublisherRestClient
-
public class APIPublisherRestClient extends Object
-
-
Constructor Summary
Constructors Constructor Description APIPublisherRestClient(String backendURL)construct of API rest client
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.wso2.carbon.automation.test.utils.http.client.HttpResponseaddAPI(APICreationRequestBean creationRequestBean)Add a API using APICreationRequestBean objectorg.wso2.carbon.automation.test.utils.http.client.HttpResponseaddAPI(APIRequest apiRequest)Facilitate add API into publisher nodeorg.wso2.carbon.automation.test.utils.http.client.HttpResponseaddDocument(String apiName, String version, String provider, String docName, String docType, String sourceType, String docUrl, String summary, String docLocation)Adding a Document to a APIorg.wso2.carbon.automation.test.utils.http.client.HttpResponseaddDocument(String apiName, String version, String provider, String docName, String docType, String sourceType, String docUrl, String summary, String docLocation, String mimeType, String newType)Adding a Document to a APIorg.wso2.carbon.automation.test.utils.http.client.HttpResponseaddDocument(AddDocumentRequestBean addDocRequestBean)Adding a Document to a API using AddDocumentRequestBeanorg.wso2.carbon.automation.test.utils.http.client.HttpResponsechangeAPILifeCycleStatus(APILifeCycleStateRequest updateRequest)change status of a created APIorg.wso2.carbon.automation.test.utils.http.client.HttpResponsechangeAPILifeCycleStatusToPublish(org.wso2.carbon.apimgt.api.model.APIIdentifier apiIdentifier, boolean isRequireReSubscription)Change the API Lifecycle status to Publish with the option of Re-subscription is required or notorg.wso2.carbon.automation.test.utils.http.client.HttpResponsecheckValidAPIName(String apiName)Validate API Name when creating a new APIorg.wso2.carbon.automation.test.utils.http.client.HttpResponsecheckValidEndpoint(String type, String endpointUrl, String providerName, String apiName, String apiVersion)Check whether the Endpoint is validorg.wso2.carbon.automation.test.utils.http.client.HttpResponsecopyAPI(String provider, String apiName, String oldVersion, String newVersion, String isDefaultVersion)copy API from existing APIorg.wso2.carbon.automation.test.utils.http.client.HttpResponsedeleteAPI(String apiName, String version, String provider)delete APIorg.wso2.carbon.automation.test.utils.http.client.HttpResponsedesignAPI(APIDesignBean designBean)Design an API using APIDesignBean objectorg.wso2.carbon.automation.test.utils.http.client.HttpResponsegetAllAPIs()Retrieve the All APIs available for the user in Publisher.org.wso2.carbon.automation.test.utils.http.client.HttpResponsegetApi(String apiName, String provider, String version)Get the API information for the given API Name,API Version and API Providerorg.wso2.carbon.automation.test.utils.http.client.HttpResponsegetAPI(String apiName, String provider)Method to get API informationorg.wso2.carbon.automation.test.utils.http.client.HttpResponsegetAPI(String apiName, String provider, String version)Get the API information for the given API Name, API Version and API Providerorg.wso2.carbon.automation.test.utils.http.client.HttpResponsegetAPIImplementPage(String apiName, String provider, String version)Retrieve implementation page for the requested APIorg.wso2.carbon.automation.test.utils.http.client.HttpResponsegetAPIInformationPage(String apiName, String provider, String version)Retrieve the API Information Pageorg.wso2.carbon.automation.test.utils.http.client.HttpResponsegetAPIManagePage(String apiName, String provider, String version)Retrieve the API Manage Pageorg.wso2.carbon.automation.test.utils.http.client.HttpResponsegetTierPermissionsPage()Retrieve the Tier Permission Pageorg.wso2.carbon.automation.test.utils.http.client.HttpResponsegetTiers()org.wso2.carbon.automation.test.utils.http.client.HttpResponseimplement(APIImplementationBean implementationBean)org.wso2.carbon.automation.test.utils.http.client.HttpResponselogin(String userName, String password)login to publisher apporg.wso2.carbon.automation.test.utils.http.client.HttpResponselogout()log out from publisherorg.wso2.carbon.automation.test.utils.http.client.HttpResponseremoveDocumentation(String apiName, String version, String provider, String docName, String docType)Remove documentorg.wso2.carbon.automation.test.utils.http.client.HttpResponserevokeAccessToken(String accessToken, String consumerKey, String authUser)revoke access tokenorg.wso2.carbon.automation.test.utils.http.client.HttpResponseupdateAPI(APICreationRequestBean creationRequestBean)Update a API using APICreationRequestBean objectorg.wso2.carbon.automation.test.utils.http.client.HttpResponseupdateAPI(APIRequest apiRequest)Facilitate update APIorg.wso2.carbon.automation.test.utils.http.client.HttpResponseupdateDocument(String apiName, String version, String provider, String docName, String content)org.wso2.carbon.automation.test.utils.http.client.HttpResponseupdatePermissions(String tierName, String permissionType, String roles)update permissions to API accessorg.wso2.carbon.automation.test.utils.http.client.HttpResponseupdateResourceOfAPI(String provider, String apiName, String version, String swaggerRes)Update resources of APIorg.wso2.carbon.automation.test.utils.http.client.HttpResponseuploadCertificate(ClientCertificateCreationBean clientCertificateCreationBean)To upload a client certificate against an API.org.wso2.carbon.automation.test.utils.http.client.HttpResponsevalidateRoles(String role)
-
-
-
Constructor Detail
-
APIPublisherRestClient
public APIPublisherRestClient(String backendURL)
construct of API rest client- Parameters:
backendURL- - backend URL of the publisher Jaggery app
-
-
Method Detail
-
login
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse login(String userName, String password) throws APIManagerIntegrationTestException
login to publisher app- Parameters:
userName- - provided user namepassword- - password- Returns:
- HTTP response object
- Throws:
APIManagerIntegrationTestException- - Throws if user cannot login to the publisher
-
logout
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse logout() throws APIManagerIntegrationTestExceptionlog out from publisher- Returns:
- http response object
- Throws:
APIManagerIntegrationTestException- - Throws if logout fails
-
addAPI
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse addAPI(APIRequest apiRequest) throws APIManagerIntegrationTestException
Facilitate add API into publisher node- Parameters:
apiRequest- - Constructed API request object- Returns:
- http response object
- Throws:
APIManagerIntegrationTestException- - Throws if API addition fails
-
copyAPI
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse copyAPI(String provider, String apiName, String oldVersion, String newVersion, String isDefaultVersion) throws APIManagerIntegrationTestException
copy API from existing API- Parameters:
provider- - name of the provider , ex: adminapiName- - API nameoldVersion- - existing versionnewVersion- - new versionisDefaultVersion- - check default version- Returns:
- - http response object
- Throws:
APIManagerIntegrationTestException- - Throws if error occurred at API copy operation
-
updateAPI
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse updateAPI(APIRequest apiRequest) throws Exception
Facilitate update API- Parameters:
apiRequest- - constructed API request object- Returns:
- http response object
- Throws:
APIManagerIntegrationTestException- - throws if update API failsException
-
changeAPILifeCycleStatus
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse changeAPILifeCycleStatus(APILifeCycleStateRequest updateRequest) throws APIManagerIntegrationTestException
change status of a created API- Parameters:
updateRequest- - APILifeCycleStateRequest object- Returns:
- http response object
- Throws:
APIManagerIntegrationTestException- - throws if change lifecycle state fails
-
getAPI
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAPI(String apiName, String provider) throws APIManagerIntegrationTestException
Method to get API information- Parameters:
apiName- - API nameprovider- - name of the provider- Returns:
- http response object
- Throws:
APIManagerIntegrationTestException- - Throws if api information cannot be retrieved.
-
deleteAPI
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse deleteAPI(String apiName, String version, String provider) throws APIManagerIntegrationTestException
delete API- Parameters:
apiName- - API nameversion- - API versionprovider- - name of the provider- Returns:
- http response object
- Throws:
APIManagerIntegrationTestException- - Throws if API delete fails
-
removeDocumentation
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse removeDocumentation(String apiName, String version, String provider, String docName, String docType) throws APIManagerIntegrationTestException
Remove document- Parameters:
apiName- - API nameversion- - API versionprovider- - name of the providerdocName- - document namedocType- - document type- Returns:
- http response object
- Throws:
APIManagerIntegrationTestException- - Throws if remove API document fails
-
revokeAccessToken
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse revokeAccessToken(String accessToken, String consumerKey, String authUser) throws APIManagerIntegrationTestException
revoke access token- Parameters:
accessToken- - access token already receivedconsumerKey- - consumer key returnedauthUser- - user name- Returns:
- http response object
- Throws:
APIManagerIntegrationTestException- - throws if access token revoke fails
-
updatePermissions
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse updatePermissions(String tierName, String permissionType, String roles) throws APIManagerIntegrationTestException
update permissions to API access- Parameters:
tierName- - name of api throttling tierpermissionType- - permission typeroles- - roles of permission- Returns:
- http response object
- Throws:
APIManagerIntegrationTestException- - throws if permission update fails
-
updateResourceOfAPI
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse updateResourceOfAPI(String provider, String apiName, String version, String swaggerRes) throws APIManagerIntegrationTestException
Update resources of API- Parameters:
provider- - provider name of creatorapiName- - name of apiversion- - api versionswaggerRes- - swagger doc- Returns:
- http response object
- Throws:
APIManagerIntegrationTestException- - throws if API resource update fails
-
getAPI
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAPI(String apiName, String provider, String version) throws APIManagerIntegrationTestException
Get the API information for the given API Name, API Version and API Provider- Parameters:
apiName- Name of the APIprovider- Provider Name of the APIversion- Version of the API- Returns:
- http response object
- Throws:
APIManagerIntegrationTestException- - Unable to get API information
-
checkValidEndpoint
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse checkValidEndpoint(String type, String endpointUrl, String providerName, String apiName, String apiVersion) throws APIManagerIntegrationTestException
Check whether the Endpoint is valid- Parameters:
endpointUrl- url of the endpointtype- type of Endpoint- Returns:
- HttpResponse - Response of the getAPI request
- Throws:
APIManagerIntegrationTestException- - Check for valid endpoint fails.
-
changeAPILifeCycleStatusToPublish
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse changeAPILifeCycleStatusToPublish(org.wso2.carbon.apimgt.api.model.APIIdentifier apiIdentifier, boolean isRequireReSubscription) throws APIManagerIntegrationTestExceptionChange the API Lifecycle status to Publish with the option of Re-subscription is required or not- Parameters:
apiIdentifier- - Instance of APIIdentifierisRequireReSubscription- - true if Re-subscription is required else false.- Returns:
- HttpResponse - Response of the API publish event
- Throws:
APIManagerIntegrationTestException- - Exception Throws in checkAuthentication() and when do the REST service calls to do the lifecycle change.
-
getApi
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getApi(String apiName, String provider, String version) throws APIManagerIntegrationTestException
Get the API information for the given API Name,API Version and API Provider- Parameters:
apiName- - Name of the APIprovider- - Provider Name of the APIversion- - Version of the API- Returns:
- HttpResponse - Response of the getAPI request
- Throws:
APIManagerIntegrationTestException- - Exception Throws in checkAuthentication() and when do the REST service calls to get the API information.
-
getTierPermissionsPage
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getTierPermissionsPage() throws APIManagerIntegrationTestExceptionRetrieve the Tier Permission Page- Returns:
- HttpResponse - Response that contains the Tier Permission Page
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doGet() method call
-
getAPIManagePage
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAPIManagePage(String apiName, String provider, String version) throws APIManagerIntegrationTestException
Retrieve the API Manage Page- Parameters:
apiName- - Name of the API.provider- - Name of the API Provider.version- - Version of the API.- Returns:
- HttpResponse - Response that contains the API Manage Page
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doGet() method call
-
getAPIInformationPage
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAPIInformationPage(String apiName, String provider, String version) throws APIManagerIntegrationTestException
Retrieve the API Information Page- Parameters:
apiName- - Name of the API.provider- - Name of the API Provider.version- - Version of the API.- Returns:
- HttpResponse - Response that contains the API Information Page
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doGet() method call
-
addDocument
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse addDocument(String apiName, String version, String provider, String docName, String docType, String sourceType, String docUrl, String summary, String docLocation, String mimeType, String newType) throws APIManagerIntegrationTestException
Adding a Document to a API- Parameters:
apiName- - Name of the API.version- - Version of the API.provider- - Name of the API Provider.docName- - Name of the DocumentdocType- - Document TypesourceType- - Source TypedocUrl- - Document URLsummary- - Document summarydocLocation- - Document Location- Returns:
- HttpResponse - Response with Document adding result.
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
-
addDocument
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse addDocument(String apiName, String version, String provider, String docName, String docType, String sourceType, String docUrl, String summary, String docLocation) throws APIManagerIntegrationTestException
Adding a Document to a API- Parameters:
apiName- - Name of the API.version- - Version of the API.provider- - Name of the API Provider.docName- - Name of the DocumentdocType- - Document TypesourceType- - Source TypedocUrl- - Document URLsummary- - Document summarydocLocation- - Document Location- Returns:
- HttpResponse - Response with Document adding result.
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
-
addDocument
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse addDocument(AddDocumentRequestBean addDocRequestBean) throws APIManagerIntegrationTestException
Adding a Document to a API using AddDocumentRequestBean- Parameters:
addDocRequestBean- - Bean that contains all the values that needed to create a Document.- Returns:
- HttpResponse - Response with Document adding result.
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
-
updateDocument
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse updateDocument(String apiName, String version, String provider, String docName, String content) throws APIManagerIntegrationTestException
-
getAllAPIs
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAllAPIs() throws APIManagerIntegrationTestExceptionRetrieve the All APIs available for the user in Publisher.- Returns:
- HttpResponse - Response that contains all available APIs for the user
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doGet() method call
-
addAPI
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse addAPI(APICreationRequestBean creationRequestBean) throws APIManagerIntegrationTestException
Add a API using APICreationRequestBean object- Parameters:
creationRequestBean- - Instance of APICreationRequestBean object with all needed information to create the API.- Returns:
- HttpResponse - Response that contains the result of APi creation activity.
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
-
uploadCertificate
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse uploadCertificate(ClientCertificateCreationBean clientCertificateCreationBean) throws APIManagerIntegrationTestException
To upload a client certificate against an API.- Parameters:
clientCertificateCreationBean- Client Certificate Creation Bean with required information for uploading client certificate.- Returns:
- Http response after uploading the certificate.
- Throws:
APIManagerIntegrationTestException- API Manager Integration Test Exception.
-
updateAPI
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse updateAPI(APICreationRequestBean creationRequestBean) throws APIManagerIntegrationTestException
Update a API using APICreationRequestBean object- Parameters:
creationRequestBean- - Instance of APICreationRequestBean object with all needed information to Update the API.- Returns:
- HttpResponse - Response that contains the result of APi creation activity.
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
-
designAPI
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse designAPI(APIDesignBean designBean) throws APIManagerIntegrationTestException
Design an API using APIDesignBean object- Parameters:
designBean- -Instance of APIDesignBean object with all needed information to create an API up to design level.- Returns:
- HttpResponse -Response that contains the results of API creation up to design level
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
-
implement
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse implement(APIImplementationBean implementationBean) throws APIManagerIntegrationTestException
-
getAPIImplementPage
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAPIImplementPage(String apiName, String provider, String version) throws APIManagerIntegrationTestException
Retrieve implementation page for the requested API- Parameters:
apiName- - Name of the APIprovider- - Provider of the APIversion- -Version of the API- Returns:
- - Response that contains the implementation page of the API
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doGet() method call
-
checkValidAPIName
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse checkValidAPIName(String apiName) throws APIManagerIntegrationTestException
Validate API Name when creating a new API- Parameters:
apiName- - Name of the API- Returns:
- - Response that contains the API is valid or not..
- Throws:
APIManagerIntegrationTestException- - Exception throws from checkAuthentication() method and HTTPSClientUtils.doPost() method call
-
getTiers
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getTiers() throws APIManagerIntegrationTestException- Returns:
- - Response that contains all the available tiers
- Throws:
APIManagerIntegrationTestException
-
validateRoles
public org.wso2.carbon.automation.test.utils.http.client.HttpResponse validateRoles(String role) throws APIManagerIntegrationTestException
- Parameters:
role- role- Returns:
- HttpResponse
- Throws:
APIManagerIntegrationTestException
-
-