Class DtoFactory

java.lang.Object
org.wso2.am.integration.test.impl.DtoFactory

public class DtoFactory extends Object
  • Constructor Details

    • DtoFactory

      public DtoFactory()
  • Method Details

    • createExportThrottlePolicyDTO

      public static ExportThrottlePolicyDTO createExportThrottlePolicyDTO(String type, String subtype, String version, Object data)
      Creates Exported ThrottlingPolicyDTO using the given data
      Parameters:
      type - Policy Type
      subtype - Throttling Policy Type
      version - APIM version
      data - Throttling Policy data
      Returns:
    • createApiProductDTO

      public static APIProductDTO createApiProductDTO(String provider, String name, String context, String version, List<ProductAPIDTO> apis, List<String> polices)
    • createApplicationThrottlePolicyDTO

      public static ApplicationThrottlePolicyDTO createApplicationThrottlePolicyDTO(String policyName, String displayName, String description, boolean isDeployed, ThrottleLimitDTO defaultLimit)
      Creates an application throttling policy DTO using the given parameters.
      Parameters:
      policyName - Name of the policy.
      displayName - Display name of the policy.
      description - Description of the policy.
      isDeployed - Deployed status of the policy.
      defaultLimit - Default Limit of the policy.
      Returns:
      Created application throttling policy DTO.
    • createThrottleLimitDTO

      public static ThrottleLimitDTO createThrottleLimitDTO(ThrottleLimitDTO.TypeEnum type, RequestCountLimitDTO requestCountLimitDTO, BandwidthLimitDTO bandwidthLimitDTO)
      Creates a throttle limit DTO using the given parameters.
      Parameters:
      type - Type of the throttle limit. (Eg:- Request Count Limit, Bandwidth Limit)
      requestCountLimitDTO - Request count limit DTO object.
      bandwidthLimitDTO - Bandwidth limit DTO object.
      Returns:
      Created throttle limit DTO.
    • createEventCountThrottleLimitDTO

      public static ThrottleLimitDTO createEventCountThrottleLimitDTO(EventCountLimitDTO eventCountLimitDTO)
      Creates a throttle limit DTO using the given event count limit DTO.
      Parameters:
      eventCountLimitDTO - Event count limit DTO object.
      Returns:
      Created throttle limit DTO.
    • createRequestCountLimitDTO

      public static RequestCountLimitDTO createRequestCountLimitDTO(String timeUnit, Integer unitTime, Long requestCount)
      Creates a request count limit DTO using the given parameters.
      Parameters:
      timeUnit - Time limit.
      unitTime - Unit of time.
      requestCount - Request count limit.
      Returns:
      Created request count limit DTO.
    • createBandwidthLimitDTO

      public static BandwidthLimitDTO createBandwidthLimitDTO(String timeUnit, Integer unitTime, Long dataAmount, String dataUnit)
      Creates a bandwidth limit DTO using the given parameters.
      Parameters:
      timeUnit - Time limit.
      unitTime - Unit of time.
      dataAmount - Data amount limit.
      dataUnit - Unit of data.
      Returns:
      Created bandwidth limit DTO.
    • createSubscriptionThrottlePolicyPermissionDTO

      public static SubscriptionThrottlePolicyPermissionDTO createSubscriptionThrottlePolicyPermissionDTO(SubscriptionThrottlePolicyPermissionDTO.PermissionTypeEnum permissionType, List<String> roles)
      Creates a subscription throttling permission DTO using the given parameters.
      Parameters:
      permissionType - Permission type.
      roles - Roles.
      Returns:
      Created subscription throttle policy DTO.
    • createEventCountLimitDTO

      public static EventCountLimitDTO createEventCountLimitDTO(String timeUnit, Integer unitTime, Long eventCount)
      Creates a event count limit DTO using the given parameters.
      Parameters:
      timeUnit - Time limit.
      unitTime - Unit of time.
      eventCount - Event count limit.
      Returns:
      Created event count limit DTO.
    • createSubscriptionThrottlePolicyDTO

      public static SubscriptionThrottlePolicyDTO createSubscriptionThrottlePolicyDTO(String policyName, String displayName, String description, boolean isDeployed, ThrottleLimitDTO defaultLimit, int graphQLMaxComplexity, int graphQLMaxDepth, int rateLimitCount, String rateLimitTimeUnit, List<CustomAttributeDTO> customAttributes, boolean stopQuotaOnReach, String billingPlan, int subscriberCount, SubscriptionThrottlePolicyPermissionDTO permissions)
      Creates a subscription throttling policy DTO using the given parameters.
      Parameters:
      policyName - Name of the policy.
      displayName - Display name of the policy.
      description - Description of the policy.
      isDeployed - Deployed status of the policy.
      defaultLimit - Default Limit of the policy.
      graphQLMaxComplexity - Maximum Complexity of the GraphQL query.
      graphQLMaxDepth - Maximum Depth of the GraphQL query.
      rateLimitCount - Burst control request count.
      rateLimitTimeUnit - Burst control time unit.
      customAttributes - Custom attributes added to the Subscription Throttling Policy.
      stopQuotaOnReach - Action to be taken when a user goes beyond the allocated quota.
      billingPlan - Defines whether this is a Paid or a Free plan.
      Returns:
      Created subscription throttling policy DTO.
    • createSubscriptionThrottlePolicyDTO

      public static SubscriptionThrottlePolicyDTO createSubscriptionThrottlePolicyDTO(String policyName, String displayName, String description, boolean isDeployed, ThrottleLimitDTO defaultLimit, int rateLimitCount, String rateLimitTimeUnit, boolean stopQuotaOnReach, SubscriptionThrottlePolicyPermissionDTO permissions)
      Creates a subscription throttling policy DTO using the given parameters.
      Parameters:
      policyName - Name of the policy.
      displayName - Display name of the policy.
      description - Description of the policy.
      isDeployed - Deployed status of the policy.
      defaultLimit - Default Limit of the policy.
      rateLimitCount - Burst control request count.
      rateLimitTimeUnit - Burst control time unit.
      stopQuotaOnReach - Action to be taken when a user goes beyond the allocated quota.
      Returns:
      Created subscription throttling policy DTO.
    • createCustomThrottlePolicyDTO

      public static CustomRuleDTO createCustomThrottlePolicyDTO(String policyName, String description, boolean isDeployed, String siddhiQuery, String keyTemplate)
      Creates a custom throttling policy DTO using the given parameters.
      Parameters:
      policyName - Name of the policy.
      description - Description of the policy.
      isDeployed - Deployed status of the policy.
      siddhiQuery - Siddhi query which represents the custom throttling policy.
      keyTemplate - The specific combination of attributes that are checked in the policy.
      Returns:
      Created custom throttling policy DTO.
    • createBlockingConditionDTO

      public static BlockingConditionDTO createBlockingConditionDTO(BlockingConditionDTO.ConditionTypeEnum conditionType, String conditionValue, boolean conditionStatus)
      Creates a blacklist policy DTO using the given parameters.
      Parameters:
      conditionType - Blocking condition type
      conditionValue - Blocking condition value
      conditionStatus - Activation status of the blocking condition
      Returns:
      Created blocking conditions DTO.
    • createHeaderConditionDTO

      public static HeaderConditionDTO createHeaderConditionDTO(String headerName, String headerValue)
      Creates a header condition DTO using the given parameters.
      Parameters:
      headerName - Name of the header.
      headerValue - Value of the header.
      Returns:
      Created header condition DTO.
    • createIPConditionDTO

      public static IPConditionDTO createIPConditionDTO(IPConditionDTO.IpConditionTypeEnum ipConditionType, String specificIP, String startingIP, String endingIP)
      Creates a IP condition DTO using the given parameters.
      Parameters:
      ipConditionType - Type of the IP condition.
      specificIP - Specific IP when "IPSPECIFIC" is used as the ipConditionType.
      startingIP - Staring IP when "IPRANGE" is used as the ipConditionType
      endingIP - Ending IP when "IPRANGE" is used as the ipConditionType.
      Returns:
      Created IP condition DTO.
    • createJWTClaimsConditionDTO

      public static JWTClaimsConditionDTO createJWTClaimsConditionDTO(String claimUrl, String attribute)
      Creates a JWT claims condition DTO using the given parameters.
      Parameters:
      claimUrl - JWT claim URL.
      attribute - Attribute to be matched.
      Returns:
      Created JWT claims condition DTO.
    • createQueryParameterConditionDTO

      public static QueryParameterConditionDTO createQueryParameterConditionDTO(String parameterName, String parameterValue)
      Creates a query parameter condition DTO using the given parameters.
      Parameters:
      parameterName - Name of the query parameter.
      parameterValue - Value of the query parameter to be matched.
      Returns:
      Created query parameter condition DTO.
    • createThrottleConditionDTO

      public static ThrottleConditionDTO createThrottleConditionDTO(ThrottleConditionDTO.TypeEnum type, boolean invertCondition, HeaderConditionDTO headerCondition, IPConditionDTO ipCondition, JWTClaimsConditionDTO jwtClaimsCondition, QueryParameterConditionDTO queryParameterCondition)
      Creates a throttle condition DTO using the given parameters.
      Parameters:
      type - Type of the throttling condition.
      invertCondition - Specifies whether inversion of the condition to be matched against the request.
      headerCondition - HTTP Header based throttling condition.
      ipCondition - IP based throttling condition.
      jwtClaimsCondition - JWT claim attribute based throttling condition.
      queryParameterCondition - Query parameter based throttling condition.
      Returns:
      Created throttle condition DTO.
    • createConditionalGroupDTO

      public static ConditionalGroupDTO createConditionalGroupDTO(String description, List<ThrottleConditionDTO> conditions, ThrottleLimitDTO limit)
      Creates a conditional group DTO using the given parameters.
      Parameters:
      description - Description of the conditional group.
      conditions - Individual throttling conditions.
      limit - Throttle limit of the conditional group.
      Returns:
      Created conditional group DTO.
    • createAdvancedThrottlePolicyDTO

      public static AdvancedThrottlePolicyDTO createAdvancedThrottlePolicyDTO(String policyName, String displayName, String description, boolean isDeployed, ThrottleLimitDTO defaultLimit, List<ConditionalGroupDTO> conditionalGroups)
      Creates an advanced throttling policy DTO using the given parameters.
      Parameters:
      policyName - Name of the policy.
      displayName - Display name of the policy.
      description - Description of the policy.
      isDeployed - Deployed status of the policy.
      defaultLimit - Default Limit of the policy.
      conditionalGroups - List of conditional groups attached to the policy.
      Returns:
      Created advanced throttling policy DTO.
    • createLabelDTO

      public static LabelDTO createLabelDTO(String name, String description, List<String> accessUrls)
      Creates a label DTO using the given parameters.
      Parameters:
      name - Name of the label.
      description - Description of the label.
      accessUrls - Access URLs.
      Returns:
      Created label DTO.
    • createEnvironmentDTO

      public static EnvironmentDTO createEnvironmentDTO(String name, String displayName, String description, String provider, boolean isReadOnly, List<VHostDTO> vhosts, String gatewayType)
      Creates an Environment DTO using the given parameters
      Parameters:
      name - Name of the environment
      displayName - Display name of the environment
      description - Description of the environment
      provider - Vendor provider of the environment
      vhosts - Vhosts available in the environment
      Returns:
      Environment DTO object
    • createVhostDTO

      public static VHostDTO createVhostDTO(String host, String httpContext, Integer httpPort, Integer httpsPort, Integer wsPort, Integer wssPort)
      Creates a Vhost DTO using the given parameters
      Parameters:
      host - Host name
      httpContext - HTTP context of access URL
      httpPort - HTTP port
      httpsPort - HTTPS port
      wsPort - WS port
      wssPort - WSS port
      Returns:
      VHost DTO object
    • createApiCategoryDTO

      public static APICategoryDTO createApiCategoryDTO(String name, String description)
      Creates an api category DTO using the given parameters.
      Parameters:
      name - Name of the label.
      description - Description of the label.
      Returns:
      Created api category DTO.
    • createKeyManagerDTO

      public static KeyManagerDTO createKeyManagerDTO(String name, String description, String type, String displayName, String issuer, String consumerKeyClaim, String scopesClaim, List<String> availableGrantTypes, KeyManagerCertificatesDTO certificates)
      Creates an key manager DTO using the given parameters.
      Parameters:
      name - Name of key manager.
      description - Description of the key manager.
      type - Type of the key manager.
      displayName - Display name of the key manager.
      issuer - Issuer of the key manager.
      consumerKeyClaim - Consumer key claim URI of the key manager.
      scopesClaim - Scopes claim URI of the key manager.
      availableGrantTypes - Available grant types of the key manager.
      certificates - Certificates of the key manager.
      Returns:
      Created key manager DTO.
    • createKeyManagerDTO

      public static KeyManagerDTO createKeyManagerDTO(String name, String description, String type, String displayName, String introspectionEndpoint, String issuer, String clientRegistrationEndpoint, String tokenEndpoint, String revokeEndpoint, String userInfoEndpoint, String authorizeEndpoint, String scopeManagementEndpoint, String consumerKeyClaim, String scopesClaim, List<String> availableGrantTypes, Object additionalProperties, KeyManagerCertificatesDTO certificates)
      Creates an key manager DTO using the given parameters.
      Parameters:
      name - Name of key manager.
      description - Description of the key manager.
      type - Type of the key manager.
      displayName - Display name of the key manager.
      introspectionEndpoint - Introspection endpoint of the key manager.
      issuer - Issuer of the key manager.
      clientRegistrationEndpoint - Client registration endpoint of the key manager.
      tokenEndpoint - Token endpoint of the key manager.
      revokeEndpoint - Revoke endpoint of the key manager.
      userInfoEndpoint - User info endpoint of the key manager.
      authorizeEndpoint - Authorize endpoint of the key manager.
      scopeManagementEndpoint - Scope management endpoint of the key manager.
      consumerKeyClaim - Consumer key claim URI of the key manager.
      scopesClaim - Scopes claim URI of the key manager.
      availableGrantTypes - Available grant types of the key manager.
      additionalProperties - Additional properties of the key manager.
      certificates - Certificates of the key manager.
      Returns:
      Created key manager DTO.
    • createKeyManagerCertificatesDTO

      public static KeyManagerCertificatesDTO createKeyManagerCertificatesDTO(KeyManagerCertificatesDTO.TypeEnum type, String value)
      Creates an key manager certificate DTO using the given parameters.
      Parameters:
      type - Type of the key manager certificate.
      value - Value of the key manager certificate.
      Returns:
      Created key manager certificate DTO.