From 2aa827e79b3f1f9fe4a0cbf97da7bfa7d674f5ac Mon Sep 17 00:00:00 2001 From: adamkulawik Date: Sat, 26 May 2018 01:10:18 +0200 Subject: [PATCH] db tests swiched to in memory db --- db-commons/pom.xml | 27 ++++ .../src/main/resources/schema/commons.xml | 11 ++ .../main/resources/schema/db.changelog.xml | 11 ++ .../resources/schema/delivery-planning.xml | 42 ++++++ .../resources/schema/demand-forecasting.xml | 134 ++++++++++++++++++ .../resources/schema/product-management.xml | 24 ++++ .../resources/schema/production-planning.xml | 60 ++++++++ .../resources/schema/shortages-prediction.xml | 40 ++++++ demand-forecasting-adapters/pom.xml | 6 + .../src/test/resources/application.properties | 6 + pom.xml | 1 + product-management-adapters/pom.xml | 5 + .../src/test/resources/application.properties | 6 + shortages-prediction-adapters/pom.xml | 6 + .../src/test/resources/application.properties | 6 + 15 files changed, 385 insertions(+) create mode 100644 db-commons/pom.xml create mode 100644 db-commons/src/main/resources/schema/commons.xml create mode 100644 db-commons/src/main/resources/schema/db.changelog.xml create mode 100644 db-commons/src/main/resources/schema/delivery-planning.xml create mode 100644 db-commons/src/main/resources/schema/demand-forecasting.xml create mode 100644 db-commons/src/main/resources/schema/product-management.xml create mode 100644 db-commons/src/main/resources/schema/production-planning.xml create mode 100644 db-commons/src/main/resources/schema/shortages-prediction.xml create mode 100644 demand-forecasting-adapters/src/test/resources/application.properties create mode 100644 product-management-adapters/src/test/resources/application.properties create mode 100644 shortages-prediction-adapters/src/test/resources/application.properties diff --git a/db-commons/pom.xml b/db-commons/pom.xml new file mode 100644 index 0000000..cfd353c --- /dev/null +++ b/db-commons/pom.xml @@ -0,0 +1,27 @@ + + + + factory + pl.com.dddbyexamples + 1.0-SNAPSHOT + + 4.0.0 + + db-commons + + + + com.h2database + h2 + 1.4.197 + + + org.liquibase + liquibase-core + 3.5.5 + + + + \ No newline at end of file diff --git a/db-commons/src/main/resources/schema/commons.xml b/db-commons/src/main/resources/schema/commons.xml new file mode 100644 index 0000000..2a2b72c --- /dev/null +++ b/db-commons/src/main/resources/schema/commons.xml @@ -0,0 +1,11 @@ + + + + + + + CREATE CAST (character varying AS jsonb) WITH INOUT AS ASSIGNMENT + + diff --git a/db-commons/src/main/resources/schema/db.changelog.xml b/db-commons/src/main/resources/schema/db.changelog.xml new file mode 100644 index 0000000..f5d9b8e --- /dev/null +++ b/db-commons/src/main/resources/schema/db.changelog.xml @@ -0,0 +1,11 @@ + + + + + + + + + diff --git a/db-commons/src/main/resources/schema/delivery-planning.xml b/db-commons/src/main/resources/schema/delivery-planning.xml new file mode 100644 index 0000000..8012ae9 --- /dev/null +++ b/db-commons/src/main/resources/schema/delivery-planning.xml @@ -0,0 +1,42 @@ + + + + + + + + + + CREATE SCHEMA delivery_planning + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/db-commons/src/main/resources/schema/demand-forecasting.xml b/db-commons/src/main/resources/schema/demand-forecasting.xml new file mode 100644 index 0000000..18b552a --- /dev/null +++ b/db-commons/src/main/resources/schema/demand-forecasting.xml @@ -0,0 +1,134 @@ + + + + + + + + + + CREATE SCHEMA demand_forecasting + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/db-commons/src/main/resources/schema/product-management.xml b/db-commons/src/main/resources/schema/product-management.xml new file mode 100644 index 0000000..8761062 --- /dev/null +++ b/db-commons/src/main/resources/schema/product-management.xml @@ -0,0 +1,24 @@ + + + + + + + + + + CREATE SCHEMA product_management + + + + + + + + + + + + \ No newline at end of file diff --git a/db-commons/src/main/resources/schema/production-planning.xml b/db-commons/src/main/resources/schema/production-planning.xml new file mode 100644 index 0000000..3e6a323 --- /dev/null +++ b/db-commons/src/main/resources/schema/production-planning.xml @@ -0,0 +1,60 @@ + + + + + + + + + + CREATE SCHEMA production_planning + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/db-commons/src/main/resources/schema/shortages-prediction.xml b/db-commons/src/main/resources/schema/shortages-prediction.xml new file mode 100644 index 0000000..6bf377e --- /dev/null +++ b/db-commons/src/main/resources/schema/shortages-prediction.xml @@ -0,0 +1,40 @@ + + + + + + + + + + CREATE SCHEMA shortages_prediction + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demand-forecasting-adapters/pom.xml b/demand-forecasting-adapters/pom.xml index 68111f0..a7310da 100644 --- a/demand-forecasting-adapters/pom.xml +++ b/demand-forecasting-adapters/pom.xml @@ -68,6 +68,12 @@ 1.7.9 test + + pl.com.dddbyexamples + db-commons + 1.0-SNAPSHOT + test + diff --git a/demand-forecasting-adapters/src/test/resources/application.properties b/demand-forecasting-adapters/src/test/resources/application.properties new file mode 100644 index 0000000..df62e6e --- /dev/null +++ b/demand-forecasting-adapters/src/test/resources/application.properties @@ -0,0 +1,6 @@ +spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_ON_EXIT=FALSE +spring.datasource.username=sa +spring.datasource.password=sa +spring.datasource.driver-class-name=org.h2.Driver +spring.liquibase.change-log=classpath:/schema/db.changelog.xml + diff --git a/pom.xml b/pom.xml index c9038bf..f98e913 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,7 @@ shortages-prediction-adapters product-management-adapters production-planning-adapters + db-commons diff --git a/product-management-adapters/pom.xml b/product-management-adapters/pom.xml index 6137fe2..6fe667f 100644 --- a/product-management-adapters/pom.xml +++ b/product-management-adapters/pom.xml @@ -27,6 +27,11 @@ test-jar test + + pl.com.dddbyexamples + db-commons + 1.0-SNAPSHOT + org.projectlombok diff --git a/product-management-adapters/src/test/resources/application.properties b/product-management-adapters/src/test/resources/application.properties new file mode 100644 index 0000000..df62e6e --- /dev/null +++ b/product-management-adapters/src/test/resources/application.properties @@ -0,0 +1,6 @@ +spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_ON_EXIT=FALSE +spring.datasource.username=sa +spring.datasource.password=sa +spring.datasource.driver-class-name=org.h2.Driver +spring.liquibase.change-log=classpath:/schema/db.changelog.xml + diff --git a/shortages-prediction-adapters/pom.xml b/shortages-prediction-adapters/pom.xml index 320a02f..6a29158 100644 --- a/shortages-prediction-adapters/pom.xml +++ b/shortages-prediction-adapters/pom.xml @@ -32,6 +32,12 @@ test-jar test + + pl.com.dddbyexamples + db-commons + 1.0-SNAPSHOT + test + org.projectlombok diff --git a/shortages-prediction-adapters/src/test/resources/application.properties b/shortages-prediction-adapters/src/test/resources/application.properties new file mode 100644 index 0000000..df62e6e --- /dev/null +++ b/shortages-prediction-adapters/src/test/resources/application.properties @@ -0,0 +1,6 @@ +spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_ON_EXIT=FALSE +spring.datasource.username=sa +spring.datasource.password=sa +spring.datasource.driver-class-name=org.h2.Driver +spring.liquibase.change-log=classpath:/schema/db.changelog.xml +