diff --git a/notification-core/pom.xml b/notification-core/pom.xml index 593971887ecc6a037e6529607a597bbb6834ce16..95e15e930f492596aa54edaa5ae1302a95e0133a 100644 --- a/notification-core/pom.xml +++ b/notification-core/pom.xml @@ -32,7 +32,7 @@ </parent> <properties> - <java.version>8</java.version> + <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> @@ -76,7 +76,7 @@ <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> - <version>1.18.8</version> + <version>1.18.26</version> <scope>provided</scope> </dependency> <dependency> @@ -285,7 +285,7 @@ <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> - <version>0.8.2</version> + <version>0.8.10</version> <configuration> <excludes> <exclude>**/models/*</exclude> @@ -316,6 +316,7 @@ <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> + <version>0.8.10</version> <reportSets> <reportSet> <reports> diff --git a/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationFilterTest.java b/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationFilterTest.java index 5ae208b775bc12e82bf8153278d2f95891c67cd1..eb486ad3543bccf3621dc6e19c7da1ef1012694b 100644 --- a/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationFilterTest.java +++ b/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationFilterTest.java @@ -37,8 +37,8 @@ import java.util.Map; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationServiceEntitlementsTest.java b/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationServiceEntitlementsTest.java index 722c856aa9267b95ddfcae9252ec50641ced47b0..519170d6d8b282cefaac777fd9b8677c2911c8ef 100644 --- a/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationServiceEntitlementsTest.java +++ b/notification-core/src/test/java/org/opengroup/osdu/notification/auth/AuthorizationServiceEntitlementsTest.java @@ -40,7 +40,7 @@ import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; @RunWith(PowerMockRunner.class) diff --git a/pom.xml b/pom.xml index 4f36ab1a3c21dec3a5d68c13a9a6a9020955d193..7ccdf17f8bc4be1815d3e42d3578df3d47b84008 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ <description>Root Notification Service project</description> <properties> - <java.version>8</java.version> + <java.version>17</java.version> <maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.source>${java.version}</maven.compiler.source> <os-core-common.version>0.24.0</os-core-common.version> @@ -104,7 +104,7 @@ <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> - <version>1.18.8</version> + <version>1.18.26</version> <scope>provided</scope> </dependency> <!-- swagger dependency --> @@ -216,6 +216,17 @@ </generateGitPropertiesFilename> </configuration> </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0</version> + <configuration> + <argLine> + @{argLine} --add-opens java.base/java.util=ALL-UNNAMED + --add-opens java.base/java.lang=ALL-UNNAMED + </argLine> + </configuration> + </plugin> </plugins> </build> </project> diff --git a/provider/notification-aws/build-aws/Dockerfile b/provider/notification-aws/build-aws/Dockerfile index 07b035a53cfe282396db1095e69996e612ad9e23..ad5ef0451173b7d69e42afb1d95c76a1479ccce7 100644 --- a/provider/notification-aws/build-aws/Dockerfile +++ b/provider/notification-aws/build-aws/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # https://docs.spring.io/spring-boot/docs/current/reference/html/deployment.html -FROM amazoncorretto:8 +FROM amazoncorretto:17 ARG JAR_FILE=provider/notification-aws/target/*spring-boot.jar # Harcoding this value since Notification-core requires this variable. AWS does not use it. Might change in future diff --git a/provider/notification-aws/build-aws/buildspec.yaml b/provider/notification-aws/build-aws/buildspec.yaml index 623f56653e3c8073d4b93684f86a18cd390cddcc..20fe43e537f3c3fbabab64fe2dfb10bf484f4d29 100644 --- a/provider/notification-aws/build-aws/buildspec.yaml +++ b/provider/notification-aws/build-aws/buildspec.yaml @@ -32,11 +32,7 @@ phases: runtime-versions: java: corretto8 commands: - # fix error noted here: https://github.com/yarnpkg/yarn/issues/7866 - - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - - if [ $(echo $CODEBUILD_SOURCE_VERSION | grep -c ^refs/heads.*) -eq 1 ]; then echo "Branch name found"; else echo "This build only supports branch builds" && exit 1; fi - - apt-get update -y -qq > /dev/null - - apt-get install -y maven -qq >/dev/null - java -version - mvn -version - mkdir -p /root/.m2 @@ -44,9 +40,6 @@ phases: - export AWS_ACCOUNT_ID=`aws sts get-caller-identity | grep Account | cut -d':' -f 2 | cut -d'"' -f 2` - export AWS_OSDU_DEV_MAVEN_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain $AWS_OSDU_DEV_MAVEN_DOMAIN --domain-owner $AWS_ACCOUNT_ID --query authorizationToken --output text` # Install git secrets - #TODO temporarily adding hotfix, due to https://github.com/awslabs/git-secrets/issues/220 - - export SAY_LOCATION=`ln -s "$(which echo)" say` - - export PATH="$PATH:$SAY_LOCATION" - git clone https://github.com/awslabs/git-secrets.git - cd git-secrets && make install && cd .. @@ -54,7 +47,10 @@ phases: pre_build: commands: - echo "Logging in to Amazon ECR..." - - aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${ECR_REGISTRY} # authenticate with ECR via the AWS CLI + - aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${ECR_REGISTRY} + - echo "Logging into Docker Hub..." + - docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} + build: commands: - export REPO_NAME=${PWD##*/} @@ -76,9 +72,9 @@ phases: - if [ "$GIT_SECRETS_SCAN_RESULT" = "FAILED" ]; then echo "Secrets detected!" && exit 1; fi - echo "Building primary service assemblies..." - - mvn -ntp -B test install -pl .,notification-core,provider/notification-aws -Ddeployment.environment=prod - - mvn sonar:sonar -pl .,provider/notification-aws -Dsonar.scm.provider=git -Dsonar.login=${SONAR_USERNAME} -Dsonar.password=${SONAR_PASSWORD} -Dsonar.branch.name=${BRANCH_NAME} - + - mvn --no-transfer-progress -ntp -B test install -pl .,notification-core,provider/notification-aws -Ddeployment.environment=prod + - mvn --no-transfer-progress sonar:sonar -pl .,provider/notification-aws -Dsonar.scm.provider=git -Dsonar.login=${SONAR_USERNAME} -Dsonar.password=${SONAR_PASSWORD} -Dsonar.branch.name=${BRANCH_NAME} + - echo "Building integration testing assemblies and gathering artifacts..." - ./testing/notification-test-aws/build-aws/prepare-dist.sh @@ -86,9 +82,6 @@ phases: - echo "--Copying Helm Charts to ${OUTPUT_DIR:-dist}--" - rsync -r devops/aws/* "${OUTPUT_DIR:-dist}" - - echo "Logging into Docker Hub..." - - docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} - - echo "Building docker image..." - docker build -f provider/notification-aws/build-aws/Dockerfile -t ${ECR_IMAGE} . - docker tag ${ECR_IMAGE} ${ECR_IMAGE_BRANCH_LATEST} @@ -117,4 +110,4 @@ artifacts: name: ${REPO_NAME}_${BRANCH_NAME}_$(date +%F)_${CODEBUILD_BUILD_NUMBER}.zip cache: paths: - - "/root/.m2/**/*" \ No newline at end of file + - "/root/.m2/**/*" diff --git a/provider/notification-aws/build-aws/entrypoint.sh b/provider/notification-aws/build-aws/entrypoint.sh index 412f71afd92e9c2ed3e50a2863cb5675c8a69b43..c372dfb636e1ff38b9f0c0bf7d89d8ccce695437 100755 --- a/provider/notification-aws/build-aws/entrypoint.sh +++ b/provider/notification-aws/build-aws/entrypoint.sh @@ -1,4 +1 @@ - - - -java $JAVA_OPTS -jar /app.jar \ No newline at end of file +java $JAVA_OPTS --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED -jar /app.jar diff --git a/provider/notification-aws/pom.xml b/provider/notification-aws/pom.xml index a3d63c2d12b67ab71ae93f79a4dfc6bf05d06014..e7b7b2baf64910a02309e80460dd639059012b4c 100644 --- a/provider/notification-aws/pom.xml +++ b/provider/notification-aws/pom.xml @@ -32,7 +32,7 @@ </parent> <properties> - <java.version>8</java.version> + <java.version>17</java.version> <maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.source>${java.version}</maven.compiler.source> <aws.version>1.11.1018</aws.version> diff --git a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/impl/AwsGoogleServiceAccountImpl.java b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/impl/AwsGoogleServiceAccountImpl.java index e4754d9a732588cb8cfbecad64cf7bae76402a11..a2e8107c531fa95d79a48b9ee0a88b4f9d345f99 100644 --- a/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/impl/AwsGoogleServiceAccountImpl.java +++ b/provider/notification-aws/src/main/java/org/opengroup/osdu/notification/provider/aws/impl/AwsGoogleServiceAccountImpl.java @@ -21,7 +21,9 @@ public class AwsGoogleServiceAccountImpl implements IGoogleServiceAccount { @Override // To do: Check if it is to be supported public String getIdToken(String keyString, String audience) { - throw new UnsupportedOperationException(); + // TODO : Check if it is to be supported + + throw new UnsupportedOperationException(); } } diff --git a/provider/notification-azure/pom.xml b/provider/notification-azure/pom.xml index 99c65812d19bd33a23f3eda6668fb591d6485546..36ca5fc9ebb364246dd379a8bf3c77c9d5a0d26a 100644 --- a/provider/notification-azure/pom.xml +++ b/provider/notification-azure/pom.xml @@ -31,10 +31,10 @@ </parent> <properties> - <java.version>8</java.version> + <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.2</jacoco-maven-plugin.version> + <jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version> <osdu.notification-core.version>0.24.0-SNAPSHOT</osdu.notification-core.version> <springframework.version>4.3.0.RELEASE</springframework.version> <reactor.netty.version>0.11.0.RELEASE</reactor.netty.version> @@ -310,6 +310,7 @@ <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> + <version>${jacoco-maven-plugin.version}</version> <reportSets> <reportSet> <reports> @@ -319,6 +320,7 @@ </reportSet> </reportSets> </plugin> + </plugins> </reporting> </project> diff --git a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/GoogleServiceAccountImpl.java b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/GoogleServiceAccountImpl.java index 27232c16675d8466a0d94918c984f6e3951b0d47..ab1027a55ece5a25ad27a030e44b9215200e6c1c 100644 --- a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/GoogleServiceAccountImpl.java +++ b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/util/GoogleServiceAccountImpl.java @@ -16,7 +16,6 @@ package org.opengroup.osdu.notification.provider.azure.util; import org.opengroup.osdu.notification.provider.interfaces.IGoogleServiceAccount; import org.springframework.stereotype.Component; -import sun.reflect.generics.reflectiveObjects.NotImplementedException; @Component public class GoogleServiceAccountImpl implements IGoogleServiceAccount { @@ -25,6 +24,6 @@ public class GoogleServiceAccountImpl implements IGoogleServiceAccount { public String getIdToken(String keyString, String audience) { // TODO : Check if it is to be supported - throw new NotImplementedException(); + throw new UnsupportedOperationException(); } } diff --git a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/GoogleServiceAccountImpTest.java b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/GoogleServiceAccountImpTest.java index a643fb4c4d83e2f268bcdb3ba66e419bcf1c97d6..21506e390511bdd261b252147a73e3624fabc2ff 100644 --- a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/GoogleServiceAccountImpTest.java +++ b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/GoogleServiceAccountImpTest.java @@ -19,7 +19,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; import org.opengroup.osdu.notification.provider.azure.util.GoogleServiceAccountImpl; -import sun.reflect.generics.reflectiveObjects.NotImplementedException; import static org.junit.Assert.fail; @@ -39,7 +38,7 @@ public class GoogleServiceAccountImpTest { // Assert fail("Should throw exception"); } catch (Exception e) { - Assertions.assertEquals(e.getClass(), NotImplementedException.class); + Assertions.assertEquals(e.getClass(), UnsupportedOperationException.class); } } } diff --git a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/ServiceAccountClientImplTest.java b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/ServiceAccountClientImplTest.java index 329b271ab0e2fed22dce1222100b6b32d04c7df1..6516eafa2451d70a8c79d7ddc5e205163fc01029 100644 --- a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/ServiceAccountClientImplTest.java +++ b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/util/ServiceAccountClientImplTest.java @@ -20,8 +20,6 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import org.mockito.junit.jupiter.MockitoExtension; -import org.omg.CORBA.portable.ApplicationException; import org.opengroup.osdu.azure.util.AzureServicePrincipleTokenService; import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.notification.provider.azure.util.ServiceAccountJwtAzureClientImpl; @@ -45,7 +43,7 @@ public class ServiceAccountClientImplTest { private AzureServicePrincipleTokenService azureServicePrincipleTokenService; @Test - public void shouldSuccessfullyGenerateToken() throws UnsupportedEncodingException, ApplicationException { + public void shouldSuccessfullyGenerateToken() throws UnsupportedEncodingException { when(azureServicePrincipleTokenService.getAuthorizationToken()).thenReturn(token); diff --git a/provider/notification-gc/pom.xml b/provider/notification-gc/pom.xml index 5e5f19b935828bb457e1c944aa8175d8e21b35e9..7875c6bbaa82719039f07f6a3ef85f3cd04b8ec0 100644 --- a/provider/notification-gc/pom.xml +++ b/provider/notification-gc/pom.xml @@ -30,7 +30,7 @@ </parent> <properties> - <java.version>8</java.version> + <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> @@ -156,7 +156,7 @@ <plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> - <version>0.7.7.201606060606</version> + <version>0.8.10</version> <executions> <execution> <goals> diff --git a/provider/notification-ibm/pom.xml b/provider/notification-ibm/pom.xml index 6a47ef1e558e24faa58720650033fd376af821bf..478275412360621f65902df0a428fa48c644178a 100644 --- a/provider/notification-ibm/pom.xml +++ b/provider/notification-ibm/pom.xml @@ -29,7 +29,7 @@ </parent> <properties> - <java.version>8</java.version> + <java.version>17</java.version> <maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.source>${java.version}</maven.compiler.source> <undertow-websockets-jsr.version>2.2.11.Final</undertow-websockets-jsr.version> diff --git a/testing/notification-test-aws/pom.xml b/testing/notification-test-aws/pom.xml index 7600686b6324e438f72a29461e1769e1582bff3e..59ba3383f72b9f973bf881a45bf84cb9da11f637 100644 --- a/testing/notification-test-aws/pom.xml +++ b/testing/notification-test-aws/pom.xml @@ -33,7 +33,7 @@ <packaging>jar</packaging> <properties> - <java.version>8</java.version> + <java.version>17</java.version> <maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.source>${java.version}</maven.compiler.source> <jackson-databind.version>2.13.2.2</jackson-databind.version> diff --git a/testing/notification-test-azure/pom.xml b/testing/notification-test-azure/pom.xml index 27e15fdb32e55de936c5a5d2fd6bd01462d9e3d5..314ee478536ffe18c0279031c37475fc69429151 100644 --- a/testing/notification-test-azure/pom.xml +++ b/testing/notification-test-azure/pom.xml @@ -33,7 +33,7 @@ <packaging>jar</packaging> <properties> - <java.version>8</java.version> + <java.version>17</java.version> <maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.source>${java.version}</maven.compiler.source> </properties> diff --git a/testing/notification-test-baremetal/pom.xml b/testing/notification-test-baremetal/pom.xml index e07309f9402fc136c42a48c80ec595ffaa4ea774..ad9ff7fe85bd4f196fb0cb1520a574040cfb88e2 100644 --- a/testing/notification-test-baremetal/pom.xml +++ b/testing/notification-test-baremetal/pom.xml @@ -32,7 +32,7 @@ <packaging>jar</packaging> <properties> - <java.version>8</java.version> + <java.version>17</java.version> <maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.source>${java.version}</maven.compiler.source> </properties> diff --git a/testing/notification-test-core/pom.xml b/testing/notification-test-core/pom.xml index a0b307a87f07b7a738bbb7300ed9f2367c2e8119..9f485d53550e950391d66e52427cc0477aef78df 100644 --- a/testing/notification-test-core/pom.xml +++ b/testing/notification-test-core/pom.xml @@ -33,7 +33,7 @@ <packaging>jar</packaging> <properties> - <java.version>8</java.version> + <java.version>17</java.version> <maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.source>${java.version}</maven.compiler.source> <jackson-databind.version>2.13.2.2</jackson-databind.version> diff --git a/testing/notification-test-gc/pom.xml b/testing/notification-test-gc/pom.xml index f649ef6d3abf116d7c75f59a359827ebff8a7e1c..eb505e811b7fd904caf342a006c7a7af4ab3ca8a 100644 --- a/testing/notification-test-gc/pom.xml +++ b/testing/notification-test-gc/pom.xml @@ -32,7 +32,7 @@ <packaging>jar</packaging> <properties> - <java.version>8</java.version> + <java.version>17</java.version> <maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.source>${java.version}</maven.compiler.source> </properties> @@ -51,7 +51,7 @@ <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> - <version>1.18.8</version> + <version>1.18.26</version> </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> diff --git a/testing/notification-test-ibm/pom.xml b/testing/notification-test-ibm/pom.xml index 4db6c21d43dee341b36179856f3ff2102d1c190b..8617ccffb8c68fb0b8aca3dd785fd453d6b3130f 100644 --- a/testing/notification-test-ibm/pom.xml +++ b/testing/notification-test-ibm/pom.xml @@ -30,7 +30,7 @@ <packaging>jar</packaging> <properties> - <java.version>8</java.version> + <java.version>17</java.version> <maven.compiler.target>${java.version}</maven.compiler.target> <maven.compiler.source>${java.version}</maven.compiler.source> <os-core-lib-ibm.version>0.24.0</os-core-lib-ibm.version>