domain model and empty database

This commit is contained in:
Michał Michaluk
2017-12-04 09:00:27 +01:00
parent a2a5e80a3f
commit b4c706b117
64 changed files with 3184 additions and 1 deletions

View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.com.bottega</groupId>
<artifactId>shared-kernel-model</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgument>-parameters</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<goals>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<useFile>false</useFile>
<includes>
<include>**/*Spec.java</include>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.18</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.1-groovy-2.4</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,15 @@
package pl.com.bottega.factory.demand.forecasting;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import java.time.LocalDate;
@Getter
@AllArgsConstructor
@EqualsAndHashCode
public class DailyId {
private final String refNo;
private final LocalDate date;
}

View File

@@ -0,0 +1,25 @@
package pl.com.bottega.factory.demand.forecasting;
import lombok.Value;
@Value
public class Demand {
long level;
Schema schema;
public enum Schema {
AtDayStart, Every3hours, TillDayEnd
}
public static Demand nothingDemanded() {
return of(0);
}
public static Demand of(long level) {
return new Demand(level, Schema.TillDayEnd);
}
public static Demand of(long level, Schema schema) {
return new Demand(level, schema);
}
}

View File

@@ -0,0 +1,28 @@
package pl.com.bottega.factory.demand.forecasting;
import lombok.Value;
import pl.com.bottega.factory.product.management.RefNoId;
import java.util.Collections;
import java.util.Map;
public interface DemandEvents {
void emit(DemandedLevelsChanged event);
@Value
class DemandedLevelsChanged {
RefNoId id;
Map<DailyId, Change> results;
public DemandedLevelsChanged(RefNoId id, Map<DailyId, Change> results) {
this.id = id;
this.results = Collections.unmodifiableMap(results);
}
@Value
public static class Change {
Demand previous;
Demand current;
}
}
}

View File

@@ -0,0 +1,12 @@
package pl.com.bottega.factory.product.management;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
@Getter
@AllArgsConstructor
@EqualsAndHashCode
public class RefNoId {
private final String refNo;
}