Skip to content

Commit

Permalink
Merge pull request #3 from WB3Tech-Java/interface-additions
Browse files Browse the repository at this point in the history
Refined BCE architecture approach
  • Loading branch information
WB3Tech authored Jan 21, 2020
2 parents 2c36f7e + 5c9d3bd commit d0c1172
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 30 deletions.
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@

<groupId>com.wb3tech</groupId>
<artifactId>kernel</artifactId>
<version>0.3.0</version>
<version>1.0.0</version>

<properties>
<java.version>13</java.version>
<junit.jupiter.version>5.6.0-M1</junit.jupiter.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.release>${java.version}</maven.compiler.release>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.plugin.version>3.8.1</maven.compiler.plugin.version>
<maven.surefire.plugin.version>3.0.0-M4</maven.surefire.plugin.version>
</properties>
Expand All @@ -34,6 +31,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<release>${maven.compiler.release}</release>
</configuration>
</plugin>

<plugin>
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/wb3tech/kernel/RequestHandler.java

This file was deleted.

5 changes: 0 additions & 5 deletions src/main/java/com/wb3tech/kernel/UseCase.java

This file was deleted.

4 changes: 4 additions & 0 deletions src/main/java/com/wb3tech/kernel/boundary/Request.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.wb3tech.kernel.boundary;

public interface Request {
}
4 changes: 4 additions & 0 deletions src/main/java/com/wb3tech/kernel/boundary/Response.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.wb3tech.kernel.boundary;

public interface Response {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.wb3tech.kernel.conroller;

public interface CommandUseCase<T> extends UseCase {
void execute(T command);
}
8 changes: 8 additions & 0 deletions src/main/java/com/wb3tech/kernel/conroller/QueryUseCase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.wb3tech.kernel.conroller;

import com.wb3tech.kernel.boundary.Request;
import com.wb3tech.kernel.boundary.Response;

public interface QueryUseCase<Req extends Request, Resp extends Response> {
Resp execute(Req request);
}
4 changes: 4 additions & 0 deletions src/main/java/com/wb3tech/kernel/conroller/UseCase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.wb3tech.kernel.conroller;

public interface UseCase {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.wb3tech.kernel;
package com.wb3tech.kernel.entity;

public abstract class Entity implements Identifiable {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.wb3tech.kernel;
package com.wb3tech.kernel.entity;

public interface Identifiable {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.wb3tech.kernel;
package com.wb3tech.kernel.entity;

import java.util.UUID;

Expand Down Expand Up @@ -61,7 +61,7 @@ public UUID value() {
return this.id;
}

protected Identity copy() {
public Identity copy() {
return new Identity(this.id);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.wb3tech.kernel.valueobject;

import com.wb3tech.kernel.ValueObject;

import java.util.regex.Pattern;

public class EmailAddress extends ValueObject {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/wb3tech/kernel/valueobject/Person.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.wb3tech.kernel.valueobject;

import com.wb3tech.kernel.ValueObject;

public class Person extends ValueObject {

private String givenName;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/wb3tech/kernel/valueobject/Username.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.wb3tech.kernel.valueobject;

import com.wb3tech.kernel.ValueObject;

public class Username extends ValueObject {

public String value;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.wb3tech.kernel;
package com.wb3tech.kernel.valueobject;

public abstract class ValueObject {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.wb3tech.kernel;
package com.wb3tech.kernel.entity;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
Expand All @@ -24,7 +24,7 @@ public void ContainsValidIdentity() {
@DisplayName("When a null Identity is provided, the entity should throw a NullPointerException with the message 'The identity is null.' .")
public void IdentityThrowNullPointerException() {

var exception = assertThrows(NullPointerException.class, () -> new ExampleEntity().setId(null));
var exception = assertThrows(NullPointerException.class, () -> ExampleEntity.Of(null));
Assertions.assertEquals("The identity is null.", exception.getMessage());
}

Expand All @@ -33,7 +33,7 @@ public void IdentityThrowNullPointerException() {
@DisplayName("When an invalid Identity is provided, the entity should throw a IllegalStateException with the message 'The identity is not valid.' .")
public void IdentityThrowIllegalStateException() {

var exception = assertThrows(IllegalStateException.class, () -> new ExampleEntity().setId(Identity.Default()));
var exception = assertThrows(IllegalStateException.class, () -> ExampleEntity.Of(Identity.Default()));
Assertions.assertEquals("The identity is not valid.", exception.getMessage());

}
Expand Down Expand Up @@ -63,4 +63,11 @@ public void setValidIdentity() {
public void setIdentity(Identity id) {
this.setId(id);
}

public static Entity Of(Identity identity) {
var entity = new ExampleEntity();
entity.setIdentity(identity);
return entity;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.wb3tech.kernel;
package com.wb3tech.kernel.entity;

import com.wb3tech.kernel.entity.Identity;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Tag;
Expand Down

0 comments on commit d0c1172

Please sign in to comment.