diff --git a/pom.xml b/pom.xml index aea56108b012fc94d56edcc6562f4956ab6e0dc4..fb48d9a851ff5a33402e45fd76dd426bf5e2bd09 100644 --- a/pom.xml +++ b/pom.xml @@ -136,13 +136,13 @@ https://community.opengroup.org/api/v4/groups/17/-/packages/maven </repo.releases.url> <publish.snapshots.url> - https://community.opengroup.org/api/v4/projects/74/packages/maven + https://community.opengroup.org/api/v4/projects/1468/packages/maven </publish.snapshots.url> <publish.releases.url> - https://community.opengroup.org/api/v4/projects/74/packages/maven + https://community.opengroup.org/api/v4/projects/1468/packages/maven </publish.releases.url> </properties> </profile> </profiles> -</project> \ No newline at end of file +</project> diff --git a/testing/maven/settings.xml b/testing/maven/settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..39cd52cc8835efe8edac9fc0be08ff848ac252d0 --- /dev/null +++ b/testing/maven/settings.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> + <servers> + <server> + <id>os-core</id> + <username>slb-des-ext-collaboration</username> + <password>${VSTS_FEED_TOKEN}</password> + </server> + </servers> +</settings> \ No newline at end of file diff --git a/testing/pom.xml b/testing/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..1f1a42c35c61bebe1df1b1f063e1f1e21ea182dd --- /dev/null +++ b/testing/pom.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2017-2019, Schlumberger + + 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. +--> +<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> + <groupId>org.opengroup.osdu</groupId> + <artifactId>pws-testing</artifactId> + <version>0.26.0-SNAPSHOT</version> + <description>Root Project and workflow Service project</description> + <packaging>pom</packaging> + <licenses> + <license> + <name>Apache License, Version 2.0</name> + <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url> + <distribution>repo</distribution> + </license> + </licenses> + <modules> + <module>pws-test-core</module> + <module>pws-test-aws</module> + </modules> + + <properties> + <maven.compiler.target>17</maven.compiler.target> + <maven.compiler.source>17</maven.compiler.source> + <os-core-common.version>0.25.0</os-core-common.version> + <java.version>17</java.version> + <jackson.version>2.13.2</jackson.version> + <jackson-databind.version>2.13.2.2</jackson-databind.version> + <maven-surefire-plugin.version>3.0.0-M3</maven-surefire-plugin.version> + </properties> + + <repositories> + <repository> + <id>${repo.releases.id}</id> + <url>${repo.releases.url}</url> + </repository> + </repositories> + + <distributionManagement> + <repository> + <id>${publish.releases.id}</id> + <url>${publish.releases.url}</url> + </repository> + <snapshotRepository> + <id>${publish.snapshots.id}</id> + <url>${publish.snapshots.url}</url> + </snapshotRepository> + </distributionManagement> + + <profiles> + <profile> + <id>Default</id> + <activation> + <property> + <name>!repo.releases.id</name> + </property> + </activation> + <properties> + <repo.releases.id>community-maven-repo</repo.releases.id> + <publish.snapshots.id>community-maven-via-job-token</publish.snapshots.id> + <publish.releases.id>community-maven-via-job-token</publish.releases.id> + <repo.releases.url>https://community.opengroup.org/api/v4/groups/17/-/packages/maven</repo.releases.url> + <publish.snapshots.url>https://community.opengroup.org/api/v4/projects/1468/packages/maven</publish.snapshots.url> + <publish.releases.url>https://community.opengroup.org/api/v4/projects/1468/packages/maven</publish.releases.url> + </properties> + </profile> + </profiles> +</project> diff --git a/testing/pws-test-aws/build-aws/prepare-dist.sh b/testing/pws-test-aws/build-aws/prepare-dist.sh new file mode 100644 index 0000000000000000000000000000000000000000..a5d437b72f07c4d1996416a24ef8c11fe5c88599 --- /dev/null +++ b/testing/pws-test-aws/build-aws/prepare-dist.sh @@ -0,0 +1,50 @@ +# 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. + +# This script prepares the dist directory for the integration tests. +# Must be run from the root of the repostiory + +# This script prepares the dist directory for the integration tests. +# Must be run from the root of the repostiory + +set -e + +OUTPUT_DIR="${OUTPUT_DIR:-dist}" + +INTEGRATION_TEST_OUTPUT_DIR=${INTEGRATION_TEST_OUTPUT_DIR:-$OUTPUT_DIR}/testing/integration +INTEGRATION_TEST_OUTPUT_BIN_DIR=${INTEGRATION_TEST_OUTPUT_DIR:-$INTEGRATION_TEST_OUTPUT_DIR}/bin +INTEGRATION_TEST_SOURCE_DIR=testing +INTEGRATION_TEST_SOURCE_DIR_AWS="$INTEGRATION_TEST_SOURCE_DIR"/pws-test-aws +INTEGRATION_TEST_SOURCE_DIR_CORE="$INTEGRATION_TEST_SOURCE_DIR"/pws-test-core +echo "--Source directories variables--" +echo $INTEGRATION_TEST_SOURCE_DIR_AWS +echo $INTEGRATION_TEST_SOURCE_DIR_CORE +echo "--Output directories variables--" +echo $OUTPUT_DIR +echo $INTEGRATION_TEST_OUTPUT_DIR +echo $INTEGRATION_TEST_OUTPUT_BIN_DIR + +rm -rf "$INTEGRATION_TEST_OUTPUT_DIR" +mkdir -p "$INTEGRATION_TEST_OUTPUT_DIR" && mkdir -p "$INTEGRATION_TEST_OUTPUT_BIN_DIR" +echo "Building integration testing assemblies and gathering artifacts..." +mvn -ntp install -f "$INTEGRATION_TEST_SOURCE_DIR_CORE"/pom.xml +mvn -ntp install dependency:copy-dependencies -DskipTests -f "$INTEGRATION_TEST_SOURCE_DIR_AWS"/pom.xml -DincludeGroupIds=org.opengroup.osdu -Dmdep.copyPom +cp "$INTEGRATION_TEST_SOURCE_DIR_AWS"/target/dependency/* "${INTEGRATION_TEST_OUTPUT_BIN_DIR}" +(cd "${INTEGRATION_TEST_OUTPUT_BIN_DIR}" && ls *.jar | sed -e 's/\.jar$//' | xargs -I {} echo mvn -ntp install:install-file -Dfile={}.jar -DpomFile={}.pom >> install-deps.sh) +chmod +x "${INTEGRATION_TEST_OUTPUT_BIN_DIR}"/install-deps.sh +mvn clean -f "$INTEGRATION_TEST_SOURCE_DIR_AWS"/pom.xml +cp -R "$INTEGRATION_TEST_SOURCE_DIR_AWS"/* "${INTEGRATION_TEST_OUTPUT_DIR}"/ + +#copy testing parent pom to output +cp "$INTEGRATION_TEST_SOURCE_DIR/pom.xml" "${OUTPUT_DIR}/testing" diff --git a/testing/pws-test-aws/build-aws/run-tests.sh b/testing/pws-test-aws/build-aws/run-tests.sh new file mode 100644 index 0000000000000000000000000000000000000000..92985742fdca6f57603355c7ec4f5689b0c733b5 --- /dev/null +++ b/testing/pws-test-aws/build-aws/run-tests.sh @@ -0,0 +1,83 @@ +# 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. + +# This script executes the test and copies reports to the provided output directory +# To call this script from the service working directory +# ./dist/testing/integration/build-aws/run-tests.sh "./reports/" + + +SCRIPT_SOURCE_DIR=$(dirname "$0") +echo "Script source location" +echo "$SCRIPT_SOURCE_DIR" +(cd "$SCRIPT_SOURCE_DIR"/../bin && ./install-deps.sh) + +#### ADD REQUIRED ENVIRONMENT VARIABLES HERE ############################################### +# The following variables are automatically populated from the environment during integration testing +# see os-deploy-aws/build-aws/integration-test-env-variables.py for an updated list + +### DYNAMIC PARMETERS ### +# AWS_COGNITO_CLIENT_ID +# ELASTIC_HOST +# ELASTIC_PORT +# FILE_URL +# LEGAL_URL +# TENANT_GROUP_NAME +# SEARCH_URL +# LEGAL_QUEUE +# LEGAL_S3_BUCKET + +### STATIC PARAMETERS ###: KEEP IN ALPHABETICAL ORDER +# ** DO NOT ADD VARIABLES NOT USED BY THIS SERVICE!!!! ** +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_CLIENT_ID=$AWS_COGNITO_CLIENT_ID +if [ -z "$LEGAL_S3_ENDPOINT" ] +then + export AWS_S3_ENDPOINT=s3.$AWS_REGION.amazonaws.com +else + export AWS_S3_ENDPOINT=$LEGAL_S3_ENDPOINT +fi + +export AWS_S3_REGION=$AWS_REGION +if [ -z "$LEGAL_DYNAMODB_ENDPOINT" ] +then + export DYNAMO_DB_ENDPOINT=dynamodb.$AWS_REGION.amazonaws.com +else + export DYNAMO_DB_ENDPOINT=$LEGAL_DYNAMODB_ENDPOINT + +fi +export DYNAMO_DB_REGION=$AWS_REGION +export HOST_URL=$LEGAL_URL +export MY_TENANT=int-test-legal +export S3_LEGAL_CONFIG_BUCKET=$LEGAL_S3_BUCKET +export SKIP_HTTP_TESTS=true +export TABLE_PREFIX=$TENANT_GROUP_NAME + + +#### RUN INTEGRATION TEST ######################################################################### +JAVA_HOME=$JAVA17_HOME + +mvn -ntp test -f "$SCRIPT_SOURCE_DIR"/../pom.xml +TEST_EXIT_CODE=$? + +#### COPY TEST REPORTS ######################################################################### + +if [ -n "$1" ] + then + mkdir -p "$1" + cp -R "$SCRIPT_SOURCE_DIR"/../target/surefire-reports "$1" +fi + +exit $TEST_EXIT_CODE diff --git a/testing/pws-test-aws/pom.xml b/testing/pws-test-aws/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..196edf97faaabdc551ceef21a5ddeb6038b297ab --- /dev/null +++ b/testing/pws-test-aws/pom.xml @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<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"> + <parent> + <groupId>org.opengroup.osdu</groupId> + <artifactId>pws-testing</artifactId> + <version>0.26.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + + <groupId>org.opengroup.osdu.pws</groupId> + <artifactId>pws-test-aws</artifactId> + <version>0.26.0-SNAPSHOT</version> + <packaging>jar</packaging> + + <properties> + <maven.compiler.target>17</maven.compiler.target> + <maven.compiler.source>17</maven.compiler.source> + <java.version>17</java.version> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.main.basedir>${project.basedir}</project.main.basedir> + </properties> + <dependencies> + <!-- Internal packages --> + <dependency> + <groupId>org.opengroup.osdu.core.aws</groupId> + <artifactId>os-core-lib-aws</artifactId> + <version>0.26.0-rc2</version> + </dependency> + + <dependency> + <groupId>org.opengroup.osdu</groupId> + <artifactId>os-core-common</artifactId> + <version>${os-core-common.version}</version> + </dependency> + + <dependency> + <groupId>org.opengroup.osdu.storage</groupId> + <artifactId>storage-test-core</artifactId> + <version>0.26.0-SNAPSHOT</version> + </dependency> + + <!-- third party Apache 2.0 license packages --> + <dependency> + <groupId>javax.json</groupId> + <artifactId>javax.json-api</artifactId> + <version>1.1.2</version> + </dependency> + <dependency> + <groupId>org.glassfish</groupId> + <artifactId>javax.json</artifactId> + <version>1.1.2</version> + </dependency> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-client</artifactId> + <version>1.19.4</version> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.10.1</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + <version>${jackson.version}</version> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + <version>${jackson-databind.version}</version> + </dependency> + <dependency> + <groupId>io.jsonwebtoken</groupId> + <artifactId>jjwt</artifactId> + <version>0.9.1</version> + <exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> + <version>4.5.2</version> + <scope>runtime</scope> + </dependency> + + <!-- Tests --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>${maven-surefire-plugin.version}</version> + <executions> + <execution> + <phase>integration-test</phase> + <goals> + <goal>test</goal> + </goals> + <configuration> + <excludes> + <exclude>none</exclude> + </excludes> + <includes> + <include>**/pws</include> + </includes> + </configuration> + </execution> + </executions> + <configuration> + <trimStackTrace>false</trimStackTrace> + <systemPropertyVariables> + <buildDirectory>${project.build.directory}</buildDirectory> + </systemPropertyVariables> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/testing/pws-test-aws/src/test/resources/logback-test.xml b/testing/pws-test-aws/src/test/resources/logback-test.xml new file mode 100644 index 0000000000000000000000000000000000000000..dafd8ae394dc34b62ffa81307a76900db4b66af8 --- /dev/null +++ b/testing/pws-test-aws/src/test/resources/logback-test.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration> + <include resource="org/springframework/boot/logging/logback/base.xml" /> + <root level="INFO" /> + <logger name="org.springframework" level="INFO"/> +</configuration> \ No newline at end of file diff --git a/testing/pws-test-core/pom.xml b/testing/pws-test-core/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..db104a1d716c27b9d18de7ef6c68857a8d1d59df --- /dev/null +++ b/testing/pws-test-core/pom.xml @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright 2017-2019, Schlumberger + + 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. +--> +<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"> + <parent> + <groupId>org.opengroup.osdu</groupId> + <artifactId>pws-testing</artifactId> + <version>0.26.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <modelVersion>4.0.0</modelVersion> + <groupId>org.opengroup.osdu.pws</groupId> + <artifactId>pws-test-core</artifactId> + <version>0.26.0-SNAPSHOT</version> + <packaging>jar</packaging> + + <properties> + <maven.compiler.target>17</maven.compiler.target> + <maven.compiler.source>17</maven.compiler.source> + <java.version>17</java.version> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.main.basedir>${project.basedir}</project.main.basedir> + </properties> + + <dependencies> + <dependency> + <groupId>com.sun.jersey</groupId> + <artifactId>jersey-client</artifactId> + <version>1.19.4</version> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + <version>1.18.26</version> + </dependency> + <!-- https://mvnrepository.com/artifact/junit/junit --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.12</version> + </dependency> + <dependency> + <groupId>au.com.dius</groupId> + <artifactId>pact-jvm-provider-junit_2.12</artifactId> + <version>3.5.5</version> + </dependency> + <dependency> + <groupId>org.opengroup.osdu</groupId> + <artifactId>os-core-common</artifactId> + <version>${os-core-common.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.httpcomponents.client5</groupId> + <artifactId>httpclient5</artifactId> + <version>5.2.1</version> + </dependency> + <dependency> + <groupId>com.google.code.gson</groupId> + <artifactId>gson</artifactId> + <version>2.9.1</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.1</version> + </plugin> + </plugins> + </build> +</project>