fix: Set locale in tests to be able to run locally. Remove logging dependency fixed versions in parent pom.xml to prevent conflicts with spring boot. Update license headers. Update urm diagrams.

This commit is contained in:
Ilkka Seppälä
2025-03-18 15:56:06 +02:00
parent 0b1933ece3
commit dd8b9b377a
51 changed files with 1498 additions and 7 deletions
+32
View File
@@ -0,0 +1,32 @@
@startuml
package com.iluwatar.bloc {
class Bloc {
- currentState : State
- listeners : List<StateListener<State>>
+ Bloc()
+ addListener(listener : StateListener<State>)
+ decrement()
- emitState(newState : State)
+ getListeners() : List<StateListener<State>>
+ increment()
+ removeListener(listener : StateListener<State>)
}
class BlocUi {
+ BlocUi()
+ createAndShowUi()
}
interface ListenerManager<T> {
+ addListener(StateListener<T>) {abstract}
+ getListeners() : List<StateListener<T>> {abstract}
+ removeListener(StateListener<T>) {abstract}
}
class Main {
+ Main()
+ main(args : String[]) {static}
}
interface StateListener<T> {
+ onStateChange(T) {abstract}
}
}
Bloc ..|> ListenerManager
@enduml
+26
View File
@@ -1,4 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
The MIT License
Copyright © 2014-2022 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<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">
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.bloc;
import java.util.ArrayList;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.bloc;
import java.awt.BorderLayout;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.bloc;
import java.util.List;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.bloc;
/**
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.bloc;
/**
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.bloc;
/**
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.bloc;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.bloc;
import org.junit.After;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.bloc;
import org.junit.jupiter.api.Test;
@@ -0,0 +1,72 @@
@startuml
package com.iluwatar.fluentinterface.fluentiterable.simple {
class SimpleFluentIterable<E> {
- iterable : Iterable<E>
+ SimpleFluentIterable<E>(iterable : Iterable<E>)
+ asList() : List<E>
+ filter(predicate : Predicate<? super E>) : FluentIterable<E>
+ first() : Optional<E>
+ first(count : int) : FluentIterable<E>
+ forEach(action : Consumer<? super E>)
+ from(iterable : Iterable<E>) : FluentIterable<E> {static}
+ fromCopyOf(iterable : Iterable<E>) : FluentIterable<E> {static}
+ getRemainingElementsCount() : int
+ iterator() : Iterator<E>
+ last() : Optional<E>
+ last(count : int) : FluentIterable<E>
+ map(function : Function<? super E, T>) : FluentIterable<T>
+ spliterator() : Spliterator<E>
+ toList(iterator : Iterator<E>) : List<E> {static}
}
}
package com.iluwatar.fluentinterface.app {
class App {
- LOGGER : Logger {static}
+ App()
+ main(args : String[]) {static}
- negatives() : Predicate<? super Integer> {static}
- positives() : Predicate<? super Integer> {static}
- prettyPrint(delimiter : String, prefix : String, iterable : Iterable<E>) {static}
- prettyPrint(prefix : String, iterable : Iterable<E>) {static}
- transformToString() : Function<Integer, String> {static}
}
}
package com.iluwatar.fluentinterface.fluentiterable.lazy {
abstract class DecoratingIterator<E> {
# fromIterator : Iterator<E>
- next : E
+ DecoratingIterator<E>(fromIterator : Iterator<E>)
+ computeNext() : E {abstract}
+ hasNext() : boolean
+ next() : E
}
class LazyFluentIterable<E> {
- iterable : Iterable<E>
# LazyFluentIterable<E>()
+ LazyFluentIterable<E>(iterable : Iterable<E>)
+ asList() : List<E>
+ filter(predicate : Predicate<? super E>) : FluentIterable<E>
+ first() : Optional<E>
+ first(count : int) : FluentIterable<E>
+ from(iterable : Iterable<E>) : FluentIterable<E> {static}
+ iterator() : Iterator<E>
+ last() : Optional<E>
+ last(count : int) : FluentIterable<E>
+ map(function : Function<? super E, T>) : FluentIterable<T>
}
}
package com.iluwatar.fluentinterface.fluentiterable {
interface FluentIterable<E> {
+ asList() : List<E> {abstract}
+ copyToList(iterable : Iterable<E>) : List<E> {static}
+ filter(Predicate<? super E>) : FluentIterable<E> {abstract}
+ first() : Optional<E> {abstract}
+ first(int) : FluentIterable<E> {abstract}
+ last() : Optional<E> {abstract}
+ last(int) : FluentIterable<E> {abstract}
+ map(Function<? super E, T>) : FluentIterable<T> {abstract}
}
}
LazyFluentIterable ..|> FluentIterable
SimpleFluentIterable ..|> FluentIterable
@enduml
@@ -0,0 +1,12 @@
@startuml
package com.iluwatar.function.composition {
class App {
+ App()
+ main(args : String[]) {static}
}
class FunctionComposer {
+ FunctionComposer()
+ composeFunctions(f1 : Function<Integer, Integer>, f2 : Function<Integer, Integer>) : Function<Integer, Integer> {static}
}
}
@enduml
@@ -31,6 +31,7 @@ import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryUsage;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -72,6 +73,7 @@ class GarbageCollectionHealthIndicatorTest {
}
});
healthIndicator.setMemoryUsageThreshold(0.8);
Locale.setDefault(Locale.US);
}
/** Test case to verify that the health status is up when memory usage is low. */
@@ -0,0 +1,282 @@
@startuml
package com.iluwatar.hexagonal.sampledata {
class SampleData {
- PLAYERS : List<PlayerDetails> {static}
- RANDOM : SecureRandom {static}
+ SampleData()
- getRandomPlayerDetails() : PlayerDetails {static}
+ submitTickets(lotteryService : LotteryService, numTickets : int) {static}
}
}
package com.iluwatar.hexagonal.service {
class ConsoleLottery {
- LOGGER : Logger {static}
+ ConsoleLottery()
+ main(args : String[]) {static}
- printMainMenu() {static}
- readString(scanner : Scanner) : String {static}
}
interface LotteryConsoleService {
+ addFundsToLotteryAccount(WireTransfers, Scanner) {abstract}
+ checkTicket(LotteryService, Scanner) {abstract}
+ queryLotteryAccountFunds(WireTransfers, Scanner) {abstract}
+ submitTicket(LotteryService, Scanner) {abstract}
}
class LotteryConsoleServiceImpl {
- logger : Logger
+ LotteryConsoleServiceImpl(logger : Logger)
+ addFundsToLotteryAccount(bank : WireTransfers, scanner : Scanner)
+ checkTicket(service : LotteryService, scanner : Scanner)
+ queryLotteryAccountFunds(bank : WireTransfers, scanner : Scanner)
- readString(scanner : Scanner) : String
+ submitTicket(service : LotteryService, scanner : Scanner)
}
}
package com.iluwatar.hexagonal.mongo {
class MongoConnectionPropertiesLoader {
- DEFAULT_HOST : String {static}
- DEFAULT_PORT : int {static}
- LOGGER : Logger {static}
+ MongoConnectionPropertiesLoader()
+ load() {static}
}
}
package com.iluwatar.hexagonal.domain {
class LotteryAdministration {
- notifications : LotteryEventLog
- repository : LotteryTicketRepository
- wireTransfers : WireTransfers
+ LotteryAdministration(repository : LotteryTicketRepository, notifications : LotteryEventLog, wireTransfers : WireTransfers)
+ getAllSubmittedTickets() : Map<LotteryTicketId, LotteryTicket>
+ performLottery() : LotteryNumbers
+ resetLottery()
}
class LotteryConstants {
+ PLAYER_MAX_BALANCE : int {static}
+ PRIZE_AMOUNT : int {static}
+ SERVICE_BANK_ACCOUNT : String {static}
+ SERVICE_BANK_ACCOUNT_BALANCE : int {static}
+ TICKET_PRIZE : int {static}
- LotteryConstants()
}
class LotteryNumbers {
+ MAX_NUMBER : int {static}
+ MIN_NUMBER : int {static}
+ NUM_NUMBERS : int {static}
- numbers : Set<Integer>
- LotteryNumbers()
- LotteryNumbers(givenNumbers : Set<Integer>)
# canEqual(other : Object) : boolean
+ create(givenNumbers : Set<Integer>) : LotteryNumbers {static}
+ createRandom() : LotteryNumbers {static}
+ equals(o : Object) : boolean
- generateRandomNumbers()
+ getNumbers() : Set<Integer>
+ getNumbersAsString() : String
+ hashCode() : int
+ toString() : String
}
-class RandomNumberGenerator {
- randomIterator : OfInt
+ RandomNumberGenerator(min : int, max : int)
+ nextInt() : int
}
class LotteryService {
- notifications : LotteryEventLog
- repository : LotteryTicketRepository
- wireTransfers : WireTransfers
+ LotteryService(repository : LotteryTicketRepository, notifications : LotteryEventLog, wireTransfers : WireTransfers)
+ checkTicketForPrize(id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult
+ submitTicket(ticket : LotteryTicket) : Optional<LotteryTicketId>
}
class LotteryTicketCheckResult {
- prizeAmount : int
- result : CheckResult
+ LotteryTicketCheckResult(result : CheckResult)
+ LotteryTicketCheckResult(result : CheckResult, prizeAmount : int)
# canEqual(other : Object) : boolean
+ equals(o : Object) : boolean
+ getPrizeAmount() : int
+ getResult() : CheckResult
+ hashCode() : int
}
enum CheckResult {
+ NO_PRIZE {static}
+ TICKET_NOT_SUBMITTED {static}
+ WIN_PRIZE {static}
+ valueOf(name : String) : CheckResult {static}
+ values() : CheckResult[] {static}
}
class LotteryTicketId {
- id : int
- numAllocated : AtomicInteger {static}
+ LotteryTicketId()
+ LotteryTicketId(id : int)
# canEqual(other : Object) : boolean
+ equals(o : Object) : boolean
+ getId() : int
+ hashCode() : int
+ toString() : String
}
class LotteryUtils {
- LotteryUtils()
+ checkTicketForPrize(repository : LotteryTicketRepository, id : LotteryTicketId, winningNumbers : LotteryNumbers) : LotteryTicketCheckResult {static}
}
}
package com.iluwatar.hexagonal.banking {
class InMemoryBank {
- accounts : Map<String, Integer> {static}
+ InMemoryBank()
+ getFunds(bankAccount : String) : int
+ setFunds(bankAccount : String, amount : int)
+ transferFunds(amount : int, sourceAccount : String, destinationAccount : String) : boolean
}
class MongoBank {
- DEFAULT_ACCOUNTS_COLLECTION : String {static}
- DEFAULT_DB : String {static}
- accountsCollection : MongoCollection<Document>
- database : MongoDatabase
- mongoClient : MongoClient
+ MongoBank()
+ MongoBank(dbName : String, accountsCollectionName : String)
+ connect()
+ connect(dbName : String, accountsCollectionName : String)
+ getAccountsCollection() : MongoCollection<Document>
+ getDatabase() : MongoDatabase
+ getFunds(bankAccount : String) : int
+ getMongoClient() : MongoClient
+ setFunds(bankAccount : String, amount : int)
+ transferFunds(amount : int, sourceAccount : String, destinationAccount : String) : boolean
}
interface WireTransfers {
+ getFunds(String) : int {abstract}
+ setFunds(String, int) {abstract}
+ transferFunds(int, String, String) : boolean {abstract}
}
}
package com.iluwatar.hexagonal.database {
class InMemoryTicketRepository {
- tickets : Map<LotteryTicketId, LotteryTicket> {static}
+ InMemoryTicketRepository()
+ deleteAll()
+ findAll() : Map<LotteryTicketId, LotteryTicket>
+ findById(id : LotteryTicketId) : Optional<LotteryTicket>
+ save(ticket : LotteryTicket) : Optional<LotteryTicketId>
}
interface LotteryTicketRepository {
+ deleteAll() {abstract}
+ findAll() : Map<LotteryTicketId, LotteryTicket> {abstract}
+ findById(LotteryTicketId) : Optional<LotteryTicket> {abstract}
+ save(LotteryTicket) : Optional<LotteryTicketId> {abstract}
}
class MongoTicketRepository {
- DEFAULT_COUNTERS_COLLECTION : String {static}
- DEFAULT_DB : String {static}
- DEFAULT_TICKETS_COLLECTION : String {static}
- TICKET_ID : String {static}
- countersCollection : MongoCollection<Document>
- database : MongoDatabase
- mongoClient : MongoClient
- ticketsCollection : MongoCollection<Document>
+ MongoTicketRepository()
+ MongoTicketRepository(dbName : String, ticketsCollectionName : String, countersCollectionName : String)
+ connect()
+ connect(dbName : String, ticketsCollectionName : String, countersCollectionName : String)
+ deleteAll()
- docToTicket(doc : Document) : LotteryTicket
+ findAll() : Map<LotteryTicketId, LotteryTicket>
+ findById(id : LotteryTicketId) : Optional<LotteryTicket>
+ getCountersCollection() : MongoCollection<Document>
+ getNextId() : int
+ getTicketsCollection() : MongoCollection<Document>
- initCounters()
+ save(ticket : LotteryTicket) : Optional<LotteryTicketId>
}
}
package com.iluwatar.hexagonal {
class App {
+ App()
+ main(args : String[]) {static}
}
}
package com.iluwatar.hexagonal.administration {
class ConsoleAdministration {
- LOGGER : Logger {static}
+ ConsoleAdministration()
+ main(args : String[]) {static}
- printMainMenu() {static}
- readString(scanner : Scanner) : String {static}
}
interface ConsoleAdministrationSrv {
+ getAllSubmittedTickets() {abstract}
+ performLottery() {abstract}
+ resetLottery() {abstract}
}
class ConsoleAdministrationSrvImpl {
- administration : LotteryAdministration
- logger : Logger
+ ConsoleAdministrationSrvImpl(administration : LotteryAdministration, logger : Logger)
+ getAllSubmittedTickets()
+ performLottery()
+ resetLottery()
}
}
package com.iluwatar.hexagonal.eventlog {
interface LotteryEventLog {
+ prizeError(PlayerDetails, int) {abstract}
+ ticketDidNotWin(PlayerDetails) {abstract}
+ ticketSubmitError(PlayerDetails) {abstract}
+ ticketSubmitted(PlayerDetails) {abstract}
+ ticketWon(PlayerDetails, int) {abstract}
}
class MongoEventLog {
- DEFAULT_DB : String {static}
- DEFAULT_EVENTS_COLLECTION : String {static}
- EMAIL : String {static}
+ MESSAGE : String {static}
- PHONE : String {static}
- database : MongoDatabase
- eventsCollection : MongoCollection<Document>
- mongoClient : MongoClient
- stdOutEventLog : StdOutEventLog
+ MongoEventLog()
+ MongoEventLog(dbName : String, eventsCollectionName : String)
+ connect()
+ connect(dbName : String, eventsCollectionName : String)
+ getDatabase() : MongoDatabase
+ getEventsCollection() : MongoCollection<Document>
+ getMongoClient() : MongoClient
+ prizeError(details : PlayerDetails, prizeAmount : int)
+ ticketDidNotWin(details : PlayerDetails)
+ ticketSubmitError(details : PlayerDetails)
+ ticketSubmitted(details : PlayerDetails)
+ ticketWon(details : PlayerDetails, prizeAmount : int)
}
class StdOutEventLog {
- LOGGER : Logger {static}
+ StdOutEventLog()
+ prizeError(details : PlayerDetails, prizeAmount : int)
+ ticketDidNotWin(details : PlayerDetails)
+ ticketSubmitError(details : PlayerDetails)
+ ticketSubmitted(details : PlayerDetails)
+ ticketWon(details : PlayerDetails, prizeAmount : int)
}
}
LotteryAdministration --> "-wireTransfers" WireTransfers
LotteryService --> "-notifications" LotteryEventLog
LotteryAdministration --> "-repository" LotteryTicketRepository
MongoEventLog --> "-stdOutEventLog" StdOutEventLog
LotteryService --> "-wireTransfers" WireTransfers
LotteryAdministration --> "-notifications" LotteryEventLog
ConsoleAdministrationSrvImpl --> "-administration" LotteryAdministration
LotteryService --> "-repository" LotteryTicketRepository
LotteryTicketCheckResult --> "-result" CheckResult
ConsoleAdministrationSrvImpl ..|> ConsoleAdministrationSrv
InMemoryBank ..|> WireTransfers
MongoBank ..|> WireTransfers
InMemoryTicketRepository ..|> LotteryTicketRepository
MongoTicketRepository ..|> LotteryTicketRepository
MongoEventLog ..|> LotteryEventLog
StdOutEventLog ..|> LotteryEventLog
LotteryConsoleServiceImpl ..|> LotteryConsoleService
@enduml
@@ -0,0 +1,2 @@
@startuml
@enduml
@@ -0,0 +1,2 @@
@startuml
@enduml
@@ -0,0 +1,2 @@
@startuml
@enduml
@@ -0,0 +1,33 @@
@startuml
package com.iluwatar.clientsideuicomposition {
class ApiGateway {
- routes : Map<String, FrontendComponent>
+ ApiGateway()
+ handleRequest(path : String, params : Map<String, String>) : String
+ registerRoute(path : String, component : FrontendComponent)
}
class CartFrontend {
+ CartFrontend()
# getData(params : Map<String, String>) : String
}
class ClientSideIntegrator {
- LOGGER : Logger {static}
- apiGateway : ApiGateway
+ ClientSideIntegrator(apiGateway : ApiGateway)
+ composeUi(path : String, params : Map<String, String>)
}
abstract class FrontendComponent {
+ random : Random {static}
+ FrontendComponent()
+ fetchData(params : Map<String, String>) : String
# getData(Map<String, String>) : String {abstract}
}
class ProductFrontend {
+ ProductFrontend()
# getData(params : Map<String, String>) : String
}
}
ClientSideIntegrator --> "-apiGateway" ApiGateway
CartFrontend --|> FrontendComponent
ProductFrontend --|> FrontendComponent
@enduml
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.clientsideuicomposition;
import java.util.HashMap;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.clientsideuicomposition;
import java.util.Map;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.clientsideuicomposition;
import java.util.Map;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.clientsideuicomposition;
import java.util.Map;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.clientsideuicomposition;
import java.util.Map;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.clientsideuicomposition;
import org.junit.jupiter.api.Test;
@@ -0,0 +1,49 @@
@startuml
package com.iluwatar.idempotentconsumer {
class App {
- LOGGER : Logger {static}
+ App()
+ main(args : String[]) {static}
+ run(requestService : RequestService, requestRepository : RequestRepository) : CommandLineRunner
}
class Request {
- status : Status
- uuid : UUID
+ Request()
+ Request(uuid : UUID)
+ Request(uuid : UUID, status : Status)
# canEqual(other : Object) : boolean
+ equals(o : Object) : boolean
+ getStatus() : Status
+ getUuid() : UUID
+ hashCode() : int
+ setStatus(status : Status)
+ setUuid(uuid : UUID)
+ toString() : String
}
~enum Status {
+ COMPLETED {static}
+ PENDING {static}
+ STARTED {static}
+ valueOf(name : String) : Status {static}
+ values() : Status[] {static}
}
interface RequestRepository {
}
class RequestService {
~ requestRepository : RequestRepository
~ requestStateMachine : RequestStateMachine
+ RequestService(requestRepository : RequestRepository, requestStateMachine : RequestStateMachine)
+ complete(uuid : UUID) : Request
+ create(uuid : UUID) : Request
+ start(uuid : UUID) : Request
}
class RequestStateMachine {
+ RequestStateMachine()
+ next(req : Request, nextStatus : Status) : Request
}
}
RequestService --> "-requestRepository" RequestRepository
Request --> "-status" Status
RequestService --> "-requestStateMachine" RequestStateMachine
@enduml
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.idempotentconsumer;
import org.junit.jupiter.api.Test;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.idempotentconsumer;
import org.junit.jupiter.api.BeforeEach;
@@ -0,0 +1,68 @@
@startuml
package com.iluwatar.logaggregation {
class App {
+ App()
+ main(args : String[]) {static}
}
class CentralLogStore {
- LOGGER : Logger {static}
- logs : ConcurrentLinkedQueue<LogEntry>
+ CentralLogStore()
+ displayLogs()
+ storeLog(logEntry : LogEntry)
}
class LogAggregator {
- BUFFER_THRESHOLD : int {static}
- LOGGER : Logger {static}
- buffer : ConcurrentLinkedQueue<LogEntry>
- centralLogStore : CentralLogStore
- executorService : ExecutorService
- logCount : AtomicInteger
- minLogLevel : LogLevel
+ LogAggregator(centralLogStore : CentralLogStore, minLogLevel : LogLevel)
+ collectLog(logEntry : LogEntry)
- flushBuffer()
- startBufferFlusher()
+ stop()
}
class LogEntry {
- level : LogLevel
- message : String
- serviceName : String
- timestamp : LocalDateTime
+ LogEntry(serviceName : String, level : LogLevel, message : String, timestamp : LocalDateTime)
# canEqual(other : Object) : boolean
+ equals(o : Object) : boolean
+ getLevel() : LogLevel
+ getMessage() : String
+ getServiceName() : String
+ getTimestamp() : LocalDateTime
+ hashCode() : int
+ setLevel(level : LogLevel)
+ setMessage(message : String)
+ setServiceName(serviceName : String)
+ setTimestamp(timestamp : LocalDateTime)
+ toString() : String
}
enum LogLevel {
+ DEBUG {static}
+ ERROR {static}
+ INFO {static}
+ valueOf(name : String) : LogLevel {static}
+ values() : LogLevel[] {static}
}
class LogProducer {
- LOGGER : Logger {static}
- aggregator : LogAggregator
- serviceName : String
+ LogProducer(serviceName : String, aggregator : LogAggregator)
+ generateLog(level : LogLevel, message : String)
}
}
LogAggregator --> "-centralLogStore" CentralLogStore
LogEntry --> "-level" LogLevel
CentralLogStore --> "-logs" LogEntry
LogAggregator --> "-buffer" LogEntry
LogAggregator --> "-minLogLevel" LogLevel
LogProducer --> "-aggregator" LogAggregator
@enduml
+21
View File
@@ -0,0 +1,21 @@
@startuml
package com.iluwatar {
class App {
- logger : Logger {static}
+ App()
+ main(args : String[]) {static}
}
class Money {
- amount : double
- currency : String
+ Money(amnt : double, curr : String)
+ addMoney(moneyToBeAdded : Money)
+ exchangeCurrency(currencyToChangeTo : String, exchangeRate : double)
+ getAmount() : double
+ getCurrency() : String
+ multiply(factor : int)
- roundToTwoDecimals(value : double) : double
+ subtractMoney(moneyToBeSubtracted : Money)
}
}
@enduml
+24
View File
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar;
import java.util.logging.Level;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar;
/**
* An exception for when the user tries to add two diffrent currencies.
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar;
/**
* An exception for when the user tries to subtract two different currencies or subtract an amount he doesn't have.
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar;
import lombok.Getter;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwater.money;
import org.junit.jupiter.api.Test;
@@ -36,6 +36,7 @@ import com.iluwatar.monolithic.model.User;
import com.iluwatar.monolithic.repository.OrderRepository;
import com.iluwatar.monolithic.repository.ProductRepository;
import com.iluwatar.monolithic.repository.UserRepository;
import java.util.Locale;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mock;
@@ -73,6 +74,7 @@ class MonolithicAppTest {
ecommerceApp = new EcommerceApp(userService, productService, orderService);
outputStream = new ByteArrayOutputStream();
System.setOut(new PrintStream(outputStream, true, StandardCharsets.UTF_8));
Locale.setDefault(Locale.US);
}
@Test
-5
View File
@@ -48,8 +48,6 @@
<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
<license-maven-plugin.version>4.6</license-maven-plugin.version>
<urm-maven-plugin.version>2.1.1</urm-maven-plugin.version>
<slf4j.version>2.0.17</slf4j.version>
<logback.version>1.5.6</logback.version>
<!-- SonarCloud -->
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<sonar.organization>iluwatar</sonar.organization>
@@ -274,17 +272,14 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
@@ -0,0 +1,44 @@
@startuml
package com.iluwatar.queue.load.leveling {
class App {
- LOGGER : Logger {static}
- SHUTDOWN_TIME : int {static}
+ App()
+ main(args : String[]) {static}
}
class Message {
- msg : String
+ Message(msg : String)
+ getMsg() : String
+ toString() : String
}
class MessageQueue {
- LOGGER : Logger {static}
- blkQueue : BlockingQueue<Message>
+ MessageQueue()
+ retrieveMsg() : Message
+ submitMsg(msg : Message)
}
class ServiceExecutor {
- LOGGER : Logger {static}
- msgQueue : MessageQueue
+ ServiceExecutor(msgQueue : MessageQueue)
+ run()
}
interface Task {
+ submit(Message) {abstract}
}
class TaskGenerator {
- LOGGER : Logger {static}
- msgCount : int
- msgQueue : MessageQueue
+ TaskGenerator(msgQueue : MessageQueue, msgCount : int)
+ run()
+ submit(msg : Message)
}
}
MessageQueue --> "-blkQueue" Message
ServiceExecutor --> "-msgQueue" MessageQueue
TaskGenerator --> "-msgQueue" MessageQueue
TaskGenerator ..|> Task
@enduml
+19
View File
@@ -33,11 +33,30 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>subclass-sandbox</artifactId>
<properties>
<slf4j.version>2.0.17</slf4j.version>
<logback.version>1.5.6</logback.version>
</properties>
<dependencies>
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-lambda</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
@@ -0,0 +1,52 @@
@startuml
package com.iluwatar.table.inheritance {
class App {
+ App()
+ main(args : String[]) {static}
}
class Car {
- numDoors : int
+ Car(year : int, make : String, model : String, numDoors : int, id : int)
+ getNumDoors() : int
+ setNumDoors(doors : int)
+ toString() : String
}
class Truck {
- loadCapacity : double
+ Truck(year : int, make : String, model : String, loadCapacity : double, id : int)
+ getLoadCapacity() : double
+ setLoadCapacity(capacity : double)
+ toString() : String
}
class Vehicle {
- id : int
- make : String
- model : String
- year : int
+ Vehicle(year : int, make : String, model : String, id : int)
+ getId() : int
+ getMake() : String
+ getModel() : String
+ getYear() : int
+ setId(id : int)
+ setMake(make : String)
+ setModel(model : String)
+ setYear(year : int)
+ toString() : String
}
class VehicleDatabase {
- carTable : Map<Integer, Car>
~ logger : Logger
- truckTable : Map<Integer, Truck>
- vehicleTable : Map<Integer, Vehicle>
+ VehicleDatabase()
+ getCar(id : int) : Car
+ getTruck(id : int) : Truck
+ getVehicle(id : int) : Vehicle
+ printAllVehicles()
+ saveVehicle(vehicle : Vehicle)
}
}
Car --|> Vehicle
Truck --|> Vehicle
@enduml
+26
View File
@@ -1,4 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
The MIT License
Copyright © 2014-2022 Ilkka Seppälä
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<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">
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.table.inheritance;
import java.util.logging.Logger;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.table.inheritance;
import lombok.Getter;
/**
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.table.inheritance;
import lombok.Getter;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.table.inheritance;
import lombok.Getter;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.iluwatar.table.inheritance;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.iluwatar.table.inheritance.App;
@@ -1,3 +1,27 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
+29
View File
@@ -0,0 +1,29 @@
@startuml
package com.iluwatar.templateview {
class App {
- LOGGER : Logger {static}
+ App()
+ main(args : String[]) {static}
}
class ContactPageView {
- LOGGER : Logger {static}
+ ContactPageView()
# renderDynamicContent()
}
class HomePageView {
- LOGGER : Logger {static}
+ HomePageView()
# renderDynamicContent()
}
abstract class TemplateView {
- LOGGER : Logger {static}
+ TemplateView()
# printFooter()
# printHeader()
+ render()
# renderDynamicContent() {abstract}
}
}
ContactPageView --|> TemplateView
HomePageView --|> TemplateView
@enduml
@@ -1,6 +1,5 @@
/*
* This project is licensed under the MIT license. Module model-view-viewmodel
* is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
* This project is licensed under the MIT license. Module model-view-viewmodel is using ZK framework licensed under LGPL (see lgpl-3.0.txt).
*
* The MIT License
* Copyright © 2014-2022 Ilkka Seppälä
+26
View File
@@ -0,0 +1,26 @@
@startuml
package com.iluwatar.virtual.proxy {
class App {
+ App()
+ main(args : String[]) {static}
}
interface ExpensiveObject {
+ process() {abstract}
}
class RealVideoObject {
- LOGGER : Logger {static}
+ RealVideoObject()
- heavyInitialConfiguration()
+ process()
}
class VideoObjectProxy {
- realVideoObject : RealVideoObject
+ VideoObjectProxy()
+ getRealVideoObject() : RealVideoObject
+ process()
}
}
VideoObjectProxy --> "-realVideoObject" RealVideoObject
RealVideoObject ..|> ExpensiveObject
VideoObjectProxy ..|> ExpensiveObject
@enduml