diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0d301d39a7172eff7cfa3c20a354be0489731534..ab8dfe05c80df9ed3eb66b02d45fa59bb3b2125f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -156,9 +156,6 @@ azure_containerize: azure_test: image: community.opengroup.org:5555/osdu/platform/deployment-and-operations/base-containers-azure/azure-maven17:v0.0.1 -aws-test-java: - image: $CI_REGISTRY/osdu/platform/deployment-and-operations/base-containers-aws/aws-maven/aws-maven:v2.1 - fossa-analyze: image: $CI_REGISTRY/divido/fossa-with-cache:v0.9-jdk17 diff --git a/NOTICE b/NOTICE index dbc8ac6c3cf1474f65d31bfba4dd34dd286c050c..edd5b9bdbb0d9e39612877ee5be9e547c829acd8 100644 --- a/NOTICE +++ b/NOTICE @@ -136,7 +136,6 @@ The following software have components provided under the terms of this license: - Jackson-module-parameter-names (from https://repo1.maven.org/maven2/com/fasterxml/jackson/module/jackson-module-parameter-names) - Jakarta Servlet (from https://projects.eclipse.org/projects/ee4j.servlet) - Jakarta Validation API (from https://beanvalidation.org) -- Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec) - Java Architecture for XML Binding (from http://jaxb.java.net/, https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api) - Java Native Access (from https://github.com/java-native-access/jna, https://github.com/twall/jna) - Java Native Access Platform (from https://github.com/java-native-access/jna) @@ -247,7 +246,7 @@ The following software have components provided under the terms of this license: - Spring JMS (from http://www.springframework.org, https://github.com/SpringSource/spring-framework, https://github.com/spring-projects/spring-framework, https://repo1.maven.org/maven2/org/springframework/spring-jms) - Spring Messaging (from https://github.com/spring-projects/spring-framework) - Spring Object/XML Marshalling (from https://github.com/spring-projects/spring-framework) -- Spring Plugin - Metadata Extension (from https://repo1.maven.org/maven2/org/springframework/plugin/spring-plugin-metadata) +- Spring Plugin - Metadata Extension (from https://github.com/spring-projects/spring-plugin/spring-plugin-metadata, https://repo1.maven.org/maven2/org/springframework/plugin/spring-plugin-metadata) - Spring Plugin Core (from https://github.com/spring-projects/spring-plugin/spring-plugin-core, https://repo1.maven.org/maven2/org/springframework/plugin/spring-plugin-core) - Spring Security - Core (from http://spring.io/spring-security, https://repo1.maven.org/maven2/org/springframework/security/spring-security-core, https://spring.io/projects/spring-security, https://spring.io/spring-security) - Spring Security - Namespace Configuration Module (from http://spring.io/spring-security, https://repo1.maven.org/maven2/org/springframework/security/spring-security-config, https://spring.io/projects/spring-security, https://spring.io/spring-security) @@ -414,6 +413,7 @@ The following software have components provided under the terms of this license: - Guava: Google Core Libraries for Java (from http://code.google.com/p/guava-libraries, https://github.com/google/guava, https://repo1.maven.org/maven2/com/google/guava/guava) - HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/) +- Hibernate Validator (from https://repo1.maven.org/maven2/org/hibernate/hibernate-validator, https://repo1.maven.org/maven2/org/hibernate/validator/hibernate-validator) - LatencyUtils (from http://latencyutils.github.io/LatencyUtils/) - MongoDB Java Driver (from http://mongodb.org/, http://www.mongodb.org, https://www.mongodb.com/) - Netty/Common (from https://repo1.maven.org/maven2/io/netty/netty-common) @@ -467,13 +467,11 @@ The following software have components provided under the terms of this license: - JUnit Jupiter API (from http://junit.org/junit5/, https://junit.org/junit5/) - JUnit Jupiter Engine (from http://junit.org/junit5/, https://junit.org/junit5/) - JUnit Jupiter Params (from http://junit.org/junit5/, https://junit.org/junit5/) -- JUnit Platform Commons (from http://junit.org/junit5/, https://junit.org/junit5/) - JUnit Platform Engine API (from http://junit.org/junit5/, https://junit.org/junit5/) - JUnit Vintage Engine (from http://junit.org/junit5/, https://junit.org/junit5/) - Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca) - Jakarta Validation API (from https://beanvalidation.org) - Jakarta WebSocket - Server API (from https://projects.eclipse.org/projects/ee4j.websocket, https://repo1.maven.org/maven2/org/jboss/spec/javax/websocket/jboss-websocket-api_1.1_spec) -- Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec) - Java Servlet 4.0 API - Logback Contrib :: JSON :: Classic (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-json-classic) - Logback Contrib :: JSON :: Core (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-json-core) @@ -542,7 +540,6 @@ GPL-3.0-only The following software have components provided under the terms of this license: - Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca) -- Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec) - Java Servlet 4.0 API ======================================================================== @@ -605,7 +602,6 @@ The following software have components provided under the terms of this license: - ClassGraph (from https://github.com/classgraph/classgraph) - JUL to SLF4J bridge (from http://www.slf4j.org) - Jackson-core (from http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson-core) -- Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec) - Java Client Runtime for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java) - Java JWT (from http://www.jwt.io, https://github.com/auth0/java-jwt) - Lucene Core (from https://repo1.maven.org/maven2/org/apache/lucene/lucene-core) diff --git a/devops/aws/pipeline/override-stages.yml b/devops/aws/pipeline/override-stages.yml index 3fec4d932234dc0275d52ab8b369e27d2c4b3b41..58c1d60a5f5ea0b135a5f099de53ceb169a8018b 100644 --- a/devops/aws/pipeline/override-stages.yml +++ b/devops/aws/pipeline/override-stages.yml @@ -22,6 +22,42 @@ include: - project: "osdu/platform/ci-cd-pipelines" file: "cloud-providers/aws-maven.yml" +aws-containerize: + extends: + - .aws + - .aws_common_variables + - .aws_variables + stage: containerize + needs: ['compile-and-unit-test'] + script: + - | + if [ -z $AWS_BUILDER_DOCKERFILE_PATH ] && [ -z $AWS_RUNTIME_DOCKERFILE_PATH ]; then + echo Building BUILD_DIR/Dockerfile container + docker build -f $BUILD_DIR/Dockerfile -t $LOCAL_IMAGE_TAG .; + else + echo Building BUILDER->RUNTIME containers; + docker build -t builder:latest --file $AWS_BUILDER_DOCKERFILE_PATH .; + docker build -t $LOCAL_IMAGE_TAG --file $AWS_RUNTIME_DOCKERFILE_PATH --build-arg docker_builder_image=builder .; + fi + + # Push to the local container registry + - export PUSH_ENDPOINT_ECR_TAG=`echo push_endpoint.${CI_COMMIT_SHA} | cut -c 1-120` + - export PUSH_ENDPOINT_IMAGE=${AWS_IMAGE_TAG_BASE}:${PUSH_ENDPOINT_ECR_TAG} + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + - docker push $LOCAL_IMAGE_TAG + # Push to Amazon's container registry + - $(aws ecr get-login --no-include-email --region $AWS_ECR_REGION) + - docker tag $LOCAL_IMAGE_TAG $AWS_IMAGE_TAG_BASE:$CI_COMMIT_SHA + - docker tag $LOCAL_IMAGE_TAG $AWS_IMAGE_TAG_BASE:latest + - docker push $AWS_IMAGE_TAG_BASE:$CI_COMMIT_SHA + - docker push $AWS_IMAGE_TAG_BASE:latest + - export INTEGRATION_TEST_SOURCE_DIR_AWS=$(pwd)/testing/notification-test-aws + - $INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/build_push_endpoint_image.sh + only: + variables: + - $AWS == '1' + + aws-test-java: image: $CI_REGISTRY/osdu/platform/deployment-and-operations/base-containers-aws/aws-maven/aws-maven:v2.1 extends: @@ -30,7 +66,6 @@ aws-test-java: - .aws_common_variables - .aws_variables stage: integration - allow_failure: true needs: [{ job: 'aws-update-tf', optional: true }, { job: 'aws-update-helm', optional: true }, { job: 'aws-update-eks', optional: true }] retry: 1 before_script: @@ -41,8 +76,8 @@ aws-test-java: - export KUBECONFIG=/tmp/kubeconfig-${RANDOM}.yaml - aws eks update-kubeconfig --region $AWS_REGION --name $EKS_CLUSTER_NAME --role-arn $EKS_CLUSTER_MGMT_ROLE - chmod 600 $KUBECONFIG - - pip3 install boto3 - export PUSH_ENDPOINT_PATH=testing/notification-test-aws/build-aws/push-endpoint + - pip3 install -r $PUSH_ENDPOINT_PATH/requirements.txt - echo "PUSH_ENDPOINT_PATH ${PUSH_ENDPOINT_PATH}" - python3 $PUSH_ENDPOINT_PATH/setup_teardown_endpoint.py --create --environment_file $PUSH_ENDPOINT_PATH/environment_file.sh --kube_file $PUSH_ENDPOINT_PATH/push-endpoint-manifest.yaml - trap "python3 $PUSH_ENDPOINT_PATH/setup_teardown_endpoint.py --delete --environment_file $PUSH_ENDPOINT_PATH/environment_file.sh --kube_file $PUSH_ENDPOINT_PATH/push-endpoint-manifest.yaml" EXIT diff --git a/notification-core/pom.xml b/notification-core/pom.xml index 5950f33eadc8bc68ed6771c1e214f4d43b91b4e2..5ce4b99df0ebf167b6b7bd207e0cbd1bb9b43207 100644 --- a/notification-core/pom.xml +++ b/notification-core/pom.xml @@ -17,7 +17,6 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <artifactId>notification-core</artifactId> <name>notification-core</name> <description>Core module for the notification service</description> @@ -31,10 +30,6 @@ </parent> <properties> - <java.version>17</java.version> - <maven.compiler.target>${java.version}</maven.compiler.target> - <maven.compiler.source>${java.version}</maven.compiler.source> - <netty.version>4.1.70.Final</netty.version> <undertow.version>2.2.19.Final</undertow.version> <woodstox-core.version>5.3.0</woodstox-core.version> <log4j.version>2.17.1</log4j.version> diff --git a/pom.xml b/pom.xml index ada486812f525f7981c8e81c4c71cd70829e7532..9db092f8986ebe12c0a4a5c32a446974eddf723f 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,9 @@ <log4j2.version>2.17.1</log4j2.version> <json-smart.version>2.5.0</json-smart.version> <openapi.version>1.6.14</openapi.version> + <spring-webmvc.version>5.3.31</spring-webmvc.version> + <netty.version>4.1.106.Final</netty.version> + <snakeyaml-version>2.0</snakeyaml-version> </properties> <licenses> @@ -51,11 +54,11 @@ <scope>import</scope> </dependency> <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-dependencies</artifactId> - <version>2.7.17</version> - <type>pom</type> - <scope>import</scope> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>2.7.17</version> + <type>pom</type> + <scope>import</scope> </dependency> <dependency> @@ -112,6 +115,12 @@ <groupId>org.springdoc</groupId> <artifactId>springdoc-openapi-ui</artifactId> <version>${openapi.version}</version> + <exclusions> + <exclusion> + <groupId>org.yaml</groupId> + <artifactId>snakeyaml</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.springframework.plugin</groupId> diff --git a/provider/notification-aws/pom.xml b/provider/notification-aws/pom.xml index 89275df71136fccad2743a019a813c89e18e7caa..7819cb2fd3d99ee716cccef332845c2f851106aa 100644 --- a/provider/notification-aws/pom.xml +++ b/provider/notification-aws/pom.xml @@ -31,9 +31,6 @@ </parent> <properties> - <java.version>17</java.version> - <maven.compiler.target>${java.version}</maven.compiler.target> - <maven.compiler.source>${java.version}</maven.compiler.source> <log4j2.version>2.17.1</log4j2.version> <jackson-databind.version>2.13.4.2</jackson-databind.version> <jackson.version>2.13.4</jackson.version> @@ -72,6 +69,16 @@ <dependency> <groupId>org.opengroup.osdu.core.aws</groupId> <artifactId>os-core-lib-aws</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + </exclusion> + </exclusions> <version>0.25.0-rc3</version> </dependency> <dependency> @@ -91,11 +98,6 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - </dependency> - <!-- unit test dependencies --> <dependency> <groupId>org.mockito</groupId> diff --git a/provider/notification-azure/pom.xml b/provider/notification-azure/pom.xml index 970ab2f27bb8ca88c0a0e6bef56758fcf6ffaca4..26cec8a66cb7b3d4f2c3e5e883dd9744838ee154 100644 --- a/provider/notification-azure/pom.xml +++ b/provider/notification-azure/pom.xml @@ -30,9 +30,6 @@ </parent> <properties> - <java.version>17</java.version> - <maven.compiler.target>${java.version}</maven.compiler.target> - <maven.compiler.source>${java.version}</maven.compiler.source> <jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version> <osdu.notification-core.version>0.26.0-SNAPSHOT</osdu.notification-core.version> <springframework.version>4.3.0.RELEASE</springframework.version> @@ -47,12 +44,9 @@ <reactor-netty.version>1.1.14</reactor-netty.version> <oauth2-oidc-sdk.version>6.0</oauth2-oidc-sdk.version> <woodstox-core.version>5.4.0</woodstox-core.version> - <spring-webmvc.version>5.3.22</spring-webmvc.version> <undertow.version>2.2.26.Final</undertow.version> <spring-boot-maven-plugin.version>2.7.6</spring-boot-maven-plugin.version> <xnio-api.version>3.8.8.Final</xnio-api.version> - <netty.version>4.1.101.Final</netty.version> - <snakeyaml-version>2.0</snakeyaml-version> </properties> <dependencyManagement> @@ -193,6 +187,7 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> + <version>${spring-webmvc.version}</version> </dependency> <dependency> diff --git a/provider/notification-gc/pom.xml b/provider/notification-gc/pom.xml index 5db03544771ac599bff920c3a047c32d0609860d..273626d8dc88fbb8dece396b7c57ac7374882c11 100644 --- a/provider/notification-gc/pom.xml +++ b/provider/notification-gc/pom.xml @@ -29,9 +29,6 @@ </parent> <properties> - <java.version>17</java.version> - <maven.compiler.target>${java.version}</maven.compiler.target> - <maven.compiler.source>${java.version}</maven.compiler.source> <spring-boot-maven-plugin.version>2.7.6</spring-boot-maven-plugin.version> </properties> @@ -62,6 +59,12 @@ <groupId>org.opengroup.osdu</groupId> <artifactId>core-lib-gc</artifactId> <version>0.24.0</version> + <exclusions> + <exclusion> + <groupId>org.yaml</groupId> + <artifactId>snakeyaml</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> @@ -77,6 +80,10 @@ <groupId>com.google.oauth-client</groupId> <artifactId>google-oauth-client</artifactId> </exclusion> + <exclusion> + <groupId>org.yaml</groupId> + <artifactId>snakeyaml</artifactId> + </exclusion> </exclusions> </dependency> @@ -116,6 +123,12 @@ <artifactId>oqm</artifactId> <version>0.24.0</version> </dependency> + + <dependency> + <groupId>org.yaml</groupId> + <artifactId>snakeyaml</artifactId> + <version>${snakeyaml-version}</version> + </dependency> </dependencies> <build> diff --git a/provider/notification-ibm/pom.xml b/provider/notification-ibm/pom.xml index 1f18aade0a12d9ff8aaa26ae45113ae2467896f9..40e4af9896b94cf0786a05828290afae4673d038 100644 --- a/provider/notification-ibm/pom.xml +++ b/provider/notification-ibm/pom.xml @@ -102,7 +102,7 @@ <dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> - <version>1.33</version> + <version>${snakeyaml-version}</version> </dependency> <dependency> <groupId>org.apache.lucene</groupId> diff --git a/testing/notification-test-aws/build-aws/build_push_endpoint.sh b/testing/notification-test-aws/build-aws/build_push_endpoint.sh new file mode 100755 index 0000000000000000000000000000000000000000..ffe56380bdf0915103635b415e0be161b93998de --- /dev/null +++ b/testing/notification-test-aws/build-aws/build_push_endpoint.sh @@ -0,0 +1,15 @@ +# Copyright © 2020 Amazon Web Services +# +# 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. + +(cd $INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/push-endpoint && mvn -B -ntp -s ./maven/settings.xml package) diff --git a/testing/notification-test-aws/build-aws/build_push_endpoint_image.sh b/testing/notification-test-aws/build-aws/build_push_endpoint_image.sh new file mode 100755 index 0000000000000000000000000000000000000000..eca26b546b2c92589e6d45800677e165ab0aa761 --- /dev/null +++ b/testing/notification-test-aws/build-aws/build_push_endpoint_image.sh @@ -0,0 +1,15 @@ +# Copyright © 2020 Amazon Web Services +# +# 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. + +(cd $INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/push-endpoint && docker build -t $PUSH_ENDPOINT_IMAGE -f Dockerfile --no-cache . && docker push $PUSH_ENDPOINT_IMAGE) diff --git a/testing/notification-test-aws/build-aws/prepare-dist.sh b/testing/notification-test-aws/build-aws/prepare-dist.sh index a82740f3e97968bf7cdfcda58863587ef120288e..73be3acc3c40a4cb465b98edb0595d75e58f3952 100755 --- a/testing/notification-test-aws/build-aws/prepare-dist.sh +++ b/testing/notification-test-aws/build-aws/prepare-dist.sh @@ -36,7 +36,8 @@ echo $INTEGRATION_TEST_OUTPUT_DIR echo $INTEGRATION_TEST_OUTPUT_BIN_DIR # Build the Push Endpoint image -(cd $INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/push-endpoint && mvn -B -ntp -s ./maven/settings.xml package && docker build -t $PUSH_ENDPOINT_IMAGE -f Dockerfile --no-cache . && docker push $PUSH_ENDPOINT_IMAGE) +$INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/build_push_endpoint.sh +$INTEGRATION_TEST_SOURCE_DIR_AWS/build-aws/build_push_endpoint_image.sh # Finished building the Push Endpoint image rm -rf "$INTEGRATION_TEST_OUTPUT_DIR" diff --git a/testing/notification-test-aws/build-aws/push-endpoint/requirements.txt b/testing/notification-test-aws/build-aws/push-endpoint/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..457ca83c09870fe2d337d9008cbec08f5a2a1337 --- /dev/null +++ b/testing/notification-test-aws/build-aws/push-endpoint/requirements.txt @@ -0,0 +1,17 @@ +# Copyright Amazon.com, Inc. or its affiliates. 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. + +boto3==1.26.6 +botocore==1.29.6 +colorama==0.4.4 diff --git a/testing/notification-test-aws/build-aws/push-endpoint/setup_teardown_endpoint.py b/testing/notification-test-aws/build-aws/push-endpoint/setup_teardown_endpoint.py index 922e9d2b328c909a2218e973456960b3058f8755..9c1c3bb864b9e367dfd4b8804fd05db053978ca5 100644 --- a/testing/notification-test-aws/build-aws/push-endpoint/setup_teardown_endpoint.py +++ b/testing/notification-test-aws/build-aws/push-endpoint/setup_teardown_endpoint.py @@ -330,9 +330,11 @@ class CommonParameters: PolicyName=self.sa_role_policy_name, PolicyDocument=permissions_policy) role_arn = role["Role"]["Arn"] + print(f"Created role {role_arn}") except self.iam_client.exceptions.EntityAlreadyExistsException: role = self.iam_client.get_role(RoleName=service_role_name) role_arn = role["Role"]["Arn"] + print(f"Using pre-existing role {role_arn}") return role_arn def create_k8s_file(self, queue_urls: typing.List[str], diff --git a/testing/notification-test-aws/build-aws/run-tests.sh b/testing/notification-test-aws/build-aws/run-tests.sh index 5a181f150a5ccac46b6de6286638f4d7ecee6e93..3820f05f7afadcca0708e1426e87c93b40161049 100755 --- a/testing/notification-test-aws/build-aws/run-tests.sh +++ b/testing/notification-test-aws/build-aws/run-tests.sh @@ -31,15 +31,16 @@ echo "$SCRIPT_SOURCE_DIR" # see os-deploy-aws/build-aws/integration-test-env-variables.py for an updated list PUSH_ENDPOINT_PATH=$SCRIPT_SOURCE_DIR/push-endpoint +pip3 install -r $PUSH_ENDPOINT_PATH/requirements.txt python3 $PUSH_ENDPOINT_PATH/setup_teardown_endpoint.py --create --environment_file $PUSH_ENDPOINT_PATH/environment_file.sh --kube_file $PUSH_ENDPOINT_PATH/push-endpoint-manifest.yaml trap "python3 $PUSH_ENDPOINT_PATH/setup_teardown_endpoint.py --delete --environment_file $PUSH_ENDPOINT_PATH/environment_file.sh --kube_file $PUSH_ENDPOINT_PATH/push-endpoint-manifest.yaml" EXIT source $PUSH_ENDPOINT_PATH/environment_file.sh export AWS_COGNITO_AUTH_FLOW=USER_PASSWORD_AUTH -export AWS_COGNITO_AUTH_PARAMS_PASSWORD=$ADMIN_PASSWORD -export AWS_COGNITO_AUTH_PARAMS_USER=$ADMIN_USER -export AWS_COGNITO_AUTH_PARAMS_USER_NO_ACCESS=$USER_NO_ACCESS +export AWS_COGNITO_AUTH_PARAMS_PASSWORD=${AWS_COGNITO_AUTH_PARAMS_PASSWORD:-ADMIN_PASSWORD} +export AWS_COGNITO_AUTH_PARAMS_USER=${AWS_COGNITO_AUTH_PARAMS_USER:-ADMIN_USER} +export AWS_COGNITO_AUTH_PARAMS_USER_NO_ACCESS=${AWS_COGNITO_AUTH_PARAMS_USER_NO_ACCESS:-USER_NO_ACCESS} export ENVIRONMENT=DEV export NOTIFICATION_REGISTER_BASE_URL=$NOTIFICATION_REGISTER_BASE_URL export REGISTER_CUSTOM_PUSH_PATH=/api/push-endpoint/0 diff --git a/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TestNotificationsEndpoint.java b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TestNotificationsEndpoint.java index 858d7c1c6c3dc2163bcb7b975eb9d34e6e91b2ad..7b850facd7ecefbdca82786923acb3755f8efe34 100644 --- a/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TestNotificationsEndpoint.java +++ b/testing/notification-test-aws/src/test/java/org/opengroup/osdu/notification/subscriptions/TestNotificationsEndpoint.java @@ -85,7 +85,7 @@ public class TestNotificationsEndpoint { private final static ObjectMapper objectMapper = new ObjectMapper(); private static final int MAX_RETRIES = 5; - private static final int MAX_POLL_TIME = 120; + private static final int MAX_POLL_TIME = 240; private static class PushQueue { diff --git a/testing/notification-test-ibm/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java b/testing/notification-test-ibm/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java new file mode 100644 index 0000000000000000000000000000000000000000..268fcc651b8f07f65d3fb4019c78977f6f91731c --- /dev/null +++ b/testing/notification-test-ibm/src/test/java/org/opengroup/osdu/notification/api/PubsubEndpointHMACDescriptor.java @@ -0,0 +1,51 @@ +package org.opengroup.osdu.notification.api; + +import org.opengroup.osdu.notification.util.Config; +import org.opengroup.osdu.notification.util.RestDescriptor; +import org.opengroup.osdu.notification.util.TestUtils; + +import java.util.HashMap; +import java.util.Map; + +public class PubsubEndpointHMACDescriptor extends RestDescriptor{ + + @Override + public String getPath() { + return "push-handlers/records-changed"; + } + + @Override + public String getHttpMethod() { + return "POST"; + } + + @Override + public String getValidBody() { + return "{\n" + + "\t\"Type\": \"Notification\",\n" + + "\t\"message\": {\n" + + "\t\"attributes\": {\n" + + "\t\"correlation-id\": \"39137f49-67d6-4001-a6aa-15521ef4f49e\",\n" + + "\t\"data-partition-id\": \"" + TestUtils.getOsduTenant() + "\"\n" + + "\t},\n" + + "\t\"data\": \"W3sia2luZCI6InRlc3RraW5kIiwiaWQiOiJ0ZXN0aWQiLCJvcGVyYXRpb250eXBlIjoiY3JlYXRlIn0seyJraW5kIjoidGVzdGtpbmQyIiwiaWQiOiJ0ZXN0aWQyIiwib3BlcmF0aW9udHlwZSI6InVwZGF0ZSJ9XQ\",\n" + + "\t\"messageId\": \"136969346945\"\n" + + "\t},\n" + + "\t\"subscription\": \""+ arg() +"\"\n" + + "}\n"; + } + + @Override + public Map<String,String> getOsduTenantHeaders(){ + Map<String, String> headers = new HashMap<>(); + headers.put("data-partition-id", Config.Instance().OsduTenant); + return headers; + } + + @Override + public Map<String,String> getCustomerTenantHeaders(){ + Map<String, String> headers = new HashMap<>(); + headers.put("data-partition-id", Config.Instance().ClientTenant); + return headers; + } +} diff --git a/testing/notification-test-ibm/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java b/testing/notification-test-ibm/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java index cac092dbefe95654bd8183edc6a5a996c2522d82..6644148731a40c6000aa11d7385676ea4177abf1 100644 --- a/testing/notification-test-ibm/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java +++ b/testing/notification-test-ibm/src/test/java/org/opengroup/osdu/notification/api/TestPubsubEndpointHMAC.java @@ -8,15 +8,22 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; +import org.opengroup.osdu.core.common.notification.SubscriptionAPIConfig; +import org.opengroup.osdu.core.common.notification.SubscriptionFactory; +import org.opengroup.osdu.notification.util.Config; import org.opengroup.osdu.notification.util.IBMTestUtils; import com.sun.jersey.api.client.ClientResponse; public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests { - + private static SubscriptionFactory factory; @BeforeClass public static void classSetup() throws Exception { - PubsubEndpointHMACTests.classSetup(); + descriptor = new PubsubEndpointHMACDescriptor(); + //Configure Register Service Client Library + SubscriptionAPIConfig config = SubscriptionAPIConfig.builder().rootUrl(Config.Instance().RegisterServicePath).build(); + config.setApiKey("apiKey"); + factory = new SubscriptionFactory(config); } @AfterClass @@ -36,6 +43,8 @@ public class TestPubsubEndpointHMAC extends PubsubEndpointHMACTests { } @Override + @Test + @Ignore public void should_return400_when_makingHttpRequestWithoutToken()throws Exception{ ClientResponse response = descriptor.run(getArg(), ""); assertEquals(error( response.getEntity(String.class)), 403, response.getStatus());