Skip to content
This repository was archived by the owner on Nov 6, 2023. It is now read-only.

Commit 8c5ada5

Browse files
authored
Merge pull request #7 from CodelyTV/monorepo
Transform to monorepo
2 parents 1803875 + e86ae57 commit 8c5ada5

File tree

27 files changed

+116
-60
lines changed

27 files changed

+116
-60
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,5 @@ install: true
2525
script:
2626
- ./gradlew assemble --warning-mode all
2727
- ./gradlew check --warning-mode all
28+
# Checks the application is running ok
29+
- ./gradlew :app:run --warning-mode all

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
> You can do awesome stuff with Java 🙂
77
88
[![CodelyTV](https://img.shields.io/badge/codely-tv-green.svg?style=flat-square)](https://codely.tv)
9-
[![Build Status](https://travis-ci.com/CodelyTV/cqrs-ddd-java-example.svg?branch=master)](https://travis-ci.com/CodelyTV/cqrs-ddd-java-example)
9+
[![Build Status](https://travis-ci.org/CodelyTV/cqrs-ddd-java-example.svg?branch=master)](https://travis-ci.org/CodelyTV/cqrs-ddd-java-example)
1010

1111
Implementation example of a Java application following Domain-Driven Design (DDD) and Command Query Responsibility Segregation (CQRS) principles, keeping the code as simple as possible.
1212

applications/build.gradle

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apply plugin: 'application'
2+
3+
mainClassName = 'tv.codely.Starter'
4+
5+
dependencies {
6+
compile project(":src:backoffice")
7+
compile project(":src:mooc")
8+
}
9+
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package tv.codely;
2+
3+
public class Starter {
4+
public static void main(String[] args) {
5+
System.out.println("In Works!");
6+
}
7+
}

build.gradle

+47-25
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,58 @@
1-
apply plugin: 'java'
2-
apply plugin: 'application'
3-
4-
sourceCompatibility = 1.11
5-
targetCompatibility = 1.11
6-
7-
repositories {
8-
mavenCentral()
9-
jcenter()
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
jcenter()
5+
}
106
}
117

12-
dependencies {
13-
// Prod
14-
implementation 'io.projectreactor:reactor-bus:2.0.8.RELEASE'
8+
allprojects {
9+
apply plugin: 'java'
1510

16-
// Test
17-
testCompile "org.mockito:mockito-core:2.+"
18-
testCompile 'org.junit.jupiter:junit-jupiter-api:5.+'
19-
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.+'
20-
}
11+
sourceCompatibility = 11
12+
targetCompatibility = 11
2113

22-
test {
23-
useJUnitPlatform()
14+
repositories {
15+
mavenCentral()
16+
}
2417

25-
testLogging {
26-
events "passed", "skipped", "failed"
18+
sourceSets {
19+
main {
20+
java { srcDirs = [ 'main' ] }
21+
}
22+
test {
23+
java { srcDirs = [ 'test' ] }
24+
}
2725
}
2826

29-
reports {
30-
html.enabled = true
27+
task hello {
28+
doLast { task ->
29+
println "I'm $task.project.name"
30+
}
3131
}
3232
}
3333

34-
application {
35-
mainClassName = "tv.codely.context.video.module.video.infrastructure.VideoPublisherCliController"
34+
subprojects {
35+
group = "tv.codely.${rootProject.name}"
36+
37+
dependencies {
38+
// Prod
39+
implementation 'io.projectreactor:reactor-bus:2.0.8.RELEASE'
40+
41+
// Test
42+
testCompile "org.mockito:mockito-core:2.+"
43+
testCompile 'org.junit.jupiter:junit-jupiter-api:5.+'
44+
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.+'
45+
}
46+
47+
test {
48+
useJUnitPlatform()
49+
50+
testLogging {
51+
events "passed", "skipped", "failed"
52+
}
53+
54+
reports {
55+
html.enabled = true
56+
}
57+
}
3658
}
+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Sun Feb 24 20:05:13 CET 2019
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

settings.gradle

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
rootProject.name = 'cqrs-ddd-java-example'
2+
3+
include 'applications'
4+
include 'src:backoffice'
5+
include 'src:mooc'
6+
include 'src:shared'

src/backoffice/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dependencies {
2+
compile project(":src:shared")
3+
}

src/main/java/tv/codely/context/video/module/video/infrastructure/.gitkeep

Whitespace-only changes.

src/mooc/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dependencies {
2+
compile project(":src:shared")
3+
}
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package tv.codely.context.notification.module.push.application.create;
1+
package tv.codely.mooc.notification.module.push.application.create;
22

3-
import tv.codely.context.video.module.video.domain.VideoPublished;
4-
import tv.codely.shared.application.DomainEventSubscriber;
3+
import tv.codely.mooc.video.module.video.domain.VideoPublished;
4+
import tv.codely.mooc.shared.application.DomainEventSubscriber;
55

66
public class SendPushToSubscribersOnVideoPublished implements DomainEventSubscriber<VideoPublished> {
77
@Override

src/main/java/tv/codely/shared/application/DomainEventSubscriber.java renamed to src/mooc/main/tv/codely/mooc/shared/application/DomainEventSubscriber.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package tv.codely.shared.application;
1+
package tv.codely.mooc.shared.application;
22

3-
import tv.codely.shared.domain.DomainEvent;
3+
import tv.codely.mooc.shared.domain.DomainEvent;
44

55
public interface DomainEventSubscriber<EventType extends DomainEvent> {
66
Class<EventType> subscribedTo();

src/main/java/tv/codely/shared/domain/AggregateRoot.java renamed to src/mooc/main/tv/codely/mooc/shared/domain/AggregateRoot.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package tv.codely.shared.domain;
1+
package tv.codely.mooc.shared.domain;
22

33
import java.util.LinkedList;
44
import java.util.List;

src/main/java/tv/codely/shared/domain/DomainEvent.java renamed to src/mooc/main/tv/codely/mooc/shared/domain/DomainEvent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package tv.codely.shared.domain;
1+
package tv.codely.mooc.shared.domain;
22

33
public interface DomainEvent {
44
String fullQualifiedEventName();

src/main/java/tv/codely/shared/domain/EventBus.java renamed to src/mooc/main/tv/codely/mooc/shared/domain/EventBus.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package tv.codely.shared.domain;
1+
package tv.codely.mooc.shared.domain;
22

33
import java.util.List;
44

src/main/java/tv/codely/shared/infrastructure/bus/ReactorEventBus.java renamed to src/mooc/main/tv/codely/mooc/shared/infrastructure/bus/ReactorEventBus.java

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
package tv.codely.shared.infrastructure.bus;
1+
package tv.codely.mooc.shared.infrastructure.bus;
22

33
import reactor.bus.Event;
44
import reactor.bus.EventBus;
55
import reactor.bus.selector.Selector;
66
import reactor.fn.Consumer;
7-
import tv.codely.shared.application.DomainEventSubscriber;
8-
import tv.codely.shared.domain.DomainEvent;
7+
import tv.codely.mooc.shared.domain.DomainEvent;
8+
import tv.codely.mooc.shared.application.DomainEventSubscriber;
99

10-
import java.util.Arrays;
1110
import java.util.List;
1211
import java.util.Set;
1312

1413
import static reactor.bus.selector.Selectors.$;
1514

16-
public class ReactorEventBus implements tv.codely.shared.domain.EventBus {
15+
public class ReactorEventBus implements tv.codely.mooc.shared.domain.EventBus {
1716
private final EventBus bus;
1817

1918
public ReactorEventBus(final Set<DomainEventSubscriber> subscribers) {

src/main/java/tv/codely/context/video/module/video/application/publish/VideoPublisher.java renamed to src/mooc/main/tv/codely/mooc/video/module/video/application/publish/VideoPublisher.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package tv.codely.context.video.module.video.application.publish;
1+
package tv.codely.mooc.video.module.video.application.publish;
22

3-
import tv.codely.context.video.module.video.domain.Video;
4-
import tv.codely.context.video.module.video.domain.VideoDescription;
5-
import tv.codely.context.video.module.video.domain.VideoTitle;
6-
import tv.codely.shared.domain.EventBus;
3+
import tv.codely.mooc.video.module.video.domain.Video;
4+
import tv.codely.mooc.video.module.video.domain.VideoDescription;
5+
import tv.codely.mooc.video.module.video.domain.VideoTitle;
6+
import tv.codely.mooc.shared.domain.EventBus;
77

88
public final class VideoPublisher {
99
private final EventBus eventBus;

src/main/java/tv/codely/context/video/module/video/domain/Video.java renamed to src/mooc/main/tv/codely/mooc/video/module/video/domain/Video.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package tv.codely.context.video.module.video.domain;
1+
package tv.codely.mooc.video.module.video.domain;
22

3-
import tv.codely.shared.domain.AggregateRoot;
3+
import tv.codely.mooc.shared.domain.AggregateRoot;
44

55
public final class Video extends AggregateRoot {
66
private final VideoTitle title;

src/main/java/tv/codely/context/video/module/video/domain/VideoDescription.java renamed to src/mooc/main/tv/codely/mooc/video/module/video/domain/VideoDescription.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package tv.codely.context.video.module.video.domain;
1+
package tv.codely.mooc.video.module.video.domain;
22

33
public final class VideoDescription {
44
private final String value;

src/main/java/tv/codely/context/video/module/video/domain/VideoPublished.java renamed to src/mooc/main/tv/codely/mooc/video/module/video/domain/VideoPublished.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package tv.codely.context.video.module.video.domain;
1+
package tv.codely.mooc.video.module.video.domain;
22

3-
import tv.codely.shared.domain.DomainEvent;
3+
import tv.codely.mooc.shared.domain.DomainEvent;
44

55
public final class VideoPublished implements DomainEvent {
66
private static final String FULL_QUALIFIED_EVENT_NAME = "codelytv.video.video.event.1.video.published";

src/main/java/tv/codely/context/video/module/video/domain/VideoTitle.java renamed to src/mooc/main/tv/codely/mooc/video/module/video/domain/VideoTitle.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package tv.codely.context.video.module.video.domain;
1+
package tv.codely.mooc.video.module.video.domain;
22

33
public final class VideoTitle {
44
private final String value;
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package tv.codely.context.video.module.video.infrastructure;
1+
package tv.codely.mooc.video.module.video.infrastructure;
22

3-
import tv.codely.context.notification.module.push.application.create.SendPushToSubscribersOnVideoPublished;
4-
import tv.codely.context.video.module.video.application.publish.VideoPublisher;
5-
import tv.codely.shared.application.DomainEventSubscriber;
6-
import tv.codely.shared.domain.EventBus;
7-
import tv.codely.shared.infrastructure.bus.ReactorEventBus;
3+
import tv.codely.mooc.notification.module.push.application.create.SendPushToSubscribersOnVideoPublished;
4+
import tv.codely.mooc.video.module.video.application.publish.VideoPublisher;
5+
import tv.codely.mooc.shared.application.DomainEventSubscriber;
6+
import tv.codely.mooc.shared.domain.EventBus;
7+
import tv.codely.mooc.shared.infrastructure.bus.ReactorEventBus;
88

99
import java.util.Set;
1010

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
package tv.codely.context.video.module.video.application.publish;
1+
package tv.codely.mooc.video.application.publish;
22

33
import org.junit.jupiter.api.Test;
4-
import tv.codely.context.video.module.video.domain.VideoPublished;
5-
import tv.codely.shared.domain.EventBus;
4+
import tv.codely.mooc.video.module.video.application.publish.VideoPublisher;
5+
import tv.codely.mooc.video.module.video.domain.VideoPublished;
6+
import tv.codely.mooc.shared.domain.EventBus;
67

78
import java.util.List;
89

src/shared/build.gradle

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dependencies {
2+
// compile project('src:shared')
3+
}

0 commit comments

Comments
 (0)