Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
buildscript {
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
Expand All @@ -11,21 +12,25 @@ buildscript {
}

plugins {
id "com.github.ben-manes.versions" version "0.20.0"
id "com.github.ben-manes.versions" version "0.52.0"
}


subprojects {

apply plugin: "java"
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
apply plugin: "java-library"
apply plugin: "io.spring.dependency-management"

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

group = "net.chrisrichardson.ftgo"

repositories {
mavenCentral()
jcenter()

// Commenting out problematic repositories that require authentication or are no longer available
// eventuateMavenRepoUrl.split(',').each { repoUrl -> maven { url repoUrl } }
Expand All @@ -35,9 +40,28 @@ subprojects {
// }

maven {
url "${project.rootDir}/build/repo"
url = "${project.rootDir}/build/repo"
}

}

dependencyManagement {
imports {
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
}
}

dependencies {
testImplementation "org.junit.vintage:junit-vintage-engine"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-parameters"
}

tasks.withType(Test).configureEach {
useJUnitPlatform()
}

}
12 changes: 8 additions & 4 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
test.enabled=false
plugins {
id 'groovy'
}

repositories {
mavenCentral()
}

dependencies {
compile 'mysql:mysql-connector-java:8.0.33'
compile 'commons-lang:commons-lang:2.6'
}
implementation 'com.mysql:mysql-connector-j:9.3.0'
implementation 'commons-lang:commons-lang:2.6'
}

test.enabled = false
12 changes: 6 additions & 6 deletions buildSrc/src/main/groovy/IntegrationTestsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ class IntegrationTestsPlugin implements Plugin<Project> {
}

project.configurations {
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
}

project.task("integrationTest", type: Test) {
testClassesDir = project.sourceSets.integrationTest.output.classesDir
project.tasks.register("integrationTest", Test) {
testClassesDirs = project.sourceSets.integrationTest.output.classesDirs
classpath = project.sourceSets.integrationTest.runtimeClasspath
}

project.tasks.withType(Test) {
reports.html.destination = project.file("${project.reporting.baseDir}/${name}")
project.tasks.withType(Test).configureEach {
reports.html.outputLocation = project.file("${project.reporting.baseDir}/${name}")
}
}
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/groovy/WaitForMySql.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private void loadDriver() {
try {
System.out.println("Trying to initialize driver");

String datasourceDriverClassName = getenv("SPRING_DATASOURCE_DRIVER_CLASS_NAME", "com.mysql.jdbc.Driver");
String datasourceDriverClassName = getenv("SPRING_DATASOURCE_DRIVER_CLASS_NAME", "com.mysql.cj.jdbc.Driver");
Class.forName(datasourceDriverClassName);

System.out.println("Initialization succeed");
Expand Down
9 changes: 2 additions & 7 deletions common-swagger/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
dependencies {
compile ("io.springfox:springfox-swagger2:2.8.0") {
exclude group: "org.springframework"
}
compile ("io.springfox:springfox-swagger-ui:2.8.0"){
exclude group: "org.springframework"
}
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
api "org.springdoc:springdoc-openapi-starter-webmvc-ui:$springdocVersion"
api "org.springframework.boot:spring-boot-starter-web:$springBootVersion"

}
Original file line number Diff line number Diff line change
@@ -1,43 +1,18 @@
package net.chrisrichardson.eventstore.examples.customersandorders.commonswagger;

import com.fasterxml.classmate.TypeResolver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity;
import org.springframework.web.context.request.async.DeferredResult;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.WildcardType;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.concurrent.CompletableFuture;

import static springfox.documentation.schema.AlternateTypeRules.newRule;

@Configuration
@EnableSwagger2
public class CommonSwaggerConfiguration {

@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("net.chrisrichardson.ftgo"))
.build()
.pathMapping("/")
.genericModelSubstitutes(ResponseEntity.class, CompletableFuture.class)
.alternateTypeRules(
newRule(typeResolver.resolve(DeferredResult.class,
typeResolver.resolve(ResponseEntity.class, WildcardType.class)),
typeResolver.resolve(WildcardType.class))
)
.useDefaultResponseMessages(false)
;
public GroupedOpenApi api() {
return GroupedOpenApi.builder()
.group("ftgo")
.packagesToScan("net.chrisrichardson.ftgo")
.build();
}

@Autowired
private TypeResolver typeResolver;

}
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql/ftgo
SPRING_DATASOURCE_USERNAME: mysqluser
SPRING_DATASOURCE_PASSWORD: mysqlpw
SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.jdbc.Driver
SPRING_DATASOURCE_DRIVER_CLASS_NAME: com.mysql.cj.jdbc.Driver
EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS: kafka:9092
EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING: zookeeper:2181
JAVA_OPTS: -Xmx192m
Expand Down
2 changes: 1 addition & 1 deletion ftgo-application/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM openjdk:8u171-jre-alpine
FROM eclipse-temurin:17-jre-alpine
RUN apk --no-cache add curl
CMD java ${JAVA_OPTS} -jar ftgo-application.jar
HEALTHCHECK --start-period=30s --interval=5s CMD curl -f http://localhost:8080/actuator/health || exit 1
Expand Down
16 changes: 8 additions & 8 deletions ftgo-application/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: FtgoServicePlugin

dependencies {
compile project(":ftgo-consumer-service")
compile project(":ftgo-order-service")
compile project(":ftgo-restaurant-service")
compile project(":ftgo-courier-service")
api project(":ftgo-consumer-service")
api project(":ftgo-order-service")
api project(":ftgo-restaurant-service")
api project(":ftgo-courier-service")

compile "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
api "org.springframework.boot:spring-boot-starter-actuator:$springBootVersion"
api "org.springframework.boot:spring-boot-starter-web:$springBootVersion"

runtime 'mysql:mysql-connector-java:8.0.33'
runtimeOnly 'com.mysql:mysql-connector-j'

testCompile project(":ftgo-end-to-end-tests-common")
testImplementation project(":ftgo-end-to-end-tests-common")
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;

@ControllerAdvice
public class GlobalExceptionHandler {
Expand Down
1 change: 1 addition & 0 deletions ftgo-application/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ spring.datasource.url=jdbc:mysql://${DOCKER_HOST_IP:localhost}/ftgo?useSSL=false
spring.datasource.username=mysqluser
spring.datasource.password=mysqlpw
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.properties.hibernate.id.db_structure_naming_strategy=legacy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
Expand Down
4 changes: 2 additions & 2 deletions ftgo-common-jpa/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dependencies {

compile "org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion"
compile project(":ftgo-common")
api "org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion"
api project(":ftgo-common")
}
21 changes: 8 additions & 13 deletions ftgo-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@ dependencies {
// TODO eliminate this - problem is value objects like Money need to be embeddable.
// TODO https://en.wikibooks.org/wiki/Java_Persistence/Embeddables#Example_of_an_Embeddable_object_XML

compile "org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion"
compile "org.springframework.boot:spring-boot-starter-web:$springBootVersion"
api "org.springframework.boot:spring-boot-starter-data-jpa:$springBootVersion"
api "org.springframework.boot:spring-boot-starter-web:$springBootVersion"

compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.7'
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.7'
compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.7"
api "com.fasterxml.jackson.core:jackson-core"
api "com.fasterxml.jackson.core:jackson-databind"
api "commons-lang:commons-lang:2.6"
api "com.fasterxml.jackson.datatype:jackson-datatype-jsr310"

compile 'mysql:mysql-connector-java:8.0.33'
api "com.mysql:mysql-connector-j"

testCompile "org.springframework.boot:spring-boot-starter-test:$springBootVersion"

runtime "javax.xml.bind:jaxb-api:2.2.11"
runtime "com.sun.xml.bind:jaxb-core:2.2.11"
runtime "com.sun.xml.bind:jaxb-impl:2.2.11"
runtime "javax.activation:activation:1.1.1"
testImplementation "org.springframework.boot:spring-boot-starter-test:$springBootVersion"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package net.chrisrichardson.ftgo.common;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Embeddable;
import jakarta.persistence.Access;
import jakarta.persistence.AccessType;
import jakarta.persistence.Embeddable;

@Embeddable
@Access(AccessType.FIELD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.springframework.beans.factory.annotation.Autowired;

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

public class CommonJsonMapperInitializer {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.Embeddable;
import jakarta.persistence.Access;
import jakarta.persistence.AccessType;
import jakarta.persistence.Embeddable;
import java.math.BigDecimal;

@Embeddable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public Money deserialize(JsonParser jp, DeserializationContext ctxt) throws IOEx
else
return new Money(str);
} else
throw ctxt.mappingException(getValueClass());
return (Money) ctxt.handleUnexpectedToken(getValueClass(), jp);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.chrisrichardson.ftgo.common;

import javax.persistence.Embeddable;
import jakarta.persistence.Embeddable;

@Embeddable
public class PersonName {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package net.chrisrichardson.ftgo.common.tracking;

import javax.persistence.*;
import jakarta.persistence.*;
import java.time.LocalDateTime;

@Entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.util.UUID;

public class ApiTrackingInterceptor implements HandlerInterceptor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import org.apache.commons.lang.builder.ToStringBuilder;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.util.Assert;

import java.io.IOException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;

public class MoneySerializationTest {
Expand Down Expand Up @@ -83,7 +83,7 @@ public void shouldFailToDe() throws IOException {
} catch (JsonMappingException e) {
jsonMappingException = e;
}
Assert.notNull(jsonMappingException);
assertNotNull(jsonMappingException);
}


Expand Down
2 changes: 1 addition & 1 deletion ftgo-consumer-service-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dependencies {
compile project(":ftgo-common")
api project(":ftgo-common")
}
Loading