Skip to content

Commit 1987bdb

Browse files
committed
Merge pull request iluwatar#1 from mikulucky/master
Class Diagram for EDA
2 parents 7176b86 + bea1a0d commit 1987bdb

6 files changed

Lines changed: 234 additions & 1 deletion

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.iluwatar.callback;
2+
3+
/**
4+
*
5+
* This example generates the exact same output as {@link App} however the callback has been
6+
* defined as a Lambdas expression.
7+
*
8+
*/
9+
public class LambdasApp {
10+
11+
/**
12+
* Program entry point
13+
*/
14+
public static void main(String[] args) {
15+
Task task = new SimpleTask();
16+
Callback c = () -> System.out.println("I'm done now.");
17+
task.executeWith(c);
18+
}
19+
}

‎callback/src/test/java/com/iluwatar/callback/AppTest.java‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,22 @@ public void call() {
3636
assertEquals("Callback called twice", new Integer(2), callingCount);
3737

3838
}
39+
40+
@Test
41+
public void testWithLambdasExample() {
42+
Callback callback = () -> callingCount++;
43+
44+
Task task = new SimpleTask();
45+
46+
assertEquals("Initial calling count of 0", new Integer(0), callingCount);
47+
48+
task.executeWith(callback);
49+
50+
assertEquals("Callback called once", new Integer(1), callingCount);
51+
52+
task.executeWith(callback);
53+
54+
assertEquals("Callback called twice", new Integer(2), callingCount);
55+
56+
}
3957
}
-37.3 KB
Binary file not shown.
78.4 KB
Loading
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<class-diagram version="1.1.9" icons="true" automaticImage="PNG" always-add-relationships="true" generalizations="true"
3+
realizations="true" associations="true" dependencies="true" nesting-relationships="true" router="FAN">
4+
<class id="1" language="java" name="com.iluwatar.eda.model.User" project="event-driven-architecture"
5+
file="/event-driven-architecture/src/main/java/com/iluwatar/eda/model/User.java" binary="false"
6+
corner="BOTTOM_RIGHT">
7+
<position height="-1" width="-1" x="937" y="618"/>
8+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
9+
sort-features="false" accessors="true" visibility="true">
10+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
11+
<operations public="true" package="true" protected="true" private="true" static="true"/>
12+
</display>
13+
</class>
14+
<class id="2" language="java" name="com.iluwatar.eda.handler.UserUpdatedEventHandler"
15+
project="event-driven-architecture"
16+
file="/event-driven-architecture/src/main/java/com/iluwatar/eda/handler/UserUpdatedEventHandler.java" binary="false"
17+
corner="BOTTOM_RIGHT">
18+
<position height="-1" width="-1" x="936" y="90"/>
19+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
20+
sort-features="false" accessors="true" visibility="true">
21+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
22+
<operations public="true" package="true" protected="true" private="true" static="true"/>
23+
</display>
24+
</class>
25+
<class id="3" language="java" name="com.iluwatar.eda.handler.UserCreatedEventHandler"
26+
project="event-driven-architecture"
27+
file="/event-driven-architecture/src/main/java/com/iluwatar/eda/handler/UserCreatedEventHandler.java" binary="false"
28+
corner="BOTTOM_RIGHT">
29+
<position height="101" width="200" x="41" y="37"/>
30+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
31+
sort-features="false" accessors="true" visibility="true">
32+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
33+
<operations public="true" package="true" protected="true" private="true" static="true"/>
34+
</display>
35+
</class>
36+
<interface id="4" language="java" name="com.iluwatar.eda.framework.Message" project="event-driven-architecture"
37+
file="/event-driven-architecture/src/main/java/com/iluwatar/eda/framework/Message.java" binary="false"
38+
corner="BOTTOM_RIGHT">
39+
<position height="-1" width="-1" x="298" y="189"/>
40+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
41+
sort-features="false" accessors="true" visibility="true">
42+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
43+
<operations public="true" package="true" protected="true" private="true" static="true"/>
44+
</display>
45+
</interface>
46+
<interface id="5" language="java" name="com.iluwatar.eda.framework.Handler" project="event-driven-architecture"
47+
file="/event-driven-architecture/src/main/java/com/iluwatar/eda/framework/Handler.java" binary="false"
48+
corner="BOTTOM_RIGHT">
49+
<position height="-1" width="-1" x="532" y="89"/>
50+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
51+
sort-features="false" accessors="true" visibility="true">
52+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
53+
<operations public="true" package="true" protected="true" private="true" static="true"/>
54+
</display>
55+
</interface>
56+
<class id="6" language="java" name="com.iluwatar.eda.framework.EventDispatcher" project="event-driven-architecture"
57+
file="/event-driven-architecture/src/main/java/com/iluwatar/eda/framework/EventDispatcher.java" binary="false"
58+
corner="BOTTOM_RIGHT">
59+
<position height="-1" width="-1" x="613" y="292"/>
60+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
61+
sort-features="false" accessors="true" visibility="true">
62+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
63+
<operations public="true" package="true" protected="true" private="true" static="true"/>
64+
</display>
65+
</class>
66+
<class id="7" language="java" name="com.iluwatar.eda.event.UserCreatedEvent" project="event-driven-architecture"
67+
file="/event-driven-architecture/src/main/java/com/iluwatar/eda/event/UserCreatedEvent.java" binary="false"
68+
corner="BOTTOM_RIGHT">
69+
<position height="-1" width="-1" x="145" y="618"/>
70+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
71+
sort-features="false" accessors="true" visibility="true">
72+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
73+
<operations public="true" package="true" protected="true" private="true" static="true"/>
74+
</display>
75+
</class>
76+
<class id="8" language="java" name="com.iluwatar.eda.event.UserUpdatedEvent" project="event-driven-architecture"
77+
file="/event-driven-architecture/src/main/java/com/iluwatar/eda/event/UserUpdatedEvent.java" binary="false"
78+
corner="BOTTOM_RIGHT">
79+
<position height="-1" width="-1" x="769" y="455"/>
80+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
81+
sort-features="false" accessors="true" visibility="true">
82+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
83+
<operations public="true" package="true" protected="true" private="true" static="true"/>
84+
</display>
85+
</class>
86+
<class id="9" language="java" name="com.iluwatar.eda.event.Event" project="event-driven-architecture"
87+
file="/event-driven-architecture/src/main/java/com/iluwatar/eda/event/Event.java" binary="false"
88+
corner="BOTTOM_RIGHT">
89+
<position height="-1" width="-1" x="299" y="460"/>
90+
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
91+
sort-features="false" accessors="true" visibility="true">
92+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
93+
<operations public="true" package="true" protected="true" private="true" static="true"/>
94+
</display>
95+
</class>
96+
<dependency id="10">
97+
<bendpoint x="869" y="253"/>
98+
<end type="SOURCE" refId="2"/>
99+
<end type="TARGET" refId="8"/>
100+
</dependency>
101+
<dependency id="11">
102+
<bendpoint x="140" y="196"/>
103+
<end type="SOURCE" refId="3"/>
104+
<end type="TARGET" refId="9"/>
105+
</dependency>
106+
<dependency id="12">
107+
<bendpoint x="17" y="90"/>
108+
<bendpoint x="17" y="708"/>
109+
<bendpoint x="939" y="703"/>
110+
<end type="SOURCE" refId="3"/>
111+
<end type="TARGET" refId="1"/>
112+
</dependency>
113+
<dependency id="13">
114+
<bendpoint x="935" y="318"/>
115+
<bendpoint x="936" y="417"/>
116+
<end type="SOURCE" refId="2"/>
117+
<end type="TARGET" refId="1"/>
118+
</dependency>
119+
<dependency id="14">
120+
<bendpoint x="757" y="378"/>
121+
<end type="SOURCE" refId="2"/>
122+
<end type="TARGET" refId="9"/>
123+
</dependency>
124+
<generalization id="15">
125+
<end type="SOURCE" refId="7"/>
126+
<end type="TARGET" refId="9"/>
127+
</generalization>
128+
<association id="16">
129+
<end type="SOURCE" refId="8" navigable="false">
130+
<attribute id="17" name="user"/>
131+
<multiplicity id="18" minimum="0" maximum="1"/>
132+
</end>
133+
<end type="TARGET" refId="1" navigable="true"/>
134+
<display labels="true" multiplicity="true"/>
135+
</association>
136+
<realization id="19">
137+
<end type="SOURCE" refId="2"/>
138+
<end type="TARGET" refId="5"/>
139+
</realization>
140+
<dependency id="20">
141+
<end type="SOURCE" refId="5"/>
142+
<end type="TARGET" refId="9"/>
143+
</dependency>
144+
<dependency id="21">
145+
<bendpoint x="301" y="114"/>
146+
<end type="SOURCE" refId="5"/>
147+
<end type="TARGET" refId="4"/>
148+
</dependency>
149+
<realization id="22">
150+
<end type="SOURCE" refId="9"/>
151+
<end type="TARGET" refId="4"/>
152+
</realization>
153+
<dependency id="23">
154+
<end type="SOURCE" refId="6"/>
155+
<end type="TARGET" refId="9"/>
156+
</dependency>
157+
<generalization id="24">
158+
<end type="SOURCE" refId="8"/>
159+
<end type="TARGET" refId="9"/>
160+
</generalization>
161+
<dependency id="25">
162+
<bendpoint x="141" y="250"/>
163+
<end type="SOURCE" refId="3"/>
164+
<end type="TARGET" refId="7"/>
165+
</dependency>
166+
<association id="26">
167+
<end type="SOURCE" refId="6" navigable="false">
168+
<attribute id="27" name="handlers">
169+
<position height="19" width="56" x="449" y="175"/>
170+
</attribute>
171+
<multiplicity id="28" minimum="0" maximum="2147483647">
172+
<position height="17" width="23" x="574" y="173"/>
173+
</multiplicity>
174+
</end>
175+
<end type="TARGET" refId="5" navigable="true"/>
176+
<display labels="true" multiplicity="true"/>
177+
</association>
178+
<association id="29">
179+
<end type="SOURCE" refId="7" navigable="false">
180+
<attribute id="30" name="user"/>
181+
<multiplicity id="31" minimum="0" maximum="1"/>
182+
</end>
183+
<end type="TARGET" refId="1" navigable="true"/>
184+
<display labels="true" multiplicity="true"/>
185+
</association>
186+
<realization id="32">
187+
<end type="SOURCE" refId="3"/>
188+
<end type="TARGET" refId="5"/>
189+
</realization>
190+
<classifier-display autosize="true" stereotype="true" package="true" initial-value="true" signature="true"
191+
sort-features="false" accessors="true" visibility="true">
192+
<attributes public="true" package="true" protected="true" private="true" static="true"/>
193+
<operations public="true" package="true" protected="true" private="true" static="true"/>
194+
</classifier-display>
195+
<association-display labels="true" multiplicity="true"/>
196+
</class-diagram>

‎event-driven-architecture/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permalink: /patterns/event-driven-architecture
66

77
**Intent:** Send and notify state changes of your objects to other applications using an Event-driven Architecture.
88

9-
![alt text](./etc/class_diagram.png "Event Driven Architecture")
9+
![alt text](./etc/eda.png "Event Driven Architecture")
1010

1111
**Applicability:** Use an Event-driven architecture when
1212

0 commit comments

Comments
 (0)