Skip to content
Snippets Groups Projects
Commit c700f691 authored by Solomon Ayalew's avatar Solomon Ayalew Committed by Chad Leong
Browse files

Upgrade to java 17

(cherry picked from commit 1586ab4d)
parent ad48d782
No related branches found
No related tags found
1 merge request!450Cherry-pick 'Solxget/java 17 test' into release/0.24
Showing
with 50 additions and 48 deletions
......@@ -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>
......
......@@ -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;
......
......@@ -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)
......
......@@ -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>
......@@ -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
......
......@@ -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/**/*"
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
......@@ -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>
......
......@@ -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();
}
}
......
......@@ -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>
......@@ -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();
}
}
......@@ -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);
}
}
}
......@@ -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);
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment