diff --git a/pre-registration-booking-service/Dockerfile b/pre-registration-booking-service/Dockerfile index 00658c85e77..4d669da677d 100644 --- a/pre-registration-booking-service/Dockerfile +++ b/pre-registration-booking-service/Dockerfile @@ -49,16 +49,16 @@ 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} +RUN apk -q update \ +&& apk add -q unzip wget \ +&& 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} # set working directory for the user WORKDIR /home/${container_user} diff --git a/pre-registration-booking-service/pom.xml b/pre-registration-booking-service/pom.xml index 17a524e3f2e..5cb75887f1a 100644 --- a/pre-registration-booking-service/pom.xml +++ b/pre-registration-booking-service/pom.xml @@ -259,6 +259,19 @@ com.fasterxml.jackson.datatype jackson-datatype-jsr310 + + org.junit.vintage + junit-vintage-engine + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.5.0 + + + org.hibernate.validator + hibernate-validator + @@ -272,7 +285,11 @@ ${skipTests} false - ${argLine} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --illegal-access=permit + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens java.base/java.lang=ALL-UNNAMED + --illegal-access=debug + --enable-preview diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailabilityPK.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailabilityPK.java index 8c7f2ae7e1a..609d103bb30 100644 --- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailabilityPK.java +++ b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailabilityPK.java @@ -8,8 +8,8 @@ import java.time.LocalDate; import java.time.LocalTime; -import javax.persistence.Column; -import javax.persistence.Embeddable; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; import lombok.Getter; import lombok.Setter; diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailibityEntity.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailibityEntity.java index 601415e030f..1b620d6aaff 100644 --- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailibityEntity.java +++ b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/entity/AvailibityEntity.java @@ -10,14 +10,14 @@ import java.time.LocalDateTime; import java.time.LocalTime; -import javax.persistence.AttributeOverride; -import javax.persistence.AttributeOverrides; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.IdClass; -import javax.persistence.NamedQuery; -import javax.persistence.Table; +import jakarta.persistence.AttributeOverride; +import jakarta.persistence.AttributeOverrides; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.IdClass; +import jakarta.persistence.NamedQuery; +import jakarta.persistence.Table; import org.springframework.stereotype.Component; diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/util/BookingExceptionHandler.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/util/BookingExceptionHandler.java index ded9fabba60..32cb4f48226 100644 --- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/util/BookingExceptionHandler.java +++ b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/exception/util/BookingExceptionHandler.java @@ -12,8 +12,8 @@ import java.util.List; import java.util.Map; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletRequest; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/BookingAvailabilityRepository.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/BookingAvailabilityRepository.java index 92e51fd14f9..bc26f3f783d 100644 --- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/BookingAvailabilityRepository.java +++ b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/repository/BookingAvailabilityRepository.java @@ -9,7 +9,7 @@ import java.util.List; import javax.transaction.Transactional; -import javax.persistence.LockModeType; +import jakarta.persistence.LockModeType; import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Lock; diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/BookingService.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/BookingService.java index f56bdad203d..0df8281bb3d 100644 --- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/BookingService.java +++ b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/BookingService.java @@ -13,7 +13,7 @@ import java.util.TreeMap; import java.util.stream.Collectors; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.apache.commons.lang3.exception.ExceptionUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/util/BookingServiceUtil.java b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/util/BookingServiceUtil.java index 6b9520e2c6b..476ec528d18 100644 --- a/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/util/BookingServiceUtil.java +++ b/pre-registration-booking-service/src/main/java/io/mosip/preregistration/booking/service/util/BookingServiceUtil.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.TimeZone; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/pre-registration-booking-service/src/test/java/io/mosip/preregistration/booking/test/config/TestConfig.java b/pre-registration-booking-service/src/test/java/io/mosip/preregistration/booking/test/config/TestConfig.java index 02ad2a18d25..b124c76179e 100644 --- a/pre-registration-booking-service/src/test/java/io/mosip/preregistration/booking/test/config/TestConfig.java +++ b/pre-registration-booking-service/src/test/java/io/mosip/preregistration/booking/test/config/TestConfig.java @@ -7,9 +7,11 @@ import javax.net.ssl.SSLContext; -import org.apache.http.conn.ssl.SSLConnectionSocketFactory; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.apache.hc.client5.http.impl.classic.HttpClients; +import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder; +import org.apache.hc.client5.http.io.HttpClientConnectionManager; +import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory; import org.apache.http.ssl.TrustStrategy; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -29,8 +31,11 @@ public RestTemplate selfTokenRestTemplate() SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext); - CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build(); - HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); + HttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create() + .setSSLSocketFactory(csf).build(); + CloseableHttpClient httpClient = HttpClients.custom().setConnectionManager(connectionManager).build(); + HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); + requestFactory.setHttpClient(httpClient); return new RestTemplate(requestFactory); diff --git a/pre-registration-booking-service/src/test/java/io/mosip/preregistration/booking/test/config/TestSecurityConfig.java b/pre-registration-booking-service/src/test/java/io/mosip/preregistration/booking/test/config/TestSecurityConfig.java index 5058fd3913f..0844e19fb5f 100644 --- a/pre-registration-booking-service/src/test/java/io/mosip/preregistration/booking/test/config/TestSecurityConfig.java +++ b/pre-registration-booking-service/src/test/java/io/mosip/preregistration/booking/test/config/TestSecurityConfig.java @@ -4,7 +4,7 @@ // import java.util.Arrays; // import java.util.List; -// import javax.servlet.http.HttpServletResponse; +// import jakarta.servlet.http.HttpServletResponse; // import org.springframework.context.annotation.Bean; // import org.springframework.context.annotation.Configuration; @@ -27,7 +27,8 @@ // @EnableWebSecurity // @EnableGlobalMethodSecurity(prePostEnabled = true) // @Order(2) -// public class TestSecurityConfig extends WebSecurityConfigurerAdapter { +// @EnableMethodSecurity +// public class TestSecurityConfig @EnableGlobalMethodSecurity(prePostEnabled = true){ @@ -63,6 +64,11 @@ // return (request, response, authException) -> response.sendError(HttpServletResponse.SC_UNAUTHORIZED); // } +// @Bean +// protected SecurityFilterChain configureSecurityFilterChain(final HttpSecurity httpSecurity) throws Exception { +// return httpSecurity.build(); +// } + // @Bean // public UserDetailsService userDetailsService() { // List users = new ArrayList<>(); diff --git a/pre-registration-booking-service/src/test/resources/application.properties b/pre-registration-booking-service/src/test/resources/application.properties index 3463fcd79eb..d4acae55f79 100644 --- a/pre-registration-booking-service/src/test/resources/application.properties +++ b/pre-registration-booking-service/src/test/resources/application.properties @@ -167,4 +167,6 @@ mosip.iam.adapter.clientid=mosip-prereg-client mosip.iam.adapter.clientsecret=abc123 mosip.iam.adapter.appid=prereg # URL to get new Auth Token from OIDC provider & to do online validation of auth token with OIDC provider. -auth.server.admin.issuer.uri=https://dev.mosip.net/keycloak/auth/realms/ \ No newline at end of file +auth.server.admin.issuer.uri=https://dev.mosip.net/keycloak/auth/realms/ + +spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER \ No newline at end of file