diff --git a/.gitattributes b/.gitattributes
index 53d70c3..34ceb76 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -4,4 +4,4 @@
# Denote all files that are truly binary and should not be modified.
*.png binary
-*.jpg binary
\ No newline at end of file
+*.jpg binary
diff --git a/.gitignore b/.gitignore
index e7f0c88..5cd220a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,13 +1,17 @@
+## travis-ci
+!.travis.yml
+!.codecov.yml
+
## maven
target/
target-test/
+!.mvn
## linux
.*
!.git*
-*~
## windows
@@ -20,7 +24,7 @@ Desktop.ini
$RECYCLE.BIN/
-## osx
+## macOS
.DS_Store
.AppleDouble
.LSOverride
@@ -85,9 +89,9 @@ tramp
*.un~
Session.vim
.netrwhist
-*~
build
+out/
+build/
.gradle
*.log
-out
\ No newline at end of file
diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java
deleted file mode 100755
index d475a89..0000000
--- a/.mvn/wrapper/MavenWrapperDownloader.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
-*/
-
-import java.net.*;
-import java.io.*;
-import java.nio.channels.*;
-import java.util.Properties;
-
-public class MavenWrapperDownloader {
-
- /**
- * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
- */
- private static final String DEFAULT_DOWNLOAD_URL =
- "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar";
-
- /**
- * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
- * use instead of the default one.
- */
- private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
- ".mvn/wrapper/maven-wrapper.properties";
-
- /**
- * Path where the maven-wrapper.jar will be saved to.
- */
- private static final String MAVEN_WRAPPER_JAR_PATH =
- ".mvn/wrapper/maven-wrapper.jar";
-
- /**
- * Name of the property which should be used to override the default download url for the wrapper.
- */
- private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
-
- public static void main(String args[]) {
- System.out.println("- Downloader started");
- File baseDirectory = new File(args[0]);
- System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
-
- // If the maven-wrapper.properties exists, read it and check if it contains a custom
- // wrapperUrl parameter.
- File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
- String url = DEFAULT_DOWNLOAD_URL;
- if(mavenWrapperPropertyFile.exists()) {
- FileInputStream mavenWrapperPropertyFileInputStream = null;
- try {
- mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
- Properties mavenWrapperProperties = new Properties();
- mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
- url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
- } catch (IOException e) {
- System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
- } finally {
- try {
- if(mavenWrapperPropertyFileInputStream != null) {
- mavenWrapperPropertyFileInputStream.close();
- }
- } catch (IOException e) {
- // Ignore ...
- }
- }
- }
- System.out.println("- Downloading from: : " + url);
-
- File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
- if(!outputFile.getParentFile().exists()) {
- if(!outputFile.getParentFile().mkdirs()) {
- System.out.println(
- "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'");
- }
- }
- System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
- try {
- downloadFileFromURL(url, outputFile);
- System.out.println("Done");
- System.exit(0);
- } catch (Throwable e) {
- System.out.println("- Error downloading");
- e.printStackTrace();
- System.exit(1);
- }
- }
-
- private static void downloadFileFromURL(String urlString, File destination) throws Exception {
- URL website = new URL(urlString);
- ReadableByteChannel rbc;
- rbc = Channels.newChannel(website.openStream());
- FileOutputStream fos = new FileOutputStream(destination);
- fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
- fos.close();
- rbc.close();
- }
-
-}
diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar
deleted file mode 100755
index 08ebbb6..0000000
Binary files a/.mvn/wrapper/maven-wrapper.jar and /dev/null differ
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
deleted file mode 100755
index a5fcc11..0000000
--- a/.mvn/wrapper/maven-wrapper.properties
+++ /dev/null
@@ -1 +0,0 @@
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 8b54da6..ba47bd2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,9 @@
language: java
jdk:
- - oraclejdk8
+ - openjdk8
+ - openjdk9
+ - openjdk10
after_success:
- bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
diff --git a/adapter-commons/build.gradle b/adapter-commons/build.gradle
index a6ff458..bdec774 100644
--- a/adapter-commons/build.gradle
+++ b/adapter-commons/build.gradle
@@ -1,7 +1,12 @@
dependencies {
- compile("org.springframework.boot:spring-boot-starter-data-jpa")
- compile("org.springframework.boot:spring-boot-starter-data-rest")
- compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.5")
- compile("org.liquibase:liquibase-core:3.5.5")
- testCompile("org.springframework.boot:spring-boot-starter-test")
-}
\ No newline at end of file
+ compile("org.springframework.boot:spring-boot-starter-data-jpa")
+ compile("org.springframework.boot:spring-boot-starter-data-rest")
+ compile("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6")
+ compile("com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.6")
+ compile("com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.6")
+ compile("org.liquibase:liquibase-core:3.6.1")
+ compile("javax.xml.bind:jaxb-api:2.3.0")
+ runtime("org.postgresql:postgresql:42.2.2")
+
+ testCompile("org.springframework.boot:spring-boot-starter-test")
+}
diff --git a/adapter-commons/pom.xml b/adapter-commons/pom.xml
deleted file mode 100644
index 656a552..0000000
--- a/adapter-commons/pom.xml
+++ /dev/null
@@ -1,206 +0,0 @@
-
-
- 4.0.0
-
- pl.com.dddbyexamples
- adapter-commons
- 1.0-SNAPSHOT
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.2.RELEASE
-
-
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.springframework.boot
- spring-boot-starter-data-rest
-
-
- com.fasterxml.jackson.datatype
- jackson-datatype-jsr310
- 2.8.5
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.liquibase
- liquibase-core
- 3.5.5
-
-
-
-
-
- artifactory-local
- http://localhost:8081/artifactory/libs-release-local
- http://localhost:8081/artifactory/libs-snapshot-local
- http://localhost:8081/artifactory/libs-release-local
- 2.21.0
-
-
-
-
-
- ${distribution.management.release.id}
- Release Repository
- ${distribution.management.release.url}
-
-
- ${distribution.management.release.id}
- Snapshot Repository
- ${distribution.management.snapshot.url}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 3.0.2
-
-
-
- test-jar
-
-
-
-
-
-
-
-
-
- default
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- **/*Test*.*>
- **/*Spec*.*
-
-
- **/smoke/**
- **/e2e/**
-
-
-
-
-
-
-
-
- apicompatibility
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- contracttests/**/*Test*.*
- contracttests/**/*Spec*.*
-
-
-
-
-
-
-
-
- smoke
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- smoke/**/*Tests.java
- smoke/**/*Test.java
- smoke/**/*Spec.*
-
-
-
-
-
-
-
-
- e2e
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- e2e/**/*Tests.java
- e2e/**/*Test.java
- e2e/**/*Spec.*
-
-
-
-
-
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
diff --git a/adapter-commons/src/main/java/io/dddbyexamples/tools/JsonConverter.java b/adapter-commons/src/main/java/io/dddbyexamples/tools/JsonConverter.java
index c7b355d..722eed7 100644
--- a/adapter-commons/src/main/java/io/dddbyexamples/tools/JsonConverter.java
+++ b/adapter-commons/src/main/java/io/dddbyexamples/tools/JsonConverter.java
@@ -1,11 +1,14 @@
package io.dddbyexamples.tools;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
import javax.persistence.AttributeConverter;
import java.io.IOException;
@@ -20,6 +23,8 @@ public abstract class JsonConverter implements AttributeConverter
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
.enable(SerializationFeature.WRITE_DATES_WITH_ZONE_ID)
.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS)
+ .registerModule(new ParameterNamesModule(JsonCreator.Mode.PROPERTIES))
+ .registerModule(new Jdk8Module())
.registerModule(new JavaTimeModule());
private final Class type;
diff --git a/adapter-commons/src/test/resources/application.properties b/adapter-commons/src/main/resources/application-test.properties
similarity index 100%
rename from adapter-commons/src/test/resources/application.properties
rename to adapter-commons/src/main/resources/application-test.properties
diff --git a/adapter-commons/src/test/java/io/dddbyexamples/tools/IntegrationTest.java b/adapter-commons/src/test/java/io/dddbyexamples/tools/IntegrationTest.java
deleted file mode 100644
index 8d412b7..0000000
--- a/adapter-commons/src/test/java/io/dddbyexamples/tools/IntegrationTest.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package io.dddbyexamples.tools;
-
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.core.annotation.AliasFor;
-import org.springframework.test.context.ActiveProfiles;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@SpringBootTest
-@ActiveProfiles
-public @interface IntegrationTest {
- @AliasFor(annotation = ActiveProfiles.class, attribute = "profiles") String[] activeProfiles() default {"test"};
-}
diff --git a/app-monolith/build.gradle b/app-monolith/build.gradle
index b46b266..2392472 100644
--- a/app-monolith/build.gradle
+++ b/app-monolith/build.gradle
@@ -1,45 +1,38 @@
apply plugin: 'groovy'
dependencies {
- compile(project(":demand-forecasting-adapters"))
- compile(project(":shortages-prediction-adapters"))
- compile(project(":product-management-adapters"))
- compile(project(":production-planning-adapters"))
- compile(project(":adapter-commons"))
+ compile(project(":demand-forecasting-adapters"))
+ compile(project(":shortages-prediction-adapters"))
+ compile(project(":product-management-adapters"))
+ compile(project(":production-planning-adapters"))
+ compile(project(":adapter-commons"))
- compile("org.projectlombok:lombok:1.16.18")
- compile("org.springframework.boot:spring-boot-starter-data-jpa")
- compile("org.springframework.boot:spring-boot-starter-web")
- compile("org.springframework.boot:spring-boot-starter-data-rest")
- compile("org.springframework.data:spring-data-rest-hal-browser")
- compile("org.springframework.boot:spring-boot-starter-cloud-connectors")
- compile("org.liquibase:liquibase-core:3.5.5")
- compile("net.bytebuddy:byte-buddy:1.7.9")
+ compile("org.springframework.boot:spring-boot-starter-data-jpa")
+ compile("org.springframework.boot:spring-boot-starter-web")
+ compile("org.springframework.boot:spring-boot-starter-data-rest")
+ compile("org.springframework.data:spring-data-rest-hal-browser")
+ compile("org.springframework.boot:spring-boot-starter-cloud-connectors")
- runtime("org.cloudfoundry:auto-reconfiguration:1.12.0.RELEASE")
- runtime("org.postgresql:postgresql:42.1.4")
+ runtime("org.cloudfoundry:auto-reconfiguration:1.12.0.RELEASE")
- testCompile("org.springframework.boot:spring-boot-starter-test")
- testCompile("org.spockframework:spock-core:1.1-groovy-2.4")
- testCompile("org.spockframework:spock-spring:1.1-groovy-2.4")
- testCompile("com.h2database:h2:1.4.194")
- // TODO: Because of this there's no up to date check from Gradle
- testCompile(project(":adapter-commons").sourceSets.test.output)
+ testCompile("org.springframework.boot:spring-boot-starter-test")
+ testCompile("org.spockframework:spock-spring:1.1-groovy-2.4")
+ testCompile("com.h2database:h2:1.4.197")
}
[bootJar, bootRun]*.enabled = true
jar.enabled = false
task stubsJar(type: Jar) {
- classifier = "stubs"
- into("META-INF/${project.rootProject.ext.projectGroupId}/${project.rootProject.ext.projectArtifactId}/${project.rootProject.ext.projectVersion}/shortages-prediction-adapters/mappings") {
- include('**/*.*')
- from(project(":shortages-prediction-adapters").projectDir.absolutePath + "/target/generated-snippets/stubs")
- }
- into("META-INF/${project.rootProject.ext.projectGroupId}/${project.rootProject.ext.projectArtifactId}/${project.rootProject.ext.projectVersion}/shortages-prediction-adapters/contracts") {
- include('**/*.groovy')
- from(project(":shortages-prediction-adapters").projectDir.absolutePath + "/target/generated-snippets/contracts")
- }
+ classifier = "stubs"
+ into("META-INF/${project.rootProject.ext.projectGroupId}/${project.rootProject.ext.projectArtifactId}/${project.rootProject.ext.projectVersion}/shortages-prediction-adapters/mappings") {
+ include('**/*.*')
+ from(project(":shortages-prediction-adapters").projectDir.absolutePath + "/target/generated-snippets/stubs")
+ }
+ into("META-INF/${project.rootProject.ext.projectGroupId}/${project.rootProject.ext.projectArtifactId}/${project.rootProject.ext.projectVersion}/shortages-prediction-adapters/contracts") {
+ include('**/*.groovy')
+ from(project(":shortages-prediction-adapters").projectDir.absolutePath + "/target/generated-snippets/contracts")
+ }
}
// we need the tests to pass to build the stub jar
@@ -47,16 +40,16 @@ stubsJar.dependsOn(test)
stubsJar.dependsOn(project(":shortages-prediction-adapters").test)
artifacts {
- archives stubsJar
+ archives stubsJar
}
jar.dependsOn(stubsJar)
publishing {
- publications {
- stubs(MavenPublication) {
- artifactId project.name
- artifact stubsJar
- }
- }
-}
\ No newline at end of file
+ publications {
+ stubs(MavenPublication) {
+ artifactId project.name
+ artifact stubsJar
+ }
+ }
+}
diff --git a/app-monolith/pom.xml b/app-monolith/pom.xml
deleted file mode 100644
index 83c734d..0000000
--- a/app-monolith/pom.xml
+++ /dev/null
@@ -1,346 +0,0 @@
-
-
- 4.0.0
-
- pl.com.dddbyexamples
- app-monolith
- 1.0-SNAPSHOT
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.2.RELEASE
-
-
-
-
- 1.8
-
- artifactory-local
- http://localhost:8081/artifactory/libs-release-local
- http://localhost:8081/artifactory/libs-snapshot-local
- http://localhost:8081/artifactory/libs-release-local
- 2.21.0
-
-
-
-
-
- ${distribution.management.release.id}
- Release Repository
- ${distribution.management.release.url}
-
-
- ${distribution.management.release.id}
- Snapshot Repository
- ${distribution.management.snapshot.url}
-
-
-
-
-
- pl.com.dddbyexamples
- demand-forecasting-adapters
- 1.0-SNAPSHOT
-
-
- pl.com.dddbyexamples
- shortages-prediction-adapters
- 1.0-SNAPSHOT
-
-
- pl.com.dddbyexamples
- product-management-adapters
- 1.0-SNAPSHOT
-
-
- pl.com.dddbyexamples
- production-planning-adapters
- 1.0-SNAPSHOT
-
-
-
- pl.com.dddbyexamples
- adapter-commons
- 1.0-SNAPSHOT
-
-
- pl.com.dddbyexamples
- adapter-commons
- 1.0-SNAPSHOT
- test-jar
- test
-
-
-
- org.projectlombok
- lombok
- 1.16.18
- provided
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-data-rest
-
-
- org.springframework.data
- spring-data-rest-hal-browser
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.postgresql
- postgresql
- 42.1.4
- runtime
-
-
- org.cloudfoundry
- auto-reconfiguration
- 1.12.0.RELEASE
- provided
-
-
- org.springframework.boot
- spring-boot-starter-cloud-connectors
-
-
- org.liquibase
- liquibase-core
- 3.5.5
-
-
- org.spockframework
- spock-core
- 1.1-groovy-2.4
- test
-
-
- org.spockframework
- spock-spring
- 1.1-groovy-2.4
- test
-
-
- com.h2database
- h2
- 1.4.194
- test
-
-
- net.bytebuddy
- byte-buddy
- 1.7.9
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- repackage
-
-
- app
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- -parameters
-
-
-
-
- org.codehaus.gmavenplus
- gmavenplus-plugin
- 1.6
-
-
-
- addTestSources
- compileTests
-
-
-
-
-
- maven-surefire-plugin
- 2.20.1
-
- false
-
- **/*Spec.java
- **/*Test.java
-
-
-
-
-
-
-
-
- default
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- stub
- prepare-package
-
- single
-
- false
-
- true
-
- ${basedir}/src/assembly/stub.xml
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- **/*Test*.*>
- **/*Spec*.*
-
-
- **/smoke/**
- **/e2e/**
-
-
-
-
-
-
-
-
- apicompatibility
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- contracttests/**/*Test*.*
- contracttests/**/*Spec*.*
-
-
-
-
-
-
-
-
- smoke
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- smoke/**/*Tests.java
- smoke/**/*Test.java
- smoke/**/*Spec.*
-
-
-
-
-
-
-
-
- e2e
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- e2e/**/*Tests.java
- e2e/**/*Test.java
- e2e/**/*Spec.*
-
-
-
-
-
-
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
diff --git a/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/CallOffDocumentIntegrationSpec.groovy b/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/CallOffDocumentIntegrationSpec.groovy
index b558caf..34e66ed 100644
--- a/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/CallOffDocumentIntegrationSpec.groovy
+++ b/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/CallOffDocumentIntegrationSpec.groovy
@@ -1,5 +1,10 @@
package io.dddbyexamples.factory.integration
+import io.dddbyexamples.factory.AppConfiguration
+import io.dddbyexamples.factory.ProductTrait
+import io.dddbyexamples.factory.demand.forecasting.persistence.DocumentEntity
+import io.dddbyexamples.factory.demand.forecasting.projection.CurrentDemandEntity
+import io.dddbyexamples.factory.product.management.ProductDescriptionEntity
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.web.client.TestRestTemplate
@@ -9,12 +14,7 @@ import org.springframework.core.ParameterizedTypeReference
import org.springframework.hateoas.Resources
import org.springframework.http.HttpMethod
import org.springframework.http.ResponseEntity
-import io.dddbyexamples.factory.AppConfiguration
-import io.dddbyexamples.factory.ProductTrait
-import io.dddbyexamples.factory.demand.forecasting.persistence.DocumentEntity
-import io.dddbyexamples.factory.demand.forecasting.projection.CurrentDemandEntity
-import io.dddbyexamples.factory.product.management.ProductDescriptionEntity
-import io.dddbyexamples.tools.IntegrationTest
+import org.springframework.test.context.ActiveProfiles
import spock.lang.Specification
import java.time.Clock
@@ -24,28 +24,29 @@ import static java.time.Instant.from
import static java.time.ZoneId.systemDefault
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT
-@IntegrationTest
+@ActiveProfiles("test")
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = [AppConfiguration, TestConfiguration])
class CallOffDocumentIntegrationSpec extends Specification implements ProductTrait {
public static final String PRODUCT_REF_NO = "3009000"
public static final LocalDate ANY_DATE = LocalDate.now()
- @Autowired TestRestTemplate restTemplate
+ @Autowired
+ TestRestTemplate restTemplate
def 'receiving call off document should create new product demands for subsequent days'() {
given:
- productDescriptionIsSuccessfullyCreated(PRODUCT_REF_NO)
+ productDescriptionIsSuccessfullyCreated(PRODUCT_REF_NO)
when:
- callOffDocumentIsSuccessfullyRequested(PRODUCT_REF_NO, ANY_DATE, 100, 200, 300)
+ callOffDocumentIsSuccessfullyRequested(PRODUCT_REF_NO, ANY_DATE, 100, 200, 300)
and:
- Collection demands =
- demandsForProductStartingFromDateAreRequested(PRODUCT_REF_NO, ANY_DATE.minusDays(1))
+ Collection demands =
+ demandsForProductStartingFromDateAreRequested(PRODUCT_REF_NO, ANY_DATE.minusDays(1))
then:
- demands.size() == 3
- thereIsDemand(demands, ANY_DATE, 100)
- thereIsDemand(demands, ANY_DATE.plusDays(1), 200)
- thereIsDemand(demands, ANY_DATE.plusDays(2), 300)
+ demands.size() == 3
+ thereIsDemand(demands, ANY_DATE, 100)
+ thereIsDemand(demands, ANY_DATE.plusDays(1), 200)
+ thereIsDemand(demands, ANY_DATE.plusDays(2), 300)
}
void productDescriptionIsSuccessfullyCreated(String refNo) {
diff --git a/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/DemandAdjustmentIntegrationSpec.groovy b/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/DemandAdjustmentIntegrationSpec.groovy
index 0cbef43..5f4af90 100644
--- a/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/DemandAdjustmentIntegrationSpec.groovy
+++ b/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/DemandAdjustmentIntegrationSpec.groovy
@@ -5,6 +5,7 @@ import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.web.client.TestRestTemplate
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
+import org.springframework.context.annotation.Profile
import org.springframework.core.ParameterizedTypeReference
import org.springframework.hateoas.Resources
import org.springframework.http.HttpMethod
@@ -17,7 +18,7 @@ import io.dddbyexamples.factory.demand.forecasting.command.DemandAdjustmentEntit
import io.dddbyexamples.factory.demand.forecasting.persistence.DocumentEntity
import io.dddbyexamples.factory.demand.forecasting.projection.CurrentDemandEntity
import io.dddbyexamples.factory.product.management.ProductDescriptionEntity
-import io.dddbyexamples.tools.IntegrationTest
+import org.springframework.test.context.ActiveProfiles
import spock.lang.Specification
import java.time.Clock
@@ -27,7 +28,7 @@ import static java.time.Instant.from
import static java.time.ZoneId.systemDefault
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT
-@IntegrationTest
+@ActiveProfiles("test")
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = [AppConfiguration, TestConfiguration])
class DemandAdjustmentIntegrationSpec extends Specification implements ProductTrait {
diff --git a/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/ShortageIntegrationSpec.groovy b/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/ShortageIntegrationSpec.groovy
index 1ef92f7..dc10905 100644
--- a/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/ShortageIntegrationSpec.groovy
+++ b/app-monolith/src/test/groovy/io/dddbyexamples/factory/integration/ShortageIntegrationSpec.groovy
@@ -1,14 +1,5 @@
package io.dddbyexamples.factory.integration
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.test.context.SpringBootTest
-import org.springframework.boot.test.web.client.TestRestTemplate
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
-import org.springframework.core.ParameterizedTypeReference
-import org.springframework.hateoas.Resource
-import org.springframework.http.HttpMethod
-import org.springframework.http.ResponseEntity
import io.dddbyexamples.factory.AppConfiguration
import io.dddbyexamples.factory.ProductTrait
import io.dddbyexamples.factory.demand.forecasting.Adjustment
@@ -19,7 +10,16 @@ import io.dddbyexamples.factory.product.management.ProductDescriptionEntity
import io.dddbyexamples.factory.shortages.prediction.calculation.Stock
import io.dddbyexamples.factory.shortages.prediction.monitoring.persistence.ShortagesEntity
import io.dddbyexamples.factory.warehouse.WarehouseService
-import io.dddbyexamples.tools.IntegrationTest
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.boot.test.context.SpringBootTest
+import org.springframework.boot.test.web.client.TestRestTemplate
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.core.ParameterizedTypeReference
+import org.springframework.hateoas.Resource
+import org.springframework.http.HttpMethod
+import org.springframework.http.ResponseEntity
+import org.springframework.test.context.ActiveProfiles
import spock.lang.Specification
import java.time.Clock
@@ -29,7 +29,7 @@ import static java.time.Instant.from
import static java.time.ZoneId.systemDefault
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT
-@IntegrationTest
+@ActiveProfiles("test")
@SpringBootTest(webEnvironment = RANDOM_PORT, classes = [AppConfiguration, TestConfiguration])
class ShortageIntegrationSpec extends Specification implements ProductTrait {
@@ -37,17 +37,18 @@ class ShortageIntegrationSpec extends Specification implements ProductTrait {
public static final LocalDate ANY_DATE = LocalDate.now()
public static final int PRODUCT_STOCK_LEVEL = 100
- @Autowired TestRestTemplate restTemplate
+ @Autowired
+ TestRestTemplate restTemplate
def 'adjustment that exceeds current stock level should result in shortage'() {
given:
- productDescriptionIsSuccessfullyCreated(PRODUCT_REF_NO)
+ productDescriptionIsSuccessfullyCreated(PRODUCT_REF_NO)
when:
- callOffDocumentIsSuccessfullyRequested(PRODUCT_REF_NO, ANY_DATE, PRODUCT_STOCK_LEVEL)
+ callOffDocumentIsSuccessfullyRequested(PRODUCT_REF_NO, ANY_DATE, PRODUCT_STOCK_LEVEL)
and:
- adjustmentIsSuccessfullyRequested(ANY_DATE.plusDays(1), 200)
+ adjustmentIsSuccessfullyRequested(ANY_DATE.plusDays(1), 200)
then:
- thereIsShortage(PRODUCT_REF_NO, ANY_DATE.plusDays(1), 200)
+ thereIsShortage(PRODUCT_REF_NO, ANY_DATE.plusDays(1), 200)
}
diff --git a/build.gradle b/build.gradle
index e6f5bc3..e1e0e57 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,94 +1,105 @@
buildscript {
- repositories {
- mavenCentral()
- mavenLocal()
- maven { url "http://repo.spring.io/snapshot" }
- maven { url "http://repo.spring.io/milestone" }
- maven { url "http://repo.spring.io/release" }
- }
- dependencies {
- classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE"
- // TODO: Snapshots are used only for testing purposes
- classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:2.0.0.BUILD-SNAPSHOT"
- }
+ repositories {
+ mavenCentral()
+ mavenLocal()
+ maven { url "http://repo.spring.io/snapshot" }
+ maven { url "http://repo.spring.io/milestone" }
+ maven { url "http://repo.spring.io/release" }
+ }
+ dependencies {
+ classpath "org.springframework.boot:spring-boot-gradle-plugin:2.0.2.RELEASE"
+ // TODO: Snapshots are used only for testing purposes
+ classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:2.0.0.BUILD-SNAPSHOT"
+ }
}
allprojects {
- apply plugin: 'java'
- apply plugin: 'org.springframework.boot'
- apply plugin: 'io.spring.dependency-management'
- apply plugin: 'maven-publish'
+ apply plugin: 'java'
+ apply plugin: 'org.springframework.boot'
+ apply plugin: 'io.spring.dependency-management'
+ apply plugin: 'maven-publish'
- group = 'pl.com.dddbyexamples'
- version = getProp('newVersion') ?: '1.0-SNAPSHOT'
+ group = 'pl.com.dddbyexamples'
+ version = getProp('newVersion') ?: '1.0-SNAPSHOT'
- apply from: project.rootDir.absolutePath + '/gradle/pipeline.gradle'
+ apply from: project.rootDir.absolutePath + '/gradle/pipeline.gradle'
- bootJar.enabled = false
- jar.enabled = true
- bootRun.enabled = false
+ bootJar.enabled = false
+ jar.enabled = true
+ bootRun.enabled = false
- dependencyManagement {
- imports {
- mavenBom "org.springframework.cloud:spring-cloud-dependencies:${BOM_VERSION}"
- }
- }
+ compileJava.options.compilerArgs << '-parameters'
+ compileTestJava.options.compilerArgs << '-parameters'
- repositories {
- mavenCentral()
- mavenLocal()
- if (getProp("M2_LOCAL")) {
- maven {
- url getProp("M2_LOCAL")
- }
- }
- maven { url "http://repo.spring.io/snapshot" }
- maven { url "http://repo.spring.io/milestone" }
- maven { url "http://repo.spring.io/release" }
- }
+ dependencies {
+ compileOnly('org.projectlombok:lombok:1.18.0')
+ annotationProcessor('org.projectlombok:lombok:1.18.0')
- publishing {
- repositories {
- maven {
- url getProp('REPO_WITH_BINARIES_FOR_UPLOAD') ?:
- getProp('REPO_WITH_BINARIES') ?: 'http://localhost:8081/artifactory/libs-release-local'
- credentials {
- username getProp('M2_SETTINGS_REPO_USERNAME') ?: 'admin'
- password getProp('M2_SETTINGS_REPO_PASSWORD') ?: 'password'
- }
- }
- }
- publications {
- mavenJava(MavenPublication) {
- artifactId project.name
- from components.java
- }
- }
- }
+ testCompile("org.spockframework:spock-core:1.1-groovy-2.4")
+ testCompile("net.bytebuddy:byte-buddy:1.8.12")
+ }
- tasks.withType(Test) {
- testLogging {
- events "started", "passed", "skipped", "failed"
- }
- }
+ dependencyManagement {
+ imports {
+ mavenBom "org.springframework.cloud:spring-cloud-dependencies:${BOM_VERSION}"
+ }
+ }
+
+ repositories {
+ mavenCentral()
+ mavenLocal()
+ if (getProp("M2_LOCAL")) {
+ maven {
+ url getProp("M2_LOCAL")
+ }
+ }
+ maven { url "http://repo.spring.io/snapshot" }
+ maven { url "http://repo.spring.io/milestone" }
+ maven { url "http://repo.spring.io/release" }
+ }
+
+ publishing {
+ repositories {
+ maven {
+ url getProp('REPO_WITH_BINARIES_FOR_UPLOAD') ?:
+ getProp('REPO_WITH_BINARIES') ?: 'http://localhost:8081/artifactory/libs-release-local'
+ credentials {
+ username getProp('M2_SETTINGS_REPO_USERNAME') ?: 'admin'
+ password getProp('M2_SETTINGS_REPO_PASSWORD') ?: 'password'
+ }
+ }
+ }
+ publications {
+ mavenJava(MavenPublication) {
+ artifactId project.name
+ from components.java
+ }
+ }
+ }
+
+ tasks.withType(Test) {
+ testLogging {
+ events "started", "passed", "skipped", "failed"
+ }
+ }
}
ext {
- projectGroupId = project.group
- // In a multi-module env we can specify which project is the one that produces the fat-jar
- projectArtifactId = "app-monolith"
- projectVersion = project.version
+ projectGroupId = project.group
+ // In a multi-module env we can specify which project is the one that produces the fat-jar
+ projectArtifactId = "app-monolith"
+ projectVersion = project.version
}
apply plugin: "java"
[bootJar, bootRun]*.enabled = false
task wrapper(type: Wrapper) {
- gradleVersion = '4.8'
+ gradleVersion = '4.8'
}
String getProp(String propName) {
- return hasProperty(propName) ?
- (getProperty(propName) ?: System.properties[propName]) : System.properties[propName] ?:
- System.getenv(propName)
-}
\ No newline at end of file
+ return hasProperty(propName) ?
+ (getProperty(propName) ?: System.properties[propName]) : System.properties[propName] ?:
+ System.getenv(propName)
+}
diff --git a/demand-forecasting-adapters/build.gradle b/demand-forecasting-adapters/build.gradle
index 80cbe04..972d3df 100644
--- a/demand-forecasting-adapters/build.gradle
+++ b/demand-forecasting-adapters/build.gradle
@@ -4,13 +4,7 @@ dependencies {
compile(project(":demand-forecasting-model"))
compile(project(":adapter-commons"))
- compile("org.projectlombok:lombok:1.16.18")
-
- runtime("org.postgresql:postgresql:42.1.4")
-
testCompile("org.springframework.boot:spring-boot-starter-test")
- testCompile("org.spockframework:spock-core:1.1-groovy-2.4")
testCompile("org.spockframework:spock-spring:1.1-groovy-2.4")
testCompile("com.h2database:h2:1.4.194")
- testCompile(project(":adapter-commons").sourceSets.test.output)
-}
\ No newline at end of file
+}
diff --git a/demand-forecasting-adapters/pom.xml b/demand-forecasting-adapters/pom.xml
deleted file mode 100644
index c1126bf..0000000
--- a/demand-forecasting-adapters/pom.xml
+++ /dev/null
@@ -1,265 +0,0 @@
-
-
- 4.0.0
-
- pl.com.dddbyexamples
- demand-forecasting-adapters
- 1.0-SNAPSHOT
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.2.RELEASE
-
-
-
-
- pl.com.dddbyexamples
- demand-forecasting-model
- 1.0-SNAPSHOT
-
-
- pl.com.dddbyexamples
- adapter-commons
- 1.0-SNAPSHOT
-
-
- pl.com.dddbyexamples
- adapter-commons
- 1.0-SNAPSHOT
- test-jar
- test
-
-
-
- org.projectlombok
- lombok
- 1.16.18
- provided
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.postgresql
- postgresql
- 42.1.4
- runtime
-
-
- org.spockframework
- spock-core
- 1.1-groovy-2.4
- test
-
-
- org.spockframework
- spock-spring
- 1.1-groovy-2.4
- test
-
-
- net.bytebuddy
- byte-buddy
- 1.7.9
- test
-
-
- com.h2database
- h2
- 1.4.197
- test
-
-
-
-
- 1.8
-
- artifactory-local
- http://localhost:8081/artifactory/libs-release-local
- http://localhost:8081/artifactory/libs-snapshot-local
- http://localhost:8081/artifactory/libs-release-local
- 2.21.0
-
-
-
-
-
- ${distribution.management.release.id}
- Release Repository
- ${distribution.management.release.url}
-
-
- ${distribution.management.release.id}
- Snapshot Repository
- ${distribution.management.snapshot.url}
-
-
-
-
-
-
- org.codehaus.gmavenplus
- gmavenplus-plugin
- 1.6
-
-
-
- addTestSources
- compileTests
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- -parameters
-
-
-
-
- maven-surefire-plugin
- 2.20.1
-
- false
-
- **/*Spec.java
- **/*Test.java
-
-
-
-
-
-
-
-
- default
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- **/*Test*.*>
- **/*Spec*.*
-
-
- **/smoke/**
- **/e2e/**
-
-
-
-
-
-
-
-
- apicompatibility
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- contracttests/**/*Test*.*
- contracttests/**/*Spec*.*
-
-
-
-
-
-
-
-
- smoke
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- smoke/**/*Tests.java
- smoke/**/*Test.java
- smoke/**/*Spec.*
-
-
-
-
-
-
-
-
- e2e
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- e2e/**/*Tests.java
- e2e/**/*Test.java
- e2e/**/*Spec.*
-
-
-
-
-
-
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
diff --git a/demand-forecasting-adapters/src/main/java/io/dddbyexamples/factory/delivery/planning/DeliveryAutoPlannerORMRepository.java b/demand-forecasting-adapters/src/main/java/io/dddbyexamples/factory/delivery/planning/DeliveryAutoPlannerORMRepository.java
index b2e3328..6365da0 100644
--- a/demand-forecasting-adapters/src/main/java/io/dddbyexamples/factory/delivery/planning/DeliveryAutoPlannerORMRepository.java
+++ b/demand-forecasting-adapters/src/main/java/io/dddbyexamples/factory/delivery/planning/DeliveryAutoPlannerORMRepository.java
@@ -1,5 +1,6 @@
package io.dddbyexamples.factory.delivery.planning;
+import io.dddbyexamples.factory.delivery.planning.definition.DeliveryPlannerDefinition;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Component;
import io.dddbyexamples.factory.delivery.planning.definition.DeliveryPlannerDefinitionDao;
@@ -17,6 +18,7 @@ public class DeliveryAutoPlannerORMRepository {
return new DeliveryAutoPlanner(refNo,
dao.findById(refNo)
.map(DeliveryPlannerDefinitionEntity::getDefinition)
+ .filter(def -> !def.isDisabled())
.map(x -> x.map(DeliveriesSuggestion::timesAndFractions))
.orElse(Collections.emptyMap()));
}
diff --git a/demand-forecasting-adapters/src/main/java/io/dddbyexamples/factory/delivery/planning/definition/DeliveryPlannerDefinition.java b/demand-forecasting-adapters/src/main/java/io/dddbyexamples/factory/delivery/planning/definition/DeliveryPlannerDefinition.java
index 2387171..4f0cb98 100644
--- a/demand-forecasting-adapters/src/main/java/io/dddbyexamples/factory/delivery/planning/definition/DeliveryPlannerDefinition.java
+++ b/demand-forecasting-adapters/src/main/java/io/dddbyexamples/factory/delivery/planning/definition/DeliveryPlannerDefinition.java
@@ -18,6 +18,7 @@ import java.util.stream.Collectors;
public class DeliveryPlannerDefinition {
@Singular
private final Map> definitions;
+ private final boolean disabled;
public static Map of(LocalTime time, Double fraction) {
return Collections.singletonMap(time, fraction);
diff --git a/demand-forecasting-adapters/src/test/groovy/io/dddbyexamples/factory/delivery/planning/DeliveryPlannerDefinitionSpec.groovy b/demand-forecasting-adapters/src/test/groovy/io/dddbyexamples/factory/delivery/planning/DeliveryPlannerDefinitionSpec.groovy
index 1243708..146b8b8 100644
--- a/demand-forecasting-adapters/src/test/groovy/io/dddbyexamples/factory/delivery/planning/DeliveryPlannerDefinitionSpec.groovy
+++ b/demand-forecasting-adapters/src/test/groovy/io/dddbyexamples/factory/delivery/planning/DeliveryPlannerDefinitionSpec.groovy
@@ -5,12 +5,15 @@ import org.springframework.boot.test.context.SpringBootTest
import io.dddbyexamples.factory.delivery.planning.definition.DeliveryPlannerDefinition
import io.dddbyexamples.factory.delivery.planning.definition.DeliveryPlannerDefinitionDao
import io.dddbyexamples.factory.delivery.planning.definition.DeliveryPlannerDefinitionEntity
+import org.springframework.test.context.ActiveProfiles
+import org.springframework.test.context.TestPropertySource
import spock.lang.Specification
import static java.time.LocalTime.of as time
import static io.dddbyexamples.factory.delivery.planning.definition.DeliveryPlannerDefinition.of
import static io.dddbyexamples.factory.demand.forecasting.Demand.Schema.*
+@ActiveProfiles("test")
@SpringBootTest
class DeliveryPlannerDefinitionSpec extends Specification {
diff --git a/demand-forecasting-adapters/src/test/groovy/io/dddbyexamples/factory/demand/forecasting/ProductDemandORMRepositorySpec.groovy b/demand-forecasting-adapters/src/test/groovy/io/dddbyexamples/factory/demand/forecasting/ProductDemandORMRepositorySpec.groovy
index a1d0b23..3f5a34b 100644
--- a/demand-forecasting-adapters/src/test/groovy/io/dddbyexamples/factory/demand/forecasting/ProductDemandORMRepositorySpec.groovy
+++ b/demand-forecasting-adapters/src/test/groovy/io/dddbyexamples/factory/demand/forecasting/ProductDemandORMRepositorySpec.groovy
@@ -1,24 +1,22 @@
package io.dddbyexamples.factory.demand.forecasting
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.test.context.SpringBootTest
-import org.springframework.test.annotation.Commit
+import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
import io.dddbyexamples.factory.demand.forecasting.persistence.DemandDao
import io.dddbyexamples.factory.demand.forecasting.persistence.DemandEntity
import io.dddbyexamples.factory.demand.forecasting.persistence.ProductDemandDao
import io.dddbyexamples.factory.demand.forecasting.persistence.ProductDemandEntity
+import org.springframework.test.context.ActiveProfiles
import spock.lang.Specification
import javax.persistence.EntityManager
-import javax.transaction.Transactional
import java.time.Clock
import java.time.Instant
import java.time.LocalDate
import java.time.ZoneId
-@SpringBootTest
-@Transactional
-@Commit
+@ActiveProfiles("test")
+@DataJpaTest
class ProductDemandORMRepositorySpec extends Specification {
def clock = Clock.fixed(Instant.now(), ZoneId.systemDefault())
diff --git a/demand-forecasting-model/build.gradle b/demand-forecasting-model/build.gradle
index 9a0d5b7..aad9908 100644
--- a/demand-forecasting-model/build.gradle
+++ b/demand-forecasting-model/build.gradle
@@ -1,10 +1,6 @@
apply plugin: 'groovy'
+apply plugin: "jacoco"
dependencies {
compile(project(":shared-kernel-model"))
- compile(project(":adapter-commons"))
-
- compile("org.projectlombok:lombok:1.16.18")
-
- testCompile("org.spockframework:spock-core:1.1-groovy-2.4")
-}
\ No newline at end of file
+}
diff --git a/demand-forecasting-model/pom.xml b/demand-forecasting-model/pom.xml
deleted file mode 100644
index d3fccd2..0000000
--- a/demand-forecasting-model/pom.xml
+++ /dev/null
@@ -1,236 +0,0 @@
-
-
- 4.0.0
-
- pl.com.dddbyexamples
- demand-forecasting-model
- jar
- 1.0-SNAPSHOT
-
-
- 1.8
-
- artifactory-local
- http://localhost:8081/artifactory/libs-release-local
- http://localhost:8081/artifactory/libs-snapshot-local
- http://localhost:8081/artifactory/libs-release-local
- 2.21.0
-
-
-
-
-
- ${distribution.management.release.id}
- Release Repository
- ${distribution.management.release.url}
-
-
- ${distribution.management.release.id}
- Snapshot Repository
- ${distribution.management.snapshot.url}
-
-
-
-
-
- pl.com.dddbyexamples
- shared-kernel-model
- 1.0-SNAPSHOT
-
-
- org.projectlombok
- lombok
- 1.16.18
- provided
-
-
- org.spockframework
- spock-core
- 1.1-groovy-2.4
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.7.0
-
- 1.8
- 1.8
- -parameters
-
-
-
- org.codehaus.gmavenplus
- gmavenplus-plugin
- 1.6
-
-
-
- compileTests
-
-
-
-
-
- maven-surefire-plugin
- 2.20.1
-
- false
-
- **/*Spec.java
- **/*Test.java
-
-
-
-
- org.jacoco
- jacoco-maven-plugin
- 0.8.0
-
-
-
- prepare-agent
-
-
-
- report
- test
-
- report
-
-
-
-
-
-
-
-
-
- default
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- **/*Test*.*>
- **/*Spec*.*
-
-
- **/smoke/**
- **/e2e/**
-
-
-
-
-
-
-
-
- apicompatibility
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- contracttests/**/*Test*.*
- contracttests/**/*Spec*.*
-
-
-
-
-
-
-
-
- smoke
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- smoke/**/*Tests.java
- smoke/**/*Test.java
- smoke/**/*Spec.*
-
-
-
-
-
-
-
-
- e2e
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- e2e/**/*Tests.java
- e2e/**/*Test.java
- e2e/**/*Spec.*
-
-
-
-
-
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
diff --git a/demand-forecasting-model/src/test/groovy/io/dddbyexamples/factory/demand/forecasting/DemandsFake.groovy b/demand-forecasting-model/src/test/groovy/io/dddbyexamples/factory/demand/forecasting/DemandsFake.groovy
index 3f5e5f2..8a4fd95 100644
--- a/demand-forecasting-model/src/test/groovy/io/dddbyexamples/factory/demand/forecasting/DemandsFake.groovy
+++ b/demand-forecasting-model/src/test/groovy/io/dddbyexamples/factory/demand/forecasting/DemandsFake.groovy
@@ -12,14 +12,6 @@ class DemandsFake extends Demands {
fetch = { date -> nothingDemanded(date) }
}
- DailyDemand nothingDemanded(LocalDate date) {
- def demand = builder.reset()
- .date(date)
- .build()
- fetched.put(date, demand)
- demand
- }
-
DailyDemand demanded(LocalDate date, long level) {
def demand = builder.date(date)
.demandedLevels(level)
@@ -48,4 +40,11 @@ class DemandsFake extends Demands {
fetched.put(date, demand)
demand
}
+
+ private DailyDemand nothingDemanded(LocalDate date) {
+ def demand = builder.reset()
+ .date(date)
+ .build()
+ demand
+ }
}
diff --git a/gradle.properties b/gradle.properties
index 57ed1c5..d765e1c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,2 +1,2 @@
org.gradle.daemon=false
-BOM_VERSION=Finchley.BUILD-SNAPSHOT
\ No newline at end of file
+BOM_VERSION=Finchley.BUILD-SNAPSHOT
diff --git a/lombok.config b/lombok.config
index b10dcbd..f3fa06b 100644
--- a/lombok.config
+++ b/lombok.config
@@ -1,3 +1,2 @@
config.stopBubbling=true
lombok.addLombokGeneratedAnnotation=true
-#lombok.anyConstructor.addConstructorProperties=true
diff --git a/manifest.yml b/manifest.yml
index f53f453..c74ba21 100644
--- a/manifest.yml
+++ b/manifest.yml
@@ -5,4 +5,4 @@ applications:
- app-monolith-db
env:
JAVA_OPTS: -Djava.security.egd=file:///dev/urandom
- TRUST_CERTS: api.run.pivotal.io
\ No newline at end of file
+ TRUST_CERTS: api.run.pivotal.io
diff --git a/mvnw b/mvnw
deleted file mode 100755
index 961a825..0000000
--- a/mvnw
+++ /dev/null
@@ -1,286 +0,0 @@
-#!/bin/sh
-# ----------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Maven2 Start Up Batch script
-#
-# Required ENV vars:
-# ------------------
-# JAVA_HOME - location of a JDK home dir
-#
-# Optional ENV vars
-# -----------------
-# M2_HOME - location of maven2's installed home dir
-# MAVEN_OPTS - parameters passed to the Java VM when running Maven
-# e.g. to debug Maven itself, use
-# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-# ----------------------------------------------------------------------------
-
-if [ -z "$MAVEN_SKIP_RC" ] ; then
-
- if [ -f /etc/mavenrc ] ; then
- . /etc/mavenrc
- fi
-
- if [ -f "$HOME/.mavenrc" ] ; then
- . "$HOME/.mavenrc"
- fi
-
-fi
-
-# OS specific support. $var _must_ be set to either true or false.
-cygwin=false;
-darwin=false;
-mingw=false
-case "`uname`" in
- CYGWIN*) cygwin=true ;;
- MINGW*) mingw=true;;
- Darwin*) darwin=true
- # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
- # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
- if [ -z "$JAVA_HOME" ]; then
- if [ -x "/usr/libexec/java_home" ]; then
- export JAVA_HOME="`/usr/libexec/java_home`"
- else
- export JAVA_HOME="/Library/Java/Home"
- fi
- fi
- ;;
-esac
-
-if [ -z "$JAVA_HOME" ] ; then
- if [ -r /etc/gentoo-release ] ; then
- JAVA_HOME=`java-config --jre-home`
- fi
-fi
-
-if [ -z "$M2_HOME" ] ; then
- ## resolve links - $0 may be a link to maven's home
- PRG="$0"
-
- # need this for relative symlinks
- while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG="`dirname "$PRG"`/$link"
- fi
- done
-
- saveddir=`pwd`
-
- M2_HOME=`dirname "$PRG"`/..
-
- # make it fully qualified
- M2_HOME=`cd "$M2_HOME" && pwd`
-
- cd "$saveddir"
- # echo Using m2 at $M2_HOME
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --unix "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
-fi
-
-# For Mingw, ensure paths are in UNIX format before anything is touched
-if $mingw ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME="`(cd "$M2_HOME"; pwd)`"
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
- # TODO classpath?
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- javaExecutable="`which javac`"
- if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
- # readlink(1) is not available as standard on Solaris 10.
- readLink=`which readlink`
- if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
- if $darwin ; then
- javaHome="`dirname \"$javaExecutable\"`"
- javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
- else
- javaExecutable="`readlink -f \"$javaExecutable\"`"
- fi
- javaHome="`dirname \"$javaExecutable\"`"
- javaHome=`expr "$javaHome" : '\(.*\)/bin'`
- JAVA_HOME="$javaHome"
- export JAVA_HOME
- fi
- fi
-fi
-
-if [ -z "$JAVACMD" ] ; then
- if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- else
- JAVACMD="`which java`"
- fi
-fi
-
-if [ ! -x "$JAVACMD" ] ; then
- echo "Error: JAVA_HOME is not defined correctly." >&2
- echo " We cannot execute $JAVACMD" >&2
- exit 1
-fi
-
-if [ -z "$JAVA_HOME" ] ; then
- echo "Warning: JAVA_HOME environment variable is not set."
-fi
-
-CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
-# traverses directory structure from process work directory to filesystem root
-# first directory with .mvn subdirectory is considered project base directory
-find_maven_basedir() {
-
- if [ -z "$1" ]
- then
- echo "Path not specified to find_maven_basedir"
- return 1
- fi
-
- basedir="$1"
- wdir="$1"
- while [ "$wdir" != '/' ] ; do
- if [ -d "$wdir"/.mvn ] ; then
- basedir=$wdir
- break
- fi
- # workaround for JBEAP-8937 (on Solaris 10/Sparc)
- if [ -d "${wdir}" ]; then
- wdir=`cd "$wdir/.."; pwd`
- fi
- # end of workaround
- done
- echo "${basedir}"
-}
-
-# concatenates all lines of a file
-concat_lines() {
- if [ -f "$1" ]; then
- echo "$(tr -s '\n' ' ' < "$1")"
- fi
-}
-
-BASE_DIR=`find_maven_basedir "$(pwd)"`
-if [ -z "$BASE_DIR" ]; then
- exit 1;
-fi
-
-##########################################################################################
-# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-# This allows using the maven wrapper in projects that prohibit checking in binary data.
-##########################################################################################
-if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found .mvn/wrapper/maven-wrapper.jar"
- fi
-else
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
- fi
- jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"
- while IFS="=" read key value; do
- case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
- esac
- done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Downloading from: $jarUrl"
- fi
- wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
-
- if command -v wget > /dev/null; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found wget ... using wget"
- fi
- wget "$jarUrl" -O "$wrapperJarPath"
- elif command -v curl > /dev/null; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found curl ... using curl"
- fi
- curl -o "$wrapperJarPath" "$jarUrl"
- else
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Falling back to using Java to download"
- fi
- javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
- if [ -e "$javaClass" ]; then
- if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo " - Compiling MavenWrapperDownloader.java ..."
- fi
- # Compiling the Java class
- ("$JAVA_HOME/bin/javac" "$javaClass")
- fi
- if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
- # Running the downloader
- if [ "$MVNW_VERBOSE" = true ]; then
- echo " - Running MavenWrapperDownloader.java ..."
- fi
- ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
- fi
- fi
- fi
-fi
-##########################################################################################
-# End of extension
-##########################################################################################
-
-export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
-if [ "$MVNW_VERBOSE" = true ]; then
- echo $MAVEN_PROJECTBASEDIR
-fi
-MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --path --windows "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
- [ -n "$MAVEN_PROJECTBASEDIR" ] &&
- MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
-fi
-
-WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-exec "$JAVACMD" \
- $MAVEN_OPTS \
- -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
- "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
- ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/mvnw.cmd b/mvnw.cmd
deleted file mode 100755
index 830073a..0000000
--- a/mvnw.cmd
+++ /dev/null
@@ -1,161 +0,0 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Maven2 Start Up Batch script
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM M2_HOME - location of maven2's installed home dir
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM set title of command window
-title %0
-@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
-if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.0/maven-wrapper-0.4.0.jar"
-FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO (
- IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
-)
-
-@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
-if exist %WRAPPER_JAR% (
- echo Found %WRAPPER_JAR%
-) else (
- echo Couldn't find %WRAPPER_JAR%, downloading it ...
- echo Downloading from: %DOWNLOAD_URL%
- powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"
- echo Finished downloading %WRAPPER_JAR%
-)
-@REM End of extension
-
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
-if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%" == "on" pause
-
-if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
-
-exit /B %ERROR_CODE%
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index 53feef2..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
- 4.0.0
-
- pl.com.dddbyexamples
- factory
- pom
- 1.0-SNAPSHOT
-
-
- app-monolith
- adapter-commons
- shared-kernel-model
- demand-forecasting-model
- demand-forecasting-adapters
- shortages-prediction-model
- shortages-prediction-adapters
- product-management-adapters
- production-planning-adapters
-
-
-
- ${project.basedir}
-
- artifactory-local
- http://localhost:8081/artifactory/libs-release-local
- http://localhost:8081/artifactory/libs-snapshot-local
- http://localhost:8081/artifactory/libs-release-local
- 2.21.0
-
-
-
-
-
- ${distribution.management.release.id}
- Release Repository
- ${distribution.management.release.url}
-
-
- ${distribution.management.release.id}
- Snapshot Repository
- ${distribution.management.snapshot.url}
-
-
-
-
diff --git a/product-management-adapters/build.gradle b/product-management-adapters/build.gradle
index fcab307..b35cf98 100644
--- a/product-management-adapters/build.gradle
+++ b/product-management-adapters/build.gradle
@@ -3,14 +3,7 @@ apply plugin: 'groovy'
dependencies {
compile(project(":adapter-commons"))
- compile("org.projectlombok:lombok:1.16.18")
- compile("net.bytebuddy:byte-buddy:1.7.9")
-
- runtime("org.postgresql:postgresql:42.1.4")
-
testCompile("org.springframework.boot:spring-boot-starter-test")
- testCompile("org.spockframework:spock-core:1.1-groovy-2.4")
testCompile("org.spockframework:spock-spring:1.1-groovy-2.4")
testCompile("com.h2database:h2:1.4.194")
- testCompile(project(":adapter-commons").sourceSets.test.output)
-}
\ No newline at end of file
+}
diff --git a/product-management-adapters/pom.xml b/product-management-adapters/pom.xml
deleted file mode 100644
index 0a457eb..0000000
--- a/product-management-adapters/pom.xml
+++ /dev/null
@@ -1,259 +0,0 @@
-
-
- 4.0.0
-
- pl.com.dddbyexamples
- product-management-adapters
- 1.0-SNAPSHOT
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.2.RELEASE
-
-
-
-
- pl.com.dddbyexamples
- adapter-commons
- 1.0-SNAPSHOT
-
-
- pl.com.dddbyexamples
- adapter-commons
- 1.0-SNAPSHOT
- test-jar
- test
-
-
-
- org.projectlombok
- lombok
- 1.16.18
- provided
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.postgresql
- postgresql
- 42.1.4
- runtime
-
-
- org.spockframework
- spock-core
- 1.1-groovy-2.4
- test
-
-
- org.spockframework
- spock-spring
- 1.1-groovy-2.4
- test
-
-
- net.bytebuddy
- byte-buddy
- 1.7.9
-
-
- com.h2database
- h2
- 1.4.197
- test
-
-
-
-
-
- 1.8
-
- artifactory-local
- http://localhost:8081/artifactory/libs-release-local
- http://localhost:8081/artifactory/libs-snapshot-local
- http://localhost:8081/artifactory/libs-release-local
- 2.21.0
-
-
-
-
-
- ${distribution.management.release.id}
- Release Repository
- ${distribution.management.release.url}
-
-
- ${distribution.management.release.id}
- Snapshot Repository
- ${distribution.management.snapshot.url}
-
-
-
-
-
-
- org.codehaus.gmavenplus
- gmavenplus-plugin
- 1.6
-
-
-
- addTestSources
- compileTests
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- -parameters
-
-
-
-
- maven-surefire-plugin
- 2.20.1
-
- false
-
- **/*Spec.java
- **/*Test.java
-
-
-
-
-
-
-
-
- default
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- **/*Test*.*>
- **/*Spec*.*
-
-
- **/smoke/**
- **/e2e/**
-
-
-
-
-
-
-
-
- apicompatibility
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- contracttests/**/*Test*.*
- contracttests/**/*Spec*.*
-
-
-
-
-
-
-
-
- smoke
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- smoke/**/*Tests.java
- smoke/**/*Test.java
- smoke/**/*Spec.*
-
-
-
-
-
-
-
-
- e2e
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- e2e/**/*Tests.java
- e2e/**/*Test.java
- e2e/**/*Spec.*
-
-
-
-
-
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
diff --git a/product-management-adapters/src/test/groovy/io/dddbyexamples/factory/product/management/ProductDescriptionPersistenceSpec.groovy b/product-management-adapters/src/test/groovy/io/dddbyexamples/factory/product/management/ProductDescriptionPersistenceSpec.groovy
index 437911a..ff6fa39 100644
--- a/product-management-adapters/src/test/groovy/io/dddbyexamples/factory/product/management/ProductDescriptionPersistenceSpec.groovy
+++ b/product-management-adapters/src/test/groovy/io/dddbyexamples/factory/product/management/ProductDescriptionPersistenceSpec.groovy
@@ -1,5 +1,6 @@
package io.dddbyexamples.factory.product.management
+import org.springframework.test.context.ActiveProfiles
import spock.lang.Ignore
import org.springframework.beans.factory.annotation.Autowired
@@ -8,9 +9,8 @@ import spock.lang.Specification
import static java.util.Collections.singletonList
-// TODO: Unignore
-@Ignore
@SpringBootTest
+@ActiveProfiles("test")
class ProductDescriptionPersistenceSpec extends Specification {
@Autowired
diff --git a/production-planning-adapters/build.gradle b/production-planning-adapters/build.gradle
index fcab307..b35cf98 100644
--- a/production-planning-adapters/build.gradle
+++ b/production-planning-adapters/build.gradle
@@ -3,14 +3,7 @@ apply plugin: 'groovy'
dependencies {
compile(project(":adapter-commons"))
- compile("org.projectlombok:lombok:1.16.18")
- compile("net.bytebuddy:byte-buddy:1.7.9")
-
- runtime("org.postgresql:postgresql:42.1.4")
-
testCompile("org.springframework.boot:spring-boot-starter-test")
- testCompile("org.spockframework:spock-core:1.1-groovy-2.4")
testCompile("org.spockframework:spock-spring:1.1-groovy-2.4")
testCompile("com.h2database:h2:1.4.194")
- testCompile(project(":adapter-commons").sourceSets.test.output)
-}
\ No newline at end of file
+}
diff --git a/production-planning-adapters/pom.xml b/production-planning-adapters/pom.xml
deleted file mode 100644
index 4c79ad8..0000000
--- a/production-planning-adapters/pom.xml
+++ /dev/null
@@ -1,228 +0,0 @@
-
-
- 4.0.0
-
- pl.com.dddbyexamples
- production-planning-adapters
- 1.0-SNAPSHOT
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.2.RELEASE
-
-
-
-
- pl.com.dddbyexamples
- adapter-commons
- 1.0-SNAPSHOT
-
-
- pl.com.dddbyexamples
- adapter-commons
- 1.0-SNAPSHOT
- test-jar
- test
-
-
-
- org.projectlombok
- lombok
- 1.16.18
- provided
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.postgresql
- postgresql
- 42.1.4
- runtime
-
-
- org.spockframework
- spock-core
- 1.1-groovy-2.4
- test
-
-
- org.spockframework
- spock-spring
- 1.1-groovy-2.4
- test
-
-
- net.bytebuddy
- byte-buddy
- 1.7.9
-
-
-
-
- 1.8
-
- artifactory-local
- http://localhost:8081/artifactory/libs-release-local
- http://localhost:8081/artifactory/libs-snapshot-local
- http://localhost:8081/artifactory/libs-release-local
- 2.21.0
-
-
-
-
-
- ${distribution.management.release.id}
- Release Repository
- ${distribution.management.release.url}
-
-
- ${distribution.management.release.id}
- Snapshot Repository
- ${distribution.management.snapshot.url}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- -parameters
-
-
-
-
-
-
-
-
- default
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- **/*Test*.*>
- **/*Spec*.*
-
-
- **/smoke/**
- **/e2e/**
-
-
-
-
-
-
-
-
- apicompatibility
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- contracttests/**/*Test*.*
- contracttests/**/*Spec*.*
-
-
-
-
-
-
-
-
- smoke
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- smoke/**/*Tests.java
- smoke/**/*Test.java
- smoke/**/*Spec.*
-
-
-
-
-
-
-
-
- e2e
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- e2e/**/*Tests.java
- e2e/**/*Test.java
- e2e/**/*Spec.*
-
-
-
-
-
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
diff --git a/sc-pipelines.yml b/sc-pipelines.yml
index 6e694ac..fb1d52e 100644
--- a/sc-pipelines.yml
+++ b/sc-pipelines.yml
@@ -15,4 +15,4 @@ stage:
type: broker
broker: elephantsql
plan: turtle
- useExisting: true
\ No newline at end of file
+ useExisting: true
diff --git a/settings.gradle b/settings.gradle
index 7e6ab6e..be39c41 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -7,4 +7,4 @@ include "demand-forecasting-adapters"
include "shortages-prediction-model"
include "shortages-prediction-adapters"
include "product-management-adapters"
-include "production-planning-adapters"
\ No newline at end of file
+include "production-planning-adapters"
diff --git a/shared-kernel-model/build.gradle b/shared-kernel-model/build.gradle
index 3e358d9..804f813 100644
--- a/shared-kernel-model/build.gradle
+++ b/shared-kernel-model/build.gradle
@@ -1,7 +1,5 @@
apply plugin: 'groovy'
+apply plugin: "jacoco"
dependencies {
- compile("org.projectlombok:lombok:1.16.18")
-
- testCompile("org.spockframework:spock-core:1.1-groovy-2.4")
-}
\ No newline at end of file
+}
diff --git a/shared-kernel-model/pom.xml b/shared-kernel-model/pom.xml
deleted file mode 100644
index ec69191..0000000
--- a/shared-kernel-model/pom.xml
+++ /dev/null
@@ -1,231 +0,0 @@
-
-
- 4.0.0
-
- pl.com.dddbyexamples
- shared-kernel-model
- jar
- 1.0-SNAPSHOT
-
-
- 1.8
-
- artifactory-local
- http://localhost:8081/artifactory/libs-release-local
- http://localhost:8081/artifactory/libs-snapshot-local
- http://localhost:8081/artifactory/libs-release-local
- 2.21.0
-
-
-
-
-
- ${distribution.management.release.id}
- Release Repository
- ${distribution.management.release.url}
-
-
- ${distribution.management.release.id}
- Snapshot Repository
- ${distribution.management.snapshot.url}
-
-
-
-
-
- org.projectlombok
- lombok
- 1.16.18
- compile
-
-
- org.spockframework
- spock-core
- 1.1-groovy-2.4
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.7.0
-
- 1.8
- 1.8
- -parameters
-
-
-
- org.codehaus.gmavenplus
- gmavenplus-plugin
- 1.6
-
-
-
- compileTests
-
-
-
-
-
- maven-surefire-plugin
- 2.20.1
-
- false
-
- **/*Spec.java
- **/*Test.java
-
-
-
-
- org.jacoco
- jacoco-maven-plugin
- 0.8.0
-
-
-
- prepare-agent
-
-
-
- report
- test
-
- report
-
-
-
-
-
-
-
-
-
- default
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- **/*Test*.*>
- **/*Spec*.*
-
-
- **/smoke/**
- **/e2e/**
-
-
-
-
-
-
-
-
- apicompatibility
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- contracttests/**/*Test*.*
- contracttests/**/*Spec*.*
-
-
-
-
-
-
-
-
- smoke
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- smoke/**/*Tests.java
- smoke/**/*Test.java
- smoke/**/*Spec.*
-
-
-
-
-
-
-
-
- e2e
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- e2e/**/*Tests.java
- e2e/**/*Test.java
- e2e/**/*Spec.*
-
-
-
-
-
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
diff --git a/shortages-prediction-adapters/build.gradle b/shortages-prediction-adapters/build.gradle
index 2e7950c..54f6fbe 100644
--- a/shortages-prediction-adapters/build.gradle
+++ b/shortages-prediction-adapters/build.gradle
@@ -4,18 +4,12 @@ dependencies {
compile(project(":shortages-prediction-model"))
compile(project(":adapter-commons"))
- compile("org.projectlombok:lombok:1.16.18")
-
- runtime("org.postgresql:postgresql:42.1.4")
-
testCompile("org.springframework.boot:spring-boot-starter-test")
- testCompile("org.spockframework:spock-core:1.1-groovy-2.4")
testCompile("org.spockframework:spock-spring:1.1-groovy-2.4")
testCompile("org.springframework.cloud:spring-cloud-starter-contract-stub-runner")
testCompile("org.springframework.cloud:spring-cloud-starter-contract-verifier")
testCompile("org.springframework.restdocs:spring-restdocs-mockmvc")
testCompile("com.h2database:h2:1.4.194")
- testCompile(project(":adapter-commons").sourceSets.test.output)
}
if (gradle.startParameter.taskRequests.any { it.args.any { it.contains("apiCompatibility") } }) {
@@ -50,4 +44,4 @@ if (gradle.startParameter.taskRequests.any { it.args.any { it.contains("apiCompa
}
}
-}
\ No newline at end of file
+}
diff --git a/shortages-prediction-adapters/pom.xml b/shortages-prediction-adapters/pom.xml
deleted file mode 100644
index bc149fe..0000000
--- a/shortages-prediction-adapters/pom.xml
+++ /dev/null
@@ -1,357 +0,0 @@
-
-
- 4.0.0
-
- pl.com.dddbyexamples
- shortages-prediction-adapters
- 1.0-SNAPSHOT
-
-
- org.springframework.boot
- spring-boot-starter-parent
- 2.0.2.RELEASE
-
-
-
-
-
- pl.com.dddbyexamples
- shortages-prediction-model
- 1.0-SNAPSHOT
-
-
- pl.com.dddbyexamples
- adapter-commons
- 1.0-SNAPSHOT
-
-
- pl.com.dddbyexamples
- adapter-commons
- 1.0-SNAPSHOT
- test-jar
- test
-
-
-
- org.projectlombok
- lombok
- 1.16.18
- provided
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- org.postgresql
- postgresql
- 42.1.4
- runtime
-
-
- org.spockframework
- spock-core
- 1.1-groovy-2.4
- test
-
-
- org.spockframework
- spock-spring
- 1.1-groovy-2.4
- test
-
-
- net.bytebuddy
- byte-buddy
- 1.7.9
- test
-
-
- org.springframework.cloud
- spring-cloud-starter-contract-stub-runner
- test
-
-
- org.springframework.cloud
- spring-cloud-starter-contract-verifier
- test
-
-
- org.springframework.restdocs
- spring-restdocs-mockmvc
- test
-
-
- com.h2database
- h2
- 1.4.197
- test
-
-
-
-
-
-
- org.springframework.cloud
- spring-cloud-dependencies
- ${spring-cloud.version}
- pom
- import
-
-
-
-
-
- 1.8
- Finchley.BUILD-SNAPSHOT
- 2.0.0.BUILD-SNAPSHOT
-
- artifactory-local
- http://localhost:8081/artifactory/libs-release-local
- http://localhost:8081/artifactory/libs-snapshot-local
- http://localhost:8081/artifactory/libs-release-local
- 2.21.0
-
-
-
-
-
- ${distribution.management.release.id}
- Release Repository
- ${distribution.management.release.url}
-
-
- ${distribution.management.release.id}
- Snapshot Repository
- ${distribution.management.snapshot.url}
-
-
-
-
-
-
- org.codehaus.gmavenplus
- gmavenplus-plugin
- 1.6
-
-
-
- addTestSources
- compileTests
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- -parameters
-
-
-
-
- org.codehaus.mojo
- build-helper-maven-plugin
- 3.0.0
-
-
- add-test-source
- generate-test-sources
-
- add-test-source
-
-
-
- ${project.build.directory}/generated-test-sources/contracts
-
-
-
-
-
-
-
-
-
-
- default
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- **/*Test*.*>
- **/*Spec*.*
-
-
- **/smoke/**
- **/e2e/**
-
-
-
-
-
-
-
-
- apicompatibility
-
- false
-
-
-
-
- org.codehaus.gmavenplus
- gmavenplus-plugin
- 1.6
-
-
-
- addTestSources
- compileTests
-
-
-
-
-
-
-
- ${project.build.directory}/generated-test-sources/contracts/
-
- **/*.groovy
-
-
-
- ${project.basedir}/src/test/groovy/
-
- **/*.groovy
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- contracttests/**/*Test*.*
- contracttests/**/*Spec*.*
-
- true
-
-
-
- org.springframework.cloud
- spring-cloud-contract-maven-plugin
- ${spring-cloud-contract.version}
- true
-
-
- ${repo.with.binaries}
- REMOTE
-
-
-
- ${project.groupId}
- app-monolith
- stubs
- ${latest.production.version}
-
- SPOCK
- EXPLICIT
- io.dddbyexamples.factory.shortages.prediction.monitoring.persistence.BaseClass
- io.dddbyexamples.contracttests
- META-INF/${project.groupId}/app-monolith/${latest.production.version}/shortages-prediction-adapters/contracts
-
-
-
-
-
-
-
- smoke
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- smoke/**/*Tests.java
- smoke/**/*Test.java
- smoke/**/*Spec.*
-
-
-
-
-
-
-
-
- e2e
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- e2e/**/*Tests.java
- e2e/**/*Test.java
- e2e/**/*Spec.*
-
-
-
-
-
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
diff --git a/shortages-prediction-adapters/src/main/java/io/dddbyexamples/factory/shortages/prediction/monitoring/ShortagePredictionProcessORMRepository.java b/shortages-prediction-adapters/src/main/java/io/dddbyexamples/factory/shortages/prediction/monitoring/ShortagePredictionProcessORMRepository.java
index b11292a..2d06de5 100644
--- a/shortages-prediction-adapters/src/main/java/io/dddbyexamples/factory/shortages/prediction/monitoring/ShortagePredictionProcessORMRepository.java
+++ b/shortages-prediction-adapters/src/main/java/io/dddbyexamples/factory/shortages/prediction/monitoring/ShortagePredictionProcessORMRepository.java
@@ -44,26 +44,24 @@ class ShortagePredictionProcessORMRepository implements ShortagePredictionProces
.flatMap(dao::findById)
.orElseGet(() -> dao.save(new ShortagesEntity(refNo.getRefNo())));
entity.setShortage(event.getShortage());
-
- events.emit(event);
}
private void delete(ShortageSolved event) {
TechnicalId.get(event.getRefNo())
.ifPresent(dao::deleteById);
-
- events.emit(event);
- }
+ }
private class EventsHandler implements ShortageEvents {
@Override
public void emit(NewShortage event) {
save(event);
+ events.emit(event);
}
@Override
public void emit(ShortageSolved event) {
delete(event);
+ events.emit(event);
}
}
}
diff --git a/shortages-prediction-adapters/src/test/groovy/io/dddbyexamples/factory/shortages/prediction/monitoring/ShortagePredictionProcessORMRepositorySpec.groovy b/shortages-prediction-adapters/src/test/groovy/io/dddbyexamples/factory/shortages/prediction/monitoring/ShortagePredictionProcessORMRepositorySpec.groovy
index accbfb6..25b22ee 100644
--- a/shortages-prediction-adapters/src/test/groovy/io/dddbyexamples/factory/shortages/prediction/monitoring/ShortagePredictionProcessORMRepositorySpec.groovy
+++ b/shortages-prediction-adapters/src/test/groovy/io/dddbyexamples/factory/shortages/prediction/monitoring/ShortagePredictionProcessORMRepositorySpec.groovy
@@ -1,27 +1,21 @@
package io.dddbyexamples.factory.shortages.prediction.monitoring
-import spock.lang.Ignore
-
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.boot.test.context.SpringBootTest
-import org.springframework.test.annotation.Commit
import io.dddbyexamples.factory.product.management.RefNoId
import io.dddbyexamples.factory.shortages.prediction.Shortage
import io.dddbyexamples.factory.shortages.prediction.calculation.ShortageForecasts
import io.dddbyexamples.factory.shortages.prediction.monitoring.persistence.ShortagesDao
import io.dddbyexamples.factory.shortages.prediction.monitoring.persistence.ShortagesEntity
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
+import org.springframework.test.context.ActiveProfiles
import spock.lang.Specification
-import javax.transaction.Transactional
import java.time.LocalDateTime
import static io.dddbyexamples.factory.shortages.prediction.monitoring.NewShortage.After.DemandChanged
-@SpringBootTest
-@Transactional
-@Commit
-//TODO: Unignore
-@Ignore
+@DataJpaTest
+@ActiveProfiles("test")
class ShortagePredictionProcessORMRepositorySpec extends Specification {
def now = LocalDateTime.now()
@@ -42,54 +36,54 @@ class ShortagePredictionProcessORMRepositorySpec extends Specification {
def "provides process instance when no shortage persisted"() {
when:
- def process = fetchProcess()
+ def process = fetchProcess()
then:
- shortagesCurrentlyKnownBy(process) == noShortages()
+ shortagesCurrentlyKnownBy(process) == noShortages()
}
def "provides process instance with last known shortage"() {
given:
- persistedShortage(someShortages())
+ persistedShortage(someShortages())
when:
- def process = fetchProcess()
+ def process = fetchProcess()
then:
- shortagesCurrentlyKnownBy(process) == someShortages()
+ shortagesCurrentlyKnownBy(process) == someShortages()
}
def "persists first shortage"() {
when:
- def process = fetchProcess()
- processEmitsNewShortage(process, someShortages())
+ def process = fetchProcess()
+ processEmitsNewShortage(process, someShortages())
then:
- shortagesCurrentlyPersisted() == someShortages()
+ shortagesCurrentlyPersisted() == someShortages()
}
def "updates previous shortage"() {
given:
- persistedShortage(someOldShortages())
+ persistedShortage(someOldShortages())
when:
- def process = fetchProcess()
- processEmitsNewShortage(process, someShortages())
+ def process = fetchProcess()
+ processEmitsNewShortage(process, someShortages())
then:
- shortagesCurrentlyPersisted() == someShortages()
+ shortagesCurrentlyPersisted() == someShortages()
}
def "deletes solved shortage"() {
given:
- persistedShortage(someShortages())
+ persistedShortage(someShortages())
when:
- def process = fetchProcess()
- processEmitsShortageSolved(process)
+ def process = fetchProcess()
+ processEmitsShortageSolved(process)
then:
- noShortagesPersisted()
+ noShortagesPersisted()
}
def persistedShortage(Shortage shortages) {
diff --git a/shortages-prediction-adapters/src/test/groovy/io/dddbyexamples/factory/shortages/prediction/monitoring/persistence/ShortagesDaoTest.groovy b/shortages-prediction-adapters/src/test/groovy/io/dddbyexamples/factory/shortages/prediction/monitoring/persistence/ShortagesDaoSpec.groovy
similarity index 57%
rename from shortages-prediction-adapters/src/test/groovy/io/dddbyexamples/factory/shortages/prediction/monitoring/persistence/ShortagesDaoTest.groovy
rename to shortages-prediction-adapters/src/test/groovy/io/dddbyexamples/factory/shortages/prediction/monitoring/persistence/ShortagesDaoSpec.groovy
index 39b9489..2abc578 100644
--- a/shortages-prediction-adapters/src/test/groovy/io/dddbyexamples/factory/shortages/prediction/monitoring/persistence/ShortagesDaoTest.groovy
+++ b/shortages-prediction-adapters/src/test/groovy/io/dddbyexamples/factory/shortages/prediction/monitoring/persistence/ShortagesDaoSpec.groovy
@@ -1,24 +1,16 @@
package io.dddbyexamples.factory.shortages.prediction.monitoring.persistence
-import groovy.transform.CompileStatic
-import org.mockito.Mockito
-import spock.lang.Specification
-
-import org.springframework.beans.BeansException
import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.beans.factory.config.BeanPostProcessor
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase
import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.cloud.contract.wiremock.restdocs.SpringCloudContractRestDocs
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.ComponentScan
-import org.springframework.context.annotation.Configuration
import org.springframework.restdocs.mockmvc.MockMvcRestDocumentation
+import org.springframework.test.context.ActiveProfiles
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.result.MockMvcResultMatchers
+import spock.lang.Specification
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.MOCK
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
@@ -31,18 +23,21 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
// would love to get rid of this
@AutoConfigureTestDatabase
@AutoConfigureRestDocs
-class ShortagesDaoTest extends Specification {
+@ActiveProfiles("test")
+class ShortagesDaoSpec extends Specification {
- @Autowired ShortagesDao shortagesDao
- @Autowired MockMvc mockMvc
+ @Autowired
+ ShortagesDao shortagesDao
+ @Autowired
+ MockMvc mockMvc
- def "should find ref by no"() {
- given:
- Config.defaultStubbing(shortagesDao)
- expect:
- mockMvc.perform(get("/shortages?refNo=1"))
- .andExpect(MockMvcResultMatchers.status().isOk())
- .andDo(MockMvcRestDocumentation.document("find_ref_by_no",
- SpringCloudContractRestDocs.dslContract()))
- }
+ def "should find ref by no"() {
+ given:
+ Config.defaultStubbing(shortagesDao)
+ expect:
+ mockMvc.perform(get("/shortages?refNo=1"))
+ .andExpect(MockMvcResultMatchers.status().isOk())
+ .andDo(MockMvcRestDocumentation.document("find_ref_by_no",
+ SpringCloudContractRestDocs.dslContract()))
+ }
}
diff --git a/shortages-prediction-model/build.gradle b/shortages-prediction-model/build.gradle
index 62c080d..aad9908 100644
--- a/shortages-prediction-model/build.gradle
+++ b/shortages-prediction-model/build.gradle
@@ -1,8 +1,6 @@
apply plugin: 'groovy'
+apply plugin: "jacoco"
dependencies {
compile(project(":shared-kernel-model"))
- compile("org.projectlombok:lombok:1.16.18")
-
- testCompile("org.spockframework:spock-core:1.1-groovy-2.4")
-}
\ No newline at end of file
+}
diff --git a/shortages-prediction-model/pom.xml b/shortages-prediction-model/pom.xml
deleted file mode 100644
index 5c38db9..0000000
--- a/shortages-prediction-model/pom.xml
+++ /dev/null
@@ -1,236 +0,0 @@
-
-
- 4.0.0
-
- pl.com.dddbyexamples
- shortages-prediction-model
- jar
- 1.0-SNAPSHOT
-
-
- 1.8
-
- artifactory-local
- http://localhost:8081/artifactory/libs-release-local
- http://localhost:8081/artifactory/libs-snapshot-local
- http://localhost:8081/artifactory/libs-release-local
- 2.21.0
-
-
-
-
-
- ${distribution.management.release.id}
- Release Repository
- ${distribution.management.release.url}
-
-
- ${distribution.management.release.id}
- Snapshot Repository
- ${distribution.management.snapshot.url}
-
-
-
-
-
- pl.com.dddbyexamples
- shared-kernel-model
- 1.0-SNAPSHOT
-
-
- org.projectlombok
- lombok
- 1.16.18
- compile
-
-
- org.spockframework
- spock-core
- 1.1-groovy-2.4
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.7.0
-
- 1.8
- 1.8
- -parameters
-
-
-
- org.codehaus.gmavenplus
- gmavenplus-plugin
- 1.6
-
-
-
- compileTests
-
-
-
-
-
- maven-surefire-plugin
- 2.20.1
-
- false
-
- **/*Spec.java
- **/*Test.java
-
-
-
-
- org.jacoco
- jacoco-maven-plugin
- 0.8.0
-
-
-
- prepare-agent
-
-
-
- report
- test
-
- report
-
-
-
-
-
-
-
-
-
- default
-
- true
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- **/*Test*.*>
- **/*Spec*.*
-
-
- **/smoke/**
- **/e2e/**
-
-
-
-
-
-
-
-
- apicompatibility
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- contracttests/**/*Test*.*
- contracttests/**/*Spec*.*
-
-
-
-
-
-
-
-
- smoke
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- smoke/**/*Tests.java
- smoke/**/*Test.java
- smoke/**/*Spec.*
-
-
-
-
-
-
-
-
- e2e
-
- false
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- ${maven-surefire.version}
-
-
- e2e/**/*Tests.java
- e2e/**/*Test.java
- e2e/**/*Spec.*
-
-
-
-
-
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-
- spring-snapshots
- Spring Snapshots
- https://repo.spring.io/libs-snapshot
-
- true
-
-
- true
-
-
-
-
-