Class APIPublisherRestClient

java.lang.Object
org.wso2.am.integration.test.utils.clients.APIPublisherRestClient

public class APIPublisherRestClient extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    construct of API rest client
  • Method Summary

    Modifier and Type
    Method
    Description
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    addAPI(APICreationRequestBean creationRequestBean)
    Add a API using APICreationRequestBean object
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    addAPI(APIRequest apiRequest)
    Facilitate add API into publisher node
    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)
    Adding a Document to a API
    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)
    Adding a Document to a API
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    Adding a Document to a API using AddDocumentRequestBean
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    change status of a created API
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    changeAPILifeCycleStatusToPublish(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 not
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    Validate API Name when creating a new API
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    checkValidEndpoint(String type, String endpointUrl, String providerName, String apiName, String apiVersion)
    Check whether the Endpoint is valid
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    copyAPI(String provider, String apiName, String oldVersion, String newVersion, String isDefaultVersion)
    copy API from existing API
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    deleteAPI(String apiName, String version, String provider)
    delete API
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    Design an API using APIDesignBean object
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    Retrieve the All APIs available for the user in Publisher.
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    getApi(String apiName, String provider, String version)
    Get the API information for the given API Name,API Version and API Provider
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    getAPI(String apiName, String provider)
    Method to get API information
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    getAPI(String apiName, String provider, String version)
    Get the API information for the given API Name, API Version and API Provider
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    getAPIImplementPage(String apiName, String provider, String version)
    Retrieve implementation page for the requested API
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    getAPIInformationPage(String apiName, String provider, String version)
    Retrieve the API Information Page
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    getAPIManagePage(String apiName, String provider, String version)
    Retrieve the API Manage Page
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    Retrieve the Tier Permission Page
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
     
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    implement(APIImplementationBean implementationBean)
     
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    login(String userName, String password)
    login to publisher app
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    log out from publisher
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    removeDocumentation(String apiName, String version, String provider, String docName, String docType)
    Remove document
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    revokeAccessToken(String accessToken, String consumerKey, String authUser)
    revoke access token
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    updateAPI(APICreationRequestBean creationRequestBean)
    Update a API using APICreationRequestBean object
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    updateAPI(APIRequest apiRequest)
    Facilitate update API
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    updateDocument(String apiName, String version, String provider, String docName, String content)
     
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    updatePermissions(String tierName, String permissionType, String roles)
    update permissions to API access
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    updateResourceOfAPI(String provider, String apiName, String version, String swaggerRes)
    Update resources of API
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
    uploadCertificate(ClientCertificateCreationBean clientCertificateCreationBean)
    To upload a client certificate against an API.
    org.wso2.carbon.automation.test.utils.http.client.HttpResponse
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • APIPublisherRestClient

      public APIPublisherRestClient(String backendURL)
      construct of API rest client
      Parameters:
      backendURL - - backend URL of the publisher Jaggery app
  • Method Details

    • 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 name
      password - - 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 APIManagerIntegrationTestException
      log 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: admin
      apiName - - API name
      oldVersion - - existing version
      newVersion - - new version
      isDefaultVersion - - 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 fails
      Exception
    • 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 name
      provider - - 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 name
      version - - API version
      provider - - 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 name
      version - - API version
      provider - - name of the provider
      docName - - document name
      docType - - 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 received
      consumerKey - - consumer key returned
      authUser - - 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 tier
      permissionType - - permission type
      roles - - 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 creator
      apiName - - name of api
      version - - api version
      swaggerRes - - 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 API
      provider - Provider Name of the API
      version - 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:
      type - type of Endpoint
      endpointUrl - url of the 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 APIManagerIntegrationTestException
      Change the API Lifecycle status to Publish with the option of Re-subscription is required or not
      Parameters:
      apiIdentifier - - Instance of APIIdentifier
      isRequireReSubscription - - 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 API
      provider - - Provider Name of the API
      version - - 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 APIManagerIntegrationTestException
      Retrieve 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 Document
      docType - - Document Type
      sourceType - - Source Type
      docUrl - - Document URL
      summary - - Document summary
      docLocation - - 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 Document
      docType - - Document Type
      sourceType - - Source Type
      docUrl - - Document URL
      summary - - Document summary
      docLocation - - 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
      Throws:
      APIManagerIntegrationTestException
    • getAllAPIs

      public org.wso2.carbon.automation.test.utils.http.client.HttpResponse getAllAPIs() throws APIManagerIntegrationTestException
      Retrieve 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
      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 API
      provider - - Provider of the API
      version - -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