Hexagonal pattern: More descriptive class names

This commit is contained in:
Ilkka Seppälä 2016-09-09 21:36:17 +03:00
parent 1b10ddbb73
commit 0f2807b9cf
13 changed files with 188 additions and 240 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 162 KiB

After

Width:  |  Height:  |  Size: 145 KiB

View File

@ -1,142 +1,141 @@
<?xml version="1.0" encoding="UTF-8"?>
<class-diagram version="1.1.9" icons="true" automaticImage="PNG" always-add-relationships="false" generalizations="true"
realizations="true" associations="true" dependencies="false" nesting-relationships="true" router="FAN">
<class id="1" language="java" name="com.iluwatar.hexagonal.domain.LotteryTicket" project="hexagonal"
<class-diagram version="1.1.10" icons="true" automaticImage="PNG" always-add-relationships="false"
generalizations="true" realizations="true" associations="true" dependencies="false" nesting-relationships="true"
router="FAN">
<class id="1" language="java" name="com.iluwatar.hexagonal.notifications.StdOutNotifications" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/notifications/StdOutNotifications.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="167" width="235" x="731" y="122"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="2" language="java" name="com.iluwatar.hexagonal.banking.InMemoryBank" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/InMemoryBank.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="149" width="217" x="1006" y="122"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="3" language="java" name="com.iluwatar.hexagonal.domain.LotterySystemImpl" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotterySystemImpl.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="167" width="421" x="1263" y="122"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="4" language="java" name="com.iluwatar.hexagonal.domain.LotteryTicket" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicket.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="169" width="270" x="2042" y="351"/>
<position height="167" width="278" x="1568" y="347"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<interface id="2" language="java" name="com.iluwatar.hexagonal.banking.WireTransfers" project="hexagonal"
<class id="5" language="java" name="com.iluwatar.hexagonal.database.InMemoryTicketRepository" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/database/InMemoryTicketRepository.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="149" width="265" x="1724" y="122"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<interface id="6" language="java" name="com.iluwatar.hexagonal.banking.WireTransfers" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/WireTransfers.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="115" width="215" x="1490" y="351"/>
<position height="113" width="217" x="1006" y="347"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</interface>
<class id="3" language="java" name="com.iluwatar.hexagonal.administration.LotteryAdministrationImpl"
project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/LotteryAdministrationImpl.java" binary="false"
<class id="7" language="java" name="com.iluwatar.hexagonal.service.ConsoleService" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/service/ConsoleService.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="133" width="311" x="992" y="124"/>
<position height="113" width="421" x="2029" y="122"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<interface id="4" language="java" name="com.iluwatar.hexagonal.database.LotteryTicketRepository" project="hexagonal"
<interface id="8" language="java" name="com.iluwatar.hexagonal.database.LotteryTicketRepository" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/database/LotteryTicketRepository.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="133" width="257" x="1745" y="351"/>
<position height="131" width="265" x="1263" y="347"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</interface>
<class id="5" language="java" name="com.iluwatar.hexagonal.domain.LotteryConstants" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryConstants.java" binary="false"
<interface id="9" language="java" name="com.iluwatar.hexagonal.domain.LotterySystem" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotterySystem.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="169" width="227" x="205" y="124"/>
<position height="149" width="421" x="1886" y="347"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="6" language="java" name="com.iluwatar.hexagonal.domain.LotteryTicketId" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketId.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="115" width="140" x="508" y="124"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="7" language="java" name="com.iluwatar.hexagonal.domain.LotteryNumbers" project="hexagonal"
</interface>
<class id="10" language="java" name="com.iluwatar.hexagonal.domain.LotteryNumbers" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryNumbers.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="277" width="206" x="2042" y="560"/>
<position height="275" width="209" x="1568" y="554"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="8" language="java" name="com.iluwatar.hexagonal.notifications.LotteryNotificationsImpl" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/notifications/LotteryNotificationsImpl.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="169" width="229" x="723" y="124"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="9" language="java" name="com.iluwatar.hexagonal.banking.WireTransfersImpl" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/banking/WireTransfersImpl.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="151" width="215" x="1787" y="124"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<interface id="10" language="java" name="com.iluwatar.hexagonal.administration.LotteryAdministration"
<interface id="11" language="java" name="com.iluwatar.hexagonal.administration.LotteryAdministration"
project="hexagonal" file="/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/LotteryAdministration.java"
binary="false" corner="BOTTOM_RIGHT">
<position height="115" width="311" x="426" y="351"/>
<position height="113" width="320" x="2808" y="347"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</interface>
<class id="11" language="java" name="com.iluwatar.hexagonal.domain.LotteryNumbers.RandomNumberGenerator"
<class id="12" language="java" name="com.iluwatar.hexagonal.domain.LotteryNumbers.RandomNumberGenerator"
project="hexagonal" file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryNumbers.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="115" width="188" x="2042" y="877"/>
<position height="113" width="189" x="1568" y="869"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="12" language="java" name="com.iluwatar.hexagonal.domain.LotteryTicketCheckResult" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketCheckResult.java" binary="false"
<class id="13" language="java" name="com.iluwatar.hexagonal.administration.ConsoleAdministration" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/administration/ConsoleAdministration.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="187" width="229" x="2352" y="124"/>
<position height="131" width="320" x="2490" y="122"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="13" language="java" name="com.iluwatar.hexagonal.domain.PlayerDetails" project="hexagonal"
<class id="14" language="java" name="com.iluwatar.hexagonal.domain.PlayerDetails" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/PlayerDetails.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="241" width="219" x="1106" y="560"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="14" language="java" name="com.iluwatar.hexagonal.database.LotteryTicketInMemoryRepository"
project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/database/LotteryTicketInMemoryRepository.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="151" width="257" x="2042" y="124"/>
<position height="239" width="222" x="1019" y="554"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
@ -146,174 +145,130 @@
<interface id="15" language="java" name="com.iluwatar.hexagonal.service.LotteryService" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryService.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="97" width="404" x="1046" y="351"/>
<position height="95" width="421" x="2347" y="347"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</interface>
<enumeration id="16" language="java" name="com.iluwatar.hexagonal.domain.LotteryTicketCheckResult.CheckResult"
project="hexagonal" file="/hexagonal/src/main/java/com/iluwatar/hexagonal/domain/LotteryTicketCheckResult.java"
binary="false" corner="BOTTOM_RIGHT">
<position height="133" width="229" x="2352" y="351"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</enumeration>
<class id="17" language="java" name="com.iluwatar.hexagonal.App" project="hexagonal"
<class id="16" language="java" name="com.iluwatar.hexagonal.App" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/App.java" binary="false" corner="BOTTOM_RIGHT">
<position height="133" width="217" x="169" y="351"/>
<position height="131" width="221" x="470" y="347"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<class id="18" language="java" name="com.iluwatar.hexagonal.service.LotteryServiceImpl" project="hexagonal"
file="/hexagonal/src/main/java/com/iluwatar/hexagonal/service/LotteryServiceImpl.java" binary="false"
corner="BOTTOM_RIGHT">
<position height="115" width="404" x="1343" y="124"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</class>
<interface id="19" language="java" name="com.iluwatar.hexagonal.notifications.LotteryNotifications"
<interface id="17" language="java" name="com.iluwatar.hexagonal.notifications.LotteryNotifications"
project="hexagonal" file="/hexagonal/src/main/java/com/iluwatar/hexagonal/notifications/LotteryNotifications.java"
binary="false" corner="BOTTOM_RIGHT">
<position height="151" width="229" x="777" y="351"/>
<position height="149" width="235" x="731" y="347"/>
<display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"
sort-features="false" accessors="true" visibility="true">
<attributes public="true" package="true" protected="true" private="true" static="true"/>
<operations public="true" package="true" protected="true" private="true" static="true"/>
</display>
</interface>
<association id="20">
<association id="18">
<end type="SOURCE" refId="16" navigable="false">
<attribute id="19" name="PLAYERS"/>
<multiplicity id="20" minimum="0" maximum="2147483647"/>
</end>
<end type="TARGET" refId="14" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="21">
<end type="SOURCE" refId="3" navigable="false">
<attribute id="21" name="repository"/>
<multiplicity id="22" minimum="0" maximum="1"/>
<attribute id="22" name="wireTransfers"/>
<multiplicity id="23" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="6" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<realization id="24">
<end type="SOURCE" refId="5"/>
<end type="TARGET" refId="8"/>
</realization>
<nesting id="25">
<end type="SOURCE" refId="10"/>
<end type="TARGET" refId="12"/>
</nesting>
<association id="26">
<end type="SOURCE" refId="5" navigable="false">
<attribute id="27" name="tickets"/>
<multiplicity id="28" minimum="0" maximum="2147483647"/>
</end>
<end type="TARGET" refId="4" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="23">
<end type="SOURCE" refId="3" navigable="false">
<attribute id="24" name="notifications"/>
<multiplicity id="25" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="19" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="26">
<end type="SOURCE" refId="18" navigable="false">
<attribute id="27" name="notifications"/>
<multiplicity id="28" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="19" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="29">
<end type="SOURCE" refId="14" navigable="false">
<attribute id="30" name="tickets"/>
<multiplicity id="31" minimum="0" maximum="2147483647"/>
</end>
<end type="TARGET" refId="1" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<realization id="32">
<end type="SOURCE" refId="8"/>
<end type="TARGET" refId="19"/>
<realization id="29">
<end type="SOURCE" refId="1"/>
<end type="TARGET" refId="17"/>
</realization>
<realization id="33">
<end type="SOURCE" refId="18"/>
<realization id="30">
<end type="SOURCE" refId="3"/>
<end type="TARGET" refId="9"/>
</realization>
<realization id="31">
<end type="SOURCE" refId="7"/>
<end type="TARGET" refId="15"/>
</realization>
<realization id="34">
<end type="SOURCE" refId="3"/>
<end type="TARGET" refId="10"/>
</realization>
<association id="35">
<end type="SOURCE" refId="18" navigable="false">
<attribute id="36" name="bank"/>
<multiplicity id="37" minimum="0" maximum="1"/>
<association id="32">
<end type="SOURCE" refId="4" navigable="false">
<attribute id="33" name="lotteryNumbers"/>
<multiplicity id="34" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="2" navigable="true"/>
<end type="TARGET" refId="10" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="38">
<end type="SOURCE" refId="18" navigable="false">
<attribute id="39" name="repository"/>
<multiplicity id="40" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="4" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="41">
<end type="SOURCE" refId="3" navigable="false">
<attribute id="42" name="bank"/>
<multiplicity id="43" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="2" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="44">
<end type="SOURCE" refId="12" navigable="false">
<attribute id="45" name="checkResult"/>
<multiplicity id="46" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="16" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<nesting id="47">
<end type="SOURCE" refId="12"/>
<end type="TARGET" refId="16"/>
</nesting>
<association id="48">
<end type="SOURCE" refId="17" navigable="false">
<attribute id="49" name="allPlayerDetails"/>
<multiplicity id="50" minimum="0" maximum="2147483647"/>
</end>
<end type="TARGET" refId="13" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="51">
<end type="SOURCE" refId="1" navigable="false">
<attribute id="52" name="playerDetails"/>
<multiplicity id="53" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="13" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="54">
<end type="SOURCE" refId="1" navigable="false">
<attribute id="55" name="lotteryNumbers"/>
<multiplicity id="56" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="7" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<realization id="57">
<end type="SOURCE" refId="14"/>
<end type="TARGET" refId="4"/>
</realization>
<nesting id="58">
<end type="SOURCE" refId="7"/>
<realization id="35">
<end type="SOURCE" refId="13"/>
<end type="TARGET" refId="11"/>
</nesting>
<realization id="59">
<end type="SOURCE" refId="9"/>
<end type="TARGET" refId="2"/>
</realization>
<association id="60">
<end type="SOURCE" refId="3" navigable="false">
<attribute id="61" name="service"/>
<multiplicity id="62" minimum="0" maximum="1"/>
<association id="36">
<end type="SOURCE" refId="13" navigable="false">
<attribute id="37" name="lotterySystem"/>
<multiplicity id="38" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="15" navigable="true"/>
<end type="TARGET" refId="9" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="39">
<end type="SOURCE" refId="7" navigable="false">
<attribute id="40" name="lotterySystem"/>
<multiplicity id="41" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="9" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="42">
<end type="SOURCE" refId="3" navigable="false">
<attribute id="43" name="repository"/>
<multiplicity id="44" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="8" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<realization id="45">
<end type="SOURCE" refId="2"/>
<end type="TARGET" refId="6"/>
</realization>
<association id="46">
<end type="SOURCE" refId="3" navigable="false">
<attribute id="47" name="notifications"/>
<multiplicity id="48" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="17" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<association id="49">
<end type="SOURCE" refId="4" navigable="false">
<attribute id="50" name="playerDetails"/>
<multiplicity id="51" minimum="0" maximum="1"/>
</end>
<end type="TARGET" refId="14" navigable="true"/>
<display labels="true" multiplicity="true"/>
</association>
<classifier-display autosize="true" stereotype="true" package="true" initial-value="false" signature="true"

