-
-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Implemented FSM design pattern issue #203 #3116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
a53c561
Implemented FSM design pattern issue #203
Wessam100 d6cc250
Implemented FSM design pattern issue #203
Wessam100 30e652b
FSM issue #203
Wessam100 60a67c2
FSM issue #203
Wessam100 7474939
Fixed test coverage issues and reorganized files to adhere to the Sin…
Wessam100 d67c77d
fixed testcases
Wessam100 69da551
Update opm.xml
Wessam100 af696cb
fixed pom.xml
Wessam100 2b57ef5
edit
Wessam100 195b40e
fixed failing check
Wessam100 323afa2
update pom.xml
Wessam100 9e87fd7
fix
Wessam100 61e92bb
fixed
Wessam100 77d4cbc
added more testcases
Wessam100 b88de19
coverage
Wessam100 d5c14be
updated tests
Wessam100 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fixed
- Loading branch information
commit 61e92bb3955cb76205ffe46a9fc4dfb8651e5065
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| @startuml | ||
| package com.iluwatar.trafficlight { | ||
| class GreenLightState { | ||
| + GreenLightState() | ||
| + handleEvent(context : TrafficLightContext) | ||
| } | ||
| class RedLightState { | ||
| + RedLightState() | ||
| + handleEvent(context : TrafficLightContext) | ||
| } | ||
| class TrafficLightContext { | ||
| - currentState : TrafficLightState | ||
| + TrafficLightContext(initialState : TrafficLightState) | ||
| + getCurrentState() : TrafficLightState | ||
| + handleEvent() | ||
| + setState(newState : TrafficLightState) | ||
| } | ||
| class TrafficLightFsm { | ||
| + TrafficLightFsm() | ||
| + main(args : String[]) {static} | ||
| } | ||
| interface TrafficLightState { | ||
| + handleEvent(TrafficLightContext) {abstract} | ||
| } | ||
| class YellowLightState { | ||
| + YellowLightState() | ||
| + handleEvent(context : TrafficLightContext) | ||
| } | ||
| } | ||
| TrafficLightContext --> "-currentState" TrafficLightState | ||
| GreenLightState ..|> TrafficLightState | ||
| RedLightState ..|> TrafficLightState | ||
| YellowLightState ..|> TrafficLightState | ||
| @enduml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| @startuml | ||
| @enduml |
2 changes: 2 additions & 0 deletions
2
microservices-aggregrator/etc/microservices-aggregrator.urm.puml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| @startuml | ||
| @enduml |
49 changes: 49 additions & 0 deletions
49
microservices-idempotent-consumer/etc/microservices-idempotent-consumer.urm.puml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
68 changes: 68 additions & 0 deletions
68
microservices-log-aggregation/etc/microservices-log-aggregation.urm.puml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
queue-based-load-leveling/etc/queue-based-load-leveling.urm.puml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comes from parent pom.xml and can be left out