Abdelkader Mrimed
11/18/2024, 9:38 AMLee Turner
11/18/2024, 9:46 AMAbdelkader Mrimed
11/18/2024, 10:08 AMAbdelkader Mrimed
11/18/2024, 10:09 AMLee Turner
11/18/2024, 10:19 AM--add-exports=java.base/sun.security.x509=ALL-UNNAMED
Abdelkader Mrimed
11/18/2024, 10:25 AMLee Turner
11/18/2024, 10:28 AMAbdelkader Mrimed
11/18/2024, 10:31 AMdependencies {
//lombok
compileOnly 'org.projectlombok:lombok'
implementation 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
//mapstruct
implementation 'org.mapstruct:mapstruct:1.5.2.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.2.Final'
compileOnly 'jakarta.annotation:jakarta.annotation-api:2.1.1'
// wiremock
implementation 'org.wiremock:wiremock:3.6.0'
implementation 'org.eclipse.jetty:jetty-server'
implementation 'org.eclipse.jetty:jetty-servlet'
// flyway
implementation 'org.flywaydb:flyway-core'
// casbin
implementation 'org.casbin:casbin-spring-boot-starter:0.4.4'
implementation "org.casbin:jdbc-adapter:2.4.1"
// start keycloak dependency
implementation 'org.keycloak:keycloak-spring-boot-starter:25.0.3'
implementation 'org.keycloak:keycloak-admin-client:25.0.3'
// end keycloak dependency
// <https://mvnrepository.com/artifact/com.google.code.gson/gson>
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1'
//Jwt
implementation 'io.jsonwebtoken:jjwt:0.9.1'
// start unit test dependencies
implementation 'junit:junit:4.13.1'
testImplementation "com.intuit.karate:karate-apache:0.9.6"
testImplementation 'com.intuit.karate:karate-junit5:1.1.0'
testImplementation 'com.auth0:java-jwt:3.19.1'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
}
this is my build.gradleLee Turner
11/18/2024, 10:32 AMAbdelkader Mrimed
11/18/2024, 10:41 AMbuildscript {
ext {
protobufVersion = '3.14.0'
protobufPluginVersion = '0.8.18'
grpcVersion = '1.49.2'
}
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.14'
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.4.1")
}
}
plugins {
id 'java-library'
id 'com.google.protobuf' version "${protobufPluginVersion}"
id 'org.springframework.boot' version '3.2.4'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
}
version = '0.0.1-SNAPSHOT'
java {
sourceCompatibility = '17.0.8'
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom 'org.eclipse.jetty:jetty-bom:11.0.20'
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'io.micrometer:micrometer-registry-prometheus'
runtimeOnly 'org.postgresql:postgresql:42.7.3'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.graalvm.js:js:21.3.0'
implementation 'org.graalvm.js:js-scriptengine:21.3.0'
implementation 'org.hibernate.validator:hibernate-validator:8.0.1.Final'
implementation "io.grpc:grpc-protobuf:${grpcVersion}"
implementation "io.grpc:grpc-stub:${grpcVersion}"
implementation 'javax.annotation:javax.annotation-api:1.3.2'
implementation 'com.google.protobuf:protobuf-java:3.24.4'
implementation 'net.devh:grpc-spring-boot-starter:2.15.0.RELEASE'
implementation 'net.devh:grpc-server-spring-boot-starter:2.15.0.RELEASE'
api "io.grpc:grpc-netty:${grpcVersion}"
api "io.grpc:grpc-protobuf:${grpcVersion}"
api "io.grpc:grpc-stub:${grpcVersion}"
api "io.grpc:grpc-all:${grpcVersion}"
api "io.grpc:grpc-okhttp:${grpcVersion}"
api('org.springframework.boot:spring-boot-starter')
//lombok
compileOnly 'org.projectlombok:lombok'
implementation 'org.springframework.boot:spring-boot-devtools'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
//mapstruct
implementation 'org.mapstruct:mapstruct:1.5.2.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.2.Final'
compileOnly 'jakarta.annotation:jakarta.annotation-api:2.1.1'
// wiremock
implementation 'org.wiremock:wiremock:3.6.0'
implementation 'org.eclipse.jetty:jetty-server'
implementation 'org.eclipse.jetty:jetty-servlet'
// flyway
implementation 'org.flywaydb:flyway-core'
// casbin
implementation 'org.casbin:casbin-spring-boot-starter:0.4.4'
implementation "org.casbin:jdbc-adapter:2.4.1"
// start keycloak dependency
implementation 'org.keycloak:keycloak-spring-boot-starter:25.0.3'
implementation 'org.keycloak:keycloak-admin-client:25.0.3'
// end keycloak dependency
// <https://mvnrepository.com/artifact/com.google.code.gson/gson>
implementation group: 'com.google.code.gson', name: 'gson', version: '2.10.1'
//Jwt
implementation 'io.jsonwebtoken:jjwt:0.9.1'
// start unit test dependencies
implementation 'junit:junit:4.13.1'
testImplementation "com.intuit.karate:karate-apache:0.9.6"
testImplementation 'com.intuit.karate:karate-junit5:1.1.0'
testImplementation 'com.auth0:java-jwt:3.19.1'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.2'
testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
}
jar {
enabled = false
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:${protobufVersion}"
}
plugins {
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
all()*.plugins {
grpc {}
}
}
}
sourceSets {
main {
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
}
}
test {
resources {
srcDir file('src/test/java')
exclude '**/*.java'
}
}
}
// to lunch build: ./gradlew build
test {
useJUnitPlatform {
finalizedBy jacocoTestReport // report is always generated after tests run
excludeTags("karateLocal")
excludeTags("karateITG")
exclude '**/*IntegrationTest*'
// exclude any test class whose name contains the string "IntegrationTest" from running during the build process
}
}
task integrationTest(type: Test) {
useJUnitPlatform {
include '**/*IntegrationTest*'
}
}
// to lunch karate tests on ITG env: ./gradlew karateITG
task karateITGTest(type: Test) {
useJUnitPlatform {
includeTags('karateITG')
}
}
// to lunch karate tests on Local env: ./gradlew karateLocal
task karateLocalTest(type: Test) {
useJUnitPlatform {
includeTags('karateLocal')
}
}
}
Lee Turner
11/18/2024, 10:47 AMLee Turner
11/18/2024, 10:49 AMDockerFile
in your project?Lee Turner
11/18/2024, 10:51 AMAbdelkader Mrimed
11/18/2024, 12:32 PMpublic WireMockServer createRecording(int port, String targetBaseUrl) {
<http://log.info|log.info>("enter in Component");
WireMockServer wireMockServer = new WireMockServer(
WireMockConfiguration.wireMockConfig()
.port(port)
.enableBrowserProxying(true)
);
wireMockServer.startRecording(targetBaseUrl);
return wireMockServer;
}
Abdelkader Mrimed
11/18/2024, 12:32 PMAbdelkader Mrimed
11/18/2024, 12:34 PM#First stage: build jar
FROM gradle:8.5-jdk17 AS builder
# add build files
WORKDIR /app
COPY build.gradle settings.gradle ./
COPY src/ src/
# build application
RUN gradle clean build --no-daemon
# Second stage: build docker image
FROM openjdk:17-jdk-alpine
# Copy the application JAR into the Docker image
COPY --from=builder /app/build/libs/*.jar app.jar
ENTRYPOINT ["java", "-jar", "app.jar"]
Lee Turner
11/18/2024, 1:28 PMAbdelkader Mrimed
11/19/2024, 7:40 AMbuild.gradle
file:
implementation 'org.wiremock:wiremock:3.6.0'
.
Afterward, I created a new WireMock instance for recording.