-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1 +1,13 @@ | ||
# demo-kotlin-cli | ||
|
||
## Use Case Diagram | ||
|
||
![Class Diagram](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/djvelimir/demo-kotlin-cli/main/diagrams/UseCase.puml) | ||
|
||
## Sequence Diagram | ||
|
||
![Class Diagram](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/djvelimir/demo-kotlin-cli/main/diagrams/Sequence.puml) | ||
|
||
## Class Diagram | ||
|
||
![Class Diagram](http://www.plantuml.com/plantuml/proxy?cache=no&src=https://raw.githubusercontent.com/djvelimir/demo-kotlin-cli/main/diagrams/Class.puml) |
This file contains 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,73 @@ | ||
@startuml Class | ||
interface ArgumentValidator { | ||
+ validate(args: String[]): boolean | ||
} | ||
|
||
class ArgumentValidatorImpl { | ||
} | ||
|
||
interface ArgumentProcessor { | ||
+ process(args: String[]) | ||
} | ||
|
||
class ArgumentProcessorImpl { | ||
- argumentValidator: ArgumentValidator | ||
- passwordGenerator: PasswordGenerator | ||
- terminal: Terminal | ||
} | ||
|
||
interface Terminal { | ||
+ show(message: String) | ||
} | ||
|
||
class TerminalImpl { | ||
} | ||
|
||
interface PasswordGenerator { | ||
+ generate(): String | ||
} | ||
|
||
class PasswordGeneratorImpl { | ||
- passwordLength: int | ||
- randomCharacterGenerator: RandomCharacterGenerator | ||
- stringShuffler: StringShuffler | ||
} | ||
|
||
interface RandomCharacterGenerator { | ||
+ generateUppercaseCharacter(): char | ||
+ generateLowercaseCharacter(): char | ||
+ generateDigitCharacter(): char | ||
+ generateSpecialCharacter(): char | ||
+ generateAllowedCharacter(): char | ||
} | ||
|
||
class RandomCharacterGeneratorImpl { | ||
- uppercaseCharacters: String | ||
- lowercaseCharacters: String | ||
- digitCharacters: String | ||
- specialCharacters: String | ||
- allowedCharacters: String | ||
- random: Random | ||
} | ||
|
||
interface StringShuffler { | ||
+ shuffle(characters: String): String | ||
} | ||
|
||
class StringShufflerImpl { | ||
} | ||
|
||
ArgumentValidator <|-- ArgumentValidatorImpl | ||
ArgumentProcessor <|-- ArgumentProcessorImpl | ||
Terminal <|-- TerminalImpl | ||
PasswordGenerator <|-- PasswordGeneratorImpl | ||
RandomCharacterGenerator <|-- RandomCharacterGeneratorImpl | ||
StringShuffler <|-- StringShufflerImpl | ||
|
||
ArgumentProcessorImpl *--l ArgumentValidator | ||
ArgumentProcessorImpl *--d PasswordGenerator | ||
ArgumentProcessorImpl *--r Terminal | ||
|
||
PasswordGeneratorImpl *--l RandomCharacterGenerator | ||
PasswordGeneratorImpl *--r StringShuffler | ||
@enduml |
This file contains 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,85 @@ | ||
@startuml Sequence | ||
participant Main as app | ||
participant ArgumentProcessorImpl as argumentProcessor | ||
participant ArgumentValidatorImpl as argumentValidator | ||
participant PasswordGeneratorImpl as passwordGenerator | ||
participant RandomCharacterGeneratorImpl as randomCharacterGenerator | ||
participant StringShufflerImpl as stringShuffler | ||
participant TerminalImpl as terminal | ||
|
||
activate app | ||
|
||
app -> argumentProcessor: process(args) | ||
activate argumentProcessor | ||
|
||
argumentProcessor -> argumentValidator: validate(args) | ||
activate argumentValidator | ||
argumentProcessor <-- argumentValidator: return are arguments valid | ||
deactivate argumentValidator | ||
|
||
alt#Gold #LightBlue Arguments are valid | ||
argumentProcessor -> passwordGenerator: generate() | ||
activate passwordGenerator | ||
|
||
passwordGenerator -> randomCharacterGenerator: generateUppercaseCharacter() | ||
activate randomCharacterGenerator | ||
|
||
randomCharacterGenerator -> passwordGenerator: return uppercase character | ||
deactivate randomCharacterGenerator | ||
passwordGenerator -> passwordGenerator: append character | ||
|
||
passwordGenerator -> randomCharacterGenerator: generateLowercaseCharacter() | ||
activate randomCharacterGenerator | ||
|
||
randomCharacterGenerator -> passwordGenerator: return lowercase character | ||
deactivate randomCharacterGenerator | ||
passwordGenerator -> passwordGenerator: append character | ||
|
||
passwordGenerator -> randomCharacterGenerator: generateDigitCharacter() | ||
activate randomCharacterGenerator | ||
|
||
randomCharacterGenerator -> passwordGenerator: return digit character | ||
deactivate randomCharacterGenerator | ||
passwordGenerator -> passwordGenerator: append character | ||
|
||
passwordGenerator -> randomCharacterGenerator: generateSpecialCharacter() | ||
activate randomCharacterGenerator | ||
|
||
randomCharacterGenerator -> passwordGenerator: return special character | ||
deactivate randomCharacterGenerator | ||
passwordGenerator -> passwordGenerator: append character | ||
|
||
loop passwordLength - 4 times | ||
passwordGenerator -> randomCharacterGenerator: generateAllowedCharacter() | ||
activate randomCharacterGenerator | ||
|
||
randomCharacterGenerator -> passwordGenerator: return character | ||
deactivate randomCharacterGenerator | ||
passwordGenerator -> passwordGenerator: append character | ||
end | ||
|
||
passwordGenerator -> stringShuffler: shuffle(characters) | ||
activate stringShuffler | ||
|
||
stringShuffler -> passwordGenerator: return shuffled characters | ||
deactivate stringShuffler | ||
|
||
argumentProcessor <-- passwordGenerator: return generated password | ||
deactivate passwordGenerator | ||
|
||
argumentProcessor -> terminal: show(password) | ||
activate terminal | ||
argumentProcessor <-- terminal | ||
deactivate terminal | ||
|
||
else #Pink Arguments are not valid | ||
argumentProcessor -> terminal: show(usage) | ||
activate terminal | ||
argumentProcessor <-- terminal | ||
deactivate terminal | ||
end | ||
|
||
app <-- argumentProcessor | ||
deactivate argumentProcessor | ||
|
||
@enduml |
This file contains 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,9 @@ | ||
@startuml UseCase | ||
actor "User" as user | ||
|
||
rectangle demo-kotlin-cli { | ||
usecase "Generate Password" as generatePassword | ||
} | ||
|
||
user -> generatePassword | ||
@enduml |