Skip to content

Commit

Permalink
Merge pull request #1514 from kameshsr/MOSIP-34016-2
Browse files Browse the repository at this point in the history
Mosip-34016 Merge java 21 changes to develop
  • Loading branch information
ckm007 authored Jul 4, 2024
2 parents a27aa1f + 9f5130b commit 2c7afcd
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 163 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/authdemo-push-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:

jobs:
build-maven-authentication-demo-service:
uses: mosip/kattu/.github/workflows/maven-build.yml@master
uses: mosip/kattu/.github/workflows/maven-build.yml@master-java21
with:
SERVICE_LOCATION: ./authentication-demo-service
BUILD_ARTIFACT: authentication-demo-service
Expand All @@ -45,7 +45,7 @@ jobs:
BUILD_ARTIFACT: 'authentication-demo-service'
fail-fast: false
name: ${{ matrix.SERVICE_NAME }}
uses: mosip/kattu/.github/workflows/docker-build.yml@master
uses: mosip/kattu/.github/workflows/docker-build.yml@master-java21
with:
SERVICE_LOCATION: ${{ matrix.SERVICE_LOCATION }}
SERVICE_NAME: ${{ matrix.SERVICE_NAME }}
Expand All @@ -59,7 +59,7 @@ jobs:
publish_to_nexus:
if: "${{ !contains(github.ref, 'master') && github.event_name != 'pull_request' && github.event_name != 'release' && github.event_name != 'prerelease' && github.event_name != 'publish' }}"
needs: build-maven-authentication-demo-service
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master
uses: mosip/kattu/.github/workflows/maven-publish-to-nexus.yml@master-java21
with:
SERVICE_LOCATION: ./authentication-demo-service
secrets:
Expand All @@ -72,9 +72,9 @@ jobs:


sonar_analysis:
if: "${{ github.event_name != 'pull_request' }}"
needs: build-maven-authentication-demo-service
if: "${{ github.event_name != 'pull_request' }}"
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master
uses: mosip/kattu/.github/workflows/maven-sonar-analysis.yml@master-java21
with:
SERVICE_LOCATION: ./authentication-demo-service
secrets:
Expand Down
29 changes: 13 additions & 16 deletions authentication-demo-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:11
FROM eclipse-temurin:21-jre-alpine

ARG SOURCE
ARG COMMIT_HASH
Expand Down Expand Up @@ -46,38 +46,35 @@ ARG container_user=mosip
ARG container_user_group=mosip

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_uid=1001
ARG container_user_uid=1002

# can be passed during Docker build as build time environment for github branch to pickup configuration from.
ARG container_user_gid=1001

# install packages and create user
RUN apt-get -y update \
&& apt-get install -y unzip \
&& groupadd -g ${container_user_gid} ${container_user_group} \
&& useradd -u ${container_user_uid} -g ${container_user_group} -s /bin/sh -m ${container_user}

# set working directory for the user
WORKDIR /home/${container_user}

ENV work_dir=/home/${container_user}

ARG loader_path=${work_dir}/additional_jars/

RUN mkdir -p ${loader_path}

ENV loader_path_env=${loader_path}

COPY ./target/authentication-demo-service-*.jar authentication-demo-service.jar

ADD entrypoint.sh $work_dir/entrypoint.sh

RUN chmod +x $work_dir/entrypoint.sh

# change permissions of file inside working dir
RUN chown -R ${container_user}:${container_user} /home/${container_user} /usr/local/openjdk-11/lib/security/cacerts

RUN chmod 644 /usr/local/openjdk-11/lib/security/cacerts
# install packages and create user
RUN apk -q update \
&& apk add -q unzip wget bash \
&& addgroup -g ${container_user_gid} ${container_user_group} \
&& adduser -s /bin/sh -u ${container_user_uid} -G ${container_user_group} -h /home/${container_user} --disabled-password ${container_user} \
&& mkdir -p ${loader_path} \
&& chmod +x $work_dir/entrypoint.sh \
&& mkdir -p /usr/local/openjdk-21/lib/security && touch /usr/local/openjdk-21/lib/security/cacerts \
&& chown ${container_user}:${container_user} /usr/local/openjdk-21/lib/security/cacerts \
&& chmod 644 /usr/local/openjdk-21/lib/security/cacerts \
&& chown -R ${container_user}:${container_user} /home/${container_user}

# select container user for all tasks
USER ${container_user_uid}:${container_user_gid}
Expand Down
82 changes: 49 additions & 33 deletions authentication-demo-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