View File

@ -29,7 +29,7 @@ import java.util.Random;
import com.google.inject.Guice;
import com.google.inject.Injector;
import com.iluwatar.hexagonal.administration.LotteryAdministration;
import com.iluwatar.hexagonal.banking.WireTransfersImpl;
import com.iluwatar.hexagonal.banking.InMemoryBank;
import com.iluwatar.hexagonal.domain.LotteryConstants;
import com.iluwatar.hexagonal.domain.LotteryNumbers;
import com.iluwatar.hexagonal.domain.LotteryTicket;
@ -112,7 +112,7 @@ public class App {
PLAYERS.add(PlayerDetails.create("ron@google.com", "637-738", "+09842354"));
PLAYERS.add(PlayerDetails.create("xavier@google.com", "143-947", "+375245"));
PLAYERS.add(PlayerDetails.create("harriet@google.com", "842-404", "+131243252"));
WireTransfersImpl wireTransfers = new WireTransfersImpl();
InMemoryBank wireTransfers = new InMemoryBank();
Random random = new Random();
for (int i = 0; i < PLAYERS.size(); i++) {
wireTransfers.setFunds(PLAYERS.get(i).getBankAccount(),

View File

@ -24,17 +24,17 @@ package com.iluwatar.hexagonal;
import com.google.inject.AbstractModule;
import com.iluwatar.hexagonal.administration.LotteryAdministration;
import com.iluwatar.hexagonal.administration.LotteryAdministrationImpl;
import com.iluwatar.hexagonal.administration.ConsoleAdministration;
import com.iluwatar.hexagonal.banking.InMemoryBank;
import com.iluwatar.hexagonal.banking.WireTransfers;
import com.iluwatar.hexagonal.banking.WireTransfersImpl;
import com.iluwatar.hexagonal.database.LotteryTicketInMemoryRepository;
import com.iluwatar.hexagonal.database.InMemoryTicketRepository;
import com.iluwatar.hexagonal.database.LotteryTicketRepository;
import com.iluwatar.hexagonal.domain.LotterySystem;
import com.iluwatar.hexagonal.domain.LotterySystemImpl;
import com.iluwatar.hexagonal.notifications.LotteryNotifications;
import com.iluwatar.hexagonal.notifications.LotteryNotificationsImpl;
import com.iluwatar.hexagonal.notifications.StdOutNotifications;
import com.iluwatar.hexagonal.service.ConsoleService;
import com.iluwatar.hexagonal.service.LotteryService;
import com.iluwatar.hexagonal.service.LotteryServiceImpl;
/**
* Guice module for binding production dependencies
@ -42,11 +42,11 @@ import com.iluwatar.hexagonal.service.LotteryServiceImpl;
public class LotteryModule extends AbstractModule {
@Override
protected void configure() {
bind(LotteryTicketRepository.class).to(LotteryTicketInMemoryRepository.class);
bind(LotteryTicketRepository.class).to(InMemoryTicketRepository.class);
bind(LotterySystem.class).to(LotterySystemImpl.class);
bind(LotteryNotifications.class).to(LotteryNotificationsImpl.class);
bind(WireTransfers.class).to(WireTransfersImpl.class);
bind(LotteryAdministration.class).to(LotteryAdministrationImpl.class);
bind(LotteryService.class).to(LotteryServiceImpl.class);
bind(LotteryNotifications.class).to(StdOutNotifications.class);
bind(WireTransfers.class).to(InMemoryBank.class);
bind(LotteryAdministration.class).to(ConsoleAdministration.class);
bind(LotteryService.class).to(ConsoleService.class);
}
}

View File

@ -35,12 +35,12 @@ import java.util.Map;
* Lottery administration implementation
*
*/
public class LotteryAdministrationImpl implements LotteryAdministration {
public class ConsoleAdministration implements LotteryAdministration {
private final LotterySystem lotterySystem;
@Inject
public LotteryAdministrationImpl(LotterySystem lotterySystem) {
public ConsoleAdministration(LotterySystem lotterySystem) {
this.lotterySystem = lotterySystem;
}

View File

@ -32,7 +32,7 @@ import com.iluwatar.hexagonal.domain.LotteryConstants;
* Banking implementation
*
*/
public class WireTransfersImpl implements WireTransfers {
public class InMemoryBank implements WireTransfers {
private static Map<String, Integer> accounts = new HashMap<>();

View File

@ -34,7 +34,7 @@ import com.iluwatar.hexagonal.domain.LotteryTicketId;
* Mock database for lottery tickets.
*
*/
public class LotteryTicketInMemoryRepository implements LotteryTicketRepository {
public class InMemoryTicketRepository implements LotteryTicketRepository {
private static Map<LotteryTicketId, LotteryTicket> tickets = new HashMap<>();

View File

@ -24,7 +24,7 @@ package com.iluwatar.hexagonal.notifications;
import com.iluwatar.hexagonal.domain.PlayerDetails;
public class LotteryNotificationsImpl implements LotteryNotifications {
public class StdOutNotifications implements LotteryNotifications {
@Override
public void notifyTicketSubmitted(PlayerDetails details) {

View File

@ -36,7 +36,7 @@ import java.util.Optional;
* Implementation for lottery service
*
*/
public class LotteryServiceImpl implements LotteryService {
public class ConsoleService implements LotteryService {
private final LotterySystem lotterySystem;
@ -44,7 +44,7 @@ public class LotteryServiceImpl implements LotteryService {
* Constructor
*/
@Inject
public LotteryServiceImpl(LotterySystem lotterySystem) {
public ConsoleService(LotterySystem lotterySystem) {
this.lotterySystem = lotterySystem;
}

View File

@ -23,18 +23,18 @@
package com.iluwatar.hexagonal;
import com.google.inject.AbstractModule;
import com.iluwatar.hexagonal.administration.ConsoleAdministration;
import com.iluwatar.hexagonal.administration.LotteryAdministration;
import com.iluwatar.hexagonal.administration.LotteryAdministrationImpl;
import com.iluwatar.hexagonal.banking.InMemoryBank;
import com.iluwatar.hexagonal.banking.WireTransfers;
import com.iluwatar.hexagonal.banking.WireTransfersImpl;
import com.iluwatar.hexagonal.database.LotteryTicketInMemoryRepository;
import com.iluwatar.hexagonal.database.InMemoryTicketRepository;
import com.iluwatar.hexagonal.database.LotteryTicketRepository;
import com.iluwatar.hexagonal.domain.LotterySystem;
import com.iluwatar.hexagonal.domain.LotterySystemImpl;
import com.iluwatar.hexagonal.notifications.LotteryNotifications;
import com.iluwatar.hexagonal.notifications.LotteryNotificationsImpl;
import com.iluwatar.hexagonal.notifications.StdOutNotifications;
import com.iluwatar.hexagonal.service.ConsoleService;
import com.iluwatar.hexagonal.service.LotteryService;
import com.iluwatar.hexagonal.service.LotteryServiceImpl;
/**
* Guice module for testing dependencies
@ -42,11 +42,11 @@ import com.iluwatar.hexagonal.service.LotteryServiceImpl;
public class LotteryTestingModule extends AbstractModule {
@Override
protected void configure() {
bind(LotteryTicketRepository.class).to(LotteryTicketInMemoryRepository.class);
bind(LotteryTicketRepository.class).to(InMemoryTicketRepository.class);
bind(LotterySystem.class).to(LotterySystemImpl.class);
bind(LotteryNotifications.class).to(LotteryNotificationsImpl.class);
bind(WireTransfers.class).to(WireTransfersImpl.class);
bind(LotteryAdministration.class).to(LotteryAdministrationImpl.class);
bind(LotteryService.class).to(LotteryServiceImpl.class);
bind(LotteryNotifications.class).to(StdOutNotifications.class);
bind(WireTransfers.class).to(InMemoryBank.class);
bind(LotteryAdministration.class).to(ConsoleAdministration.class);
bind(LotteryService.class).to(ConsoleService.class);
}
}

View File

@ -34,7 +34,7 @@ import org.junit.Test;
*/
public class WireTransfersTest {
private final WireTransfers bank = new WireTransfersImpl();
private final WireTransfers bank = new InMemoryBank();
@Test
public void testInit() {

View File

@ -30,8 +30,6 @@ import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import com.iluwatar.hexagonal.database.LotteryTicketRepository;
import com.iluwatar.hexagonal.database.LotteryTicketInMemoryRepository;
import com.iluwatar.hexagonal.domain.LotteryTicket;
import com.iluwatar.hexagonal.domain.LotteryTicketId;
import com.iluwatar.hexagonal.test.LotteryTestUtils;
@ -43,7 +41,7 @@ import com.iluwatar.hexagonal.test.LotteryTestUtils;
*/
public class LotteryTicketRepositoryTest {
private final LotteryTicketRepository repository = new LotteryTicketInMemoryRepository();
private final LotteryTicketRepository repository = new InMemoryTicketRepository();
@Before
public void clear() {
@ -52,7 +50,7 @@ public class LotteryTicketRepositoryTest {
@Test
public void testCrudOperations() {
LotteryTicketRepository repository = new LotteryTicketInMemoryRepository();
LotteryTicketRepository repository = new InMemoryTicketRepository();
assertEquals(repository.findAll().size(), 0);
LotteryTicket ticket = LotteryTestUtils.createLotteryTicket();
Optional<LotteryTicketId> id = repository.save(ticket);

View File

@ -33,16 +33,11 @@ import java.util.Optional;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.iluwatar.hexagonal.LotteryModule;
import com.iluwatar.hexagonal.LotteryTestingModule;
import com.iluwatar.hexagonal.domain.*;
import org.junit.Before;
import org.junit.Test;
import com.iluwatar.hexagonal.banking.WireTransfers;
import com.iluwatar.hexagonal.banking.WireTransfersImpl;
import com.iluwatar.hexagonal.database.LotteryTicketRepository;
import com.iluwatar.hexagonal.database.LotteryTicketInMemoryRepository;
import com.iluwatar.hexagonal.domain.LotteryTicketCheckResult.CheckResult;
import com.iluwatar.hexagonal.test.LotteryTestUtils;