diff --git a/test/apim-apk-agent-test/agent-helm-chart/templates/serviceAccount/agent-cluster-role.yaml b/test/apim-apk-agent-test/agent-helm-chart/templates/serviceAccount/agent-cluster-role.yaml index 5f11b5e61d..aaedc90699 100644 --- a/test/apim-apk-agent-test/agent-helm-chart/templates/serviceAccount/agent-cluster-role.yaml +++ b/test/apim-apk-agent-test/agent-helm-chart/templates/serviceAccount/agent-cluster-role.yaml @@ -122,15 +122,15 @@ rules: - apiGroups: ["dp.wso2.com"] resources: ["gqlroutes/status"] verbs: ["get","patch","update"] - - apiGroups: [ "dp.wso2.com" ] - resources: [ "aiproviders" ] - verbs: [ "get","list","watch","update","delete","create" ] - - apiGroups: [ "dp.wso2.com" ] - resources: [ "aiproviders/status" ] - verbs: [ "get","patch","update" ] - - apiGroups: [ "dp.wso2.com" ] - resources: [ "aiproviders/finalizers" ] - verbs: [ "update" ] + - apiGroups: ["dp.wso2.com"] + resources: ["aiproviders"] + verbs: ["get","list","watch","update","delete","create"] + - apiGroups: ["dp.wso2.com"] + resources: ["aiproviders/status"] + verbs: ["get","patch","update"] + - apiGroups: ["dp.wso2.com"] + resources: ["aiproviders/finalizers"] + verbs: ["update"] - apiGroups: ["dp.wso2.com"] resources: ["airatelimitpolicies"] verbs: ["get","list","watch","update","delete","create"] diff --git a/test/apim-apk-agent-test/cucumber-tests/.gitattributes b/test/apim-apk-agent-test/cucumber-tests/.gitattributes deleted file mode 100644 index 097f9f98d9..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/.gitattributes +++ /dev/null @@ -1,9 +0,0 @@ -# -# https://help.github.com/articles/dealing-with-line-endings/ -# -# Linux start script should use lf -/gradlew text eol=lf - -# These are Windows script files and should use crlf -*.bat text eol=crlf - diff --git a/test/apim-apk-agent-test/cucumber-tests/.gitignore b/test/apim-apk-agent-test/cucumber-tests/.gitignore deleted file mode 100644 index 1b6985c009..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# Ignore Gradle project-specific cache directory -.gradle - -# Ignore Gradle build output directory -build diff --git a/test/apim-apk-agent-test/cucumber-tests/CRs/artifacts.yaml b/test/apim-apk-agent-test/cucumber-tests/CRs/artifacts.yaml deleted file mode 100644 index 0182fd1569..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/CRs/artifacts.yaml +++ /dev/null @@ -1,1159 +0,0 @@ -# -------------------------------------------------------------------- - -# Copyright (c) 2024, WSO2 LLC (http://www.wso2.com). - -# WSO2 LLC licenses this file to you under the Apache License, -# Version 2.0 (the "License"); you may not use this file except -# in compliance with the License. -# You may obtain a copy of the License at - -# http://www.apache.org/licenses/LICENSE-2.0 - -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# ----------------------------------------------------------------------- - -apiVersion: v1 -kind: Service -metadata: - name: backend - namespace: apk -spec: - ports: - - name: http - port: 80 - targetPort: 80 - selector: - app: httpbin ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: httpbin - namespace: apk -spec: - replicas: 1 - selector: - matchLabels: - app: httpbin - template: - metadata: - labels: - app: httpbin - spec: - containers: - - image: docker.io/kennethreitz/httpbin:latest - imagePullPolicy: IfNotPresent - name: httpbin - ports: - - containerPort: 80 - resources: - requests: - memory: "200Mi" - cpu: "300m" - limits: - memory: "200Mi" - cpu: "300m" ---- -apiVersion: v1 -kind: Secret -metadata: - name: backend-creds - namespace: apk -data: - username: YWRtaW4= - password: YWRtaW4= -type: Opaque ---- -apiVersion: v1 -kind: Secret -metadata: - name: backend-creds-1 - namespace: apk -data: - username: ZHNmZHNmc2Rmc2Rm - password: YWRtaW4= -type: Opaque ---- -apiVersion: dp.wso2.com/v1alpha1 -kind: TokenIssuer -metadata: - name: jwtissuer-1 - namespace: apk -spec: - consumerKeyClaim: azp - issuer: https://idp.am.wso2.com/token - name: Domain-service-idp - organization: default - scopesClaim: scope - signatureValidation: - certificate: - secretRef: - key: wso2carbon.pem - name: apk-test-setup-wso2-apk-enforcer-truststore-secret - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: wso2-apk-default ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: interceptor-service-config-toml - namespace: apk -data: - Config.toml: | - [ballerina.log] - level = "DEBUG" - [ballerina.http] - traceLogConsole = true ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: interceptor-service-configmap - namespace: "apk" -binaryData: - tls.key: LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcEFJQkFBS0NBUUVBcHl4OGhtYW0yWkduNTR3bndnb1VWblY1QnMwRHhFZm9HckVUWENsMEhDdWYyYmoxCkZ6VXdQOWRza2IzZE9VbHU4b0lramUrMmZFa1pGOXRBWEM4akpGTFlETXVYYjVXMVpHVlZJQkYyVlZQY2RLVkgKRjA3WkU2V1VDVWdJUHZtN0RJbFBFMUI0RkhXREhkakY2V2w2WVpZU1AzcmEwRmgrdFR5YUJoQkcyL3R5MENXagpRZ3VzUEs1ZVhIN0tQVEx2citnTUcwenFLc0xyaGg2Z1Q1TGlnZ2VjNjdkR01XUEkwdWN1dHFxL25KN3RoQ2d5Ck9rZGdrcWt6V2hiZU1FYWlPS084TXRCeWRlU1BFbkd3RDgzSmtSQmN1bXArRE5wSExoSVg2eHlYNTVob215ZFQKb3RQcllFY0R0bzFJdk83cmF5cHNDZVVXZHJHdFliOVJDMkViUHdJREFRQUJBb0lCQUVpUG1LVkZuUnBHakppRwpUeU43K0lQbWpWZVVXUlF6R2Qyc0Nua3dUUU9GTStidXp3TDV4UzJRdGNFMHBmY2RscGlRUUltVENLUTlualNxCnArN2JUdWVQUmRPWDh1MHVFQU81c0E4eFJTbVlNdEkyZ3ZyczhIQUVxSksydjAyR1c5Zi9LV0Y2eGdRclZYUDUKQ1Q1YzJBL1BjYkE0QlEzMXUxbXpLaStEbFI0Wi9CS3ZDWks5UjBEdENrbDU4U1phSDJZMjVRWEZLVDBCcmhZbApyNGduSWlZTk4wRXVWZDFGbHlsVGpXcFlVUCtHVTluVHUxMUwySDlpV1dqNmVWaUlsRmxuekE3WVdCR1Nza1EwCklkd01BRXRRV3R3RXlmWUQ3MElrcm5WOGxjUlFSNlh0RjgwMHU5VFhvQ0UxNmlYODYraFYrL2NHMVR4elIwTlEKTmZ3YVRVRUNnWUVBM3E3RXhENG9GYWFreGZnWHJDUmJGdzVBczRxbnY5R2ZsRi9OaTN5S25aZnp2cVZLQnk5RQpSTlRZOGxYWXJMb0Z2TWlpdzBQb2tBcnlQZ00yV2RWb2lLczJidzlqQ1U2VWI2THk0ZWJWTmgyYmh4MXdGbjkzCmRoeWRNa2lVRjlZUC9QVzdSUk53aklZTy9DbGpVNHFtNFRQdTBpb3ovYVY0TnVhcE5PL29qUThDZ1lFQXdDK2IKQ3FveE45SEdDTGdyREpsdlJqQTlQNlg5aUJGTHM4OW15b0lEUTBRSzIyUkYxajFUcDZQa1lhZTBBTm9BUFlkRwpHaWptbFQrUkp6MGFmU29PRHlyS2dVc3ptNUhPWjhQMkRGaFQ0Y1ZZbDZnL3FqYWh0amFFWTRTOFJhdnRrMGMxClpYVG9JOUhJUHpKayszcWNIVDlWVmtLcFE5ZGt2Q3JzYVpKKzd0RUNnWUVBakl3YVBSSk9FbncvZTRQK3pQT1YKV3BQd1dtR2xSdmh6bEI1emlScHVFdEdaVWpiWTVuZjZ5c2JjdHZkZjdvVHFvaUN3T2paZVRxdmFBVEhkMkExTwpFUlNmSXJHL2ZGeFFhN1daUHVPR3BzVkJLS0ozNEh0TFZ3endXcEJjaUQ3ZmtIVTRZWHpIaUtvRVF6dU1LV3BWCnNjWXBjaFNaQS9xd1NWYUViWmtPV2hrQ2dZQkxFazE5M1AxYzBKU0swMlg5aGZIeGVPWno5bU1TdzY3T2pqV1kKNVRCaEZqTW5nQVBIckMwQlR3UG5JWnN1dWZsZUQzbFN2cWRUcFlFTjB0Q0dFK2RxQlUwVk5FcjBlZ0FtaUdXVQpiT3hYUkw5V2ZtSmdHdmNRTmp1QXBGam0za0h2UmVHVndCVHQ2UVJQcTEvRzNCNGZUcDRIRkFNS2ZSamNaK2Z4ClZVaEFBUUtCZ1FDVGhVd3Bsaisrd0U4SjlDY1JTVHdqWWVuVTMvN2R5RUpFMmU2ZWJiMTVJbXdyTTErL1daZUEKWG9LQ29KQ05wZVBnTUxsdjIrcHVoZzJmWVFLUE9MTGQrMGNqWnMwRERMVVZtNzBIdzBOSk8vYngxa3VNSkdBbwpvaFp1TzJCOEFteWp6MFY1SDFpMjhsbzIvSVQ0MjltSzUyaDNubGhxTmFWbGswSVJpYVltTGc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ== - tls.pem: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUR4akNDQXE2Z0F3SUJBZ0lFWk1PUHlUQU5CZ2txaGtpRzl3MEJBUXNGQURCMU1Rc3dDUVlEVlFRR0V3SlYKVXpFTE1Ba0dBMVVFQ0F3Q1EwRXhGakFVQmdOVkJBY01EVTF2ZFc1MFlXbHVJRlpwWlhjeERUQUxCZ05WQkFvTQpCRmRUVHpJeEZEQVNCZ05WQkFzTUMwVnVaMmx1WldWeWFXNW5NUnd3R2dZRFZRUUREQk5wYm5SbGNtTmxjSFJ2CmNpMXpaWEoyYVdObE1CNFhEVEl6TURjeU9EQTVOVEl3T1ZvWERUTXpNRGN5T0RBNU5USXdPVm93ZFRFTE1Ba0cKQTFVRUJoTUNWVk14Q3pBSkJnTlZCQWdNQWtOQk1SWXdGQVlEVlFRSERBMU5iM1Z1ZEdGcGJpQldhV1YzTVEwdwpDd1lEVlFRS0RBUlhVMDh5TVJRd0VnWURWUVFMREF0RmJtZHBibVZsY21sdVp6RWNNQm9HQTFVRUF3d1RhVzUwClpYSmpaWEIwYjNJdGMyVnlkbWxqWlRDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUIKQUtjc2ZJWm1wdG1ScCtlTUo4SUtGRloxZVFiTkE4Ukg2QnF4RTF3cGRCd3JuOW00OVJjMU1EL1hiSkc5M1RsSgpidktDSkkzdnRueEpHUmZiUUZ3dkl5UlMyQXpMbDIrVnRXUmxWU0FSZGxWVDNIU2xSeGRPMlJPbGxBbElDRDc1CnV3eUpUeE5RZUJSMWd4M1l4ZWxwZW1HV0VqOTYydEJZZnJVOG1nWVFSdHY3Y3RBbG8wSUxyRHl1WGx4K3lqMHkKNzYvb0RCdE02aXJDNjRZZW9FK1M0b0lIbk91M1JqRmp5TkxuTHJhcXY1eWU3WVFvTWpwSFlKS3BNMW9XM2pCRwpvamlqdkRMUWNuWGtqeEp4c0EvTnlaRVFYTHBxZmd6YVJ5NFNGK3NjbCtlWWFKc25VNkxUNjJCSEE3YU5TTHp1CjYyc3FiQW5sRm5heHJXRy9VUXRoR3o4Q0F3RUFBYU5lTUZ3d1dnWURWUjBSQkZNd1VZSVRhVzUwWlhKalpYQjAKYjNJdGMyVnlkbWxqWllJNmFXNTBaWEpqWlhCMGIzSXRjMlZ5ZG1salpTNWhjR3N0YVc1MFpXZHlZWFJwYjI0dApkR1Z6ZEM1emRtTXVZMngxYzNSbGNpNXNiMk5oYkRBTkJna3Foa2lHOXcwQkFRc0ZBQU9DQVFFQU9UTGVJSzZTCkU1Q0VFZEpXVVZPOUk3QUFNRkZxYmtWazU5NmlVZlYzSXlYZmN2dG8vUVhoS3dZOHpRU0VxU28za2dJejZrK1oKdllTcVBjWnIyTHJyTVZjNWh4NEoyZWxqUGZQSnhwUUtSbllSRUhrNDRFSDhwR1o4c0RoUVYrNHVtS2w3SjFNbgp0dEx6VmNFY1hzWmZncTA3bUVsTHplOXJ2eUg3Um02WjdSMGNhaXpUL016SjFNSllYbmlXV1FjQmxOTzk0TGtCCjRvalFMaUpuVHRLTEFCVzZEQVNhdFhydEpqRmdWVnZPLyt3Y2dhSnlTVm42RldrTzl6ODNJWTNsLzRXQU5kN0sKaVpwbmFaeXVoSy8zMXVSMDYrK05JKzU5MmtFWGRUREtaN2NQUmFzOXZQQUJzNUs2dGl3ZmY0ZE55cHlvRi9NLwpEbFUzYkxLektEM1ZBUT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0= ---- -apiVersion: "v1" -kind: "Service" -metadata: - labels: - app: "interceptor_service" - name: "interceptor-service" - namespace: "apk" -spec: - ports: - - name: "port-1-intercep" - port: 8443 - protocol: "TCP" - targetPort: 8443 - - name: "port-2-intercep" - port: 8444 - protocol: "TCP" - targetPort: 8444 - - name: "port-3-intercep" - port: 8445 - protocol: "TCP" - targetPort: 8445 - selector: - app: "interceptor_service" - type: "ClusterIP" ---- -apiVersion: "apps/v1" -kind: "Deployment" -metadata: - labels: - app: "interceptor_service" - name: "interceptor-service-deployment" - namespace: "apk" -spec: - replicas: 1 - selector: - matchLabels: - app: "interceptor_service" - template: - metadata: - labels: - app: "interceptor_service" - spec: - containers: - - image: "tharindu1st/interceptor_service:latest" - imagePullPolicy: "Always" - name: "interceptor-service-deployment" - ports: - - containerPort: 8443 - name: "port-1-intercep" - protocol: "TCP" - - containerPort: 8444 - name: "port-2-intercep" - protocol: "TCP" - - containerPort: 8445 - name: "port-3-intercep" - protocol: "TCP" - resources: - limits: - memory: "512Mi" - cpu: "1000m" - requests: - memory: "100Mi" - cpu: "200m" - volumeMounts: - - mountPath: "/home/ineterceptor/tls.pem" - name: "service-certs" - subPath: "tls.pem" - - mountPath: "/home/ineterceptor/tls.key" - name: "service-certs" - subPath: "tls.key" - - mountPath: "/home/ineterceptor/Config.toml" - name: "config-toml" - subPath: "Config.toml" - readinessProbe: - httpGet: - path: /api/v1/health - port: 8443 - scheme: HTTP - httpHeaders: - - name: "Connection" - value: "keep-alive" - initialDelaySeconds: 10 - periodSeconds: 10 - livenessProbe: - httpGet: - path: /api/v1/health - port: 8443 - scheme: HTTP - httpHeaders: - - name: "Connection" - value: "keep-alive" - initialDelaySeconds: 10 - periodSeconds: 10 - env: - - name: "BAL_CONFIG_FILES" - value: "/home/ineterceptor/Config.toml" - volumes: - - name: "service-certs" - configMap: - name: "interceptor-service-configmap" - - name: "config-toml" - configMap: - name: "interceptor-service-config-toml" ---- -apiVersion: dp.wso2.com/v1alpha3 -kind: APIPolicy -metadata: - name: interceptor-policy-gateway-level - namespace: apk -spec: - override: - requestInterceptors: - - name: interceptor-service-gateway-level-req - responseInterceptors: - - name: interceptor-service-gateway-level-res - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: wso2-apk-default ---- -apiVersion: dp.wso2.com/v1alpha2 -kind: Backend -metadata: - name: interceptor-backend-v1 - namespace: apk -spec: - services: - - host: interceptor-service.apk.svc.cluster.local - port: 8445 - protocol: https - # Uncomment following to validate certificate via a given ca cert (this should be a root level cert) - tls: - certificateInline: | - -----BEGIN CERTIFICATE----- - MIIDxjCCAq6gAwIBAgIEZMOPyTANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJV - UzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxDTALBgNVBAoM - BFdTTzIxFDASBgNVBAsMC0VuZ2luZWVyaW5nMRwwGgYDVQQDDBNpbnRlcmNlcHRv - ci1zZXJ2aWNlMB4XDTIzMDcyODA5NTIwOVoXDTMzMDcyODA5NTIwOVowdTELMAkG - A1UEBhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MQ0w - CwYDVQQKDARXU08yMRQwEgYDVQQLDAtFbmdpbmVlcmluZzEcMBoGA1UEAwwTaW50 - ZXJjZXB0b3Itc2VydmljZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB - AKcsfIZmptmRp+eMJ8IKFFZ1eQbNA8RH6BqxE1wpdBwrn9m49Rc1MD/XbJG93TlJ - bvKCJI3vtnxJGRfbQFwvIyRS2AzLl2+VtWRlVSARdlVT3HSlRxdO2ROllAlICD75 - uwyJTxNQeBR1gx3YxelpemGWEj962tBYfrU8mgYQRtv7ctAlo0ILrDyuXlx+yj0y - 76/oDBtM6irC64YeoE+S4oIHnOu3RjFjyNLnLraqv5ye7YQoMjpHYJKpM1oW3jBG - ojijvDLQcnXkjxJxsA/NyZEQXLpqfgzaRy4SF+scl+eYaJsnU6LT62BHA7aNSLzu - 62sqbAnlFnaxrWG/UQthGz8CAwEAAaNeMFwwWgYDVR0RBFMwUYITaW50ZXJjZXB0 - b3Itc2VydmljZYI6aW50ZXJjZXB0b3Itc2VydmljZS5hcGstaW50ZWdyYXRpb24t - dGVzdC5zdmMuY2x1c3Rlci5sb2NhbDANBgkqhkiG9w0BAQsFAAOCAQEAOTLeIK6S - E5CEEdJWUVO9I7AAMFFqbkVk596iUfV3IyXfcvto/QXhKwY8zQSEqSo3kgIz6k+Z - vYSqPcZr2LrrMVc5hx4J2eljPfPJxpQKRnYREHk44EH8pGZ8sDhQV+4umKl7J1Mn - ttLzVcEcXsZfgq07mElLze9rvyH7Rm6Z7R0caizT/MzJ1MJYXniWWQcBlNO94LkB - 4ojQLiJnTtKLABW6DASatXrtJjFgVVvO/+wcgaJySVn6FWkO9z83IY3l/4WANd7K - iZpnaZyuhK/31uR06++NI+592kEXdTDKZ7cPRas9vPABs5K6tiwff4dNypyoF/M/ - DlU3bLKzKD3VAQ== - -----END CERTIFICATE----- - allowedSANs: - - "interceptor-service" - ---- -apiVersion: dp.wso2.com/v1alpha1 -kind: InterceptorService -metadata: - name: interceptor-service-gateway-level-req - namespace: apk -spec: - backendRef: - name: interceptor-backend-v1 - includes: - - request_body - - request_headers - - invocation_context ---- -apiVersion: dp.wso2.com/v1alpha1 -kind: InterceptorService -metadata: - name: interceptor-service-gateway-level-res - namespace: apk -spec: - backendRef: - name: interceptor-backend-v1 - includes: - - response_body - - response_headers - - invocation_context ---- -apiVersion: dp.wso2.com/v1alpha3 -kind: RateLimitPolicy -metadata: - name: gw-ratelimit-user - namespace: apk -spec: - override: - custom: - key: user_key - value: bob - requestsPerUnit: 4 - unit: Minute - organization: default - targetRef: - kind: Gateway - name: wso2-apk-default - group: gateway.networking.k8s.io ---- -apiVersion: dp.wso2.com/v1alpha3 -kind: RateLimitPolicy -metadata: - name: gw-ratelimit-org - namespace: apk -spec: - override: - custom: - key: org_key - value: wso2 - requestsPerUnit: 10 - unit: Minute - organization: default - targetRef: - kind: Gateway - name: wso2-apk-default - group: gateway.networking.k8s.io - ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: interceptor-service-secret - namespace: "apk" -data: - tls.pem: | - -----BEGIN CERTIFICATE----- - MIIDxjCCAq6gAwIBAgIEZMOPyTANBgkqhkiG9w0BAQsFADB1MQswCQYDVQQGEwJV - UzELMAkGA1UECAwCQ0ExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxDTALBgNVBAoM - BFdTTzIxFDASBgNVBAsMC0VuZ2luZWVyaW5nMRwwGgYDVQQDDBNpbnRlcmNlcHRv - ci1zZXJ2aWNlMB4XDTIzMDcyODA5NTIwOVoXDTMzMDcyODA5NTIwOVowdTELMAkG - A1UEBhMCVVMxCzAJBgNVBAgMAkNBMRYwFAYDVQQHDA1Nb3VudGFpbiBWaWV3MQ0w - CwYDVQQKDARXU08yMRQwEgYDVQQLDAtFbmdpbmVlcmluZzEcMBoGA1UEAwwTaW50 - ZXJjZXB0b3Itc2VydmljZTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB - AKcsfIZmptmRp+eMJ8IKFFZ1eQbNA8RH6BqxE1wpdBwrn9m49Rc1MD/XbJG93TlJ - bvKCJI3vtnxJGRfbQFwvIyRS2AzLl2+VtWRlVSARdlVT3HSlRxdO2ROllAlICD75 - uwyJTxNQeBR1gx3YxelpemGWEj962tBYfrU8mgYQRtv7ctAlo0ILrDyuXlx+yj0y - 76/oDBtM6irC64YeoE+S4oIHnOu3RjFjyNLnLraqv5ye7YQoMjpHYJKpM1oW3jBG - ojijvDLQcnXkjxJxsA/NyZEQXLpqfgzaRy4SF+scl+eYaJsnU6LT62BHA7aNSLzu - 62sqbAnlFnaxrWG/UQthGz8CAwEAAaNeMFwwWgYDVR0RBFMwUYITaW50ZXJjZXB0 - b3Itc2VydmljZYI6aW50ZXJjZXB0b3Itc2VydmljZS5hcGstaW50ZWdyYXRpb24t - dGVzdC5zdmMuY2x1c3Rlci5sb2NhbDANBgkqhkiG9w0BAQsFAAOCAQEAOTLeIK6S - E5CEEdJWUVO9I7AAMFFqbkVk596iUfV3IyXfcvto/QXhKwY8zQSEqSo3kgIz6k+Z - vYSqPcZr2LrrMVc5hx4J2eljPfPJxpQKRnYREHk44EH8pGZ8sDhQV+4umKl7J1Mn - ttLzVcEcXsZfgq07mElLze9rvyH7Rm6Z7R0caizT/MzJ1MJYXniWWQcBlNO94LkB - 4ojQLiJnTtKLABW6DASatXrtJjFgVVvO/+wcgaJySVn6FWkO9z83IY3l/4WANd7K - iZpnaZyuhK/31uR06++NI+592kEXdTDKZ7cPRas9vPABs5K6tiwff4dNypyoF/M/ - DlU3bLKzKD3VAQ== - -----END CERTIFICATE----- ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: backend-retry-deployment - namespace: apk -spec: - replicas: 1 - selector: - matchLabels: - app: backend-retry - template: - metadata: - labels: - app: backend-retry - spec: - containers: - - name: your-container-name - image: tharsanan/retry-backend:latest - imagePullPolicy: IfNotPresent - ports: - - containerPort: 3000 - resources: - requests: - cpu: "100m" - memory: "128Mi" - limits: - cpu: "500m" - memory: "512Mi" ---- -apiVersion: v1 -kind: Service -metadata: - name: backend-retry - namespace: apk -spec: - selector: - app: backend-retry - ports: - - protocol: TCP - port: 80 - targetPort: 3000 - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: dynamic-backend - name: dynamic-backend - namespace: apk -spec: - replicas: 1 - selector: - matchLabels: - app: dynamic-backend - template: - metadata: - labels: - app: dynamic-backend - spec: - containers: - - image: wiremock/wiremock - name: wiremock - imagePullPolicy: IfNotPresent - ports: - - containerPort: 8080 - - containerPort: 8443 - resources: - limits: - cpu: 100m - memory: 128Mi - requests: - cpu: 100m - memory: 128Mi - volumeMounts: - - name: wiremock-mappings - mountPath: /home/wiremock/mappings - volumes: - - name: wiremock-mappings - configMap: - name: wiremock-mappings ---- -apiVersion: v1 -kind: Service -metadata: - name: dynamic-backend-service - namespace: apk -spec: - ports: - - name: http - port: 8080 - targetPort: 8080 - - name: https - port: 8443 - targetPort: 8443 - type: LoadBalancer - selector: - app: dynamic-backend ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: wiremock-mappings - namespace: apk -data: - jwks-endpoint.json: | - { - "request": { - "method": "GET", - "url": "/idp1/jwks" - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json" - }, - "body": "{\n \"keys\":[\n {\n \"kty\":\"RSA\",\n \"n\":\"m0YNpM5MVYToWZMZ9wL4KQOygvG0f6y0dw4wZ02T4C3SxiC1zEBCZLh2clj7bncyA3EV2bFrTIBNeq-1pFEfbNDMZB88Jcg0S9QyYujr6GM0AqLA7WjZQ6lLxLpeQdEQroEZI-c8rnGmzU8Qb25aiPbRf6Vh7vFYGQz5FnZ8E0LcEMYQ-4KPMkAqnMon1UKWDkqszTY5a-DGMAi5w7imKzXaU4qiEKVKIcezv9nLUVC5Od0T4FkUQi462ZA9SoHx1HNhcVAj8Nf9TG_C65GbsMMFJVcRXwZR99cVzVxVqEtxGlK7Qr0woYKQ3S5kHZPRFcMFXI6WHhEQXqyOMBdUfQ\",\n \"e\":\"AQAB\",\n \"alg\":\"RS256\",\n \"kid\":\"123-456\",\n \"use\":\"sig\"\n }\n ]\n}" - } - } - sem-versioning.json: | - {"mappings": [ - { - "request": { - "method": "GET", - "url": "/sem-api/v1.0/employee" - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json" - }, - "body": "{\n \"version\":\"v1.0\" \n}" - } - }, - { - "request": { - "method": "GET", - "url": "/sem-api/v1.1/employee" - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json" - }, - "body": "{\n \"version\":\"v1.1\" \n}" - } - }, - { - "request": { - "method": "GET", - "url": "/sem-api/v1.5/employee" - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json" - }, - "body": "{\n \"version\":\"v1.5\" \n}" - } - }, - { - "request": { - "method": "GET", - "url": "/sem-api/v2.1/employee" - }, - "response": { - "status": 200, - "headers": { - "Content-Type": "application/json" - }, - "body": "{\n \"version\":\"v2.1\" \n}" - } - } - ]} ---- -kind: TokenIssuer -apiVersion: dp.wso2.com/v1alpha1 -metadata: - name: jwt-issuer-idp-1 - namespace: apk -spec: - consumerKeyClaim: azp - issuer: https://idp1.com - name: idp-1 - organization: default - scopesClaim: scope - signatureValidation: - jwks: - url: "http://dynamic-backend-service:8080/idp1/jwks" - - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: wso2-apk-default ---- -kind: TokenIssuer -apiVersion: dp.wso2.com/v1alpha1 -metadata: - name: jwt-issuer-idp-2 - namespace: apk -spec: - consumerKeyClaim: azp - issuer: https://idp1.com - name: idp-6 - organization: apk-system - scopesClaim: scope - signatureValidation: - jwks: - url: "http://dynamic-backend-service:8080/idp1/jwks" - claimMappings: - - remoteClaim: "organization" - localClaim: "x-wso2-organization" - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: wso2-apk-default ---- -kind: TokenIssuer -apiVersion: dp.wso2.com/v1alpha1 -metadata: - name: jwt-issuer-idp-3 - namespace: apk -spec: - consumerKeyClaim: azp - issuer: https://idp1.com - name: idp-7 - organization: org1 - scopesClaim: scope - signatureValidation: - jwks: - url: "http://dynamic-backend-service:8080/idp1/jwks" - claimMappings: - - remoteClaim: "organization" - localClaim: "x-wso2-organization" - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: wso2-apk-default ---- -kind: TokenIssuer -apiVersion: dp.wso2.com/v1alpha1 -metadata: - name: jwt-issuer-idp-4 - namespace: apk -spec: - consumerKeyClaim: azp - issuer: https://idp1.com - name: idp-8 - organization: org2 - scopesClaim: scope - signatureValidation: - jwks: - url: "http://dynamic-backend-service:8080/idp1/jwks" - claimMappings: - - remoteClaim: "organization" - localClaim: "x-wso2-organization" - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: wso2-apk-default ---- -kind: TokenIssuer -apiVersion: dp.wso2.com/v1alpha2 -metadata: - name: multi-env-token-issuer-all-envs - namespace: apk -spec: - consumerKeyClaim: azp - issuer: https://idp1.com - name: idp-all-env - organization: org3 - scopesClaim: scope - environments: - - "*" - signatureValidation: - jwks: - url: "http://dynamic-backend-service:8080/idp1/jwks" - claimMappings: - - remoteClaim: "organization" - localClaim: "x-wso2-organization" - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: wso2-apk-default ---- -kind: TokenIssuer -apiVersion: dp.wso2.com/v1alpha2 -metadata: - name: multi-env-token-issuer-dev-env - namespace: apk -spec: - consumerKeyClaim: azp - issuer: https://idp1.com - name: idp-dev-only - organization: org4 - scopesClaim: scope - environments: - - "dev" - signatureValidation: - jwks: - url: "http://dynamic-backend-service:8080/idp1/jwks" - claimMappings: - - remoteClaim: "organization" - localClaim: "x-wso2-organization" - targetRef: - group: gateway.networking.k8s.io - kind: Gateway - name: wso2-apk-default ---- -# We have removed the Envoy admin interface port from our helm gateway service yaml. So we need this one here. -apiVersion: v1 -kind: Service -metadata: - name: apk-test-setup-wso2-apk-gateway-service - namespace : apk - -spec: - type: LoadBalancer - # label keys and values that must match in order to receive traffic for this service - selector: - app.kubernetes.io/app: gateway - app.kubernetes.io/release: apk-test-setup - ports: - - name: endpoint1 - protocol: TCP - port: 9095 - - name: endpoint3 - protocol: TCP - port: 9000 ---- -kind: Application -apiVersion: cp.wso2.com/v1alpha2 -metadata: - name: 583e4146-7ef5-11ee-b962-0242ac120003 - namespace : apk -spec: - name: sample-app - owner: admin - organization: default - securitySchemes: - oauth2: - environments: - - envId: Default - appId: 45f1c5c8-a92e-11ed-afa1-0242ac120005 - keyType: PRODUCTION ---- -kind: Application -apiVersion: cp.wso2.com/v1alpha2 -metadata: - name: 583e4146-7ef5-11ee-b962-0242ac120004 - namespace : apk -spec: - name: sample-app1 - owner: admin - organization: default - securitySchemes: - oauth2: - environments: - - envId: Default - appId: 45f1c5c8-a92e-11ed-afa1-0242ac120006 - keyType: PRODUCTION - - envId: Default - appId: 45f1c5c8-a92e-11ed-afa1-0242ac120007 - keyType: SANDBOX ---- -kind: Application -apiVersion: cp.wso2.com/v1alpha2 -metadata: - name: 583e4146-7ef5-11ee-b962-0242ac120005 - namespace : apk -spec: - name: sample-app1 - owner: admin - organization: default - securitySchemes: - oauth2: - environments: - - envId: Default - appId: 45f1c5c8-a92e-11ed-afa1-0242ac120008 - keyType: PRODUCTION - - envId: Default - appId: 45f1c5c8-a92e-11ed-afa1-0242ac120009 - keyType: SANDBOX ---- -apiVersion: cp.wso2.com/v1alpha2 -kind: Subscription -metadata: - name: 583e4146-7ef6-11ee-b962-0242ac120003 - namespace: apk -spec: - organization: "default" - subscriptionStatus: "ACTIVE" - api: - name: "subscription-api" - version: "1.0.0" - ---- -apiVersion: cp.wso2.com/v1alpha2 -kind: ApplicationMapping -metadata: - name: 583e4146-7ef5-11ee-b964-0242ac120002 - namespace: apk -spec: - applicationRef: 583e4146-7ef5-11ee-b962-0242ac120003 - subscriptionRef: 583e4146-7ef6-11ee-b962-0242ac120003 ---- -apiVersion: cp.wso2.com/v1alpha2 -kind: ApplicationMapping -metadata: - name: 583e4146-7ef5-11ee-b964-0242ac120004 - namespace: apk -spec: - applicationRef: 583e4146-7ef5-11ee-b962-0242ac120004 - subscriptionRef: 583e4146-7ef6-11ee-b962-0242ac120003 ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: mtls-test-configmap - namespace: apk -data: - tls.crt: | - -----BEGIN CERTIFICATE----- - MIIDGTCCAgECFANIkLQBkd76qiTXzSXjBS2scPJsMA0GCSqGSIb3DQEBCwUAME0x - CzAJBgNVBAYTAkxLMRMwEQYDVQQIDApTb21lLVN0YXRlMQ0wCwYDVQQKDAR3c28y - MQwwCgYDVQQLDANhcGsxDDAKBgNVBAMMA2FwazAeFw0yMzEyMDYxMDEyNDhaFw0y - NTA0MTkxMDEyNDhaMEUxCzAJBgNVBAYTAkxLMRMwEQYDVQQIDApTb21lLVN0YXRl - MSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3 - DQEBAQUAA4IBDwAwggEKAoIBAQCdG90W/Tlk4u9awHPteD5zpVcThUKwMLvAKw9i - vVQBC0AG6GzPbakol5gKVm+kBUDFzzzF6eayEXKWbyaZDty66A2+7HLLcKBop5M/ - a57Q9XtU3lRYvotgutLWuHcI7mLCScZDrjA3rnb/KjjbhZ602ZS1pp5jtyUz6DwL - m7w4wQ/RProqCdBj8QqoAvnDDLSPeDfsx14J5VeNJVGJV2wax65jWRjRkj6wE7z2 - qzWAlP5vDeED6bogYYVDpC8DtgayQ+vKAQLi1uj+I9Yqb/nPUrdUh9IlxudlqiFQ - QxyvsXMJEzbWWmlbD0kXYkHmHzetJNPK9ayOS/fJcAcfAb01AgMBAAEwDQYJKoZI - hvcNAQELBQADggEBAFmUc7+cI8d0Dl4wTdq+gfyWdqjQb7AYVO9DvJi3XGxdc5Kp - 1nCSsKzKUz9gvxXHeaYKrBNYf4SSU+Pkdf/BWePqi7UX/SIxNXby2da8zWg+W6Uh - xZfKlLYGMp3mCjueZpZTJ7SKOOGFA8IIgEzjJD9Ln1gl3ywMaCwlNrG9RpiD1McT - COKvyWNKnSRVr/RvCklLVrAMTJr50kce2czcdFl/xF4Hm66vp7cP/bYJKWAL8hBG - zUa9aQBKncOoAO+zQ/SGy7uJxTDUF8SverDsmjOc6AU6IhBGVUyX/JQbYyJfZinB - YlviYxVzIm6IaNJHx4sihw4U1/jMFWRXT470zcQ= - -----END CERTIFICATE----- ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: mtls-test-configmap2 - namespace: apk -data: - tls.crt: | - -----BEGIN CERTIFICATE----- - MIIDkTCCAnmgAwIBAgIUJitjysknJ0nHeLH/mjT1JIpOz4YwDQYJKoZIhvcNAQEL - BQAwYDELMAkGA1UEBhMCVVMxEjAQBgNVBAgMCVlvdXJTdGF0ZTERMA8GA1UEBwwI - WW91ckNpdHkxGTAXBgNVBAoMEFlvdXJPcmdhbml6YXRpb24xDzANBgNVBAMMBllv - dXJDQTAeFw0yNDAxMDUwNDAwMjNaFw0yNTAxMDQwNDAwMjNaMGExCzAJBgNVBAYT - AlVTMRIwEAYDVQQIDAlZb3VyU3RhdGUxETAPBgNVBAcMCFlvdXJDaXR5MRkwFwYD - VQQKDBBZb3VyT3JnYW5pemF0aW9uMRAwDgYDVQQDDAdjbGllbnQxMIIBIjANBgkq - hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuJhFZmCVnj6N+/+HHuMvb4vyWqWcorUf - pAWO7a3YVsHp3BX+lbGGzh67jbPcFK6K7RqejenFw7sQK8duZlqXmik/JvZMLxY3 - l/6e8LIAhN7PaX1zg58OU61baQ5VNBhUXkoYN77xqb87Yo7IFyyQ/tyWfRVFEzNj - V1+q2MpEinuscViieIQHEpB4i6fsRxomYkR+FwdfCB65MYCYveIB1z9NkmR6Pm6V - 7zSPp+QYwc6WX4/61fbRje4BJh3j+FGYboJJg1o9O/MkD70RW6mdMV1l5bT9T98W - B+hJtN+5dEpSfAwXqlWWxzhDxNsEvdSwuoLz9e58gteR1LSLaJXMjQIDAQABo0Iw - QDAdBgNVHQ4EFgQULaoslUgyglywztd95CkL6sU5wa4wHwYDVR0jBBgwFoAUGUkK - +QXBjeGMy7XVnrXfrvVJUNswDQYJKoZIhvcNAQELBQADggEBABodQ1Y7zt7kvDI8 - jQUfLLkZZAPnVpjYpG7P1dLjOzUxqDNmyZAzoBMENXy/Zu81sRQt+Bs5NKsx1pu5 - z2TRk9ddxhszD1FKu9Hb6hqLcGHF7GnwPGVXJlHctkMp4QYvXc942VDk7c59/knC - PXAul7832cPTUMvFHdzRxBwJruK9xuvNLj2I24+Fji1ELPO7M/e8KZ1NrIS0Fdwn - DuDDw3kMkl0BlSrmvMBreSaIOU4mFhmepC97awZ/wZZ+4mpIdWIagZf01txue8o0 - +8kdGkFsmoCpnJjNjpoQFAYLEdif00iLcRpwwW/saUuxqZC0aDnQCIeo0GSNet8t - HOXCkvQ= - -----END CERTIFICATE----- ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: mtls-test-configmap3 - namespace: apk -data: - tls.crt: | - -----BEGIN CERTIFICATE----- - MIIDkTCCAnmgAwIBAgIUJitjysknJ0nHeLH/mjT1JIpOz4cwDQYJKoZIhvcNAQEL - BQAwYDELMAkGA1UEBhMCVVMxEjAQBgNVBAgMCVlvdXJTdGF0ZTERMA8GA1UEBwwI - WW91ckNpdHkxGTAXBgNVBAoMEFlvdXJPcmdhbml6YXRpb24xDzANBgNVBAMMBllv - dXJDQTAeFw0yNDAxMDUwNDE0MTlaFw0yNTAxMDQwNDE0MTlaMGExCzAJBgNVBAYT - AlVTMRIwEAYDVQQIDAlZb3VyU3RhdGUxETAPBgNVBAcMCFlvdXJDaXR5MRkwFwYD - VQQKDBBZb3VyT3JnYW5pemF0aW9uMRAwDgYDVQQDDAdjbGllbnQyMIIBIjANBgkq - hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2JQ8LITwayvjrrHUmFT44lH3IF3fdPhr - pQgKx7Z295QD9Ocka2rOFu47tuIeNcLiBTSyRLOFDRwjW9WXfWk9ALtxbedJfDyy - us/kLxY+SdzHW7/5dFbupGOcs58A/sxMyGTJgiCBxsgsRFfhet7ekq/ypmj5B8L3 - 5FlGg5NS0mbZlTM6aapLnkqU907RcsmzpFQBfWOHlDdWJocKEHECBXcxiTQk72C7 - s2tndES5ltX/Wc8U/kX/M9LDXhn1Ew+roeFf0HCpdg6BlnTknhYU9S1c4aYKB2Yx - LNx74CsKsnxPPcePTXPqZEtZ4EsjF4PSToVFyceMBKvD6C6WPQoRNwIDAQABo0Iw - QDAdBgNVHQ4EFgQUWE8btMihi5eZXLJOeiNfh7XHaI0wHwYDVR0jBBgwFoAUGUkK - +QXBjeGMy7XVnrXfrvVJUNswDQYJKoZIhvcNAQELBQADggEBAJmXn/gefez7mq1b - iKpPLPeHUncIgVaru03v8YCX14pHFAsVuLgZ1lANelSrq+PR/HBJbQj8iloV938o - YFppe/fb96D8a2u90dnGwWipMRSDo3wgcInL38xfcH5UEPBVJVLa3IUkfwDjjEqK - 3O0GXVSpjyv3RW+E9wfPfGSysRX66cTo5Uh3z3hTAloDc8uhCYRPcxG7S9eKD6jW - Z3MlFlw4U8CdO90L0nB1KFhz1Et0Sl9u/LDsUYq6mE+XhTngPs8qwR/o43s1DUID - y5Oi4A4+id+xO0XnHIkkqCfPtFzxl3hwytcy8EqISynzzHWNJ8bFZIYX4tgX+PLq - u0/ITEw= - -----END CERTIFICATE----- ---- -apiVersion: cp.wso2.com/v1alpha2 -kind: Subscription -metadata: - name: semantic-versioning-subscription - namespace: apk -spec: - organization: "default" - subscriptionStatus: "ACTIVE" - api: - name: "Semantic Versioning API" - version: "v\\d+(\\.\\d+)?" ---- -apiVersion: cp.wso2.com/v1alpha2 -kind: ApplicationMapping -metadata: - name: semantic-versioning-app-mapping - namespace: apk -spec: - applicationRef: 583e4146-7ef5-11ee-b962-0242ac120003 - subscriptionRef: semantic-versioning-subscription ---- -apiVersion: v1 -kind: ConfigMap -metadata: - name: graphql-faker-schema - namespace: apk -data: - schema.graphql: | - schema { - query: Query - mutation: Mutation - subscription: Subscription - } - - # The query type, represents all of the entry points into our object graph - type Query { - hero(episode: Episode): Character - reviews(episode: Episode!): [Review] - search(text: String): [SearchResult] - character(id: ID!): Character - droid(id: ID!): Droid - human(id: ID!): Human - allHumans(first: Int): [Human] - allDroids(first: Int): [Droid] - allCharacters(first: Int): [Character] - starship(id: ID!): Starship - } - - # The mutation type, represents all updates we can make to our data - type Mutation { - createReview(episode: Episode, review: ReviewInput!): Review - } - - # The subscription type, represents all subscriptions we can make to our data - type Subscription { - reviewAdded(episode: Episode): Review - } - - # The episodes in the Star Wars trilogy - enum Episode { - # Star Wars Episode IV: A New Hope, released in 1977. - NEWHOPE - - # Star Wars Episode V: The Empire Strikes Back, released in 1980. - EMPIRE - - # Star Wars Episode VI: Return of the Jedi, released in 1983. - JEDI - - # Star Wars Episode III: Revenge of the Sith, released in 2005 - SITH - } - - # A character from the Star Wars universe - interface Character { - # The ID of the character - id: ID! - - # The name of the character - name: String! - - # The friends of the character, or an empty list if they have none - friends: [Character] - - # The friends of the character exposed as a connection with edges - friendsConnection(first: Int, after: ID): FriendsConnection! - - # The movies this character appears in - appearsIn: [Episode]! - } - - # Units of height - enum LengthUnit { - # The standard unit around the world - METER - - # Primarily used in the United States - FOOT - } - - # A humanoid creature from the Star Wars universe - type Human implements Character { - # The ID of the human - id: ID! - - # What this human calls themselves - name: String! - - # The home planet of the human, or null if unknown - homePlanet: String - - # Height in the preferred unit, default is meters - height(unit: LengthUnit = METER): Float - - # Mass in kilograms, or null if unknown - mass: Float - - # This human's friends, or an empty list if they have none - friends: [Character] - - # The friends of the human exposed as a connection with edges - friendsConnection(first: Int, after: ID): FriendsConnection! - - # The movies this human appears in - appearsIn: [Episode]! - - # A list of starships this person has piloted, or an empty list if none - starships: [Starship] - } - - # An autonomous mechanical character in the Star Wars universe - type Droid implements Character { - # The ID of the droid - id: ID! - - # What others call this droid - name: String! - - # This droid's friends, or an empty list if they have none - friends: [Character] - - # The friends of the droid exposed as a connection with edges - friendsConnection(first: Int, after: ID): FriendsConnection! - - # The movies this droid appears in - appearsIn: [Episode]! - - # This droid's primary function - primaryFunction: String - } - - # A connection object for a character's friends - type FriendsConnection { - # The total number of friends - totalCount: Int - - # The edges for each of the character's friends. - edges: [FriendsEdge] - - # A list of the friends, as a convenience when edges are not needed. - friends: [Character] - - # Information for paginating this connection - pageInfo: PageInfo! - } - - # An edge object for a character's friends - type FriendsEdge { - # A cursor used for pagination - cursor: ID! - - # The character represented by this friendship edge - node: Character - } - - # Information for paginating this connection - type PageInfo { - startCursor: ID - endCursor: ID - hasNextPage: Boolean! - } - - # Represents a review for a movie - type Review { - # The movie - episode: Episode - - # The number of stars this review gave, 1-5 - stars: Int! - - # Comment about the movie - commentary: String - } - - # The input object sent when someone is creating a new review - input ReviewInput { - # 0-5 stars - stars: Int! - - # Comment about the movie, optional - commentary: String - - # Favorite color, optional - favorite_color: ColorInput - } - - # The input object sent when passing in a color - input ColorInput { - red: Int! - green: Int! - blue: Int! - } - - type Starship { - # The ID of the starship - id: ID! - - # The name of the starship - name: String! - - # Length of the starship, along the longest axis - length(unit: LengthUnit = METER): Float - - coordinates: [[Float!]!] - } - - union SearchResult = Human | Droid | Starship - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: graphql-faker - namespace: apk - labels: - app: graphql-faker -spec: - replicas: 1 - selector: - matchLabels: - app: graphql-faker - template: - metadata: - labels: - app: graphql-faker - spec: - containers: - - name: graphql-faker - image: apisguru/graphql-faker - args: ["--open=false", "/etc/graphql-faker/schema.graphql"] - ports: - - containerPort: 9002 - volumeMounts: - - name: schema-volume - mountPath: /etc/graphql-faker - resources: - requests: - memory: "256Mi" - cpu: "250m" - limits: - memory: "512Mi" - cpu: "500m" - volumes: - - name: schema-volume - configMap: - name: graphql-faker-schema ---- -apiVersion: v1 -kind: Service -metadata: - name: graphql-faker-service - namespace: apk -spec: - type: LoadBalancer - ports: - - port: 9002 - targetPort: 9002 - protocol: TCP - selector: - app: graphql-faker \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/README.md b/test/apim-apk-agent-test/cucumber-tests/README.md deleted file mode 100644 index 0951fb8ad1..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/README.md +++ /dev/null @@ -1,90 +0,0 @@ -# WSO2 APK Cucumber Based Integration Tests - -This folder contains APK cucumber integration tests that is used to test APK product capabilities - -## Pre-requisites - -1. [Helm](https://helm.sh/docs/intro/install/) -2. [Kubernetes Client](https://kubernetes.io/docs/tasks/tools/install-kubectl/) -3. [Kubernetes Cluster](https://kubernetes.io/docs/setup) - -## Overview - -This test module use the [Cucumber](https://cucumber.io/) framework and [Gherkin](https://cucumber.io/docs/gherkin/) Syntax to write the integration tests. - -## Writing Tests - -The tests are written using the Cucumber syntax in feature files located under the `src/test/resources/tests` directory. Each feature file represents a set of related test scenarios written in the Gherkin language. - -To create a new feature, follow these steps: - -1. Create a new feature file in the `src/test/resources/tests` directory with a `.feature` extension. - -2. Write your test scenarios in Gherkin syntax. - -3. Step definitions are written in Java and can be found under the `src/test/java/org/wso2/apk/integration` directory. You may need to add new step definitions to support your new scenarios. - -4. Add the new feature file to the `src/resources/testng.xml` file to run the tests. - -## Run or Debug the Integration Tests Locally - -1. Setup the deployment namespace. - - ```bash - kubectl create namespace apk - ``` - -2. Go to the `helm-charts/` directory and run following commands to install the APK components. - - ```bash - helm repo add bitnami https://charts.bitnami.com/bitnami - helm repo add jetstack https://charts.jetstack.io - helm dependency build - helm install apk . -n apk - ``` - -3. Port forward router-service to use localhost. - - ```bash - kubectl port-forward svc/apk-wso2-apk-router-service -n apk 9095:9095 - ``` - -4. Add the following DNS mappings to `/etc/hosts` file. - - ```bash - IP=127.0.0.1 - sudo echo "$IP idp.am.wso2.com" | sudo tee -a /etc/hosts - sudo echo "$IP api.am.wso2.com" | sudo tee -a /etc/hosts - sudo echo "$IP default.gw.wso2.com" | sudo tee -a /etc/hosts - sudo echo "$IP default.sandbox.gw.wso2.com" | sudo tee -a /etc/hosts - ``` - -5. Run following commands to deploy the APIM CP component. - -helm repo add wso2apim https://github.com/wso2/helm-apim/releases/download/cp-4.3.0-beta -helm repo update -helm install apim wso2apim/wso2am-cp --version 4.3.0-beta -f https://raw.githubusercontent.com/wso2/apk/main/helm-charts/sample/apim/cp/amd-values.yaml -n apk --debug --wait --timeout 5m0s - -6. Port forward router-service to use localhost. - - ```bash - kubectl port-forward svc/apim-wso2am-cp-1-service -n apk 9443:9443 - ``` - -7. Go to the `test/apim-apk-agent-test/agent-helm-chart` directory and run following commands to install the APIM APK Agent components. - - ```bash - helm dependency build - helm install apim-apk-agent . -n apk - ``` - -8. Run or debug integration tests. - - - Run following command from `test/apim-apk-agent-test/cucumber-tests` directory to run the integration tests. - - ```bash - gradle runTests - ``` - - To run a single test, update the `test/apim-apk-agent-test/cucumber-tests/src/resources/testng.xml` file with the required feature file and run the above command. - - - Run the `gradle runTests --debug-jvm` command and attach the debugger in the IDE to debug the integration tests. diff --git a/test/apim-apk-agent-test/cucumber-tests/build.gradle b/test/apim-apk-agent-test/cucumber-tests/build.gradle deleted file mode 100644 index 8080e798d4..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/build.gradle +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com) All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -plugins { - id 'java' -} - -repositories { - mavenCentral() -} - -dependencies { - testImplementation 'io.cucumber:cucumber-picocontainer:7.2.3' - testImplementation 'io.cucumber:cucumber-core:7.2.3' - testImplementation 'com.google.guava:guava:32.1.1-jre' - testImplementation 'com.google.code.gson:gson:2.10.1' - testImplementation 'org.apache.httpcomponents:httpmime:4.5.13' - testImplementation 'org.apache.httpcomponents:httpclient:4.5.13' - testImplementation 'org.apache.httpcomponents:httpcore:4.4.14' - testImplementation 'io.cucumber:cucumber-java:7.13.0' - testImplementation 'io.cucumber:cucumber-testng:7.13.0' - testImplementation 'commons-io:commons-io:2.13.0' - testImplementation 'com.nimbusds:nimbus-jose-jwt:9.31' - testImplementation 'com.googlecode.json-simple:json-simple:1.1.1' -} - -test { - reports.junitXml.enabled = true - useTestNG() - testLogging { - events "passed", "skipped", "failed", "standardOut", "standardError" - } -} - -task runTests(type: JavaExec, dependsOn: 'classes') { - main = 'org.testng.TestNG' - classpath = files("./src/test/resources", - project.sourceSets.main.compileClasspath, - project.sourceSets.test.compileClasspath, - project.sourceSets.main.runtimeClasspath, - project.sourceSets.test.runtimeClasspath) - args = ["-d", "./build/test-output", "./src/test/resources/testng.xml"] -} diff --git a/test/apim-apk-agent-test/cucumber-tests/gradle/wrapper/gradle-wrapper.jar b/test/apim-apk-agent-test/cucumber-tests/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 943f0cbfa7..0000000000 Binary files a/test/apim-apk-agent-test/cucumber-tests/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/test/apim-apk-agent-test/cucumber-tests/gradle/wrapper/gradle-wrapper.properties b/test/apim-apk-agent-test/cucumber-tests/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 070cb702f0..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/test/apim-apk-agent-test/cucumber-tests/gradlew b/test/apim-apk-agent-test/cucumber-tests/gradlew deleted file mode 100755 index a69d9cb6c2..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/gradlew +++ /dev/null @@ -1,240 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/test/apim-apk-agent-test/cucumber-tests/gradlew.bat b/test/apim-apk-agent-test/cucumber-tests/gradlew.bat deleted file mode 100644 index f127cfd49d..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/gradlew.bat +++ /dev/null @@ -1,91 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/test/apim-apk-agent-test/cucumber-tests/scripts/setup-hosts.sh b/test/apim-apk-agent-test/cucumber-tests/scripts/setup-hosts.sh deleted file mode 100644 index adffeb61d3..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/scripts/setup-hosts.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -kubectl apply -f ./CRs/artifacts.yaml -kubectl wait deployment/apim-wso2am-cp-deployment-1 -n apk --for=condition=available --timeout=600s -kubectl wait --timeout=5m -n apk deployment/apk-wso2-apk-adapter-deployment --for=condition=Available -kubectl wait --timeout=15m -n apk deployment/apk-wso2-apk-gateway-runtime-deployment --for=condition=Available -kubectl wait --timeout=5m -n apk deployment/apim-apk-agent --for=condition=Available -IP=$(kubectl get svc apk-wso2-apk-gateway-service -n apk --output jsonpath='{.status.loadBalancer.ingress[0].ip}') -ING_IP=$(kubectl get ing -n apk apim-wso2am-cp-ingress --output=jsonpath='{.status.loadBalancer.ingress[0].ip}') -CC_IP=$(kubectl get svc apk-wso2-apk-common-controller-web-server-service -n apk --output jsonpath='{.status.loadBalancer.ingress[0].ip}') -sudo echo "$IP localhost" | sudo tee -a /etc/hosts -sudo echo "$IP idp.am.wso2.com" | sudo tee -a /etc/hosts -sudo echo "$CC_IP apk-wso2-apk-common-controller-service.apk.svc" | sudo tee -a /etc/hosts -sudo echo "$ING_IP am.wso2.com" | sudo tee -a /etc/hosts -sudo echo "$IP api.am.wso2.com" | sudo tee -a /etc/hosts -sudo echo "$IP default.gw.wso2.com" | sudo tee -a /etc/hosts -sudo echo "$IP default.sandbox.gw.wso2.com" | sudo tee -a /etc/hosts -sudo echo "$IP sandbox.default.gw.wso2.com" | sudo tee -a /etc/hosts -sudo echo "255.255.255.255 broadcasthost" | sudo tee -a /etc/hosts -sudo echo "::1 localhost" | sudo tee -a /etc/hosts diff --git a/test/apim-apk-agent-test/cucumber-tests/settings.gradle b/test/apim-apk-agent-test/cucumber-tests/settings.gradle deleted file mode 100644 index e44b1a136c..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/settings.gradle +++ /dev/null @@ -1,10 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - * - * The settings file is used to specify which projects to include in your build. - * - * Detailed information about configuring a multi-project build in Gradle can be found - * in the user manual at https://docs.gradle.org/7.5.1/userguide/multi_project_builds.html - */ - -rootProject.name = 'cucumber-tests' diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/APKIntegrationTestSuite.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/APKIntegrationTestSuite.java deleted file mode 100644 index 5acc772cd9..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/APKIntegrationTestSuite.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2024, WSO2 LLC (http://www.wso2.com). - * - * WSO2 LLC licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.apk.integration; - -import io.cucumber.testng.AbstractTestNGCucumberTests; - -public class APKIntegrationTestSuite extends AbstractTestNGCucumberTests { - -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/APIDeploymentSteps.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/APIDeploymentSteps.java deleted file mode 100644 index 529051fcc6..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/APIDeploymentSteps.java +++ /dev/null @@ -1,687 +0,0 @@ -/* - * Copyright (c) 2024, WSO2 LLC (http://www.wso2.com). - * - * WSO2 LLC licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.apk.integration.api; - -import com.google.common.io.Resources; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import io.cucumber.java.en.Given; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.NameValuePair; -import org.apache.http.client.utils.URIBuilder; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.mime.HttpMultipartMode; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; -import org.apache.http.message.BasicNameValuePair; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.testng.Assert; -import org.wso2.apk.integration.utils.Constants; -import org.wso2.apk.integration.utils.Utils; -import org.wso2.apk.integration.utils.clients.SimpleHTTPClient; -import java.nio.file.Files; -import java.nio.charset.StandardCharsets; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.net.URI; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * This class contains the step definitions for API Deployment. - */ -public class APIDeploymentSteps { - - private final SharedContext sharedContext; - private File payloadFile; - private File definitionFile; - private File certificateFile; - - private String OASURL; - - private static final Log logger = LogFactory.getLog(APIDeploymentSteps.class); - - public APIDeploymentSteps(SharedContext sharedContext) { - - this.sharedContext = sharedContext; - } - - @When("I use the Payload file {string}") - public void iHaveTheAPKConf(String payloadFileName) throws IOException { - - URL url = Resources.getResource(payloadFileName); - payloadFile = new File(url.getPath()); - } - - @When("I use the OAS URL {string}") - public void iHaveTheOASURL(String pOASURL) throws IOException { - OASURL = pOASURL; - } - - @When("the definition file {string}") - public void iHaveTheDefinitionFile(String definitionFileName) throws IOException { - - URL url = Resources.getResource(definitionFileName); - definitionFile = new File(url.getPath()); - } - - @When("make the import API Creation request using OAS {string}") - public void make_import_api_creation_request(String definitionType) throws Exception { - MultipartEntityBuilder builder = null; - if(definitionType.equals("URL")){ - logger.info("OAS URL: " + OASURL); - builder = MultipartEntityBuilder.create() - .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) - .addTextBody("url", OASURL, ContentType.TEXT_PLAIN) - .addPart("additionalProperties", new FileBody(payloadFile)); - - logger.info("Payload File: "+ new FileBody(payloadFile)); - } - if(definitionType.equals("File")){ - logger.info("OAS File: " + definitionFile.getName()); - builder = MultipartEntityBuilder.create() - .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) - .addPart("file", new FileBody(definitionFile)) - .addPart("additionalProperties", new FileBody(payloadFile)); - - logger.info("Payload File: "+ new FileBody(payloadFile)); - } - - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpEntity multipartEntity = builder.build(); - - HttpResponse response = sharedContext.getHttpClient().doPostWithMultipart(Utils.getImportAPIURL(), - multipartEntity, headers); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setApiUUID(Utils.extractID(sharedContext.getResponseBody())); - Thread.sleep(3000); - } - - @When("make the API Revision Deployment request") - public void make_a_api_revision_deployment_request() throws Exception { - String apiUUID = sharedContext.getApiUUID(); - String payload = "{\"description\":\"Initial Revision\"}"; - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse response = sharedContext.getHttpClient().doPost(Utils.getAPIRevisionURL(apiUUID), - headers, payload, Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setRevisionUUID(Utils.extractID(SimpleHTTPClient.responseEntityBodyToString(response))); - - Thread.sleep(3000); - - String payload2 = "[{\"name\": \"Default\", \"vhost\": \"default.gw.wso2.com\", \"displayOnDevportal\": true}]"; - - HttpResponse response2 = sharedContext.getHttpClient().doPost(Utils.getAPIRevisionDeploymentURL(apiUUID, sharedContext.getRevisionUUID()), - headers, payload2, Constants.CONTENT_TYPES.APPLICATION_JSON); - - logger.info("Response: "+ response2); - - sharedContext.setResponse(response2); - Thread.sleep(3000); - } - - @When("make the Change Lifecycle request") - public void make_a_change_lifecycle_request() throws Exception { - String apiUUID = sharedContext.getApiUUID(); - String payload = ""; - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse response = sharedContext.getHttpClient().doPost(Utils.getAPIChangeLifecycleURL(apiUUID), - headers, payload, Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setResponse(response); - Thread.sleep(3000); - } - - @When("make the Application Creation request with the name {string}") - public void make_application_creation_request(String applicationName) throws Exception { - logger.info("Creating an application"); - String payload = "{\"name\":\"" + applicationName + "\",\"throttlingPolicy\":\"10PerMin\",\"description\":\"test app\",\"tokenType\":\"JWT\",\"groups\":null,\"attributes\":{}}"; - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getDevportalAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse response = sharedContext.getHttpClient().doPost(Utils.getApplicationCreateURL(), - headers, payload, Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - logger.info("Response: " + sharedContext.getResponseBody()); - sharedContext.setApplicationUUID(Utils.extractApplicationID(sharedContext.getResponseBody())); - Thread.sleep(3000); - } - - - @When("I have a KeyManager") - public void i_have_a_key_manager() throws Exception { - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getDevportalAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse response = sharedContext.getHttpClient().doGet(Utils.getKeyManagerURL(), - headers); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setKeyManagerUUID(Utils.extractKeyManagerID(sharedContext.getResponseBody())); - Thread.sleep(3000); - } - - @When("make the Generate Keys request") - public void make_generate_keys_request() throws Exception { - String applicationUUID = sharedContext.getApplicationUUID(); - String keyManagerUUID = sharedContext.getKeyManagerUUID(); - logger.info("Key Manager UUID: " + keyManagerUUID); - logger.info("Application UUID: " + applicationUUID); - String payloadForProdKeys = "{\"keyType\":\"PRODUCTION\",\"grantTypesToBeSupported\":[\"password\",\"client_credentials\"]," + - "\"callbackUrl\":\"\",\"additionalProperties\":{\"application_access_token_expiry_time\":\"N/A\"," + - "\"user_access_token_expiry_time\":\"N/A\",\"refresh_token_expiry_time\":\"N/A\"," + - "\"id_token_expiry_time\":\"N/A\",\"pkceMandatory\":\"false\",\"pkceSupportPlain\":\"false\"," + - "\"bypassClientCredentials\":\"false\"},\"keyManager\":\"" + keyManagerUUID +"\"," + - "\"validityTime\":3600,\"scopes\":[\"default\"]}"; - - - String payloadForSandboxKeys = "{\"keyType\":\"SANDBOX\",\"grantTypesToBeSupported\":[\"password\",\"client_credentials\"]," + - "\"callbackUrl\":\"\",\"additionalProperties\":{\"application_access_token_expiry_time\":\"N/A\"," + - "\"user_access_token_expiry_time\":\"N/A\",\"refresh_token_expiry_time\":\"N/A\"," + - "\"id_token_expiry_time\":\"N/A\",\"pkceMandatory\":\"false\",\"pkceSupportPlain\":\"false\"," + - "\"bypassClientCredentials\":\"false\"},\"keyManager\":\"" + keyManagerUUID +"\"," + - "\"validityTime\":3600,\"scopes\":[\"default\"]}"; - - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getDevportalAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse response = sharedContext.getHttpClient().doPost(Utils.getGenerateKeysURL(applicationUUID), - headers, payloadForProdKeys, Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setConsumerSecret(Utils.extractKeys(sharedContext.getResponseBody(), "consumerSecret"), "production"); - sharedContext.setConsumerKey(Utils.extractKeys(sharedContext.getResponseBody(), "consumerKey"), "production"); - sharedContext.setKeyMappingID(Utils.extractKeys(sharedContext.getResponseBody(), "keyMappingId"), "production"); - Thread.sleep(3000); - - HttpResponse response2 = sharedContext.getHttpClient().doPost(Utils.getGenerateKeysURL(applicationUUID), - headers, payloadForSandboxKeys, Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setResponse(response2); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setConsumerSecret(Utils.extractKeys(sharedContext.getResponseBody(), "consumerSecret"), "sandbox"); - sharedContext.setConsumerKey(Utils.extractKeys(sharedContext.getResponseBody(), "consumerKey"), "sandbox"); - sharedContext.setKeyMappingID(Utils.extractKeys(sharedContext.getResponseBody(), "keyMappingId"), "sandbox"); - Thread.sleep(3000); - } - - @When("make the Subscription request") - public void make_subscription_request() throws Exception { - String applicationUUID = sharedContext.getApplicationUUID(); - String apiUUID = sharedContext.getApiUUID(); - logger.info("API UUID: " + apiUUID); - logger.info("Application UUID: " + applicationUUID); - String payload = "{\"apiId\":\"" + apiUUID + "\",\"applicationId\":\"" + applicationUUID + "\",\"throttlingPolicy\":\"Unlimited\"}"; - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getDevportalAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse response = sharedContext.getHttpClient().doPost(Utils.getSubscriptionURL(), - headers, payload, Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setSubscriptionID(Utils.extractKeys(sharedContext.getResponseBody(), "subscriptionId")); - logger.info("Extracted subscription ID: " + sharedContext.getSubscriptionID()); - Thread.sleep(3000); - } - - @When("I get {string} oauth keys for application") - public void get_oauth_keys_for_application(String type) throws Exception { - String applicationUUID = sharedContext.getApplicationUUID(); - String keyType = (type.equals("production")) ? "production" : "sandbox"; - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getDevportalAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse response = sharedContext.getHttpClient().doGet(Utils.getOauthKeysURL(applicationUUID), - headers); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setOauthKeyUUID(Utils.extractOAuthMappingID(sharedContext.getResponseBody(), sharedContext.getKeyMappingID(keyType))); - Thread.sleep(3000); - } - - @When("make the Access Token Generation request for {string}") - public void make_access_token_generation_request(String type) throws Exception { - String applicationUUID = sharedContext.getApplicationUUID(); - String oauthKeyUUID = sharedContext.getOauthKeyUUID(); - String keyType = (type.equals("production")) ? "production" : "sandbox"; - logger.info("Generating keys for: " + keyType); - String consumerKey = sharedContext.getConsumerKey(keyType); - String consumerSecret = sharedContext.getConsumerSecret(keyType); - - logger.info("Application UUID: " + applicationUUID); - logger.info("Oauth Key UUID: " + oauthKeyUUID); - - String payload = "{\"consumerSecret\":\"" + consumerSecret + "\",\"validityPeriod\":3600,\"revokeToken\":null," + - "\"scopes\":[\"write:pets\",\"read:pets\",\"query:hero\"],\"additionalProperties\":{\"id_token_expiry_time\":3600," + - "\"application_access_token_expiry_time\":3600,\"user_access_token_expiry_time\":3600,\"bypassClientCredentials\":false," + - "\"pkceMandatory\":false,\"pkceSupportPlain\":false,\"refresh_token_expiry_time\":86400}}"; - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getDevportalAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse response = sharedContext.getHttpClient().doPost(Utils.getAccessTokenGenerationURL(applicationUUID, oauthKeyUUID), - headers, payload, Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setApiAccessToken(Utils.extractKeys(sharedContext.getResponseBody(), "accessToken")); - sharedContext.addStoreValue("accessToken",sharedContext.getApiAccessToken()); - logger.info("Access Token: " + sharedContext.getApiAccessToken()); - Thread.sleep(3000); - } - - @When("I make Access Token Generation request without scopes") - public void make_access_token_generation_request_without_scopes() throws Exception { - String applicationUUID = sharedContext.getApplicationUUID(); - String oauthKeyUUID = sharedContext.getOauthKeyUUID(); - String keyType = "production"; //Use the same ternary logic above if both sandbox and production routes need to be tested - String consumerKey = sharedContext.getConsumerKey(keyType); - String consumerSecret = sharedContext.getConsumerSecret(keyType); - - logger.info("Application UUID: " + applicationUUID); - logger.info("Oauth Key UUID: " + oauthKeyUUID); - - String payload = "{\"consumerSecret\":\"" + consumerSecret + "\",\"validityPeriod\":3600,\"revokeToken\":null," + - "\"scopes\":[],\"additionalProperties\":{\"id_token_expiry_time\":3600," + - "\"application_access_token_expiry_time\":3600,\"user_access_token_expiry_time\":3600,\"bypassClientCredentials\":false," + - "\"pkceMandatory\":false,\"pkceSupportPlain\":false,\"refresh_token_expiry_time\":86400}}"; - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getDevportalAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse response = sharedContext.getHttpClient().doPost(Utils.getAccessTokenGenerationURL(applicationUUID, oauthKeyUUID), - headers, payload, Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setApiAccessToken(Utils.extractKeys(sharedContext.getResponseBody(), "accessToken")); - sharedContext.addStoreValue("accessToken",sharedContext.getApiAccessToken()); - logger.info("Access Token without scopes: " + sharedContext.getApiAccessToken()); - Thread.sleep(3000); - } - - @When("make the API Deployment request") - public void make_a_api_deployment_request() throws Exception { - - // Create a MultipartEntityBuilder to build the request entity - MultipartEntityBuilder builder = MultipartEntityBuilder.create() - .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) - .addPart("url", new FileBody(definitionFile)) - .addPart("apkConfiguration", new FileBody(payloadFile)); - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpEntity multipartEntity = builder.build(); - - HttpResponse response = sharedContext.getHttpClient().doPostWithMultipart(Utils.getAPIDeployerURL(), - multipartEntity, headers); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - Thread.sleep(3000); - } - - @When("make the API deployment request for organization {string}") - public void makeAPIDeploymentFromOrganization(String organization) throws Exception { - - // Create a MultipartEntityBuilder to build the request entity - MultipartEntityBuilder builder = MultipartEntityBuilder.create() - .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) - .addPart("definitionFile", new FileBody(definitionFile)) - .addPart("apkConfiguration", new FileBody(payloadFile)); - - Map headers = new HashMap<>(); - Object accessToken = sharedContext.getStoreValue(organization); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + accessToken); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpEntity multipartEntity = builder.build(); - - HttpResponse response = sharedContext.getHttpClient().doPostWithMultipart(Utils.getAPIDeployerURL(), - multipartEntity, headers); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - Thread.sleep(3000); - } - - // @When("I undeploy the API whose ID is {string}") - // public void i_undeploy_the_api_whose_id_is(String apiID) throws Exception { - - // // Create query parameters - // List queryParams = new ArrayList<>(); - // queryParams.add(new BasicNameValuePair("apiId", apiID)); - - // URI uri = new URIBuilder(Utils.getAPIUnDeployerURL()).addParameters(queryParams).build(); - - // Map headers = new HashMap<>(); - // headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - // headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - // HttpResponse response = sharedContext.getHttpClient().doPost(uri.toString(), headers, "", - // Constants.CONTENT_TYPES.APPLICATION_JSON); - - // sharedContext.setResponse(response); - // sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - // } - - // @When("I undeploy the API whose ID is {string} and organization {string}") - // public void undeployAPIByIdAndOrganization(String apiID,String organization) throws Exception { - - // // Create query parameters - // List queryParams = new ArrayList<>(); - // queryParams.add(new BasicNameValuePair("apiId", apiID)); - - // URI uri = new URIBuilder(Utils.getAPIUnDeployerURL()).addParameters(queryParams).build(); - - // Map headers = new HashMap<>(); - // Object header = sharedContext.getStoreValue(organization); - // headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + header); - // headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - // HttpResponse response = sharedContext.getHttpClient().doPost(uri.toString(), headers, "", - // Constants.CONTENT_TYPES.APPLICATION_JSON); - - // sharedContext.setResponse(response); - // sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - // } - - @Given("a valid graphql definition file") - public void iHaveValidGraphQLDefinition() throws Exception { - - // Create a MultipartEntityBuilder to build the request entity - MultipartEntityBuilder builder = MultipartEntityBuilder.create() - .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) - .addPart("file", new FileBody(definitionFile)); - - logger.info("Definition File: "+ new FileBody(definitionFile)); - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_APIM_HOST); - - HttpEntity multipartEntity = builder.build(); - - // Convert the multipart form entity to a string representation - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - multipartEntity.writeTo(outputStream); - String multipartForm = new String(outputStream.toByteArray(), StandardCharsets.UTF_8); - - // Log the multipart form - logger.debug("Multipart Form Data:\n{}"+ multipartForm); - logger.debug("Validator URL: " + Utils.getGQLSchemaValidatorURL()); - logger.debug("Publisher Token: " + sharedContext.getPublisherAccessToken()); - - HttpResponse response = sharedContext.getHttpClient().doPostWithMultipart(Utils.getGQLSchemaValidatorURL(), - multipartEntity, headers); - - sharedContext.setResponse(response); - logger.info("Full Res:" + response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - logger.info("GQL validation res: "+ sharedContext.getResponseBody()); - sharedContext.setAPIDefinitionValidStatus(Utils.extractValidStatus(sharedContext.getResponseBody())); - Thread.sleep(3000); - } - - @Then("I make the import GraphQLAPI Creation request") - public void make_import_gqlapi_creation_request() throws Exception { - - // Create a MultipartEntityBuilder to build the request entity - MultipartEntityBuilder builder = MultipartEntityBuilder.create() - .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) - .addPart("additionalProperties", new FileBody(payloadFile)) - .addPart("file", new FileBody(definitionFile)); - - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpEntity multipartEntity = builder.build(); - - HttpResponse response = sharedContext.getHttpClient().doPostWithMultipart(Utils.getGQLImportAPIURL(), - multipartEntity, headers); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setApiUUID(Utils.extractID(sharedContext.getResponseBody())); - Thread.sleep(3000); - } - - @Then("I update the API settings") - public void make_update_gql_request() throws Exception { - String fileContent = new String(Files.readAllBytes(payloadFile.toPath()), StandardCharsets.UTF_8); - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse response = sharedContext.getHttpClient().doPut(Utils.getAPIUnDeployerURL(sharedContext.getApiUUID()), headers, fileContent ,Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setApiUUID(Utils.extractID(sharedContext.getResponseBody())); - Thread.sleep(3000); - } - - @Then("I delete the application {string} from devportal") - public void make_application_deletion_request(String applicationName) throws Exception { - logger.info("Fetching the applications"); - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getDevportalAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - List queryParams = new ArrayList<>(); - queryParams.add(new BasicNameValuePair("query", applicationName)); - - URI uri = new URIBuilder(Utils.getApplicationCreateURL()).addParameters(queryParams).build(); - HttpResponse appSearchResponse = sharedContext.getHttpClient().doGet(uri.toString(), headers); - - sharedContext.setResponse(appSearchResponse); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setApplicationUUID(Utils.extractApplicationUUID(sharedContext.getResponseBody())); - HttpResponse deleteResponse = sharedContext.getHttpClient().doDelete(Utils.getApplicationCreateURL() + "/" + sharedContext.getApplicationUUID(), headers); - - sharedContext.setResponse(deleteResponse); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - Thread.sleep(3000); - } - - @Then("I find the apiUUID of the API created with the name {string}") - public void find_api_uuid_using_name(String apiName) throws Exception { - logger.info("Fetching the APIs"); - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse appSearchResponse = sharedContext.getHttpClient().doGet(Utils.getAPISearchEndpoint(apiName), headers); - - sharedContext.setResponse(appSearchResponse); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setApiUUID(Utils.extractAPIUUID(sharedContext.getResponseBody())); - Thread.sleep(3000); - } - - @When("I undeploy the selected API") - public void i_undeploy_the_api() throws Exception { - logger.info("API UUID to be deleted: " + sharedContext.getApiUUID()); - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse response = sharedContext.getHttpClient().doDelete(Utils.getAPIUnDeployerURL(sharedContext.getApiUUID()), headers); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - Thread.sleep(3000); - } - - @When("I create the new version {string} of the same API with default version set to {string}") - public void create_new_version_of_the_api(String newVersion, String isDefaultVersion) throws Exception { - String apiUUID = sharedContext.getApiUUID(); - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - // Create query parameters - List queryParams = new ArrayList<>(); - queryParams.add(new BasicNameValuePair("newVersion", newVersion)); - queryParams.add(new BasicNameValuePair("defaultVersion", isDefaultVersion)); - queryParams.add(new BasicNameValuePair("apiId", apiUUID)); - - URI uri = new URIBuilder(Utils.getAPINewVersionCreationURL()).addParameters(queryParams).build(); - - HttpResponse response = sharedContext.getHttpClient().doPost(uri.toString(), headers,"",Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setApiUUID(Utils.extractID(sharedContext.getResponseBody())); - Thread.sleep(3000); - } - - @Then("I set new API throttling policy allowing {string} requests per every {string} minute") - public void add_new_custom_throttling_policy(String requestCount, String unitTime) throws Exception { - String payload = "{\"policyName\":\"TestRatelimit\",\"description\":\"Test descroption\",\"conditionalGroups\":[],\"defaultLimit\":{\"requestCount\":{\"timeUnit\":\"min\",\"unitTime\":"+ unitTime + ",\"requestCount\":" + requestCount + "},\"type\":\"REQUESTCOUNTLIMIT\",\"bandwidth\":null}}"; - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getAdminAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - HttpResponse httpResponse = sharedContext.getHttpClient().doPost(Utils.getAPIThrottlingConfigEndpoint(), headers, payload, Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setResponse(httpResponse); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setPolicyID(Utils.extractKeys(sharedContext.getResponseBody(), "policyId")); - Thread.sleep(3000); - } - - @Then("I send the subcription blocking request") - public void send_subscription_blocking() throws Exception { - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - HttpResponse httpResponse = sharedContext.getHttpClient().doPost(Utils.getSubscriptionBlockingURL(sharedContext.getSubscriptionID()), headers, "", Constants.CONTENT_TYPES.APPLICATION_JSON); - sharedContext.setResponse(httpResponse); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - Thread.sleep(3000); - } - - @Then("I make an internal key generation request") - public void generate_internal_key() throws Exception { - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpResponse httpResponse = sharedContext.getHttpClient().doPost(Utils.getInternalKeyGenerationEndpoint(sharedContext.getApiUUID()), headers, "", Constants.CONTENT_TYPES.APPLICATION_JSON); - - sharedContext.setResponse(httpResponse); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - sharedContext.setAPIInternalKey(Utils.extractKeys(sharedContext.getResponseBody(), "apikey")); - sharedContext.addStoreValue("internalKey",Utils.extractKeys(sharedContext.getResponseBody(), "apikey")); - logger.info("Internal Key: " + sharedContext.getAPIInternalKey()); - Thread.sleep(3000); - } - - @Then("I have a client certificate {string}") - public void get_valid_client_cert_for_mtls(String clientCertificatePath) throws Exception { - URL url = Resources.getResource("artifacts/certificates/" + clientCertificatePath); - - certificateFile = new File(url.getPath()); - String clientCertificate = Resources.toString(url, StandardCharsets.UTF_8); - sharedContext.addStoreValue("clientCertificate", clientCertificate); - - } - - @When("I update the API with mtls certificate data with the alias {string}") - public void update_api_with_mtls_cert_data(String alias) throws Exception { - - MultipartEntityBuilder builder = MultipartEntityBuilder.create() - .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) - .addBinaryBody("certificate", certificateFile, ContentType.create("application/x-x509-ca-cert"), "tls.crt") - .addTextBody("alias", alias, ContentType.TEXT_PLAIN) - .addTextBody("tier", "", ContentType.TEXT_PLAIN); - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getPublisherAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - HttpEntity multipartEntity = builder.build(); - - HttpResponse response = sharedContext.getHttpClient().doPostWithMultipart(Utils.getClientCertUpdateEndpoint(sharedContext.getApiUUID()), - multipartEntity, headers); - - sharedContext.setResponse(response); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - Thread.sleep(3000); - } - - @Then("I delete the created API throttling policy") - public void delete_throtlling_policy() throws Exception { - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Bearer " + sharedContext.getAdminAccessToken()); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_API_HOST); - - logger.info("PolicyID to be deleted: " + sharedContext.getPolicyID()); - String URI = Utils.getAPIThrottlingConfigEndpoint() + "/" + sharedContext.getPolicyID(); - HttpResponse httpResponse = sharedContext.getHttpClient().doDelete(URI, headers); - sharedContext.setResponse(httpResponse); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - Thread.sleep(3000); - } - -} \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/APKGenerationSteps.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/APKGenerationSteps.java deleted file mode 100644 index 21f2b09a07..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/APKGenerationSteps.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2023, WSO2 LLC (http://www.wso2.com). - * - * WSO2 LLC licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.apk.integration.api; - -import com.google.common.io.Resources; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.entity.mime.HttpMultipartMode; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; -import org.testng.Assert; -import org.wso2.apk.integration.utils.Utils; - -import java.io.File; -import java.net.URL; -import java.nio.charset.StandardCharsets; - -/** - * This class contains the step definitions for APK generation. - */ -public class APKGenerationSteps { - - private final SharedContext sharedContext; - private File definitionFile; - - public APKGenerationSteps(SharedContext sharedContext) { - - this.sharedContext = sharedContext; - } - - @When("I use the definition file {string} in resources") - public void i_use_the_definition_file_in_resources(String definitionFilePath) { - - URL url = Resources.getResource(definitionFilePath); - definitionFile = new File(url.getPath()); - } - - @When("generate the APK conf file for a {string} API") - public void generate_the_apk_conf_file(String apiType) throws Exception { - - // Create a MultipartEntityBuilder to build the request entity - MultipartEntityBuilder builder = MultipartEntityBuilder.create() - .setMode(HttpMultipartMode.BROWSER_COMPATIBLE) - .addTextBody("apiType", apiType) - .addPart("definition", new FileBody(definitionFile)); - - HttpEntity multipartEntity = builder.build(); - HttpResponse httpResponse = sharedContext.getHttpClient().doPostWithMultipart(Utils.getConfigGeneratorURL(), - multipartEntity); - sharedContext.setResponse(httpResponse); - } - - @Then("the response body should be {string} in resources") - public void the_response_body_should_be_in_resources(String expectedAPKConfFilePath) throws Exception { - - URL url = Resources.getResource(expectedAPKConfFilePath); - String text = Resources.toString(url, StandardCharsets.UTF_8); - - Assert.assertEquals(sharedContext.getHttpClient().getResponsePayload(sharedContext.getResponse()), text); - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java deleted file mode 100644 index f2844498a2..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java +++ /dev/null @@ -1,440 +0,0 @@ -/* - * Copyright (c) 2024, WSO2 LLC (http://www.wso2.com). - * - * WSO2 LLC licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.apk.integration.api; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.nimbusds.jose.JOSEException; -import com.nimbusds.jose.JOSEObjectType; -import com.nimbusds.jose.JWSAlgorithm; -import com.nimbusds.jose.jwk.source.JWKSource; -import com.nimbusds.jose.jwk.source.JWKSourceBuilder; -import com.nimbusds.jose.proc.BadJOSEException; -import com.nimbusds.jose.proc.DefaultJOSEObjectTypeVerifier; -import com.nimbusds.jose.proc.JWSKeySelector; -import com.nimbusds.jose.proc.JWSVerificationKeySelector; -import com.nimbusds.jose.proc.SecurityContext; -import com.nimbusds.jose.util.Resource; -import com.nimbusds.jose.util.ResourceRetriever; -import com.nimbusds.jwt.JWTClaimsSet; -import com.nimbusds.jwt.proc.ConfigurableJWTProcessor; -import com.nimbusds.jwt.proc.DefaultJWTProcessor; -import io.cucumber.core.options.CurlOption; -import io.cucumber.datatable.DataTable; -import io.cucumber.java.Before; -import io.cucumber.java.en.Given; -import io.cucumber.java.en.Then; -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.Header; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.StatusLine; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.testng.Assert; -import org.wso2.apk.integration.utils.Constants; -import org.wso2.apk.integration.utils.Utils; -import org.wso2.apk.integration.utils.clients.SimpleHTTPClient; -import org.apache.http.entity.mime.HttpMultipartMode; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.ContentType; - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.security.KeyManagementException; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.text.ParseException; -import java.time.LocalDateTime; -import java.time.temporal.ChronoUnit; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * This class contains the common step definitions. - */ -public class BaseSteps { - - private static final Log logger = LogFactory.getLog(BaseSteps.class); - private final SharedContext sharedContext; - private SimpleHTTPClient httpClient; - private static final int MAX_WAIT_FOR_NEXT_MINUTE_IN_SECONDS = 10; - - public BaseSteps(SharedContext sharedContext) { - - this.sharedContext = sharedContext; - } - - @Before - public void setup() throws Exception { - - httpClient = sharedContext.getHttpClient(); - } - - @Given("The system is ready") - public void systemIsReady() { - - } - - @Then("the response body should contain {string}") - public void theResponseBodyShouldContain(String expectedText) throws IOException { - Assert.assertTrue(sharedContext.getResponseBody().contains(expectedText), "Actual response body: " + sharedContext.getResponseBody()); - } - @Then("the response body should not contain {string}") - public void theResponseBodyShouldNotContain(String expectedText) throws IOException { - Assert.assertFalse(sharedContext.getResponseBody().contains(expectedText), "Actual response body: " + sharedContext.getResponseBody()); - } - - @Then("the response body should contain") - public void theResponseBodyShouldContain(DataTable dataTable) throws IOException { - List responseBodyLines = dataTable.asList(String.class); - for (String line : responseBodyLines) { - Assert.assertTrue(sharedContext.getResponseBody().contains(line), "Actual response body: " + sharedContext.getResponseBody()); - } - } - - @Then("the response status code should be {int}") - public void theResponseStatusCodeShouldBe(int expectedStatusCode) throws IOException { - - int actualStatusCode = sharedContext.getResponse().getStatusLine().getStatusCode(); - ((CloseableHttpResponse)sharedContext.getResponse()).close(); - Assert.assertEquals(actualStatusCode, expectedStatusCode); - } - - @Then("I send {string} request to {string} with body {string}") - public void sendHttpRequest(String httpMethod, String url, String body) throws IOException { - body = Utils.resolveVariables(body, sharedContext.getValueStore()); - if (sharedContext.getResponse() instanceof CloseableHttpResponse) { - ((CloseableHttpResponse) sharedContext.getResponse()).close(); - } - if (CurlOption.HttpMethod.GET.toString().toLowerCase().equals(httpMethod.toLowerCase())) { - sharedContext.setResponse(httpClient.doGet(url, sharedContext.getHeaders())); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - } else if (CurlOption.HttpMethod.POST.toString().toLowerCase().equals(httpMethod.toLowerCase())) { - sharedContext.setResponse(httpClient.doPost(url, sharedContext.getHeaders(), body, null)); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - } else if (CurlOption.HttpMethod.PUT.toString().toLowerCase().equals(httpMethod.toLowerCase())) { - sharedContext.setResponse(httpClient.doPut(url, sharedContext.getHeaders(), body, null)); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - } else if (CurlOption.HttpMethod.DELETE.toString().toLowerCase().equals(httpMethod.toLowerCase())) { - sharedContext.setResponse(httpClient.doDelete(url, sharedContext.getHeaders())); - sharedContext.setResponseBody(SimpleHTTPClient.responseEntityBodyToString(sharedContext.getResponse())); - } else if (CurlOption.HttpMethod.OPTIONS.toString().toLowerCase().equals(httpMethod.toLowerCase())) { - sharedContext.setResponse(httpClient.doOptions(url, sharedContext.getHeaders(), null, null)); - } - } - - // It will send request using a new thread and forget about the response - @Then("I send {string} async request to {string} with body {string}") - public void sendAsyncHttpRequest(String httpMethod, String url, String body) throws IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { - String finalBody = Utils.resolveVariables(body, sharedContext.getValueStore()); - if (sharedContext.getResponse() instanceof CloseableHttpResponse) { - ((CloseableHttpResponse) sharedContext.getResponse()).close(); - } - SimpleHTTPClient simpleHTTPClient = new SimpleHTTPClient(); - Thread thread = new Thread(() -> { - try { - if (CurlOption.HttpMethod.GET.toString().toLowerCase().equals(httpMethod.toLowerCase())) { - simpleHTTPClient.doGet(url, sharedContext.getHeaders()); - } else if (CurlOption.HttpMethod.POST.toString().toLowerCase().equals(httpMethod.toLowerCase())) { - simpleHTTPClient.doPost(url, sharedContext.getHeaders(), finalBody, null); - } else if (CurlOption.HttpMethod.PUT.toString().toLowerCase().equals(httpMethod.toLowerCase())) { - simpleHTTPClient.doPut(url, sharedContext.getHeaders(), finalBody, null); - } else if (CurlOption.HttpMethod.DELETE.toString().toLowerCase().equals(httpMethod.toLowerCase())) { - simpleHTTPClient.doPut(url, sharedContext.getHeaders(), finalBody, null); - } else if (CurlOption.HttpMethod.OPTIONS.toString().toLowerCase().equals(httpMethod.toLowerCase())) { - simpleHTTPClient.doOptions(url, sharedContext.getHeaders(), null, null); - } - } catch (IOException e) { - logger.warn("An async http request sending thread experienced an error: " + e); - } - }); - thread.start(); - } - - @Then("I set headers") - public void setHeaders(DataTable dataTable) { - List> rows = dataTable.asLists(String.class); - for (List columns : rows) { - String key = columns.get(0); - String value = columns.get(1); - key = Utils.resolveVariables(key, sharedContext.getValueStore()); - value = Utils.resolveVariables(value, sharedContext.getValueStore()); - sharedContext.addHeader(key, value); - } - } - - @Then("I remove the header {string}") - public void removeHeader(String key) { - sharedContext.removeHeader(key); - } - - @Then("the response headers should contain") - public void theResponseHeadersShouldContain(DataTable dataTable) { - List> rows = dataTable.asLists(String.class); - for (List columns : rows) { - String key = columns.get(0); - String value = columns.get(1); - Header header = sharedContext.getResponse().getFirstHeader(key); - Assert.assertNotNull(header); - Assert.assertEquals(header.getValue(), value); - } - } - - @Then("the response headers should not contain") - public void theResponseHeadersShouldNotContain(DataTable dataTable) { - List> rows = dataTable.asLists(String.class); - for (List columns : rows) { - String key = columns.get(0); - Header header = sharedContext.getResponse().getFirstHeader(key); - Assert.assertNull(header); - } - } - - @Then("I eventually receive {int} response code, not accepting") - public void eventualSuccess(int statusCode, DataTable dataTable) throws IOException, InterruptedException { - List nonAcceptableCodes = dataTable.asList(Integer.class); - if (sharedContext.getResponse().getStatusLine().getStatusCode() == statusCode) { - Assert.assertTrue(true); - } else { - HttpResponse httpResponse = httpClient.executeLastRequestForEventualConsistentResponse(statusCode, - nonAcceptableCodes); - sharedContext.setResponse(httpResponse); - Assert.assertEquals(httpResponse.getStatusLine().getStatusCode(), statusCode); - } - } - - @Then("I wait for next minute") - public void waitForNextMinute() throws InterruptedException { - LocalDateTime now = LocalDateTime.now(); - LocalDateTime nextMinute = now.plusMinutes(1).withSecond(0).withNano(0); - long secondsToWait = now.until(nextMinute, ChronoUnit.SECONDS); - if (secondsToWait > MAX_WAIT_FOR_NEXT_MINUTE_IN_SECONDS) { - return; - } - Thread.sleep((secondsToWait+1) * 1000); - logger.info("Current time: " + LocalDateTime.now()); - } - - @Then("I wait for next minute strictly") - public void waitForNextMinuteStrictly() throws InterruptedException { - LocalDateTime now = LocalDateTime.now(); - LocalDateTime nextMinute = now.plusMinutes(1).withSecond(0).withNano(0); - long secondsToWait = now.until(nextMinute, ChronoUnit.SECONDS); - Thread.sleep((secondsToWait+1) * 1000); - logger.info("Current time: " + LocalDateTime.now()); - } - - @Then("I wait for {int} minute") - public void waitForMinute(int minute) throws InterruptedException { - Thread.sleep(minute * 1000); - } - - @Then("I wait for {int} seconds") - public void waitForSeconds(int seconds) throws InterruptedException { - Thread.sleep(seconds * 1000); - } - - @Then("the response headers contains key {string} and value {string}") - public void containsHeader(String key, String value) { - key = Utils.resolveVariables(key, sharedContext.getValueStore()); - value = Utils.resolveVariables(value, sharedContext.getValueStore()); - HttpResponse response = sharedContext.getResponse(); - if (response == null) { - Assert.fail("Response is null."); - } - Header header = response.getFirstHeader(key); - if (header == null) { - Assert.fail("Could not find a header with the given key: " + key); - } - if ("*".equals(value)) { - return; // Any value is acceptable - } - String actualValue = header.getValue(); - Assert.assertEquals(value, actualValue,"Header with key found but value mismatched."); - } - @Then("the response headers not contains key {string}") - public void notContainsHeader(String key) { - key = Utils.resolveVariables(key, sharedContext.getValueStore()); - HttpResponse response = sharedContext.getResponse(); - if (response == null) { - Assert.fail("Response is null."); - } - Header header = response.getFirstHeader(key); - Assert.assertNull(header,"header contains in response headers"); - } - - @Then("the {string} jwt should validate from JWKS {string} and contain") - public void decode_header_and_validate(String header,String jwksEndpoint, DataTable dataTable) throws MalformedURLException { - List> claims = dataTable.asMaps(String.class, String.class); - JsonObject jsonResponse = (JsonObject) JsonParser.parseString(sharedContext.getResponseBody()); - String headerValue = jsonResponse.get("headers").getAsJsonObject().get(header).getAsString(); - ConfigurableJWTProcessor jwtProcessor = new DefaultJWTProcessor<>(); - jwtProcessor.setJWSTypeVerifier(new DefaultJOSEObjectTypeVerifier<>(JOSEObjectType.JWT)); - ResourceRetriever retriever = url -> { - try { - HttpResponse httpResponse = new SimpleHTTPClient().doGet(url.toString(), Collections.emptyMap()); - StatusLine statusLine = httpResponse.getStatusLine(); - if (statusLine.getStatusCode() == 200) { - Header header1 = httpResponse.getFirstHeader("Content-Type"); - try (InputStream content = httpResponse.getEntity().getContent()) { - return new Resource(IOUtils.toString(content), header1.getValue()); - } - } else { - throw new IOException("HTTP " + statusLine.getStatusCode() + ": " + statusLine.getReasonPhrase()); - } - } catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { - throw new IOException(e); - } - }; - - JWKSource keySource = JWKSourceBuilder.create(new URL(jwksEndpoint), retriever).build(); - JWSAlgorithm expectedJWSAlg = JWSAlgorithm.RS256; - JWSKeySelector keySelector = new JWSVerificationKeySelector<>(expectedJWSAlg, keySource); - jwtProcessor.setJWSKeySelector(keySelector); - try { - JWTClaimsSet claimsSet = jwtProcessor.process(headerValue, null); - for (Map claim : claims) { - Object claim1 = claimsSet.getClaim(claim.get("claim")); - Assert.assertNotNull(claim1, "Actual decoded JWT body: " + claimsSet); - Assert.assertEquals(claim.get("value"), claim1.toString(), "Actual " + - "decoded JWT body: " + claimsSet); - } - } catch (BadJOSEException | JOSEException|ParseException e) { - logger.error("JWT Signature verification fail", e); - Assert.fail("JWT Signature verification fail"); - } - } - - @Given("I have a DCR application") - public void iHaveADCRApplication() throws Exception { - - Map headers = new HashMap<>(); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_IDP_HOST); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Basic YWRtaW46YWRtaW4="); - - HttpResponse httpResponse = httpClient.doPost(Utils.getDCREndpointURL(), headers, "{\n" + - " \"callbackUrl\":\"www.google.lk\",\n" + - " \"clientName\":\"rest_api_publisher\",\n" + - " \"owner\":\"admin\",\n" + - " \"grantType\":\"client_credentials password refresh_token\",\n" + - " \"saasApp\":true\n" + - " }", - Constants.CONTENT_TYPES.APPLICATION_JSON); - sharedContext.setBasicAuthToken(Utils.extractBasicToken(httpResponse)); - sharedContext.addStoreValue("publisherBasicAuthToken", sharedContext.getBasicAuthToken()); - } - - - @Given("I have a valid Publisher access token") - public void iHaveValidPublisherAccessToken() throws Exception { - - Map headers = new HashMap<>(); - String basicAuthHeader = "Basic " + sharedContext.getBasicAuthToken(); - logger.info("Basic Auth Header: " + basicAuthHeader); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_IDP_HOST); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, basicAuthHeader); - - HttpResponse httpResponse = httpClient.doPost(Utils.getTokenEndpointURL(), headers, "grant_type=password&username=admin&password=admin&scope=apim:api_view apim:api_create apim:api_publish apim:api_delete apim:api_manage apim:api_import_export apim:subscription_manage apim:client_certificates_add apim:client_certificates_update", - Constants.CONTENT_TYPES.APPLICATION_X_WWW_FORM_URLENCODED); - logger.info("Response: " + httpResponse); - sharedContext.setPublisherAccessToken(Utils.extractToken(httpResponse)); - sharedContext.addStoreValue("publisherAccessToken", sharedContext.getPublisherAccessToken()); - } - - @Given("I have a valid Devportal access token") - public void iHaveValidDevportalAccessToken() throws Exception { - logger.info("Basic Auth Header: " + sharedContext.getBasicAuthToken()); - - Map headers = new HashMap<>(); - String basicAuthHeader = "Basic " + sharedContext.getBasicAuthToken(); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_IDP_HOST); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, basicAuthHeader); - - HttpResponse httpResponse = httpClient.doPost(Utils.getTokenEndpointURL(), headers, "grant_type=password&username=admin&password=admin&scope=apim:app_manage apim:sub_manage apim:subscribe", - Constants.CONTENT_TYPES.APPLICATION_X_WWW_FORM_URLENCODED); - sharedContext.setDevportalAccessToken(Utils.extractToken(httpResponse)); - sharedContext.addStoreValue("devportalAccessToken", sharedContext.getDevportalAccessToken()); - logger.info("Devportal Access Token: " + sharedContext.getDevportalAccessToken()); - } - - @Given("I have a valid Adminportal access token") - public void iHaveValidAdminportalAccessToken() throws Exception { - logger.info("Basic Auth Header: " + sharedContext.getBasicAuthToken()); - - Map headers = new HashMap<>(); - String basicAuthHeader = "Basic " + sharedContext.getBasicAuthToken(); - headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_IDP_HOST); - headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, basicAuthHeader); - - HttpResponse httpResponse = httpClient.doPost(Utils.getTokenEndpointURL(), headers, "grant_type=password&username=admin&password=admin&scope=apim:app_manage apim:admin_tier_view apim:admin_tier_manage", - Constants.CONTENT_TYPES.APPLICATION_X_WWW_FORM_URLENCODED); - sharedContext.setAdminAccessToken(Utils.extractToken(httpResponse)); - sharedContext.addStoreValue("adminportalAccessToken", sharedContext.getAdminAccessToken()); - logger.info("Admin Access Token: " + sharedContext.getAdminAccessToken()); - } - - @Then("the response should be given as valid") - public void theResponseShouldBeGivenAs() throws IOException { - Boolean status = sharedContext.getDefinitionValidStatus(); - Assert.assertEquals(true, status,"Actual definition validation status: "+ status); - } - -// @Given("I have a valid subscription without api deploy permission") -// public void iHaveValidSubscriptionWithAPICreateScope() throws Exception { -// -// Map headers = new HashMap<>(); -// headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_IDP_HOST); -// headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, "Basic NDVmMWM1YzgtYTkyZS0xMWVkLWFmYTEtMDI0MmFjMTIwMDAyOjRmYmQ2MmVjLWE5MmUtMTFlZC1hZmExLTAyNDJhYzEyMDAwMg=="); -// -// HttpResponse httpResponse = httpClient.doPost(Utils.getTokenEndpointURL(), headers, "grant_type=client_credentials", -// Constants.CONTENT_TYPES.APPLICATION_X_WWW_FORM_URLENCODED); -// sharedContext.setAccessToken(Utils.extractToken(httpResponse)); -// sharedContext.addStoreValue("accessToken", sharedContext.getAccessToken()); -// } -// -// @Given("I have a valid subscription with scopes") -// public void iHaveValidSubscriptionWithScope(DataTable dataTable) throws Exception { -// List> rows = dataTable.asLists(String.class); -// String scopes = Constants.EMPTY_STRING; -// for (List row : rows) { -// String scope = row.get(0); -// scopes += scope + Constants.SPACE_STRING; -// } -// Map headers = new HashMap<>(); -// headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_IDP_HOST); -// headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, Constants.SUBSCRIPTION_BASIC_AUTH_TOKEN); -// -// HttpResponse httpResponse = httpClient.doPost(Utils.getTokenEndpointURL(), headers, -// "grant_type=client_credentials&scope=" + scopes, -// Constants.CONTENT_TYPES.APPLICATION_X_WWW_FORM_URLENCODED); -// sharedContext.setAccessToken(Utils.extractToken(httpResponse)); -// sharedContext.addStoreValue(Constants.ACCESS_TOKEN, sharedContext.getAccessToken()); -// } - - @Then("I set {string} as the new access token") - public void set_invalid_access_token(String newToken) throws Exception { - sharedContext.setApiAccessToken(newToken); - sharedContext.addStoreValue("accessToken",sharedContext.getApiAccessToken()); - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/JWTGeneratorSteps.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/JWTGeneratorSteps.java deleted file mode 100644 index 9b3d940288..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/JWTGeneratorSteps.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.wso2.apk.integration.api; - -import com.google.common.io.Resources; -import com.nimbusds.jose.JOSEException; -import com.nimbusds.jose.JWSAlgorithm; -import com.nimbusds.jose.JWSHeader; -import com.nimbusds.jose.JWSSigner; -import com.nimbusds.jose.crypto.RSASSASigner; -import com.nimbusds.jose.jwk.RSAKey; -import com.nimbusds.jwt.JWTClaimsSet; -import com.nimbusds.jwt.SignedJWT; -import io.cucumber.java.en.And; -import io.cucumber.java.en.Then; -import io.cucumber.java.en.When; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; -import java.util.Date; -import java.util.UUID; - -import org.wso2.apk.integration.utils.Constants; - -public class JWTGeneratorSteps { - - private final SharedContext sharedContext; - - public JWTGeneratorSteps(SharedContext sharedContext) { - - this.sharedContext = sharedContext; - } - - @Then("I generate JWT token from idp1 with kid {string}") - public void generateTokenFromIdp1(String kid) throws IOException, CertificateException, KeyStoreException, - NoSuchAlgorithmException, JOSEException { - - URL url = Resources.getResource("artifacts/jwtcert/idp1.jks"); - File keyStoreFile = new File(url.getPath()); - KeyStore keyStore = KeyStore.getInstance(keyStoreFile, "wso2carbon".toCharArray()); - RSAKey rsaKey = RSAKey.load(keyStore, "idp1Key", "wso2carbon".toCharArray()); - JWSSigner signer = new RSASSASigner(rsaKey); - JWTClaimsSet claimsSet = new JWTClaimsSet.Builder() - .subject("alice") - .issuer("https://idp1.com") - .expirationTime(new Date(new Date().getTime() + 60 * 1000)) - .jwtID(UUID.randomUUID().toString()) - .claim("azp", UUID.randomUUID().toString()) - .claim("scope", Constants.API_CREATE_SCOPE) - .build(); - SignedJWT signedJWT = new SignedJWT( - new JWSHeader.Builder(JWSAlgorithm.RS256).keyID(kid).build(), - claimsSet); - signedJWT.sign(signer); - String jwtToken = signedJWT.serialize(); - sharedContext.addStoreValue("idp-1-token", jwtToken); - } - @Then("I generate JWT token from idp1 with kid {string} and consumer_key {string}") - public void generateTokenFromIdp1WithConsumerKey(String kid,String consumerKey) throws IOException, CertificateException, KeyStoreException, - NoSuchAlgorithmException, JOSEException { - - URL url = Resources.getResource("artifacts/jwtcert/idp1.jks"); - File keyStoreFile = new File(url.getPath()); - KeyStore keyStore = KeyStore.getInstance(keyStoreFile, "wso2carbon".toCharArray()); - RSAKey rsaKey = RSAKey.load(keyStore, "idp1Key", "wso2carbon".toCharArray()); - JWSSigner signer = new RSASSASigner(rsaKey); - JWTClaimsSet claimsSet = new JWTClaimsSet.Builder() - .subject("alice") - .issuer("https://idp1.com") - .expirationTime(new Date(new Date().getTime() + 60 * 1000)) - .jwtID(UUID.randomUUID().toString()) - .claim("azp", consumerKey) - .claim("scope", Constants.API_CREATE_SCOPE) - .build(); - SignedJWT signedJWT = new SignedJWT( - new JWSHeader.Builder(JWSAlgorithm.RS256).keyID(kid).build(), - claimsSet); - signedJWT.sign(signer); - String jwtToken = signedJWT.serialize(); - sharedContext.addStoreValue("idp-1-"+consumerKey+"-token", jwtToken); - } - - - @And("I have a valid token for organization {string}") - public void generateTokenFromIdp1WithOrganization(String organization) throws IOException, CertificateException, - KeyStoreException, - NoSuchAlgorithmException, JOSEException { - - URL url = Resources.getResource("artifacts/jwtcert/idp1.jks"); - File keyStoreFile = new File(url.getPath()); - KeyStore keyStore = KeyStore.getInstance(keyStoreFile, "wso2carbon".toCharArray()); - RSAKey rsaKey = RSAKey.load(keyStore, "idp1Key", "wso2carbon".toCharArray()); - JWSSigner signer = new RSASSASigner(rsaKey); - JWTClaimsSet claimsSet = new JWTClaimsSet.Builder() - .subject("alice") - .issuer("https://idp1.com") - .expirationTime(new Date(new Date().getTime() + 60 * 1000)) - .jwtID(UUID.randomUUID().toString()) - .claim("azp", UUID.randomUUID().toString()) - .claim("scope", Constants.API_CREATE_SCOPE) - .claim("organization", organization) - .build(); - SignedJWT signedJWT = new SignedJWT( - new JWSHeader.Builder(JWSAlgorithm.RS256).keyID("123-456").build(), - claimsSet); - signedJWT.sign(signer); - String jwtToken = signedJWT.serialize(); - sharedContext.addStoreValue(organization, jwtToken); - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/MTLSClientCertSteps.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/MTLSClientCertSteps.java deleted file mode 100644 index b3f66a8656..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/MTLSClientCertSteps.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2023, WSO2 LLC (http://www.wso2.com). - * - * WSO2 LLC licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.apk.integration.api; - -import org.apache.http.HttpResponse; -import org.wso2.apk.integration.utils.Constants; -import org.wso2.apk.integration.utils.Utils; -import org.wso2.apk.integration.utils.clients.SimpleHTTPClient; - -import com.google.common.io.Resources; - -import io.cucumber.java.Before; -import io.cucumber.java.en.Then; - -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; - -/** - * This class contains the common step definitions. - */ -public class MTLSClientCertSteps { - - private final SharedContext sharedContext; - private SimpleHTTPClient httpClient; - - public MTLSClientCertSteps(SharedContext sharedContext) { - - this.sharedContext = sharedContext; - } - - @Before - public void setup() throws Exception { - - httpClient = sharedContext.getHttpClient(); - } - -// @Then("I have a valid token with a client certificate {string}") -// public void getValidClientCertificateForMTLS(String clientCertificatePath) throws Exception { -// -// Map headers = new HashMap<>(); -// headers.put(Constants.REQUEST_HEADERS.HOST, Constants.DEFAULT_IDP_HOST); -// headers.put(Constants.REQUEST_HEADERS.AUTHORIZATION, -// "Basic NDVmMWM1YzgtYTkyZS0xMWVkLWFmYTEtMDI0MmFjMTIwMDAyOjRmYmQ2MmVjLWE5MmUtMTFlZC1hZmExLTAyNDJhYzEyMDAwMg=="); -// -// HttpResponse httpResponse = httpClient.doPost(Utils.getTokenEndpointURL(), headers, -// "grant_type=client_credentials&scope=" + Constants.API_CREATE_SCOPE, -// Constants.CONTENT_TYPES.APPLICATION_X_WWW_FORM_URLENCODED); -// sharedContext.setAccessToken(Utils.extractToken(httpResponse)); -// sharedContext.addStoreValue("accessToken", sharedContext.getAccessToken()); -// -// URL url = Resources.getResource("artifacts/certificates/" + clientCertificatePath); -// String clientCertificate = Resources.toString(url, StandardCharsets.UTF_8); -// sharedContext.addStoreValue("clientCertificate", clientCertificate); -// -// } -} \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/SharedContext.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/SharedContext.java deleted file mode 100644 index f52dff9557..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/SharedContext.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (c) 2024, WSO2 LLC (http://www.wso2.com). - * - * WSO2 LLC licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.apk.integration.api; - -import org.apache.http.HttpResponse; -import org.wso2.apk.integration.utils.clients.SimpleHTTPClient; - -import java.security.KeyManagementException; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -public class SharedContext { - - private SimpleHTTPClient httpClient; - private String publisherAccessToken; - private String devportalAccessToken; - private String adminportalAccessToken; - private String basicAuthToken; - private HttpResponse response; - private String responseBody; - private String apiUUID; - private String revisionUUID; - private String applicationUUID; - private String keyManagerUUID; - private String oauthKeyUUID; - private String consumerSecret; - private String consumerKey; - private String sandboxConsumerSecret; - private String sandboxConsumerKey; - private String prodKeyMappingID; - private String sandboxKeyMappingID; - private String apiAccessToken; - private Boolean definitionValidStatus; - private String subscriptionID; - private String internalKey; - private static String policyID; - private HashMap valueStore = new HashMap<>(); - private HashMap headers = new HashMap<>(); - - public SimpleHTTPClient getHttpClient() throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException { - if (httpClient == null) { - httpClient = new SimpleHTTPClient(); - } - return httpClient; - } - - public String getPublisherAccessToken() { - - return publisherAccessToken; - } - - public void setPublisherAccessToken(String accessToken) { - - this.publisherAccessToken = accessToken; - } - - public String getDevportalAccessToken() { - - return devportalAccessToken; - } - - public void setDevportalAccessToken(String accessToken) { - - this.devportalAccessToken = accessToken; - } - - public String getAdminAccessToken() { - - return adminportalAccessToken; - } - - public void setAdminAccessToken(String accessToken) { - - this.adminportalAccessToken = accessToken; - } - - public String getBasicAuthToken() { - - return basicAuthToken; - } - - public void setBasicAuthToken(String basicAuthToken) { - - this.basicAuthToken = basicAuthToken; - } - - public HttpResponse getResponse() { - - return response; - } - - public void setResponse(HttpResponse response) { - - this.response = response; - } - - public Object getStoreValue(String key) { - return valueStore.get(key); - } - - public void addStoreValue(String key, Object value) { - valueStore.put(key, value); - } - - public Map getValueStore() { - return Collections.unmodifiableMap(valueStore); - } - - public Map getHeaders() { - return Collections.unmodifiableMap(headers); - } - - public void addHeader(String key, String value) { - headers.put(key, value); - } - - public void removeHeader(String key) { - headers.remove(key); - } - - public String getResponseBody() { - - return responseBody; - } - - public void setResponseBody(String responseBody) { - - this.responseBody = responseBody; - } - - public String getApiUUID() { - - return apiUUID; - } - - public void setApiUUID(String apiUUID) { - - this.apiUUID = apiUUID; - } - - public String getRevisionUUID() { - - return revisionUUID; - } - - public void setRevisionUUID(String revisionUUID) { - - this.revisionUUID = revisionUUID; - } - - public String getApplicationUUID() { - - return applicationUUID; - } - - public void setApplicationUUID(String applicationUUID) { - - this.applicationUUID = applicationUUID; - } - - public String getKeyManagerUUID() { - - return keyManagerUUID; - } - - public void setKeyManagerUUID(String keyManagerUUID) { - - this.keyManagerUUID = keyManagerUUID; - } - - public String getOauthKeyUUID() { - - return oauthKeyUUID; - } - - public void setOauthKeyUUID(String oauthKeyUUID) { - - this.oauthKeyUUID = oauthKeyUUID; - } - - public void setAPIInternalKey(String internalKey){ - this.internalKey = internalKey; - } - - public String getAPIInternalKey(){ - return internalKey; - } - - public String getConsumerSecret(String keyType) { - if ("production".equals(keyType)) - return consumerSecret; - else if ("sandbox".equals(keyType)) - return sandboxConsumerSecret; - return ""; - } - - public void setConsumerSecret(String consumerSecret, String keyType) { - if ("production".equals(keyType)) - this.consumerSecret = consumerSecret; - else if ("sandbox".equals(keyType)) - this.sandboxConsumerSecret = consumerSecret; - } - - public String getConsumerKey(String keyType) { - if ("production".equals(keyType)) - return consumerKey; - else if ("sandbox".equals(keyType)) - return sandboxConsumerKey; - return ""; - } - - public void setConsumerKey(String consumerKey, String keyType) { - if ("production".equals(keyType)) - this.consumerKey = consumerKey; - else if ("sandbox".equals(keyType)) - this.sandboxConsumerKey = consumerKey; - } - - public void setKeyMappingID(String keyMappingID, String keyType){ - if ("production".equals(keyType)) - this.prodKeyMappingID = keyMappingID; - else if ("sandbox".equals(keyType)) - this.sandboxKeyMappingID = keyMappingID; - } - - public String getKeyMappingID(String keyType){ - if ("production".equals(keyType)) - return prodKeyMappingID; - else if ("sandbox".equals(keyType)) - return sandboxKeyMappingID; - return ""; - } - - public String getApiAccessToken() { - - return apiAccessToken; - } - - public void setApiAccessToken(String apiAccessToken) { - - this.apiAccessToken = apiAccessToken; - } - - public void setAPIDefinitionValidStatus(Boolean definitionValidStatus){ - this.definitionValidStatus = definitionValidStatus; - } - - public Boolean getDefinitionValidStatus(){ - return definitionValidStatus; - } - - public String getSubscriptionID() { - - return subscriptionID; - } - - public void setSubscriptionID(String subID) { - - this.subscriptionID = subID; - } - - public String getPolicyID() { - - return policyID; - } - - public void setPolicyID(String policyId) { - - this.policyID = policyId; - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/Constants.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/Constants.java deleted file mode 100644 index 360759120f..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/Constants.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2024, WSO2 LLC (http://www.wso2.com). - * - * WSO2 LLC licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.apk.integration.utils; - -public class Constants { - - public static final String DEFAULT_IDP_HOST = "am.wso2.com"; - public static final String DEFAULT_API_HOST = "am.wso2.com"; - public static final String DEFAULT_GW_PORT = ""; - public static final String DEFAULT_TOKEN_EP = "oauth2/token"; - public static final String DEFAULT_DCR_EP = "client-registration/v0.17/register"; - public static final String DEFAULT_API_CONFIGURATOR = "api/configurator/1.1.0/"; - public static final String DEFAULT_API_DEPLOYER = "api/am/publisher/v4/"; - public static final String DEFAULT_DEVPORTAL = "api/am/devportal/v3/"; - public static final String DEFAULT_ADMINPORTAL = "api/am/admin/v4/"; - public static final String ACCESS_TOKEN = "accessToken"; - public static final String EMPTY_STRING = ""; - public static final String API_CREATE_SCOPE = "apk:api_create"; - public static final String SPACE_STRING = " "; - public static final String SUBSCRIPTION_BASIC_AUTH_TOKEN = - "Basic NDVmMWM1YzgtYTkyZS0xMWVkLWFmYTEtMDI0MmFjMTIwMDAyOjRmYmQ2MmVjLWE5MmUtMTFlZC1hZmExLTAyNDJhYzEyMDAwMg=="; - public static final String DEFAULT_APIM_HOST = "apim.wso2.com"; - - public class REQUEST_HEADERS { - - public static final String HOST = "Host"; - public static final String AUTHORIZATION = "Authorization"; - public static final String CONTENT_TYPE = "Content-Type"; - } - - public class CONTENT_TYPES { - - public static final String APPLICATION_JSON = "application/json"; - public static final String APPLICATION_X_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded"; - - public static final String MULTIPART_FORM_DATA = "multipart/form-data"; - - public static final String APPLICATION_OCTET_STREAM = "application/octet-stream"; - - public static final String APPLICATION_ZIP = "application/zip"; - - public static final String TEXT_PLAIN = "text/plain"; - - public static final String APPLICATION_CA_CERT = "application/x-x509-ca-cert"; - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/MultipartFilePart.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/MultipartFilePart.java deleted file mode 100644 index d488dd622d..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/MultipartFilePart.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2024, WSO2 LLC (http://www.wso2.com). - * - * WSO2 LLC licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.apk.integration.utils; - -import java.io.File; - -public class MultipartFilePart { - - private String name; - private File file; - - public MultipartFilePart(String name, File file) { - - this.name = name; - this.file = file; - } - - public String getName() { - - return name; - } - - public File getFile() { - - return file; - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/Utils.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/Utils.java deleted file mode 100644 index 3f8ca14967..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/Utils.java +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Copyright (c) 2023, WSO2 LLC (http://www.wso2.com). - * - * WSO2 LLC licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.apk.integration.utils; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.HttpStatus; -import org.apache.http.entity.ContentType; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.Base64; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; - -public class Utils { - - public static String getConfigGeneratorURL() { - - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_CONFIGURATOR + "apis/generate-configuration"; - } - - public static String getDCREndpointURL() { - - return "https://" + Constants.DEFAULT_IDP_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_DCR_EP; - } - - public static String getTokenEndpointURL() { - - return "https://" + Constants.DEFAULT_IDP_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_TOKEN_EP; - } - - public static String getAPIDeployerURL() { - - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_DEPLOYER + "apis/deploy"; - } - - public static String getImportAPIURL() { - - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_DEPLOYER + "apis/import-openapi"; - } - - public static String getAPIRevisionURL(String apiUUID) { - - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_DEPLOYER + "apis/" + apiUUID + "/revisions"; - } - - public static String getAPIChangeLifecycleURL(String apiUUID) { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_DEPLOYER + "apis/change-lifecycle?action=Publish&apiId=" + apiUUID; - } - - public static String getApplicationCreateURL() { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_DEVPORTAL + "applications"; - } - - public static String getGenerateKeysURL(String applicationId) { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_DEVPORTAL + "applications/" + applicationId + "/generate-keys"; - } - - public static String getOauthKeysURL(String applicationId) { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_DEVPORTAL + "applications/" + applicationId + "/oauth-keys"; - } - - public static String getKeyManagerURL() { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_DEVPORTAL+ "key-managers"; - } - - public static String getSubscriptionURL() { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_DEVPORTAL + "subscriptions"; - } - - public static String getAccessTokenGenerationURL(String applicationId, String oauthKeyId) { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_DEVPORTAL + "applications/" + applicationId + "/oauth-keys/" + oauthKeyId + "/generate-token"; - } - - public static String getAPIRevisionDeploymentURL(String apiUUID, String revisionId) { - - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_DEPLOYER + "apis/" + apiUUID + "/deploy-revision?revisionId=" + revisionId; - } - - public static String getAPIUnDeployerURL(String apiID) { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_DEPLOYER + "apis/" + apiID; - } - - public static String getGQLSchemaValidatorURL() { - return "https://" + Constants.DEFAULT_API_HOST + "/" - + Constants.DEFAULT_API_DEPLOYER + "apis/validate-graphql-schema"; - } - - public static String getGQLImportAPIURL() { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_DEPLOYER + "apis/import-graphql-schema"; - } - - public static String getAPISearchEndpoint(String queryValue) { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_DEPLOYER + "search?query=content:" + queryValue; - } - - public static String getAPINewVersionCreationURL() { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_DEPLOYER + "apis/copy-api"; - } - - public static String getAPIThrottlingConfigEndpoint() { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_ADMINPORTAL+ "throttling/policies/advanced"; - } - - public static String getSubscriptionBlockingURL(String subscriptionID) { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_DEPLOYER+ "subscriptions/block-subscription?subscriptionId=" + subscriptionID+ "&blockState=BLOCKED"; - } - - public static String getInternalKeyGenerationEndpoint(String APIUUID) { - return "https://" + Constants.DEFAULT_API_HOST + ":" + Constants.DEFAULT_GW_PORT + "/" - + Constants.DEFAULT_API_DEPLOYER+ "apis/" + APIUUID+ "/generate-key"; - } - - public static String getClientCertUpdateEndpoint(String APIUUID) { - return "https://" + Constants.DEFAULT_API_HOST + "/" - + Constants.DEFAULT_API_DEPLOYER+ "apis/" + APIUUID+ "/client-certificates"; - } - - public static String extractID(String payload) throws IOException { - - JSONParser parser = new JSONParser(); - try { - // Parse the JSON string - JSONObject jsonObject = (JSONObject) parser.parse(payload); - - // Get the value of the "id" attribute - String idValue = (String) jsonObject.get("id"); - return idValue; - } catch (ParseException e) { - throw new IOException("Error while parsing the JSON payload: " + e.getMessage()); - } - } - - public static String extractApplicationID(String payload) throws IOException { - - JSONParser parser = new JSONParser(); - try { - // Parse the JSON string - JSONObject jsonObject = (JSONObject) parser.parse(payload); - - // Get the value of the "applicationId" attribute - String idValue = (String) jsonObject.get("applicationId"); - return idValue; - } catch (ParseException e) { - throw new IOException("Error while parsing the JSON payload: " + e.getMessage()); - } - } - - public static String extractKeyManagerID(String payload) throws IOException { - - JSONParser parser = new JSONParser(); - try { - // Parse the JSON string - JSONObject jsonObject = (JSONObject) parser.parse(payload); - - // Get the value of the "id" attribute - JSONArray idValue = (JSONArray)jsonObject.get("list"); - JSONObject keyManager = (JSONObject) idValue.get(0); - String keyManagerId = (String) keyManager.get("id"); - return keyManagerId; - } catch (ParseException e) { - throw new IOException("Error while parsing the JSON payload: " + e.getMessage()); - } - } - - public static String extractOAuthMappingID(String payload, String keyMappingID) throws IOException { - JSONParser parser = new JSONParser(); - try { - JSONObject jsonObject = (JSONObject) parser.parse(payload); - JSONArray list = (JSONArray) jsonObject.get("list"); - - for (Object obj : list) { - JSONObject keyManager = (JSONObject) obj; - String currentKeyMappingId = (String) keyManager.get("keyMappingId"); - if (keyMappingID.equals(currentKeyMappingId)) { - return currentKeyMappingId; - } - } - return null; - - } catch (ParseException e) { - throw new IOException("Error while parsing the JSON payload: " + e.getMessage()); - } - } - - public static String extractKeys(String payload, String key) throws IOException { - - JSONParser parser = new JSONParser(); - try { - // Parse the JSON string - JSONObject jsonObject = (JSONObject) parser.parse(payload); - - // Get the value of the "applicationId" attribute - String idValue = (String) jsonObject.get(key); - return idValue; - } catch (ParseException e) { - throw new IOException("Error while parsing the JSON payload: " + e.getMessage()); - } - } - - - - public static String extractToken(HttpResponse response) throws IOException { - - int responseCode = response.getStatusLine().getStatusCode(); - - HttpEntity entity = response.getEntity(); - Charset charset = ContentType.getOrDefault(entity).getCharset(); - if (charset == null) { - charset = StandardCharsets.UTF_8; - } - - BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent(), charset)); - String inputLine; - StringBuilder stringBuilder = new StringBuilder(); - - while ((inputLine = reader.readLine()) != null) { - stringBuilder.append(inputLine); - } - - if (responseCode != HttpStatus.SC_OK) { - throw new IOException("Error while accessing the Token URL. " - + response.getStatusLine()); - } - - JsonParser parser = new JsonParser(); - JsonObject jsonResponse = (JsonObject) parser.parse(stringBuilder.toString()); - if (jsonResponse.has("access_token")) { - return jsonResponse.get("access_token").getAsString(); - } - throw new IOException("Missing key [access_token] in the response from the OAuth server"); - } - - public static String extractBasicToken(HttpResponse response) throws IOException { - - int responseCode = response.getStatusLine().getStatusCode(); - String clientId = null; - String clientSecret = null; - - HttpEntity entity = response.getEntity(); - Charset charset = ContentType.getOrDefault(entity).getCharset(); - if (charset == null) { - charset = StandardCharsets.UTF_8; - } - - BufferedReader reader = new BufferedReader(new InputStreamReader(entity.getContent(), charset)); - String inputLine; - StringBuilder stringBuilder = new StringBuilder(); - - while ((inputLine = reader.readLine()) != null) { - stringBuilder.append(inputLine); - } - - if (responseCode != HttpStatus.SC_OK) { - throw new IOException("Error while accessing the Token URL. " - + response.getStatusLine()); - } - - JsonParser parser = new JsonParser(); - JsonObject jsonResponse = (JsonObject) parser.parse(stringBuilder.toString()); - if (jsonResponse.has("clientId")) { - clientId = jsonResponse.get("clientId").getAsString(); - } - if (jsonResponse.has("clientSecret")) { - clientSecret = jsonResponse.get("clientSecret").getAsString(); - } - if (clientId != null && clientSecret != null) { - // base64 encode the clientId and clientSecret - return Base64.getEncoder().encodeToString((clientId + ":" + clientSecret).getBytes()); - - } - throw new IOException("Missing key [access_token] in the response from the OAuth server"); - } - - public static String resolveVariables(String input, Map valueStore) { - // Define the pattern to match variables like ${variableName} - Pattern pattern = Pattern.compile("\\$\\{([^}]*)\\}"); - Matcher matcher = pattern.matcher(input); - StringBuffer resolvedString = new StringBuffer(); - - while (matcher.find()) { - String variableName = matcher.group(1); - String variableValue = valueStore.get(variableName).toString(); - - // Replace the variable with its value from the value store if it exists - // Otherwise, keep the variable placeholder as is in the string - String replacement = (variableValue != null) ? variableValue : matcher.group(); - matcher.appendReplacement(resolvedString, Matcher.quoteReplacement(replacement)); - } - - matcher.appendTail(resolvedString); - return resolvedString.toString(); - } - - public static Boolean extractValidStatus(String payload) throws IOException { - JSONParser parser = new JSONParser(); - try { - // Parse the JSON string - JSONObject jsonObject = (JSONObject) parser.parse(payload); - - // Get the value of the "isValid" attribute - Boolean validStatus = (Boolean) jsonObject.get("isValid"); - return validStatus; - } catch (ParseException e) { - throw new IOException("Error while parsing the JSON payload: " + e.getMessage()); - } - } - - public static String extractApplicationUUID(String payload) throws IOException { - JSONParser parser = new JSONParser(); - try { - JSONObject jsonObject = (JSONObject) parser.parse(payload); - long count = (long) jsonObject.get("count"); - if (count == 1) { - JSONArray list = (JSONArray) jsonObject.get("list"); - JSONObject applicationObj = (JSONObject) list.get(0); - String applicationId = (String) applicationObj.get("applicationId"); - return applicationId; - } - } catch (ParseException e) { - throw new IOException("Error while parsing the JSON payload: " + e.getMessage()); - } - return null; // Return null if count is not 1 - } - - public static String extractAPIUUID(String payload) throws IOException { - JSONParser parser = new JSONParser(); - try { - JSONObject jsonObject = (JSONObject) parser.parse(payload); - long count = (long) jsonObject.get("count"); - if (count == 1) { - JSONArray list = (JSONArray) jsonObject.get("list"); - JSONObject apiObj = (JSONObject) list.get(0); - String apiId = (String) apiObj.get("id"); - return apiId; - } - } catch (ParseException e) { - throw new IOException("Error while parsing the JSON payload: " + e.getMessage()); - } - return null; // Return null if count is not 1 - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/clients/SimpleHTTPClient.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/clients/SimpleHTTPClient.java deleted file mode 100644 index fcccd12763..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/clients/SimpleHTTPClient.java +++ /dev/null @@ -1,502 +0,0 @@ -/* - * Copyright (c) 2023, WSO2 LLC (http://www.wso2.com). - * - * WSO2 LLC licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.wso2.apk.integration.utils.clients; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpEntity; -import org.apache.http.HttpEntityEnclosingRequest; -import org.apache.http.HttpHeaders; -import javax.net.ssl.TrustManager; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpHead; -import org.apache.http.client.methods.HttpOptions; -import org.apache.http.client.methods.HttpPatch; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpUriRequest; -import org.apache.http.conn.HttpClientConnectionManager; -import org.apache.http.conn.ssl.NoopHostnameVerifier; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.conn.ssl.TrustAllStrategy; -import org.apache.http.entity.ContentProducer; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.EntityTemplate; -import org.apache.http.entity.mime.HttpMultipartMode; -import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.client.HttpClients; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.apache.http.ssl.SSLContexts; -import org.wso2.apk.integration.utils.MultipartFilePart; -import org.wso2.apk.integration.utils.exceptions.TimeoutException; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.security.KeyManagementException; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.X509Certificate; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.zip.GZIPOutputStream; -import javax.net.ssl.SSLContext; -import javax.net.ssl.X509TrustManager; - -public class SimpleHTTPClient { - - protected Log log = LogFactory.getLog(getClass()); - private CloseableHttpClient client; - private HttpUriRequest lastRequest; - private static final int EVENTUAL_SUCCESS_RESPONSE_TIMEOUT_IN_SECONDS = 20; - - public SimpleHTTPClient() throws NoSuchAlgorithmException, KeyStoreException, KeyManagementException { - -// final SSLContext sslcontext = SSLContexts.custom() -// .loadTrustMaterial(null, new TrustAllStrategy()) -// .build(); -// -// final SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslcontext); -// this.client = HttpClients.custom() -// .setSSLSocketFactory(csf) -// .evictExpiredConnections() -// .setMaxConnPerRoute(100) -// .setMaxConnTotal(1000) -// .build(); - - // Create SSL context that trusts all certificates - SSLContext sslContext = createAcceptAllSSLContext(); - - // Create a socket factory with custom SSL context and hostname verifier that accepts all hostnames - SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext, - NoopHostnameVerifier.INSTANCE); - - // Create HttpClient with custom SSL socket factory - this.client = HttpClientBuilder.create().setSSLSocketFactory(sslSocketFactory).build(); - this.lastRequest = null; - } - - private SSLContext createAcceptAllSSLContext() throws NoSuchAlgorithmException, KeyManagementException { - // Create a TrustManager that trusts all certificates - TrustManager[] trustAllCerts = new TrustManager[]{ - new X509TrustManager() { - public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return null; - } - - public void checkClientTrusted(X509Certificate[] certs, String authType) { - } - - public void checkServerTrusted(X509Certificate[] certs, String authType) { - } - } - }; - - // Create SSL context with the TrustManager that trusts all certificates - SSLContext sslContext = SSLContext.getInstance("TLS"); - sslContext.init(null, trustAllCerts, new java.security.SecureRandom()); - return sslContext; - } - - /** - * Function to extract response body as a string - * - * @param response org.apache.http.HttpResponse object containing response entity body - * @return returns the response entity body as a string - * @throws IOException - */ - public static String responseEntityBodyToString(HttpResponse response) throws IOException { - - if (response != null && response.getEntity() != null) { - try (InputStream inputStreamContent = response.getEntity().getContent()) { - return IOUtils.toString(inputStreamContent); - } - } - return null; - } - - /** - * Send a HTTP GET request to the specified URL - * - * @param url Target endpoint URL - * @param headers Any HTTP headers that should be added to the request - * @return Returned HTTP response - * @throws IOException If an error occurs while making the invocation - */ - public HttpResponse doGet(String url, Map headers) throws IOException { - - HttpUriRequest request = new HttpGet(url); - setHeaders(headers, request); - this.lastRequest = request; - return client.execute(request); - } - - /** - * Send a HTTP POST request to the specified URL - * - * @param url Target endpoint URL - * @param headers Any HTTP headers that should be added to the request - * @param payload Content payload that should be sent - * @param contentType Content-type of the request - * @return Returned HTTP response - * @throws IOException If an error occurs while making the invocation - */ - public HttpResponse doPost(String url, final Map headers, final String payload, String contentType) - throws IOException { - - HttpUriRequest request = new HttpPost(url); - setHeaders(headers, request); - HttpEntityEnclosingRequest entityEncReq = (HttpEntityEnclosingRequest) request; - final boolean zip = headers != null && "gzip".equals(headers.get(HttpHeaders.CONTENT_ENCODING)); - - EntityTemplate ent = new EntityTemplate(new ContentProducer() { - public void writeTo(OutputStream outputStream) throws IOException { - - OutputStream out = outputStream; - if (zip) { - out = new GZIPOutputStream(outputStream); - } - out.write(payload.getBytes()); - out.flush(); - out.close(); - } - }); - if (contentType != null) { - ent.setContentType(contentType); - } else { - ent.setContentType(MediaType.JSON.getValue()); - } - if (zip) { - ent.setContentEncoding("gzip"); - } - entityEncReq.setEntity(ent); - this.lastRequest = request; - log.info("Request: " + request); - return client.execute(request); - } - - /** - * Send a HTTP POST with multipart request to the specified URL - * - * @param url Target endpoint URL - * @return Returned HTTP response - * @throws IOException If an error occurs while making the invocation - */ - public HttpResponse doPostWithMultipart(String url, HttpEntity httpEntity) - throws IOException { - - return doPostWithMultipart(url, httpEntity, new HashMap<>()); - } - - public HttpResponse doPostWithMultipart(String url, HttpEntity httpEntity, Map header) - throws IOException { - - HttpPost request = new HttpPost(url); - for (String headerKey : header.keySet()) { - request.addHeader(headerKey, header.get(headerKey)); - } - request.setEntity(httpEntity); - this.lastRequest = request; - return client.execute(request); - } - - public HttpResponse doPostWithMultipart(String url, List fileParts, Map header) - throws IOException { - - MultipartEntityBuilder entitybuilder = MultipartEntityBuilder.create(); - entitybuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); - for (MultipartFilePart filePart : fileParts) { - entitybuilder.addPart(filePart.getName(), new FileBody(filePart.getFile())); - } - HttpPost request = new HttpPost(url); - for (String headerKey : header.keySet()) { - request.addHeader(headerKey, header.get(headerKey)); - } - HttpEntity mutiPartHttpEntity = entitybuilder.build(); - request.setEntity(mutiPartHttpEntity); - this.lastRequest = request; - return client.execute(request); - } - - public HttpResponse doPutWithMultipart(String url, File file, Map header) - throws IOException { - - MultipartEntityBuilder entitybuilder = MultipartEntityBuilder.create(); - entitybuilder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); - entitybuilder.addBinaryBody("file", file, ContentType.APPLICATION_OCTET_STREAM, file.getName()); - HttpPut request = new HttpPut(url); - for (String headerKey : header.keySet()) { - request.addHeader(headerKey, header.get(headerKey)); - } - HttpEntity mutiPartHttpEntity = entitybuilder.build(); - request.setEntity(mutiPartHttpEntity); - this.lastRequest = request; - return client.execute(request); - } - - /** - * Extracts the payload from a HTTP response. For a given HttpResponse object, this - * method can be called only once. - * - * @param response HttpResponse instance to be extracted - * @return Content payload - * @throws IOException If an error occurs while reading from the response - */ - public String getResponsePayload(HttpResponse response) throws IOException { - - if (response.getEntity() != null) { - InputStream in = response.getEntity().getContent(); - int length; - byte[] tmp = new byte[2048]; - StringBuilder buffer = new StringBuilder(); - while ((length = in.read(tmp)) != -1) { - buffer.append(new String(tmp, 0, length)); - } - return buffer.toString(); - } - return null; - } - - /** - * Send a HTTP PATCH request to the specified URL - * - * @param url Target endpoint URL - * @param headers Any HTTP headers that should be added to the request - * @param payload Content payload that should be sent - * @param contentType Content-type of the request - * @return Returned HTTP response - * @throws IOException If an error occurs while making the invocation - */ - public HttpResponse doPatch(String url, final Map headers, final String payload, String contentType) - throws IOException { - - HttpUriRequest request = new HttpPatch(url); - setHeaders(headers, request); - HttpEntityEnclosingRequest entityEncReq = (HttpEntityEnclosingRequest) request; - final boolean zip = headers != null && "gzip".equals(headers.get(HttpHeaders.CONTENT_ENCODING)); - - EntityTemplate ent = new EntityTemplate(new ContentProducer() { - public void writeTo(OutputStream outputStream) throws IOException { - - OutputStream out = outputStream; - if (zip) { - out = new GZIPOutputStream(outputStream); - } - out.write(payload.getBytes()); - out.flush(); - out.close(); - } - }); - ent.setContentType(contentType); - if (zip) { - ent.setContentEncoding("gzip"); - } - entityEncReq.setEntity(ent); - return client.execute(request); - } - - /** - * Send a HTTP OPTIONS request to the specified URL - * - * @param url Target endpoint URL - * @param headers Any HTTP headers that should be added to the request - * @param payload Content payload that should be sent - * @param contentType Content-type of the request - * @return Returned HTTP response - * @throws IOException If an error occurs while making the invocation - */ - public HttpResponse doOptions(String url, final Map headers, final String payload, - String contentType) throws IOException { - - HttpUriRequest request = new HttpOptions(url); - setHeaders(headers, request); - if (payload != null) { - HttpEntityEnclosingRequest entityEncReq = (HttpEntityEnclosingRequest) request; - final boolean zip = headers != null && "gzip".equals(headers.get(HttpHeaders.CONTENT_ENCODING)); - - EntityTemplate ent = new EntityTemplate(new ContentProducer() { - public void writeTo(OutputStream outputStream) throws IOException { - - OutputStream out = outputStream; - if (zip) { - out = new GZIPOutputStream(outputStream); - } - out.write(payload.getBytes()); - out.flush(); - out.close(); - } - }); - ent.setContentType(contentType); - if (zip) { - ent.setContentEncoding("gzip"); - } - entityEncReq.setEntity(ent); - } - return client.execute(request); - } - - /** - * Send a HTTP Head request to the specified URL - * - * @param url Target endpoint URL - * @param headers Any HTTP headers that should be added to the request - * @return Returned HTTP response - * @throws IOException If an error occurs while making the invocation - */ - public HttpResponse doHead(String url, final Map headers) throws IOException { - - HttpUriRequest request = new HttpHead(url); - setHeaders(headers, request); - return client.execute(request); - } - - /** - * Send a HTTP DELETE request to the specified URL - * - * @param url Target endpoint URL - * @param headers Any HTTP headers that should be added to the request - * @return Returned HTTP response - * @throws IOException If an error occurs while making the invocation - */ - public HttpResponse doDelete(String url, final Map headers) throws IOException { - - HttpUriRequest request = new HttpDelete(url); - setHeaders(headers, request); - this.lastRequest = lastRequest; - return client.execute(request); - } - - /** - * Send a HTTP PUT request to the specified URL - * - * @param url Target endpoint URL - * @param headers Any HTTP headers that should be added to the request - * @param payload Content payload that should be sent - * @param contentType Content-type of the request - * @return Returned HTTP response - * @throws IOException If an error occurs while making the invocation - */ - public HttpResponse doPut(String url, final Map headers, final String payload, String contentType) - throws IOException { - - HttpUriRequest request = new HttpPut(url); - setHeaders(headers, request); - HttpEntityEnclosingRequest entityEncReq = (HttpEntityEnclosingRequest) request; - final boolean zip = headers != null && "gzip".equals(headers.get(HttpHeaders.CONTENT_ENCODING)); - - EntityTemplate ent = new EntityTemplate(new ContentProducer() { - public void writeTo(OutputStream outputStream) throws IOException { - - OutputStream out = outputStream; - if (zip) { - out = new GZIPOutputStream(outputStream); - } - out.write(payload.getBytes()); - out.flush(); - out.close(); - } - }); - ent.setContentType(contentType); - if (zip) { - ent.setContentEncoding("gzip"); - } - entityEncReq.setEntity(ent); - this.lastRequest = lastRequest; - return client.execute(request); - } - - private void setHeaders(Map headers, HttpUriRequest request) { - - if (headers != null && headers.size() > 0) { - for (Map.Entry header : headers.entrySet()) { - request.setHeader(header.getKey(), header.getValue()); - } - } - } - - public HttpResponse executeLastRequestForEventualConsistentResponse(int successResponseCode, - List nonAcceptableCodes) throws IOException, InterruptedException { - - int counter = 1; - int responseCode = -1; - String lastResponseBody = null; - while (counter < EVENTUAL_SUCCESS_RESPONSE_TIMEOUT_IN_SECONDS) { - counter++; - Thread.sleep(1000); - HttpResponse httpResponse = getClient().execute(lastRequest); - responseCode = httpResponse.getStatusLine().getStatusCode(); - if (responseCode == successResponseCode || nonAcceptableCodes.contains(responseCode)) { - return httpResponse; - } else { - if (counter == EVENTUAL_SUCCESS_RESPONSE_TIMEOUT_IN_SECONDS) { - lastResponseBody = responseEntityBodyToString(httpResponse); - } - ((CloseableHttpResponse) httpResponse).close(); - } - } - throw new TimeoutException("Could not receive expected response within time. Last received code: " - + responseCode + ", last response body: " + lastResponseBody); - } - - private HttpClient getClient() { - - final SSLContext sslcontext; - try { - sslcontext = SSLContexts.custom() - .loadTrustMaterial(null, new TrustAllStrategy()) - .build(); - } catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) { - throw new RuntimeException(e); - } - final SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslcontext); - - return HttpClients.custom() - .setSSLSocketFactory(csf) - .evictExpiredConnections() - .build(); - } -} - -enum MediaType { - JSON("application/json"), - XML("application/xml"), - FORM("application/x-www-form-urlencoded"); - // Add more Content-Type values as needed - - private final String value; - - MediaType(String value) { - this.value = value; - } - - public String getValue() { - return value; - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/exceptions/TimeoutException.java b/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/exceptions/TimeoutException.java deleted file mode 100644 index 3835962a69..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/java/org/wso2/apk/integration/utils/exceptions/TimeoutException.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.wso2.apk.integration.utils.exceptions; - -public class TimeoutException extends RuntimeException { - - public TimeoutException(String s) { - super(s); - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/config-map-1.crt b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/config-map-1.crt deleted file mode 100644 index 9687e88707..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/config-map-1.crt +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDGTCCAgECFANIkLQBkd76qiTXzSXjBS2scPJsMA0GCSqGSIb3DQEBCwUAME0x -CzAJBgNVBAYTAkxLMRMwEQYDVQQIDApTb21lLVN0YXRlMQ0wCwYDVQQKDAR3c28y -MQwwCgYDVQQLDANhcGsxDDAKBgNVBAMMA2FwazAeFw0yMzEyMDYxMDEyNDhaFw0y -NTA0MTkxMDEyNDhaMEUxCzAJBgNVBAYTAkxLMRMwEQYDVQQIDApTb21lLVN0YXRl -MSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQwggEiMA0GCSqGSIb3 -DQEBAQUAA4IBDwAwggEKAoIBAQCdG90W/Tlk4u9awHPteD5zpVcThUKwMLvAKw9i -vVQBC0AG6GzPbakol5gKVm+kBUDFzzzF6eayEXKWbyaZDty66A2+7HLLcKBop5M/ -a57Q9XtU3lRYvotgutLWuHcI7mLCScZDrjA3rnb/KjjbhZ602ZS1pp5jtyUz6DwL -m7w4wQ/RProqCdBj8QqoAvnDDLSPeDfsx14J5VeNJVGJV2wax65jWRjRkj6wE7z2 -qzWAlP5vDeED6bogYYVDpC8DtgayQ+vKAQLi1uj+I9Yqb/nPUrdUh9IlxudlqiFQ -QxyvsXMJEzbWWmlbD0kXYkHmHzetJNPK9ayOS/fJcAcfAb01AgMBAAEwDQYJKoZI -hvcNAQELBQADggEBAFmUc7+cI8d0Dl4wTdq+gfyWdqjQb7AYVO9DvJi3XGxdc5Kp -1nCSsKzKUz9gvxXHeaYKrBNYf4SSU+Pkdf/BWePqi7UX/SIxNXby2da8zWg+W6Uh -xZfKlLYGMp3mCjueZpZTJ7SKOOGFA8IIgEzjJD9Ln1gl3ywMaCwlNrG9RpiD1McT -COKvyWNKnSRVr/RvCklLVrAMTJr50kce2czcdFl/xF4Hm66vp7cP/bYJKWAL8hBG -zUa9aQBKncOoAO+zQ/SGy7uJxTDUF8SverDsmjOc6AU6IhBGVUyX/JQbYyJfZinB -YlviYxVzIm6IaNJHx4sihw4U1/jMFWRXT470zcQ= ------END CERTIFICATE----- \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/config-map-2.crt b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/config-map-2.crt deleted file mode 100644 index 041c596e7c..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/config-map-2.crt +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDkTCCAnmgAwIBAgIUJitjysknJ0nHeLH/mjT1JIpOz4YwDQYJKoZIhvcNAQEL -BQAwYDELMAkGA1UEBhMCVVMxEjAQBgNVBAgMCVlvdXJTdGF0ZTERMA8GA1UEBwwI -WW91ckNpdHkxGTAXBgNVBAoMEFlvdXJPcmdhbml6YXRpb24xDzANBgNVBAMMBllv -dXJDQTAeFw0yNDAxMDUwNDAwMjNaFw0yNTAxMDQwNDAwMjNaMGExCzAJBgNVBAYT -AlVTMRIwEAYDVQQIDAlZb3VyU3RhdGUxETAPBgNVBAcMCFlvdXJDaXR5MRkwFwYD -VQQKDBBZb3VyT3JnYW5pemF0aW9uMRAwDgYDVQQDDAdjbGllbnQxMIIBIjANBgkq -hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuJhFZmCVnj6N+/+HHuMvb4vyWqWcorUf -pAWO7a3YVsHp3BX+lbGGzh67jbPcFK6K7RqejenFw7sQK8duZlqXmik/JvZMLxY3 -l/6e8LIAhN7PaX1zg58OU61baQ5VNBhUXkoYN77xqb87Yo7IFyyQ/tyWfRVFEzNj -V1+q2MpEinuscViieIQHEpB4i6fsRxomYkR+FwdfCB65MYCYveIB1z9NkmR6Pm6V -7zSPp+QYwc6WX4/61fbRje4BJh3j+FGYboJJg1o9O/MkD70RW6mdMV1l5bT9T98W -B+hJtN+5dEpSfAwXqlWWxzhDxNsEvdSwuoLz9e58gteR1LSLaJXMjQIDAQABo0Iw -QDAdBgNVHQ4EFgQULaoslUgyglywztd95CkL6sU5wa4wHwYDVR0jBBgwFoAUGUkK -+QXBjeGMy7XVnrXfrvVJUNswDQYJKoZIhvcNAQELBQADggEBABodQ1Y7zt7kvDI8 -jQUfLLkZZAPnVpjYpG7P1dLjOzUxqDNmyZAzoBMENXy/Zu81sRQt+Bs5NKsx1pu5 -z2TRk9ddxhszD1FKu9Hb6hqLcGHF7GnwPGVXJlHctkMp4QYvXc942VDk7c59/knC -PXAul7832cPTUMvFHdzRxBwJruK9xuvNLj2I24+Fji1ELPO7M/e8KZ1NrIS0Fdwn -DuDDw3kMkl0BlSrmvMBreSaIOU4mFhmepC97awZ/wZZ+4mpIdWIagZf01txue8o0 -+8kdGkFsmoCpnJjNjpoQFAYLEdif00iLcRpwwW/saUuxqZC0aDnQCIeo0GSNet8t -HOXCkvQ= ------END CERTIFICATE----- \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/config-map-3.crt b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/config-map-3.crt deleted file mode 100644 index f94ba143db..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/config-map-3.crt +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDkTCCAnmgAwIBAgIUJitjysknJ0nHeLH/mjT1JIpOz4cwDQYJKoZIhvcNAQEL -BQAwYDELMAkGA1UEBhMCVVMxEjAQBgNVBAgMCVlvdXJTdGF0ZTERMA8GA1UEBwwI -WW91ckNpdHkxGTAXBgNVBAoMEFlvdXJPcmdhbml6YXRpb24xDzANBgNVBAMMBllv -dXJDQTAeFw0yNDAxMDUwNDE0MTlaFw0yNTAxMDQwNDE0MTlaMGExCzAJBgNVBAYT -AlVTMRIwEAYDVQQIDAlZb3VyU3RhdGUxETAPBgNVBAcMCFlvdXJDaXR5MRkwFwYD -VQQKDBBZb3VyT3JnYW5pemF0aW9uMRAwDgYDVQQDDAdjbGllbnQyMIIBIjANBgkq -hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2JQ8LITwayvjrrHUmFT44lH3IF3fdPhr -pQgKx7Z295QD9Ocka2rOFu47tuIeNcLiBTSyRLOFDRwjW9WXfWk9ALtxbedJfDyy -us/kLxY+SdzHW7/5dFbupGOcs58A/sxMyGTJgiCBxsgsRFfhet7ekq/ypmj5B8L3 -5FlGg5NS0mbZlTM6aapLnkqU907RcsmzpFQBfWOHlDdWJocKEHECBXcxiTQk72C7 -s2tndES5ltX/Wc8U/kX/M9LDXhn1Ew+roeFf0HCpdg6BlnTknhYU9S1c4aYKB2Yx -LNx74CsKsnxPPcePTXPqZEtZ4EsjF4PSToVFyceMBKvD6C6WPQoRNwIDAQABo0Iw -QDAdBgNVHQ4EFgQUWE8btMihi5eZXLJOeiNfh7XHaI0wHwYDVR0jBBgwFoAUGUkK -+QXBjeGMy7XVnrXfrvVJUNswDQYJKoZIhvcNAQELBQADggEBAJmXn/gefez7mq1b -iKpPLPeHUncIgVaru03v8YCX14pHFAsVuLgZ1lANelSrq+PR/HBJbQj8iloV938o -YFppe/fb96D8a2u90dnGwWipMRSDo3wgcInL38xfcH5UEPBVJVLa3IUkfwDjjEqK -3O0GXVSpjyv3RW+E9wfPfGSysRX66cTo5Uh3z3hTAloDc8uhCYRPcxG7S9eKD6jW -Z3MlFlw4U8CdO90L0nB1KFhz1Et0Sl9u/LDsUYq6mE+XhTngPs8qwR/o43s1DUID -y5Oi4A4+id+xO0XnHIkkqCfPtFzxl3hwytcy8EqISynzzHWNJ8bFZIYX4tgX+PLq -u0/ITEw= ------END CERTIFICATE----- \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/invalid-cert.crt b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/invalid-cert.crt deleted file mode 100644 index c526af6bd6..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/invalid-cert.crt +++ /dev/null @@ -1,3 +0,0 @@ ------BEGIN CERTIFICATE----- -invalidcertificate ------END CERTIFICATE----- \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/tls.crt b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/tls.crt deleted file mode 100644 index 46fa79fc6c..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/certificates/tls.crt +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDCTCCAfGgAwIBAgIUeINiBxKE48ZayvCanHDpjBBWWT0wDQYJKoZIhvcNAQEL -BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTI0MDIwMjA4NDMxOFoXDTI1MDIw -MTA4NDMxOFowFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEF -AAOCAQ8AMIIBCgKCAQEA4Cb1Kgflk0cqGl1OonsCHD8VZI8Njc4KH0guf0Vy9lcf -s937MX3jfjfZckdao+ontDK5FdXNpalSHXVsv0HFOkUwpg2RHykULzBftG8YQrV/ -6NZgvVOPaX4IjGqkQaKdaY0nQGWH5g1RWYOxrBQEagpGjbWeBi2V4D0+4WkLVpjn -Ovqs3YIlHBPihC28OXi6N1K4cy1/lWOpQ+tVEVaQ05evybxMRT+0p4mOmc5LIRzF -ovjh9dJie47AlYOoI6WCKBSqESm9E1i49vWg5Ya3p0opDt/mLb90yhcPs4Et3Atw -aDH+7hHQ8UFkP1e5MA/r8ikWh0PQnB5liPWFbG14EwIDAQABo1MwUTAdBgNVHQ4E -FgQUkeTnxySX8Vylu3H3MttzP1SUj/EwHwYDVR0jBBgwFoAUkeTnxySX8Vylu3H3 -MttzP1SUj/EwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAksub -Vus945gRyQsZrEQlP4Wq8VgEJfy/f26gV7SutaPaYb9wsFIou8favoZkqBVo51Qd -yvh5aSplMr8G8hR/u0QpPtiKF6x1Mm7pe7DILuL17f46aWw4H8znFMMlYm3XmXwC -ATDIR7Cm+HMH3VhI3FfMrXNeg8QAm+Gkya0a0717xfGmlSsKPj/Rx07e5M+XU/Zq -NOnPsWq8BZ6gJdtvL8Xq6kk9WLdzsdE0JUv0/zuXkXzvs+/61shh2A2ot78d3XpT -RAlXLyYWrmyp4G3XQvW1thaAxHF8NKlm+9QBXIeYi8R5pcNwDLbxXo2N7vJx/r+w -DXoeIHImTMHHH5CWnw== ------END CERTIFICATE----- diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/basic_auth_api.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/basic_auth_api.json deleted file mode 100644 index f6a997e536..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/basic_auth_api.json +++ /dev/null @@ -1,225 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "EmployeeServiceAPI", - "version": "3.14" - }, - "servers": [ - { - "url": "http://backend:80/anything", - "description": "Server URL", - "variables": {} - } - ], - "paths": { - "/employee": { - "get": { - "tags": [ - "employee-controller" - ], - "operationId": "getEmployees", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "default response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - } - } - }, - - "post": { - "tags": [ - "employee-controller" - ], - "operationId": "addEmployee", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - }, - "responses": { - "200": { - "description": "default response", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - } - } - }, - "/get": { - "get": { - "tags": [ - "employee-controller" - ], - "operationId": "getEmployees", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "default response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - } - } - } - }, - "/post": { - "post": { - "tags": [ - "employee-controller" - ], - "operationId": "getEmployees", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "default response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - } - } - } - }, - "/employee/{employeeId}": { - "put": { - "tags": [ - "employee-controller" - ], - "operationId": "editEmployee", - "parameters": [ - { - "name": "employeeId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "default response", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - } - }, - "delete": { - "tags": [ - "employee-controller" - ], - "operationId": "deleteEmployee", - "parameters": [ - { - "name": "employeeId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "default response", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Employee": { - "type": "object", - "properties": { - "empId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "designation": { - "type": "string" - }, - "salary": { - "type": "number", - "format": "double" - } - } - } - } - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/cors-definition.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/cors-definition.json deleted file mode 100644 index 29a7ce15a3..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/cors-definition.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "test-cors", - "description": "A simple HTTP Request & Response Service", - "version": "2.0.0" - }, - "servers": [ - { - "url": "https://httpbin.org" - } - ], - "tags": [ - { - "name": "HTTP Methods", - "description": "Testing different HTTP verbs" - }, - { - "name": "Auth", - "description": "Auth methods" - } - ], - "paths": { - "/anything": { - "get": { - "tags": [ - "Anything" - ], - "summary": "Returns anything passed in request data.", - "responses": { - "200": { - "description": "Anything passed in request", - "content": {} - } - } - } - } - }, - "components": {} -} - diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/employee_with_rl_r.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/employee_with_rl_r.json deleted file mode 100644 index 13a1d56080..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/employee_with_rl_r.json +++ /dev/null @@ -1,282 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "SimpleRateLimitResourceLevelAPI", - "version": "3.14" - }, - "servers": [ - { - "url": "http://backend:80/anything", - "description": "Server URL" - } - ], - "security": [ - { - "default": [] - } - ], - "paths": { - "/employee": { - "get": { - "tags": [ - "employee-controller" - ], - "operationId": "getEmployees", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "style": "form", - "explode": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "default response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - } - }, - "security": [ - { - "default": [] - } - ], - "x-throttling-tier": "TestRatelimit", - "x-auth-type": "Application & Application User", - "x-wso2-application-security": { - "security-types": [ - "oauth2" - ], - "optional": false - } - }, - "post": { - "tags": [ - "employee-controller" - ], - "operationId": "addEmployee", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - }, - "responses": { - "200": { - "description": "default response", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - }, - "security": [ - { - "default": [] - } - ], - "x-throttling-tier": "Unlimited", - "x-auth-type": "Application & Application User", - "x-wso2-application-security": { - "security-types": [ - "oauth2" - ], - "optional": false - } - } - }, - "/employee/{employeeId}": { - "put": { - "tags": [ - "employee-controller" - ], - "operationId": "editEmployee", - "parameters": [ - { - "name": "employeeId", - "in": "path", - "required": true, - "style": "simple", - "explode": false, - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "default response", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - }, - "security": [ - { - "default": [] - } - ], - "x-throttling-tier": "Unlimited", - "x-auth-type": "Application & Application User", - "x-wso2-application-security": { - "security-types": [ - "oauth2" - ], - "optional": false - } - }, - "delete": { - "tags": [ - "employee-controller" - ], - "operationId": "deleteEmployee", - "parameters": [ - { - "name": "employeeId", - "in": "path", - "required": true, - "style": "simple", - "explode": false, - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "default response", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - }, - "security": [ - { - "default": [] - } - ], - "x-throttling-tier": "Unlimited", - "x-auth-type": "Application & Application User", - "x-wso2-application-security": { - "security-types": [ - "oauth2" - ], - "optional": false - } - } - } - }, - "components": { - "schemas": { - "Employee": { - "type": "object", - "properties": { - "empId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "designation": { - "type": "string" - }, - "salary": { - "type": "number", - "format": "double" - } - } - } - }, - "securitySchemes": { - "default": { - "type": "oauth2", - "flows": { - "implicit": { - "authorizationUrl": "https://test.com", - "scopes": {} - } - } - } - } - }, - "x-wso2-api-key-header": "ApiKey", - "x-wso2-auth-header": "Authorization", - "x-throttling-tier": "TestRatelimit", - "x-wso2-cors": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": [ - "*" - ], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "x-wso2-production-endpoints": { - "urls": [ - "http://backend:80/anything" - ], - "type": "http" - }, - "x-wso2-sandbox-endpoints": { - "urls": [ - "http://backend:80/anything" - ], - "type": "http" - }, - "x-wso2-basePath": "/simple-rl-r/3.14", - "x-wso2-transports": [ - "http", - "https" - ], - "x-wso2-application-security": { - "security-types": [ - "oauth2" - ], - "optional": false - }, - "x-wso2-response-cache": { - "enabled": false, - "cacheTimeoutInSeconds": 300 - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/employees_api.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/employees_api.json deleted file mode 100644 index 35afc7480d..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/employees_api.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "EmployeeServiceAPI", - "version": "3.14" - }, - "servers": [ - { - "url": "http://backend:80/anything", - "description": "Server URL", - "variables": {} - } - ], - "paths": { - "/employee": { - "get": { - "tags": [ - "employee-controller" - ], - "operationId": "getEmployees", - "parameters": [ - { - "name": "id", - "in": "query", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "default response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - } - } - }, - "post": { - "tags": [ - "employee-controller" - ], - "operationId": "addEmployee", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - }, - "responses": { - "200": { - "description": "default response", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - } - } - }, - "/employee/{employeeId}": { - "put": { - "tags": [ - "employee-controller" - ], - "operationId": "editEmployee", - "parameters": [ - { - "name": "employeeId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "default response", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - } - }, - "delete": { - "tags": [ - "employee-controller" - ], - "operationId": "deleteEmployee", - "parameters": [ - { - "name": "employeeId", - "in": "path", - "required": true, - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "default response", - "content": { - "*/*": { - "schema": { - "$ref": "#/components/schemas/Employee" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Employee": { - "type": "object", - "properties": { - "empId": { - "type": "string" - }, - "name": { - "type": "string" - }, - "designation": { - "type": "string" - }, - "salary": { - "type": "number", - "format": "double" - } - } - } - } - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/schema_graphql.graphql b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/schema_graphql.graphql deleted file mode 100644 index d8273eab32..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/definitions/schema_graphql.graphql +++ /dev/null @@ -1,199 +0,0 @@ -schema { - query: Query - mutation: Mutation - subscription: Subscription -} - -# The query type, represents all of the entry points into our object graph -type Query { - hero(episode: Episode): Character - reviews(episode: Episode!): [Review] - search(text: String): [SearchResult] - character(id: ID!): Character - droid(id: ID!): Droid - human(id: ID!): Human - allHumans(first: Int): [Human] - allDroids(first: Int): [Droid] - allCharacters(first: Int): [Character] - starship(id: ID!): Starship -} - -# The mutation type, represents all updates we can make to our data -type Mutation { - createReview(episode: Episode, review: ReviewInput!): Review -} - -# The subscription type, represents all subscriptions we can make to our data -type Subscription { - reviewAdded(episode: Episode): Review -} - -# The episodes in the Star Wars trilogy -enum Episode { - # Star Wars Episode IV: A New Hope, released in 1977. - NEWHOPE - - # Star Wars Episode V: The Empire Strikes Back, released in 1980. - EMPIRE - - # Star Wars Episode VI: Return of the Jedi, released in 1983. - JEDI - - # Star Wars Episode III: Revenge of the Sith, released in 2005 - SITH -} - -# A character from the Star Wars universe -interface Character { - # The ID of the character - id: ID! - - # The name of the character - name: String! - - # The friends of the character, or an empty list if they have none - friends: [Character] - - # The friends of the character exposed as a connection with edges - friendsConnection(first: Int, after: ID): FriendsConnection! - - # The movies this character appears in - appearsIn: [Episode]! -} - -# Units of height -enum LengthUnit { - # The standard unit around the world - METER - - # Primarily used in the United States - FOOT -} - -# A humanoid creature from the Star Wars universe -type Human implements Character { - # The ID of the human - id: ID! - - # What this human calls themselves - name: String! - - # The home planet of the human, or null if unknown - homePlanet: String - - # Height in the preferred unit, default is meters - height(unit: LengthUnit = METER): Float - - # Mass in kilograms, or null if unknown - mass: Float - - # This human's friends, or an empty list if they have none - friends: [Character] - - # The friends of the human exposed as a connection with edges - friendsConnection(first: Int, after: ID): FriendsConnection! - - # The movies this human appears in - appearsIn: [Episode]! - - # A list of starships this person has piloted, or an empty list if none - starships: [Starship] -} - -# An autonomous mechanical character in the Star Wars universe -type Droid implements Character { - # The ID of the droid - id: ID! - - # What others call this droid - name: String! - - # This droid's friends, or an empty list if they have none - friends: [Character] - - # The friends of the droid exposed as a connection with edges - friendsConnection(first: Int, after: ID): FriendsConnection! - - # The movies this droid appears in - appearsIn: [Episode]! - - # This droid's primary function - primaryFunction: String -} - -# A connection object for a character's friends -type FriendsConnection { - # The total number of friends - totalCount: Int - - # The edges for each of the character's friends. - edges: [FriendsEdge] - - # A list of the friends, as a convenience when edges are not needed. - friends: [Character] - - # Information for paginating this connection - pageInfo: PageInfo! -} - -# An edge object for a character's friends -type FriendsEdge { - # A cursor used for pagination - cursor: ID! - - # The character represented by this friendship edge - node: Character -} - -# Information for paginating this connection -type PageInfo { - startCursor: ID - endCursor: ID - hasNextPage: Boolean! -} - -# Represents a review for a movie -type Review { - # The movie - episode: Episode - - # The number of stars this review gave, 1-5 - stars: Int! - - # Comment about the movie - commentary: String -} - -# The input object sent when someone is creating a new review -input ReviewInput { - # 0-5 stars - stars: Int! - - # Comment about the movie, optional - commentary: String - - # Favorite color, optional - favorite_color: ColorInput -} - -# The input object sent when passing in a color -input ColorInput { - red: Int! - green: Int! - blue: Int! -} - -type Starship { - # The ID of the starship - id: ID! - - # The name of the starship - name: String! - - # Length of the starship, along the longest axis - length(unit: LengthUnit = METER): Float - - coordinates: [[Float!]!] -} - -union SearchResult = Human | Droid | Starship diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/jwtcert/idp1.jks b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/jwtcert/idp1.jks deleted file mode 100644 index 8ce2101d89..0000000000 Binary files a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/jwtcert/idp1.jks and /dev/null differ diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api1.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api1.json deleted file mode 100644 index 2ab7363da8..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api1.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name":"SwaggerPetstore", - "version":"1.0.0", - "context":"/petstore", - "gatewayType":"wso2/apk", - "endpointConfig":{ - "endpoint_type":"http", - "sandbox_endpoints":{ - "url":"http://backend:80/anything" - }, - "production_endpoints": { - "url":"http://backend:80/anything" - } - }, - "policies": [ - "Gold", - "Unlimited" - ] -} \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_default_version.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_default_version.json deleted file mode 100644 index 6bb9d02d2b..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_default_version.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name":"SwaggerPetstore", - "version":"1.0.0", - "context":"/petstore", - "isDefaultVersion": true, - "gatewayType":"wso2/apk", - "endpointConfig":{ - "endpoint_type":"http", - "sandbox_endpoints":{ - "url":"http://backend:80/anything" - }, - "production_endpoints": { - "url":"http://backend:80/anything" - } - }, - "policies": [ - "Gold", - "Unlimited" - ] - } \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/original.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/original.json deleted file mode 100644 index 2fcabfca03..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/original.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "name": "ResourceLevelIntercepterAPI", - "context": "/rlintercepter", - "version": "1.0.0", - "provider": "admin", - "isDefaultVersion": false, - "type": "HTTP", - "audience": null, - "transport": ["http", "https"], - "tags": [], - "policies": ["Unlimited"], - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": ["oauth_basic_auth_api_key_mandatory", "oauth2"], - "additionalProperties": [ - { "name": "APIGroup", "value": "Gold", "display": false }, - { "name": "APITier", "value": "Unlimited", "display": false } - ], - "additionalPropertiesMap": { - "APIGroup": { "name": "APIGroup", "value": "Gold", "display": false }, - "APITier": { "name": "APITier", "value": "Unlimited", "display": false } - }, - "apiPolicies": { - "request": [], - "response": [], - "fault": [] - }, - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://backend.apk.svc.cluster.local" }, - "production_endpoints": { "url": "http://backend.apk.svc.cluster.local" } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/headers", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/get", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_and_response.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_and_response.json deleted file mode 100644 index 251eb72f69..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_and_response.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "name": "ReqandResIntercepterServiceAPI", - "context": "/intercepter", - "version": "1.0.0", - "provider": "admin", - "isDefaultVersion": false, - "type": "HTTP", - "audience": null, - "transport": ["http", "https"], - "tags": [], - "policies": ["Unlimited"], - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": ["oauth_basic_auth_api_key_mandatory", "oauth2"], - "apiPolicies": { - "request": [ - { - "policyName": "ccCallInterceptorService", - "policyVersion": "v1", - "parameters": { - "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", - "includes": "request_header,request_body" - } - } - ], - "response": [ - { - "policyName": "ccCallInterceptorService", - "policyVersion": "v1", - "parameters": { - "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", - "includes": "response_header,response_body" - } - } - ], - "fault": [] - }, - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://backend.apk.svc.cluster.local" }, - "production_endpoints": { "url": "http://backend.apk.svc.cluster.local" } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/*", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "PUT", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "POST", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "DELETE", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "PATCH", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/get", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" - } - \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor.json deleted file mode 100644 index 23ef0b8843..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "name": "IntercepterServiceAPI", - "context": "/intercepter", - "version": "1.0.0", - "provider": "admin", - "isDefaultVersion": false, - "type": "HTTP", - "audience": null, - "transport": ["http", "https"], - "tags": [], - "policies": ["Unlimited"], - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": ["oauth_basic_auth_api_key_mandatory", "oauth2"], - "apiPolicies": { - "request": [ - { - "policyName": "ccCallInterceptorService", - "policyVersion": "v1", - "parameters": { - "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", - "includes": "request_header,request_body" - } - } - ], - "response": [], - "fault": [] - }, - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://backend.apk.svc.cluster.local" }, - "production_endpoints": { "url": "http://backend.apk.svc.cluster.local" } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/*", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "PUT", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "POST", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "DELETE", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "PATCH", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/get", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor_param_variation.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor_param_variation.json deleted file mode 100644 index 50f92df083..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor_param_variation.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "name": "ParamVarIntercepterServiceAPI", - "context": "/intercepter", - "version": "1.0.0", - "provider": "admin", - "isDefaultVersion": false, - "type": "HTTP", - "audience": null, - "transport": ["http", "https"], - "tags": [], - "policies": ["Unlimited"], - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": ["oauth_basic_auth_api_key_mandatory", "oauth2"], - "apiPolicies": { - "request": [ - { - "policyName": "ccCallInterceptorService", - "policyVersion": "v1", - "parameters": { - "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", - "includes": "request_header,request_body,response_header,response_body" - } - } - ], - "response": [ - { - "policyName": "ccCallInterceptorService", - "policyVersion": "v1", - "parameters": { - "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", - "includes": "response_header,response_body" - } - } - ], - "fault": [] - }, - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://backend.apk.svc.cluster.local" }, - "production_endpoints": { "url": "http://backend.apk.svc.cluster.local" } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/*", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/get", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "PUT", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "POST", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "DELETE", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/*", - "verb": "PATCH", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" - } - \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/resource_level_interceptor.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/resource_level_interceptor.json deleted file mode 100644 index da8190b514..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/resource_level_interceptor.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "name": "ResourceLevelIntercepterAPI", - "context": "/rlintercepter", - "version": "1.0.0", - "provider": "admin", - "isDefaultVersion": false, - "type": "HTTP", - "audience": null, - "transport": ["http", "https"], - "tags": [], - "policies": ["Unlimited"], - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": ["oauth_basic_auth_api_key_mandatory", "oauth2"], - "additionalProperties": [ - { "name": "APIGroup", "value": "Gold", "display": false }, - { "name": "APITier", "value": "Unlimited", "display": false } - ], - "additionalPropertiesMap": { - "APIGroup": { "name": "APIGroup", "value": "Gold", "display": false }, - "APITier": { "name": "APITier", "value": "Unlimited", "display": false } - }, - "apiPolicies": { - "request": [], - "response": [], - "fault": [] - }, - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://backend.apk.svc.cluster.local" }, - "production_endpoints": { "url": "http://backend.apk.svc.cluster.local" } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/headers", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [ - { - "policyName": "ccCallInterceptorService", - "policyVersion": "v1", - "parameters": { - "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", - "includes": "request_header,request_body" - } - } - ], - "response": [ - { - "policyName": "ccCallInterceptorService", - "policyVersion": "v1", - "parameters": { - "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", - "includes": "response_header,response_body" - } - } - ], - "fault": [] - } - }, - { - "id": "", - "target": "/get", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" - } - \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/response_interceptor.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/response_interceptor.json deleted file mode 100644 index 780b66f4b5..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/response_interceptor.json +++ /dev/null @@ -1,188 +0,0 @@ -{ - "name": "ResponseIntercepterServiceAPI", - "description": null, - "context": "/interceptor", - "version": "1.0.0", - "provider": "admin", - "type": "HTTP", - "audience": null, - "transport": [ - "http", - "https" - ], - "tags": [], - "policies": [ - "Unlimited" - ], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "oauth_basic_auth_api_key_mandatory", - "oauth2" - ], - "apiPolicies": { - "request": [], - "response": [ - { - "policyName": "ccCallInterceptorService", - "policyVersion": "v1", - "parameters": { - "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", - "includes": "response_header,response_body" - } - } - ], - "fault": [] - }, - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": [ - "*" - ], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { - "url": "http://backend.apk.svc.cluster.local" - }, - "production_endpoints": { - "url": "http://backend.apk.svc.cluster.local" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/*", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/*", - "verb": "PUT", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/*", - "verb": "POST", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/*", - "verb": "DELETE", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/*", - "verb": "PATCH", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/get", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_with_basic_auth.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_with_basic_auth.json deleted file mode 100644 index b96664d784..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/api_with_basic_auth.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "SwaggerPetstore", - "context": "/petstore", - "version": "1.0.0", - "provider": "admin", - "type": "HTTP", - "transport": [ - "http", - "https" - ], - "tags": [], - "policies": [ - "Unlimited" - ], - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "oauth_basic_auth_api_key_mandatory", - "oauth2" - ], - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { - "url": "http://backend:80/anything" - }, - "production_endpoints": { - "url": "http://backend:80/anything" - }, - "endpoint_security": { - "production": { - "enabled": true, - "type": "BASIC", - "username": "admin", - "password": "admin", - "grantType": "", - "tokenUrl": "", - "clientId": null, - "clientSecret": null, - "customParameters": {} - }, - "sandbox": { - "enabled": false, - "type": "NONE", - "username": "", - "password": null, - "grantType": "", - "tokenUrl": "", - "clientId": null, - "clientSecret": null, - "customParameters": {} - } - } - }, - "gatewayVendor": "wso2", - "gatewayType":"wso2/apk" -} \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/cors_api.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/cors_api.json deleted file mode 100644 index 83ce720af3..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/cors_api.json +++ /dev/null @@ -1,59 +0,0 @@ - { - "name": "test-cors", - "context": "/test_cors", - "version": "2.0.0", - "type": "HTTP", - "gatewayType":"wso2/apk", - "transport": [ - "http", - "https" - ], - "policies": [ - "Unlimited", - "Gold" - ], - "corsConfiguration": { - "corsConfigurationEnabled": true, - "accessControlAllowOrigins": [ - "abc.com" - ], - "accessControlAllowCredentials": true, - "accessControlAllowHeaders": [ - "authorization", - "Content-Type" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { - "url": "https://httpbin.org" - }, - "production_endpoints": { - "url": "https://httpbin.org" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/anything", - "verb": "GET", - "authType": "Application \u0026 Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - } - ] -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gqlPayload.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gqlPayload.json deleted file mode 100644 index fb0a8d7e3c..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gqlPayload.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "name": "StarwarsAPI", - "version": "3.14", - "context": "/graphql", - "gatewayType":"wso2/apk", - "policies": ["Unlimited"], - "operations": [ - { - "id": "0", - "target": "hero", - "verb": "QUERY", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - }, - { - "id": "1", - "target": "reviews", - "verb": "QUERY", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - }, - { - "id": "2", - "target": "search", - "verb": "QUERY", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - }, - { - "id": "3", - "target": "character", - "verb": "QUERY", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - }, - { - "id": "4", - "target": "droid", - "verb": "QUERY", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - }, - { - "id": "5", - "target": "human", - "verb": "QUERY", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - }, - { - "id": "6", - "target": "allHumans", - "verb": "QUERY", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - }, - { - "id": "7", - "target": "allDroids", - "verb": "QUERY", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - }, - { - "id": "8", - "target": "allCharacters", - "verb": "QUERY", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - }, - { - "id": "9", - "target": "starship", - "verb": "QUERY", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - }, - { - "id": "10", - "target": "createReview", - "verb": "MUTATION", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - }, - { - "id": "11", - "target": "reviewAdded", - "verb": "SUBSCRIPTION", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - } - ], - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://graphql-faker-service:9002/graphql" }, - "production_endpoints": { "url": "http://graphql-faker-service:9002/graphql" } - } -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_api_level_rl.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_api_level_rl.json deleted file mode 100644 index 2336b86953..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_api_level_rl.json +++ /dev/null @@ -1,225 +0,0 @@ -{ - "name": "StarwarsAPI", - "context": "/graphql", - "version": "3.14", - "type": "GRAPHQL", - "transport": ["http", "https"], - "tags": [], - "policies": ["Unlimited"], - "apiThrottlingPolicy": "TestRatelimit", - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": ["oauth_basic_auth_api_key_mandatory", "oauth2"], - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://graphql-faker-service:9002/graphql" }, - "production_endpoints": { - "url": "http://graphql-faker-service:9002/graphql" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "allCharacters", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "allDroids", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "allHumans", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "character", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "createReview", - "verb": "MUTATION", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "droid", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "hero", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "human", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "reviewAdded", - "verb": "SUBSCRIPTION", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "reviews", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "search", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "starship", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_cors.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_cors.json deleted file mode 100644 index 8da95be276..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_cors.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "StarWarsAPI", - "context": "/test_cors", - "version": "2.0.0", - "provider": "admin", - "type": "GRAPHQL", - "audience": null, - "gatewayType":"wso2/apk", - "transport": [ - "http", - "https" - ], - "tags": [], - "policies": [ - "Unlimited" - ], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "oauth_basic_auth_api_key_mandatory", - "oauth2" - ], - "corsConfiguration": { - "corsConfigurationEnabled": true, - "accessControlAllowOrigins": [ - "abc.com" - ], - "accessControlAllowCredentials": true, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { - "url": "http://backend:80/anything" - }, - "production_endpoints": { - "url": "http://backend:80/anything" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "anything", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - } - ] -} \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_default_version.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_default_version.json deleted file mode 100644 index 116c5b2e0e..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_default_version.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "StarwarsAPI", - "version": "3.14", - "context": "/graphql", - "gatewayType":"wso2/apk", - "policies": ["Unlimited"], - "isDefaultVersion": true, - "operations": [ - { - "id": "0", - "target": "hero", - "verb": "QUERY", - "authType": "Any", - "throttlingPolicy": null, - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": null - } - ], - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://graphql-faker-service:9002/graphql" }, - "production_endpoints": { "url": "http://graphql-faker-service:9002/graphql" } - } - } - \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_resource_level_rl.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_resource_level_rl.json deleted file mode 100644 index 65ba137ee1..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_resource_level_rl.json +++ /dev/null @@ -1,287 +0,0 @@ -{ - "name": "StarwarsAPI", - "context": "/graphql", - "version": "3.14", - "provider": "admin", - "type": "GRAPHQL", - "audience": null, - "transport": [ - "http", - "https" - ], - "tags": [], - "policies": [ - "Unlimited" - ], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "oauth_basic_auth_api_key_mandatory", - "oauth2" - ], - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": [ - "*" - ], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { - "url": "http://graphql-faker-service:9002/graphql" - }, - "production_endpoints": { - "url": "http://graphql-faker-service:9002/graphql" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "allCharacters", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "allDroids", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "allHumans", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "character", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "createReview", - "verb": "MUTATION", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "droid", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "hero", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "TestRatelimit", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "human", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "reviewAdded", - "verb": "SUBSCRIPTION", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "reviews", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "search", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "starship", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_with_basic_auth.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_with_basic_auth.json deleted file mode 100644 index f177625c62..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_with_basic_auth.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "StarWarsAPI", - "context": "/gql_basic_auth", - "version": "2.0.0", - "type": "GRAPHQL", - "transport": [ - "http", - "https" - ], - "tags": [], - "policies": [ - "Unlimited" - ], - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "oauth_basic_auth_api_key_mandatory", - "oauth2" - ], - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": [ - "*" - ], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { - "url": "http://backend:80/anything" - }, - "production_endpoints": { - "url": "http://backend:80/anything" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "hero", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_with_basic_auth2.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_with_basic_auth2.json deleted file mode 100644 index a1d376bff5..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_with_basic_auth2.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "name": "StarWarsAPI", - "context": "/gql_basic_auth", - "version": "2.0.0", - "type": "GRAPHQL", - "transport": [ - "http", - "https" - ], - "tags": [], - "policies": [ - "Unlimited" - ], - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "oauth_basic_auth_api_key_mandatory", - "oauth2" - ], - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": [ - "*" - ], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "endpoint_security": { - "production": { - "enabled": true, - "type": "BASIC", - "username": "admin", - "password": "admin", - "grantType": "", - "tokenUrl": "", - "clientId": null, - "clientSecret": null, - "customParameters": {} - }, - "sandbox": { - "enabled": false, - "type": "NONE", - "username": "", - "password": null, - "grantType": "", - "tokenUrl": "", - "clientId": null, - "clientSecret": null, - "customParameters": {} - } - }, - "sandbox_endpoints": { - "url": "http://backend:80/anything" - }, - "production_endpoints": { - "url": "http://backend:80/anything" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "hero", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_with_scopes.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_with_scopes.json deleted file mode 100644 index e8f889ede7..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/gql_with_scopes.json +++ /dev/null @@ -1,310 +0,0 @@ -{ - "name": "StarWarsAPI", - "context": "/graphql", - "version": "3.14", - "type": "GRAPHQL", - "transport": [ - "http", - "https" - ], - "tags": [], - "policies": [ - "Unlimited" - ], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "oauth_basic_auth_api_key_mandatory", - "oauth2" - ], - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": [ - "*" - ], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { - "url": "http://graphql-faker-service:9002/graphql" - }, - "production_endpoints": { - "url": "http://graphql-faker-service:9002/graphql" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [ - { - "scope": { - "id": null, - "name": "query:hero", - "displayName": "query:hero", - "description": "Query your favorite starwars hero", - "bindings": [], - "usageCount": null - }, - "shared": false - }, - { - "scope": { - "id": null, - "name": "query:human", - "displayName": "query:human", - "description": "Query the human characters featured in startwars", - "bindings": [], - "usageCount": null - }, - "shared": false - } - ], - "operations": [ - { - "id": "", - "target": "allCharacters", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "allDroids", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "allHumans", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "character", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "createReview", - "verb": "MUTATION", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "droid", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "hero", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [ - "query:hero" - ], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "human", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "reviewAdded", - "verb": "SUBSCRIPTION", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "reviews", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "search", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "starship", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - } - ], - "gatewayVendor": "wso2", - "gatewayType":"wso2/apk" -} \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/graphql_with_mtls.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/graphql_with_mtls.json deleted file mode 100644 index a55da08f51..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/graphql_with_mtls.json +++ /dev/null @@ -1,232 +0,0 @@ -{ - "name": "GraphQLAPImTLS", - "context": "/graphql", - "version": "3.14", - "provider": "admin", - "type": "GRAPHQL", - "audience": null, - "transport": ["https"], - "tags": [], - "policies": ["Unlimited"], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "oauth2", - "oauth_basic_auth_api_key_mandatory", - "mutualssl", - "mutualssl_mandatory" - ], - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowCredentials": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://graphql-faker-service:9002/graphql" }, - "production_endpoints": { - "url": "http://graphql-faker-service:9002/graphql" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "hero", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "reviews", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "search", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "character", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "droid", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "human", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "allHumans", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "allDroids", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "allCharacters", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "starship", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "createReview", - "verb": "MUTATION", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "reviewAdded", - "verb": "SUBSCRIPTION", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/graphql_with_mtls_optional_oauth2_mandatory.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/graphql_with_mtls_optional_oauth2_mandatory.json deleted file mode 100644 index 3978ad7315..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/graphql_with_mtls_optional_oauth2_mandatory.json +++ /dev/null @@ -1,233 +0,0 @@ -{ - "name": "GraphQLAPImTLS", - "context": "/graphql", - "version": "3.14", - "provider": "admin", - "type": "GRAPHQL", - "audience": null, - "transport": ["https"], - "tags": [], - "policies": ["Unlimited"], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "oauth2", - "oauth_basic_auth_api_key_mandatory", - "mutualssl", - "mutualssl_optional" - ], - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowCredentials": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://graphql-faker-service:9002/graphql" }, - "production_endpoints": { - "url": "http://graphql-faker-service:9002/graphql" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "hero", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "reviews", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "search", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "character", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "droid", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "human", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "allHumans", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "allDroids", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "allCharacters", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "starship", - "verb": "QUERY", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "createReview", - "verb": "MUTATION", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "reviewAdded", - "verb": "SUBSCRIPTION", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" - } - \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_mandatory_oauth2_disabled.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_mandatory_oauth2_disabled.json deleted file mode 100644 index 168f7f266b..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_mandatory_oauth2_disabled.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "name": "EmployeeServiceAPI", - "context": "/mtls", - "version": "3.14", - "provider": "admin", - "type": "HTTP", - "transport": ["https"], - "tags": [], - "policies": ["Unlimited"], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "mutualssl", - "mutualssl_mandatory" - ], - "apiPolicies": { - "request": [], - "response": [], - "fault": [] - }, - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowCredentials": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://backend:80/anything" }, - "production_endpoints": { "url": "http://backend:80/anything" } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/employee", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee/{employeeId}", - "verb": "PUT", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee", - "verb": "POST", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee{employeeId}", - "verb": "DELETE", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_mandatory_oauth2_enabled.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_mandatory_oauth2_enabled.json deleted file mode 100644 index 34ef106f5f..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_mandatory_oauth2_enabled.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "name": "EmployeeServiceAPI", - "context": "/mtls", - "version": "3.14", - "provider": "admin", - "type": "HTTP", - "transport": ["https"], - "tags": [], - "policies": ["Unlimited"], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "oauth2", - "oauth_basic_auth_api_key_mandatory", - "mutualssl", - "mutualssl_mandatory" - ], - "apiPolicies": { - "request": [], - "response": [], - "fault": [] - }, - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowCredentials": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://backend:80/anything" }, - "production_endpoints": { "url": "http://backend:80/anything" } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/employee", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee/{employeeId}", - "verb": "PUT", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee", - "verb": "POST", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee{employeeId}", - "verb": "DELETE", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_mandatory_oauth2_optional.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_mandatory_oauth2_optional.json deleted file mode 100644 index 8f019ab357..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_mandatory_oauth2_optional.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "name": "EmployeeServiceAPI", - "context": "/mtls", - "version": "3.14", - "provider": "admin", - "type": "HTTP", - "transport": ["https"], - "tags": [], - "policies": ["Unlimited"], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "mutualssl", - "oauth2", - "oauth_basic_auth_api_key_optional", - "mutualssl_mandatory" - ], - "apiPolicies": { - "request": [], - "response": [], - "fault": [] - }, - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowCredentials": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://backend:80/anything" }, - "production_endpoints": { "url": "http://backend:80/anything" } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/employee", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee/{employeeId}", - "verb": "PUT", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee", - "verb": "POST", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee{employeeId}", - "verb": "DELETE", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" - } - \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_optional_oauth2_mandatory.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_optional_oauth2_mandatory.json deleted file mode 100644 index 9d4a0582e5..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_optional_oauth2_mandatory.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "name": "EmployeeServiceAPI", - "context": "/mtls", - "version": "3.14", - "provider": "admin", - "type": "HTTP", - "transport": ["https"], - "tags": [], - "policies": ["Unlimited"], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "mutualssl", - "oauth2", - "mutualssl_optional", - "oauth_basic_auth_api_key_mandatory" - ], - "apiPolicies": { - "request": [], - "response": [], - "fault": [] - }, - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowCredentials": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://backend:80/anything" }, - "production_endpoints": { "url": "http://backend:80/anything" } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/employee", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee/{employeeId}", - "verb": "PUT", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee", - "verb": "POST", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee{employeeId}", - "verb": "DELETE", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_optional_oauth2_optional.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_optional_oauth2_optional.json deleted file mode 100644 index f3601ab626..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/mtls/mtls_optional_oauth2_optional.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "name": "EmployeeServiceAPI", - "context": "/mtls", - "version": "3.14", - "provider": "admin", - "type": "HTTP", - "transport": ["https"], - "tags": [], - "policies": ["Unlimited"], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "mutualssl", - "oauth2", - "oauth_basic_auth_api_key_optional", - "mutualssl_optional" - ], - "apiPolicies": { - "request": [], - "response": [], - "fault": [] - }, - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowCredentials": false, - "accessControlAllowOrigins": ["*"], - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { "url": "http://backend:80/anything" }, - "production_endpoints": { "url": "http://backend:80/anything" } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/employee", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee/{employeeId}", - "verb": "PUT", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee", - "verb": "POST", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - }, - { - "id": "", - "target": "/employee{employeeId}", - "verb": "DELETE", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { "request": [], "response": [], "fault": [] } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" - } - \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/ratelimit_api.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/ratelimit_api.json deleted file mode 100644 index 0700cdd603..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/ratelimit_api.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "name": "SimpleRateLimitAPI", - "context": "/simple-rl", - "version": "3.14", - "type": "HTTP", - "transport": [ - "http", - "https" - ], - "policies": [ - "Gold", - "Unlimited" - ], - "apiThrottlingPolicy": "TestRatelimit", - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { - "url": "http://backend:80/anything" - }, - "production_endpoints": { - "url": "http://backend:80/anything" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/employee", - "verb": "GET", - "authType": "Application \u0026 Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/employee", - "verb": "POST", - "authType": "Application \u0026 Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/employee/{employeeId}", - "verb": "PUT", - "authType": "Application \u0026 Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/employee/{employeeId}", - "verb": "DELETE", - "authType": "Application \u0026 Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - } - ], - "gatewayType":"wso2/apk" -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/ratelimit_api2.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/ratelimit_api2.json deleted file mode 100644 index b8365fe4ec..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/ratelimit_api2.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "name": "SimpleRateLimitResourceLevelAPI", - "context": "/simple-rl-r", - "version": "3.14", - "type": "HTTP", - "transport": [ - "http", - "https" - ], - "policies": [ - "Unlimited", - "Gold" - ], - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { - "url": "http://backend:80/anything" - }, - "production_endpoints": { - "url": "http://backend:80/anything" - } - }, - "endpointImplementationType": "ENDPOINT", - "scopes": [], - "operations": [ - { - "id": "", - "target": "/employee", - "verb": "GET", - "authType": "Application \u0026 Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/employee", - "verb": "POST", - "authType": "Application \u0026 Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/employee/{employeeId}", - "verb": "PUT", - "authType": "Application \u0026 Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/employee/{employeeId}", - "verb": "DELETE", - "authType": "Application \u0026 Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - } - ], - "gatewayType":"wso2/apk" -} diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/resource_level_rl.json b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/resource_level_rl.json deleted file mode 100644 index 44f291e672..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/artifacts/payloads/resource_level_rl.json +++ /dev/null @@ -1,151 +0,0 @@ -{ - "name": "SimpleRateLimitResourceLevelAPI", - "context": "/simple-rl-r", - "version": "3.14", - "type": "HTTP", - "transport": [ - "http", - "https" - ], - "tags": [], - "policies": [ - "Unlimited" - ], - "apiThrottlingPolicy": null, - "authorizationHeader": "Authorization", - "apiKeyHeader": "ApiKey", - "securityScheme": [ - "oauth_basic_auth_api_key_mandatory", - "oauth2" - ], - "corsConfiguration": { - "corsConfigurationEnabled": false, - "accessControlAllowOrigins": [ - "*" - ], - "accessControlAllowCredentials": false, - "accessControlAllowHeaders": [ - "authorization", - "Access-Control-Allow-Origin", - "Content-Type", - "SOAPAction" - ], - "accessControlAllowMethods": [ - "GET", - "PUT", - "POST", - "DELETE", - "PATCH", - "OPTIONS" - ] - }, - "endpointConfig": { - "endpoint_type": "http", - "sandbox_endpoints": { - "url": "http://backend:80/anything" - }, - "production_endpoints": { - "url": "http://backend:80/anything" - } - }, - "endpointImplementationType": "ENDPOINT", - "operations": [ - { - "id": "", - "target": "/employee", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "TestRatelimit", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/withoutrl", - "verb": "GET", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/employee", - "verb": "POST", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/employee/{employeeId}", - "verb": "PUT", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - }, - { - "id": "", - "target": "/employee/{employeeId}", - "verb": "DELETE", - "authType": "Application & Application User", - "throttlingPolicy": "Unlimited", - "scopes": [], - "usedProductIds": [], - "amznResourceName": null, - "amznResourceTimeout": null, - "amznResourceContentEncode": null, - "payloadSchema": null, - "uriMapping": null, - "operationPolicies": { - "request": [], - "response": [], - "fault": [] - } - } - ], - "gatewayVendor": "wso2", - "gatewayType": "wso2/apk" -} \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/testng.xml b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/testng.xml deleted file mode 100644 index 959bf28869..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/testng.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/APILevelInterceptor.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/APILevelInterceptor.feature deleted file mode 100644 index 28f98f84cf..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/APILevelInterceptor.feature +++ /dev/null @@ -1,200 +0,0 @@ -Feature: API Policy Addition(Interceptor Service) - Background: - Given The system is ready - Scenario: Create a REST API and add policy for request flow over API Level - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api_policy/request_interceptor.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "IntercepterServiceAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/intercepter/1.0.0/get" with body "" - And I eventually receive 200 response code, not accepting - |429| - And the response body should contain "\"Interceptor-Header\": \"Interceptor-header-value\"" - - Scenario: Undeploying the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "IntercepterServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/interceptor/1.0.0/get" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Create a REST API and add policy for response flow over API Level - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api_policy/response_interceptor.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "IntercepterServiceAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/interceptor/1.0.0/get" with body "" - Then the response status code should be 200 - Then the response headers contains key "interceptor-response-header" and value "Interceptor-Response-header-value" - - Scenario: Undeploying the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "ResponseIntercepterServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/interceptor/1.0.0/get" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Create a REST API and add policy for request and response flow over API Level - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api_policy/request_and_response.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "ReqandResIntercepterServiceAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/intercepter/1.0.0/get" with body "" - Then the response status code should be 200 - And the response body should contain "\"Interceptor-Header\": \"Interceptor-header-value\"" - Then the response headers contains key "interceptor-response-header" and value "Interceptor-Response-header-value" - - Scenario: Undeploying the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "ReqandResIntercepterServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/interceptor/1.0.0/get" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Create a REST API and add interceptor with parameter variation - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api_policy/request_interceptor_param_variation.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "ParamVarIntercepterServiceAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/intercepter/1.0.0/get" with body "" - Then the response status code should be 200 - And the response body should contain "\"Interceptor-Header\": \"Interceptor-header-value\"" - - Scenario: Undeploying the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "ParamVarIntercepterServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/interceptor/1.0.0/get" with body "" - And I eventually receive 404 response code, not accepting - |200| \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/APIVersion.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/APIVersion.feature deleted file mode 100644 index d02944f058..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/APIVersion.feature +++ /dev/null @@ -1,138 +0,0 @@ -Feature: Creating new versions of the APIs - Background: - Given The system is ready - Scenario: Create a new version of a REST API and try to invoke both old and newer versions - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api1.json" - And I use the OAS URL "https://petstore3.swagger.io/api/v3/openapi.json" - And make the import API Creation request using OAS "URL" - Then the response status code should be 201 - And the response body should contain "SwaggerPetstore" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And I eventually receive 200 response code, not accepting - |429| - And I create the new version "2.0.0" of the same API with default version set to "false" - Then the response status code should be 201 - And the response body should contain "SwaggerPetstore" - And the response body should contain "2.0.0" - And make the API Revision Deployment request - Then the response status code should be 201 - And make the Change Lifecycle request - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/2.0.0/pet/4" with body "" - And I eventually receive 200 response code, not accepting - |429| - - Scenario: Undeploy the created REST APIs - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "1.0.0" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And the response status code should be 404 - Then I find the apiUUID of the API created with the name "2.0.0" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/2.0.0/pet/4" with body "" - And the response status code should be 404 - - - Scenario: Create a new version of a GraphQL API and try to invoke both old and newer versions - And I have a DCR application - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - When I use the Payload file "artifacts/payloads/gql_with_scopes.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - And the response body should contain "StarWarsAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "TestApp" - Then the response status code should be 201 - And the response body should contain "TestApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 200 - And I eventually receive 200 response code, not accepting - | 404 | - | 401 | - And I create the new version "3.2" of the same API with default version set to "true" - Then the response status code should be 201 - And the response body should contain "StarWarsAPI" - And the response body should contain "3.2" - And make the API Revision Deployment request - Then the response status code should be 201 - And make the Change Lifecycle request - Then the response status code should be 200 - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.2" with body "{\"query\":\"{ hero { name } }\"}" - And I eventually receive 200 response code, not accepting - |429| - - Scenario: Undeploying the created GraphQL APIs - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "TestApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "3.14" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - And I eventually receive 404 response code, not accepting - |200| - Then I find the apiUUID of the API created with the name "3.2" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.2" with body "{\"query\":\"{ hero { name } }\"}" - And I eventually receive 404 response code, not accepting - |200| \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/BackendSecurity.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/BackendSecurity.feature deleted file mode 100644 index a334781a37..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/BackendSecurity.feature +++ /dev/null @@ -1,104 +0,0 @@ -Feature: Backend Security for APIs - Background: - Given The system is ready - Scenario: Enable basic auth for endpoint and verfy the authorization for REST API - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api_with_basic_auth.json" - And I use the OAS URL "https://petstore3.swagger.io/api/v3/openapi.json" - And make the import API Creation request using OAS "URL" - Then the response status code should be 201 - And the response body should contain "SwaggerPetstore" - And make the API Revision Deployment request - Then the response status code should be 201 - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - Then I wait for 40 seconds - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/5" with body "" - Then the response status code should be 200 - # And the response body should contain "\"Authorization\": \"Basic YWRtaW46YWRtaW4=\"" - - Scenario: Undeploying an already existing REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "SwaggerPetstore" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/basic-auth/3.14/employee/" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Enable basic auth for endpoint and verfy the authorization for a GraphQL API - And I have a DCR application - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - When I use the Payload file "artifacts/payloads/gql_with_basic_auth.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - And the response body should contain "StarWarsAPI" - Then I use the Payload file "artifacts/payloads/gql_with_basic_auth2.json" - And I update the API settings - Then the response status code should be 200 - And the response body should contain "StarWarsAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "TestApp" - Then the response status code should be 201 - And the response body should contain "TestApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "POST" request to "https://default.gw.wso2.com:9095/gql_basic_auth/2.0.0/" with body "{\"query\":\"{ hero { id } }\"}" - Then the response status code should be 200 - # And the response body should contain "\"Authorization\": \"Basic YWRtaW46YWRtaW4=\"" - - Scenario: Undeploying an already existing GraphQL API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "TestApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "StarWarsAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "POST" request to "https://default.gw.wso2.com:9095/gql_basic_auth/2.0.0/" with body "{\"query\":\"{ hero { id } }\"}" - And I eventually receive 404 response code, not accepting - |200| \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/BackendSupport.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/BackendSupport.feature deleted file mode 100644 index d481aa2694..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/BackendSupport.feature +++ /dev/null @@ -1,118 +0,0 @@ -Feature: Backend Support for APIs - Background: - Given The system is ready - Scenario: Make endpoint alterations in the REST API deployment and verfy the functionality - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api1.json" - And I use the OAS URL "https://petstore3.swagger.io/api/v3/openapi.json" - And make the import API Creation request using OAS "URL" - Then the response status code should be 201 - And the response body should contain "SwaggerPetstore" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/5" with body "" - Then the response status code should be 200 - Then I remove the header "Authorization" - And I get "sandbox" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "sandbox" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://sandbox.default.gw.wso2.com:9095/petstore/1.0.0/pet/5" with body "" - Then the response status code should be 200 - - Scenario: Undeploying an already existing REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "SwaggerPetstore" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://sandbox.default.gw.wso2.com:9095/petstore/1.0.0/pet/5" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Make endpoint alterations in the GRaphQL API deployment and verfy the functionality - And I have a DCR application - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - When I use the Payload file "artifacts/payloads/gqlPayload.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - And the response body should contain "StarwarsAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "TestApp" - Then the response status code should be 201 - And the response body should contain "TestApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 200 - Then I remove the header "Authorization" - And I get "sandbox" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "sandbox" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "POST" request to "https://sandbox.default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 200 - - Scenario: Undeploying an already existing GraphQL API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "TestApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "StarwarsAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "POST" request to "https://sandbox.default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - And I eventually receive 404 response code, not accepting - |200| \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/CORS.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/CORS.feature deleted file mode 100644 index 7035855d37..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/CORS.feature +++ /dev/null @@ -1,174 +0,0 @@ -Feature: CORS Policy handling - Background: - Given The system is ready - Scenario: Testing CORS Policy for a REST API - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/cors_api.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "test-cors" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "OPTIONS" request to "https://default.gw.wso2.com:9095/test_cors/2.0.0/anything/" with body "" - And I eventually receive 204 response code, not accepting - | 429 | - And the response headers should not contain - | Access-Control-Allow-Origin | - | Access-Control-Allow-Credentials | - | Access-Control-Allow-Methods | - | Access-Control-Allow-Headers | - | Access-Control-Max-Age | - Then I set headers - | Origin | test.domain.com | - And I send "OPTIONS" request to "https://default.gw.wso2.com:9095/test_cors/2.0.0/anything/" with body "" - And I eventually receive 204 response code, not accepting - | 429 | - And the response headers should not contain - | Access-Control-Allow-Origin | - | Access-Control-Allow-Credentials | - | Access-Control-Allow-Methods | - | Access-Control-Allow-Headers | - | Access-Control-Max-Age | - Then I set headers - | Origin | abc.com | - And I send "OPTIONS" request to "https://default.gw.wso2.com:9095/test_cors/2.0.0/anything/" with body "" - And I eventually receive 204 response code, not accepting - | 429 | - And the response headers should contain - | Access-Control-Allow-Origin | abc.com | - | Access-Control-Allow-Credentials | true | - Then I set headers - | Origin | abc.com | - | Access-Control-Request-Method | GET | - And I send "OPTIONS" request to "https://default.gw.wso2.com:9095/test_cors/2.0.0/anything/" with body "" - And I eventually receive 200 response code, not accepting - | 429 | - And the response headers should contain - | Access-Control-Allow-Origin | abc.com | - | Access-Control-Allow-Credentials | true | - | Access-Control-Allow-Methods | GET, PUT, POST, DELETE | - | Access-Control-Allow-Headers | authorization, Content-Type | - - Scenario: Undeploying an already existing REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "cors" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/test_cors/2.0.0/anything/" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Testing CORS Policy for a GraphQL API - And I have a DCR application - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - When I use the Payload file "artifacts/payloads/gql_cors.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - And the response body should contain "StarWarsAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "TestApp" - Then the response status code should be 201 - And the response body should contain "TestApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "OPTIONS" request to "https://default.gw.wso2.com:9095/test_cors/2.0.0/" with body "{\"query\":\"{ anything }\"}" - And I eventually receive 204 response code, not accepting - | 429 | - And the response headers should not contain - | Access-Control-Allow-Origin | - | Access-Control-Allow-Credentials | - | Access-Control-Allow-Methods | - | Access-Control-Allow-Headers | - | Access-Control-Max-Age | - Then I set headers - | Origin | test.domain.com | - And I send "OPTIONS" request to "https://default.gw.wso2.com:9095/test_cors/2.0.0/" with body "{\"query\":\"{ anything }\"}" - And I eventually receive 204 response code, not accepting - | 429 | - And the response headers should not contain - | Access-Control-Allow-Origin | - | Access-Control-Allow-Credentials | - | Access-Control-Allow-Methods | - | Access-Control-Allow-Headers | - | Access-Control-Max-Age | - Then I set headers - | Origin | abc.com | - And I send "OPTIONS" request to "https://default.gw.wso2.com:9095/test_cors/2.0.0/" with body "{\"query\":\"{ anything }\"}" - And I eventually receive 204 response code, not accepting - | 429 | - And the response headers should contain - | Access-Control-Allow-Origin | abc.com | - | Access-Control-Allow-Credentials | true | - Then I set headers - | Origin | abc.com | - | Access-Control-Request-Method | GET | - And I send "OPTIONS" request to "https://default.gw.wso2.com:9095/test_cors/2.0.0/" with body "{\"query\":\"{ anything }\"}" - And I eventually receive 200 response code, not accepting - | 429 | - And the response headers should contain - | Access-Control-Allow-Origin | abc.com | - | Access-Control-Allow-Credentials | true | - | Access-Control-Allow-Methods | GET, PUT, POST, DELETE | - | Access-Control-Allow-Headers | authorization, Access-Control-Allow-Origin | - - - - Scenario: Undeploying an already existing GraphQL API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "TestApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "StarWarsAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/test_cors/2.0.0/" with body "{\"query\":\"{ anything }\"}" - And I eventually receive 404 response code, not accepting - |200| \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/DefaultVersion.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/DefaultVersion.feature deleted file mode 100644 index c1c02514bb..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/DefaultVersion.feature +++ /dev/null @@ -1,110 +0,0 @@ -Feature: API Default Version - Background: - Given The system is ready - Scenario: Checking the default version property for the REST API - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api_default_version.json" - And I use the OAS URL "https://petstore3.swagger.io/api/v3/openapi.json" - And make the import API Creation request using OAS "URL" - Then the response status code should be 201 - And the response body should contain "SwaggerPetstore" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And I eventually receive 200 response code, not accepting - |429| - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/pet/4" with body "" - And I eventually receive 200 response code, not accepting - |429| - - Scenario: Undeploying an already existing REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "SwaggerPetstore" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Checking the default version property for the GraphQL API - And I have a DCR application - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - When I use the Payload file "artifacts/payloads/gql_default_version.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - Then I wait for 40 seconds - And the response body should contain "StarwarsAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "TestApp" - Then the response status code should be 201 - And the response body should contain "TestApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 200 - And I eventually receive 200 response code, not accepting - | 404 | - | 401 | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 200 - And I eventually receive 200 response code, not accepting - | 404 | - | 401 | - - Scenario: Undeploying an already existing GraphQL API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "TestApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "StarwarsAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - And I eventually receive 404 response code, not accepting - |200| \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/Deployment.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/Deployment.feature deleted file mode 100644 index 4ea911359a..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/Deployment.feature +++ /dev/null @@ -1,102 +0,0 @@ -Feature: API Deployment - Background: - Given The system is ready - Scenario: Import an API, Create Application, Generate Keys, Subscribe to an API - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api1.json" - And I use the OAS URL "https://petstore3.swagger.io/api/v3/openapi.json" - And make the import API Creation request using OAS "URL" - Then the response status code should be 201 - And the response body should contain "SwaggerPetstore" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And I eventually receive 200 response code, not accepting - |429| - - Scenario: Undeploying an already existing REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "SwaggerPetstore" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Deploying a GraphQL API - And I have a DCR application - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - When I use the Payload file "artifacts/payloads/gqlPayload.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - And the response body should contain "StarwarsAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "TestApp" - Then the response status code should be 201 - And the response body should contain "TestApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 200 - And I eventually receive 200 response code, not accepting - | 404 | - | 401 | - - Scenario: Undeploying an already existing GraphQL API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "TestApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "StarwarsAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - And I eventually receive 404 response code, not accepting - |200| \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/InternalKey.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/InternalKey.feature deleted file mode 100644 index 303df50805..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/InternalKey.feature +++ /dev/null @@ -1,67 +0,0 @@ -Feature: Testing the internal-key generation and invocation - Background: - Given The system is ready - Scenario: Creating and invoking a REST API using Internal-Key - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api1.json" - And I use the OAS URL "https://petstore3.swagger.io/api/v3/openapi.json" - And make the import API Creation request using OAS "URL" - Then the response status code should be 201 - And the response body should contain "SwaggerPetstore" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - Then I make an internal key generation request - Then the response status code should be 200 - And the response body should contain "apikey" - Then I set headers - | Internal-Key | ${internalKey} | - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And I eventually receive 200 response code, not accepting - |429| - - Scenario: Undeploying an already existing REST API - And I have a DCR application - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "SwaggerPetstore" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Testing Internal Key for GraphQL API - And I have a DCR application - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - When I use the Payload file "artifacts/payloads/gqlPayload.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - And the response body should contain "StarwarsAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - Then I make an internal key generation request - Then the response status code should be 200 - And the response body should contain "apikey" - Then I set headers - | Internal-Key | ${internalKey} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - And I eventually receive 200 response code, not accepting - | 404 | - | 401 | - - Scenario: Undeploying an already existing GraphQL API - And I have a DCR application - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "StarwarsAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - And I eventually receive 404 response code, not accepting - |200| diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/MTLSwithOAuth2Mandatory.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/MTLSwithOAuth2Mandatory.feature deleted file mode 100644 index 88724c180f..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/MTLSwithOAuth2Mandatory.feature +++ /dev/null @@ -1,457 +0,0 @@ -Feature: Test mTLS between client and gateway with client certificate sent in header - Background: - Given The system is ready - # mTLS mandatory OAuth2 mandatory - Scenario: Test mandatory mTLS and mandatory OAuth2 with a valid client certificate in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_mandatory_oauth2_enabled.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 200 response code, not accepting - | 401 | - | 403 | - | 429 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - - Scenario: Test mandatory mTLS and mandatory OAuth2 with a invalid client certificate in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_mandatory_oauth2_enabled.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "invalid-cert.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 500 - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - - Scenario: Test mandatory mTLS and mandatory OAuth2 without client certificate in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_mandatory_oauth2_enabled.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - - # mTLS optional OAuth2 mandatory - Scenario: Test optional mTLS and mandatory OAuth2 with a valid client certificate in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_mandatory_oauth2_enabled.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 200 response code, not accepting - | 401 | - | 403 | - | 429 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Test optional mTLS and mandatory OAuth2 without a token - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_optional_oauth2_mandatory.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - Then I set headers - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - - Scenario: Test optional mTLS and mandatory OAuth2 with an invalid token in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_optional_oauth2_mandatory.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I set "invlaidToken" as the new access token - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - # #TODO: ERROR Exists IN THE APK SIDE that NEED TO BE FIXED. Enable this test case after that - # Scenario: Test mandatory mTLS and disabled OAuth2 with a valid client certificate in header - # And I have a DCR application - # And I have a valid Publisher access token - # When I use the Payload file "artifacts/payloads/mtls/mtls_mandatory_oauth2_disabled.json" - # When the definition file "artifacts/definitions/cors-definition.json" - # And make the import API Creation request using OAS "File" - # Then the response status code should be 201 - # And the response body should contain "EmployeeServiceAPI" - # And I have a client certificate "config-map-1.crt" - # Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - # Then the response status code should be 201 - # And make the API Revision Deployment request - # Then the response status code should be 201 - # Then I wait for 40 seconds - # And make the Change Lifecycle request - # Then the response status code should be 200 - # Then I set headers - # | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - # And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - # And I eventually receive 200 response code, not accepting - # | 401 | - - # Scenario: Undeploy the created REST API - # And I have a DCR application - # And I have a valid Devportal access token - # Then I delete the application "SampleApp" from devportal - # Then the response status code should be 200 - # And I have a valid Publisher access token - # Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - # Then I undeploy the selected API - # Then the response status code should be 200 - # And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - # And I eventually receive 404 response code, not accepting - # |200| - - # Scenario: Test mandatory mTLS and disabled OAuth2 with an invalid client certificate in header - - Scenario: Test mandatory mTLS and disabled OAuth2 without a client certificate in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_mandatory_oauth2_disabled.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - # Multiple certificates test cases - Scenario: Test an API with mTLS enabled and one associated certificate with multiple certificates existing in system - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_mandatory_oauth2_enabled.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 200 response code, not accepting - | 401 | - And I have a client certificate "config-map-2.crt" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - And I have a client certificate "config-map-3.crt" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Test an API with mTLS enabled and multiple certificates configured - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_mandatory_oauth2_enabled.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-2.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap2" - Then the response status code should be 201 - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 200 response code, not accepting - | 401 | - And I have a client certificate "config-map-2.crt" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 200 response code, not accepting - | 401 | - And I have a client certificate "config-map-3.crt" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/MTLSwithOAuth2Optional.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/MTLSwithOAuth2Optional.feature deleted file mode 100644 index e8f1eae83d..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/MTLSwithOAuth2Optional.feature +++ /dev/null @@ -1,390 +0,0 @@ -Feature: Test mTLS between client and gateway with client certificate sent in header with OAuth2 optional - Background: - Given The system is ready - #mTLS mandatory OAuth2 optional - Scenario: Test mandatory mTLS and optional OAuth2 with a valid client certificate in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_mandatory_oauth2_optional.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 200 response code, not accepting - | 401 | - Then I remove the header "Authorization" - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 200 response code, not accepting - | 401 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Test mandatory mTLS and optional OAuth2 with an invalid client certificate in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_mandatory_oauth2_optional.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - And I have a client certificate "invalid-cert.crt" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - Then I remove the header "Authorization" - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - Then I remove the header "X-WSO2-CLIENT-CERTIFICATE" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - | 200 | - - Scenario: Test mandatory mTLS and optional OAuth2 without a client certificate in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_mandatory_oauth2_optional.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - # mTLS optional OAuth2 optional - Scenario: Test optional mTLS and optional OAuth2 with a valid token and then a valid client certificate in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_optional_oauth2_optional.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 200 response code, not accepting - | 401 | - Then I remove the header "Authorization" - Then I set headers - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I eventually receive 200 response code, not accepting - | 401 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Test optional mTLS and optional OAuth2 with an invalid client certificate and invalid token in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_optional_oauth2_optional.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - Then I set "invalidToken" as the new access token - And I have a client certificate "invalid-cert.crt" - Then I set headers - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Test optional mTLS and optional OAuth2 with an invalid client certificate and valid token in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_optional_oauth2_optional.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - And I have a client certificate "invalid-cert.crt" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - Then I remove the header "Authorization" - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - | 200 | - - Scenario: Test optional mTLS and optional OAuth2 with an invalid token in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_optional_oauth2_optional.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - Then I set "invalidToken" as the new access token - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy API - And I have a DCR application - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - | 200 | - - Scenario: Test optional mTLS and optional OAuth2 with no client certificate or token in header - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/mtls/mtls_optional_oauth2_optional.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "EmployeeServiceAPI" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee/" with body "" - And I eventually receive 401 response code, not accepting - | 200 | - - Scenario: Undeploy API - And I have a DCR application - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "EmployeeServiceAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - | 200 | \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/Ratelimit.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/Ratelimit.feature deleted file mode 100644 index 76dcf2075c..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/Ratelimit.feature +++ /dev/null @@ -1,284 +0,0 @@ -Feature: Testing Ratelimit feature - Background: - Given The system is ready - Scenario: Testing API level rate limiiting for REST API - And I have a DCR application - And I have a valid Adminportal access token - Then I set new API throttling policy allowing "2" requests per every "1" minute - Then the response status code should be 201 - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/ratelimit_api.json" - When the definition file "artifacts/definitions/employees_api.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "SimpleRateLimitAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl/3.14/employee/" with body "" - And I eventually receive 200 response code, not accepting - |429| - |401| - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl/3.14/employee/" with body "" - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl/3.14/employee/" with body "" - Then the response status code should be 429 - Then I wait for next minute strictly - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl/3.14/employee/" with body "" - Then the response status code should be 200 - - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "SimpleRateLimitAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl/3.14/employee/" with body "" - Then the response status code should be 404 - And I send "GET" request to "https://sandbox.default.gw.wso2.com:9095/simple-rl/3.14/employee/" with body "" - Then the response status code should be 404 - And I have a valid Adminportal access token - Then I delete the created API throttling policy - - Scenario: Testing Resource level rate limiiting for REST API - And I have a DCR application - And I have a valid Adminportal access token - Then I set new API throttling policy allowing "2" requests per every "1" minute - Then the response status code should be 201 - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/resource_level_rl.json" - When the definition file "artifacts/definitions/employee_with_rl_r.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "SimpleRateLimitResourceLevelAPI" - And the response body should contain "\"throttlingPolicy\":\"TestRatelimit\"" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "ResourceLevelApp" - Then the response status code should be 201 - And the response body should contain "ResourceLevelApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl-r/3.14/employee/" with body "" - And I eventually receive 200 response code, not accepting - |429| - |401| - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl-r/3.14/employee/" with body "" - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl-r/3.14/employee/" with body "" - Then the response status code should be 429 - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl-r/3.14/employee/" with body "" - Then the response status code should be 429 - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl-r/3.14/withoutrl/" with body "" - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl-r/3.14/withoutrl/" with body "" - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl-r/3.14/withoutrl/" with body "" - Then the response status code should be 200 - Then I wait for next minute strictly - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl-r/3.14/employee/" with body "" - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl-r/3.14/employee/" with body "" - Then the response status code should be 200 - - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "ResourceLevelApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "SimpleRateLimitResourceLevelAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I have a valid Adminportal access token - Then I delete the created API throttling policy - - Scenario: Testing API level rate limiiting for GraphQL API - And I have a DCR application - And I have a valid Adminportal access token - Then I set new API throttling policy allowing "2" requests per every "1" minute - Then the response status code should be 201 - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - Then I use the Payload file "artifacts/payloads/gqlPayload.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - And the response body should contain "StarwarsAPI" - Then I use the Payload file "artifacts/payloads/gql_api_level_rl.json" - And I update the API settings - Then the response status code should be 200 - And the response body should contain "StarwarsAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "TestApp" - Then the response status code should be 201 - And the response body should contain "TestApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - And I eventually receive 200 response code, not accepting - |429| - |401| - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 200 - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 429 - Then I wait for next minute strictly - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 200 - - - Scenario: Undeploy the created GraphQL API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "TestApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "StarwarsAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 404 - And I send "POST" request to "https://sandbox.default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 404 - And I have a valid Adminportal access token - Then I delete the created API throttling policy - Then the response status code should be 200 - - # NOTE: In the current implementation, APK only supports API level ratelimitting hence this test case - # commented out. Uncomment this after the proper implementation. -# Scenario: Testing Resource level rate limiiting for REST API -# And I have a DCR application -# And I have a valid Adminportal access token -# Then I set new API throttling policy allowing "2" requests per every "1" minute -# Then the response status code should be 201 -# And I have a valid Publisher access token -# When the definition file "artifacts/definitions/schema_graphql.graphql" -# Then I use the Payload file "artifacts/payloads/gqlPayload.json" -# Then I make the import GraphQLAPI Creation request -# Then the response status code should be 201 -# And the response body should contain "StarwarsAPI" -# Then I use the Payload file "artifacts/payloads/gql_resource_level_rl.json" -# And I update the GQL API settings -# Then the response status code should be 200 -# And the response body should contain "StarwarsAPI" -# And make the API Revision Deployment request -# Then the response status code should be 201 -# And make the Change Lifecycle request -# Then the response status code should be 200 -# And I have a valid Devportal access token -# And make the Application Creation request with the name "TestApp" -# Then the response status code should be 201 -# And the response body should contain "TestApp" -# And I have a KeyManager -# And make the Generate Keys request -# Then the response status code should be 200 -# And the response body should contain "consumerKey" -# And the response body should contain "consumerSecret" -# And make the Subscription request -# Then the response status code should be 201 -# And the response body should contain "Unlimited" -# And I get "production" oauth keys for application -# Then the response status code should be 200 -# And make the Access Token Generation request for "production" -# Then the response status code should be 200 -# And the response body should contain "accessToken" -# Then I set headers -# | Authorization | Bearer ${accessToken} | -# And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" -# And I eventually receive 200 response code, not accepting -# |429| -# |401| -# And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" -# Then the response status code should be 200 -# And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" -# Then the response status code should be 429 -# And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" -# Then the response status code should be 429 -# #From here onwards, it should query an endpoint without rate limit -# And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ human(id:1000){ id name }}\"}"; -# Then the response status code should be 200 -# And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ human(id:1000){ id name }}\"}"; -# Then the response status code should be 200 -# And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ human(id:1000){ id name }}\"}"; -# Then the response status code should be 200 -# Then I wait for next minute strictly -# And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" -# Then the response status code should be 200 -# And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" -# Then the response status code should be 200 - - -# Scenario: Undeploy the created GraphQL API -# And I have a DCR application -# And I have a valid Devportal access token -# Then I delete the application "TestApp" from devportal -# Then the response status code should be 200 -# And I have a valid Publisher access token -# Then I find the apiUUID of the API created with the name "StarwarsAPI" -# Then I undeploy the selected API -# Then the response status code should be 200 -# And I have a valid Adminportal access token -# Then I delete the created API throttling policy -# Then the response status code should be 200 - diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/ResourceLevelInterceptor.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/ResourceLevelInterceptor.feature deleted file mode 100644 index cffaf524b7..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/ResourceLevelInterceptor.feature +++ /dev/null @@ -1,62 +0,0 @@ -Feature: API Policy Addition(Interceptor Service) - Background: - Given The system is ready - Scenario: Create a REST API and add policy for request flow over Resource Level - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api_policy/original.json" - When the definition file "artifacts/definitions/cors-definition.json" - And make the import API Creation request using OAS "File" - Then the response status code should be 201 - And the response body should contain "ResourceLevelIntercepterAPI" - Then I use the Payload file "artifacts/payloads/api_policy/resource_level_interceptor.json" - And I update the API settings - Then the response status code should be 200 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/rlintercepter/1.0.0/get" with body "" - And the response body should not contain "\"Interceptor-Header\"" - Then the response status code should be 200 - Then the response headers not contains key "interceptor-response-header" - And I send "GET" request to "https://default.gw.wso2.com:9095/rlintercepter/1.0.0/headers" with body "" - And the response body should contain - |"Interceptor-Header": "Interceptor-header-value"| - # |"Interceptor-Header-Apigroup": "Gold"| - # |"Interceptor-Header-Apitier": "Unlimited"| - Then the response status code should be 200 - Then the response headers contains key "interceptor-response-header" and value "Interceptor-Response-header-value" - - Scenario: Undeploying an already existing REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "ResourceLevelIntercepterAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/rlintercepter/1.0.0/get" with body "" - And I eventually receive 404 response code, not accepting - |200| diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/Scopes.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/Scopes.feature deleted file mode 100644 index 25e1be6b7e..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/Scopes.feature +++ /dev/null @@ -1,113 +0,0 @@ -Feature: Invoking APIs with scopes enabled - Background: - Given The system is ready - Scenario: Create API and enable scopes for resources and invoke them using keys with and without proper scopes - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api1.json" - And I use the OAS URL "https://petstore3.swagger.io/api/v3/openapi.json" - And make the import API Creation request using OAS "URL" - Then the response status code should be 201 - And the response body should contain "SwaggerPetstore" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And I eventually receive 200 response code, not accepting - |429| - Then I make Access Token Generation request without scopes - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - Then the response status code should be 403 - - Scenario: Undeploy the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "SwaggerPetstore" - Then I undeploy the selected API - Then the response status code should be 200 - - Scenario: Deploying a GraphQL API with scopes and invoking it with and without scopes - And I have a DCR application - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - When I use the Payload file "artifacts/payloads/gql_with_scopes.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - And the response body should contain "StarWarsAPI" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "TestApp" - Then the response status code should be 201 - And the response body should contain "TestApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 200 - And I eventually receive 200 response code, not accepting - | 404 | - | 401 | - Then I make Access Token Generation request without scopes - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - Then the response status code should be 403 - - Scenario: Undeploying an already existing GraphQL API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "TestApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "StarWarsAPI" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ hero { name } }\"}" - And I eventually receive 404 response code, not accepting - |200| \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/SubscriptionBlocking.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/SubscriptionBlocking.feature deleted file mode 100644 index ecf3051dbb..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/SubscriptionBlocking.feature +++ /dev/null @@ -1,60 +0,0 @@ -Feature: Blocking the subscription for a selected application - Background: - Given The system is ready - Scenario: Checking the subscription blocking for an REST API - And I have a DCR application - And I have a valid Publisher access token - When I use the Payload file "artifacts/payloads/api1.json" - And I use the OAS URL "https://petstore3.swagger.io/api/v3/openapi.json" - And make the import API Creation request using OAS "URL" - Then the response status code should be 201 - And the response body should contain "SwaggerPetstore" - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "SampleApp" - Then the response status code should be 201 - And the response body should contain "SampleApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And I eventually receive 200 response code, not accepting - |429| - Then I send the subcription blocking request - And the response status code should be 200 - And the response body should contain "BLOCKED" - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And I eventually receive 403 response code, not accepting - |200| - |201| - |429| - |500| - - Scenario: Undeploying the created REST API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "SampleApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "SwaggerPetstore" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/petstore/1.0.0/pet/4" with body "" - And I eventually receive 404 response code, not accepting - |200| \ No newline at end of file diff --git a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/graphQLmTLS.feature b/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/graphQLmTLS.feature deleted file mode 100644 index ef2a0c22e2..0000000000 --- a/test/apim-apk-agent-test/cucumber-tests/src/test/resources/tests/api/graphQLmTLS.feature +++ /dev/null @@ -1,181 +0,0 @@ -Feature: Test mTLS between client and gateway with client certificate sent in header - Background: - Given The system is ready - Scenario: Deploying GraphQL API with mTLS mandatory and valid certificate - And I have a DCR application - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - When I use the Payload file "artifacts/payloads/mtls/graphql_with_mtls.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - And the response body should contain "GraphQLAPImTLS" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "TestApp" - Then the response status code should be 201 - And the response body should contain "TestApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ allHumans { name } }\"}" - And I eventually receive 200 response code, not accepting - | 429 | - | 500 | - And the response body should contain "\"name\":\"string\"" - - Scenario: Undeploy API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "TestApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "GraphQLAPImTLS" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - - Scenario: Deploying GraphQL API with mTLS mandatory and no certificate - And I have a DCR application - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - When I use the Payload file "artifacts/payloads/mtls/graphql_with_mtls.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - And the response body should contain "GraphQLAPImTLS" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "TestApp" - Then the response status code should be 201 - And the response body should contain "TestApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ allHumans { name } }\"}" - And I eventually receive 401 response code, not accepting - | 200 | - | 429 | - | 500 | - - Scenario: Undeploy API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "TestApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "GraphQLAPImTLS" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - - Scenario: Deploying GraphQL API with OAuth2 mandatory mTLS optional - And I have a DCR application - And I have a valid Publisher access token - When the definition file "artifacts/definitions/schema_graphql.graphql" - When I use the Payload file "artifacts/payloads/mtls/graphql_with_mtls_optional_oauth2_mandatory.json" - Then I make the import GraphQLAPI Creation request - Then the response status code should be 201 - And the response body should contain "GraphQLAPImTLS" - And I have a client certificate "config-map-1.crt" - Then I update the API with mtls certificate data with the alias "mtls-test-configmap" - Then the response status code should be 201 - And make the API Revision Deployment request - Then the response status code should be 201 - Then I wait for 40 seconds - And make the Change Lifecycle request - Then the response status code should be 200 - And I have a valid Devportal access token - And make the Application Creation request with the name "TestApp" - Then the response status code should be 201 - And the response body should contain "TestApp" - And I have a KeyManager - And make the Generate Keys request - Then the response status code should be 200 - And the response body should contain "consumerKey" - And the response body should contain "consumerSecret" - And make the Subscription request - Then the response status code should be 201 - And the response body should contain "Unlimited" - And I get "production" oauth keys for application - Then the response status code should be 200 - And make the Access Token Generation request for "production" - Then the response status code should be 200 - And the response body should contain "accessToken" - Then I set headers - | Authorization | Bearer ${accessToken} | - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ allHumans { name } }\"}" - And I eventually receive 200 response code, not accepting - | 429 | - | 500 | - And the response body should contain "\"name\":\"string\"" - Then I remove the header "X-WSO2-CLIENT-CERTIFICATE" - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ allHumans { name } }\"}" - And I eventually receive 200 response code, not accepting - | 429 | - | 500 | - And the response body should contain "\"name\":\"string\"" - And I have a client certificate "invalid-cert.crt" - Then I set headers - | X-WSO2-CLIENT-CERTIFICATE | ${clientCertificate} | - And I send "POST" request to "https://default.gw.wso2.com:9095/graphql/3.14" with body "{\"query\":\"{ allHumans { name } }\"}" - And I eventually receive 401 response code, not accepting - | 429 | - | 500 | - - Scenario: Undeploy API - And I have a DCR application - And I have a valid Devportal access token - Then I delete the application "TestApp" from devportal - Then the response status code should be 200 - And I have a valid Publisher access token - Then I find the apiUUID of the API created with the name "GraphQLAPImTLS" - Then I undeploy the selected API - Then the response status code should be 200 - And I send "GET" request to "https://default.gw.wso2.com:9095/mtls/3.14/employee" with body "" - And I eventually receive 404 response code, not accepting - |200| - diff --git a/test/cucumber-tests/CRs/agent-artifacts.yaml b/test/cucumber-tests/CRs/agent-artifacts.yaml index 10672cd323..0bf4898106 100644 --- a/test/cucumber-tests/CRs/agent-artifacts.yaml +++ b/test/cucumber-tests/CRs/agent-artifacts.yaml @@ -756,7 +756,7 @@ spec: appId: 45f1c5c8-a92e-11ed-afa1-0242ac120009 keyType: SANDBOX --- -apiVersion: cp.wso2.com/v1alpha2 +apiVersion: cp.wso2.com/v1alpha3 kind: Subscription metadata: name: 583e4146-7ef6-11ee-b962-0242ac120003 @@ -767,6 +767,30 @@ spec: api: name: "subscription-api" version: "1.0.0" + ratelimitRef: + name: api-subscription-ratelimit1 + level: application + +--- +apiVersion: "dp.wso2.com/v1alpha3" +kind: "RateLimitPolicy" +metadata: + name: "api-subscription-ratelimit1" +spec: + override: + subscription: + stopOnQuotaReach: true + organization: "default" + requestCount: + requestsPerUnit: 1000 + unit: "Minute" + burstControl: + requestsPerUnit: 1000 + unit: "Minute" + targetRef: + kind: Subscription + name: "583e4146-7ef6-11ee-b962-0242ac120003" + group: gateway.networking.k8s.io --- apiVersion: cp.wso2.com/v1alpha2 @@ -874,7 +898,7 @@ data: u0/ITEw= -----END CERTIFICATE----- --- -apiVersion: cp.wso2.com/v1alpha2 +apiVersion: cp.wso2.com/v1alpha3 kind: Subscription metadata: name: semantic-versioning-subscription @@ -885,6 +909,30 @@ spec: api: name: "Semantic Versioning API" version: "v\\d+(\\.\\d+)?" + ratelimitRef: + name: api-subscription-ratelimit + level: application + +--- +apiVersion: "dp.wso2.com/v1alpha3" +kind: "RateLimitPolicy" +metadata: + name: "api-subscription-ratelimit" +spec: + override: + subscription: + stopOnQuotaReach: true + organization: "default" + requestCount: + requestsPerUnit: 1000 + unit: "Minute" + burstControl: + requestsPerUnit: 1000 + unit: "Minute" + targetRef: + kind: Subscription + name: "semantic-versioning-subscription" + group: gateway.networking.k8s.io --- apiVersion: cp.wso2.com/v1alpha2 kind: ApplicationMapping diff --git a/test/cucumber-tests/CRs/artifacts.yaml b/test/cucumber-tests/CRs/artifacts.yaml index 35a0bcb4af..f05a42ca16 100644 --- a/test/cucumber-tests/CRs/artifacts.yaml +++ b/test/cucumber-tests/CRs/artifacts.yaml @@ -756,7 +756,7 @@ spec: appId: 45f1c5c8-a92e-11ed-afa1-0242ac120009 keyType: SANDBOX --- -apiVersion: cp.wso2.com/v1alpha2 +apiVersion: cp.wso2.com/v1alpha3 kind: Subscription metadata: name: 583e4146-7ef6-11ee-b962-0242ac120003 @@ -1276,7 +1276,7 @@ spec: --- -apiVersion: dp.wso2.com/v1alpha2 +apiVersion: dp.wso2.com/v1alpha3 kind: API metadata: name: llm-api-subs @@ -1477,7 +1477,7 @@ spec: --- -apiVersion: dp.wso2.com/v1alpha2 +apiVersion: dp.wso2.com/v1alpha3 kind: API metadata: name: llm-api-header @@ -1641,7 +1641,7 @@ spec: --- -apiVersion: dp.wso2.com/v1alpha2 +apiVersion: dp.wso2.com/v1alpha3 kind: API metadata: name: llm-api diff --git a/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_and_response.json b/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_and_response.json index 251eb72f69..a7abe95f91 100644 --- a/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_and_response.json +++ b/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_and_response.json @@ -15,7 +15,7 @@ "apiPolicies": { "request": [ { - "policyName": "ccCallInterceptorService", + "policyName": "apkCallInterceptorService", "policyVersion": "v1", "parameters": { "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", @@ -25,7 +25,7 @@ ], "response": [ { - "policyName": "ccCallInterceptorService", + "policyName": "apkCallInterceptorService", "policyVersion": "v1", "parameters": { "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", diff --git a/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor.json b/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor.json index 23ef0b8843..9d57363899 100644 --- a/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor.json +++ b/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor.json @@ -15,7 +15,7 @@ "apiPolicies": { "request": [ { - "policyName": "ccCallInterceptorService", + "policyName": "apkCallInterceptorService", "policyVersion": "v1", "parameters": { "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", diff --git a/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor_param_variation.json b/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor_param_variation.json index 50f92df083..8968ef679c 100644 --- a/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor_param_variation.json +++ b/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/request_interceptor_param_variation.json @@ -15,7 +15,7 @@ "apiPolicies": { "request": [ { - "policyName": "ccCallInterceptorService", + "policyName": "apkCallInterceptorService", "policyVersion": "v1", "parameters": { "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", @@ -25,7 +25,7 @@ ], "response": [ { - "policyName": "ccCallInterceptorService", + "policyName": "apkCallInterceptorService", "policyVersion": "v1", "parameters": { "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443", diff --git a/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/response_interceptor.json b/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/response_interceptor.json index 780b66f4b5..e47593945c 100644 --- a/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/response_interceptor.json +++ b/test/cucumber-tests/src/test/resources/artifacts/payloads/api_policy/response_interceptor.json @@ -25,7 +25,7 @@ "request": [], "response": [ { - "policyName": "ccCallInterceptorService", + "policyName": "apkCallInterceptorService", "policyVersion": "v1", "parameters": { "interceptorServiceURL": "http://interceptor-service.apk.svc.cluster.local:8443",