<groupId>io.mosip.testrig.authentication.demo</groupId>
<version>1.2.0.1-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
<artifactId>authentication-demo-service</artifactId>
<name>authentication-demo-service</name>
<description>Parent project of MOSIP functional tests</description>
Expand Down Expand Up @@ -62,18 +62,18 @@

<properties>
<!-- Maven Plugins -->
<spring.boot.version>2.0.2.RELEASE</spring.boot.version>
<spring.boot.version>3.2.3</spring.boot.version>
<spring-cloud-config.version>2.0.0.RELEASE</spring-cloud-config.version>

<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.version>3.8.0</maven.compiler.version>
<maven.javadoc.version>3.0.1</maven.javadoc.version>
<maven.swagger.version>2.9.2</maven.swagger.version>
<maven.jacoco.version>0.8.2</maven.jacoco.version>
<sonar.skip>true</sonar.skip>

<kernel-websubclient-api.version>1.2.0.1-SNAPSHOT</kernel-websubclient-api.version>
<kernel-websubclient-api.version>1.2.1-SNAPSHOT</kernel-websubclient-api.version>

</properties>

Expand All @@ -82,27 +82,14 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
Expand All @@ -112,13 +99,12 @@
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<version>2.22.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.mosip.authentication</groupId>
<artifactId>authentication-core</artifactId>
<version>1.2.0.1-B3</version>
<version>1.2.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
Expand All @@ -129,19 +115,17 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.23.4</version>
</dependency>

<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-core</artifactId>
<version>1.2.0.1-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
Expand All @@ -164,13 +148,11 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.7</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
Expand All @@ -193,7 +175,6 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.tensorflow</groupId>
Expand Down Expand Up @@ -221,22 +202,19 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-templatemanager-velocity</artifactId>
<version>1.2.0.1-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
<version>${spring-cloud-config.version}</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.1</version>
</dependency>
<dependency>
<groupId>com.github.jai-imageio</groupId>
Expand All @@ -251,7 +229,7 @@
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-keymanager-service</artifactId>
<version>1.2.0.1-SNAPSHOT</version>
<version>1.2.1-SNAPSHOT</version>
<classifier>lib</classifier>
<exclusions>
<exclusion>
Expand All @@ -267,7 +245,27 @@
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.5.0</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.mosip.kernel</groupId>
<artifactId>kernel-bom</artifactId>
<version>1.2.1-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -327,8 +325,27 @@
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
<configuration>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/service-git.properties</generateGitPropertiesFilename>
<includeOnlyProperties>
<includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
<includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
</includeOnlyProperties>
<commitIdGenerationMode>full</commitIdGenerationMode>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<!-- <format>json</format> -->
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand All @@ -341,7 +358,6 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${maven.jacoco.version}</version>
<configuration>
<excludes>
<exclude>**/constant/**</exclude>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package io.mosip.testrig.authentication.demo.service;

import io.mosip.kernel.templatemanager.velocity.builder.TemplateManagerBuilderImpl;
import io.mosip.kernel.websub.api.client.PublisherClientImpl;
import io.mosip.kernel.websub.api.client.SubscriberClientImpl;
import io.mosip.kernel.websub.api.config.publisher.RestTemplateHelper;
import org.apache.velocity.app.VelocityEngine;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -15,7 +19,8 @@
* @author Dinesh Karuppiah
*/
@SpringBootApplication
@Import(value = { TemplateManagerImpl.class, VelocityEngine.class, SwaggerConfig.class, CryptoCore.class})
@Import(value = { TemplateManagerImpl.class, VelocityEngine.class, SwaggerConfig.class, CryptoCore.class, TemplateManagerBuilderImpl.class,
PublisherClientImpl.class, RestTemplateHelper.class, SubscriberClientImpl.class})
public class PartnerDemoApplication {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.mosip.testrig.authentication.demo.service.config;

import javax.annotation.PostConstruct;
import jakarta.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.mosip.testrig.authentication.demo.service.config;

import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import lombok.Data;

/**
* @author Kamesh Shekhar prasad
*/

@Configuration
@ConfigurationProperties(prefix = "openapi")
@Data
public class OpenApiProperties {
private InfoProperty info;
private AuthDemoServiceServer authDemoServiceServer;
}

@Data
class InfoProperty {
private String title;
private String description;
private String version;
private LicenseProperty license;
}

@Data
class LicenseProperty {
private String name;
private String url;
}

@Data
class AuthDemoServiceServer {
private List<Server> servers;
}

@Data
class Server {
private String description;
private String url;
}
Loading

0 comments on commit 2c7afcd

Please sign in to comment.