Skip to content

Commit

Permalink
Extend user guide's domain model overview (#1221)
Browse files Browse the repository at this point in the history
  • Loading branch information
hankem authored Apr 10, 2024
2 parents 6fda869 + fe1ef05 commit 6e20006
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 64 deletions.
4 changes: 2 additions & 2 deletions docs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ asciidoctor {
asciidoctorj {
modules {
diagram.use()
diagram.version '2.2.4'
diagram.version '2.2.14' // https://github.com/asciidoctor/asciidoctorj-diagram/releases/
}
}
}
Expand All @@ -34,7 +34,7 @@ asciidoctor.doFirst {
}

asciidoctorj {
version = '2.3.0'
version = '2.5.11' // https://github.com/asciidoctor/asciidoctorj/releases
}

asciidoctor.dependsOn cleanUserGuide
Expand Down
43 changes: 34 additions & 9 deletions docs/userguide/004_What_to_Check.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The following section illustrates some typical checks you could do with ArchUnit

=== Package Dependency Checks

[plantuml, "package-deps-no-access"]
[plantuml, "package-deps-no-access", svg, opts=interactive]
----
skinparam componentStyle uml2
skinparam component {
Expand All @@ -23,7 +23,7 @@ noClasses().that().resideInAPackage("..source..")
.should().dependOnClassesThat().resideInAPackage("..foo..")
----

[plantuml, "package-deps-only-access"]
[plantuml, "package-deps-only-access", svg, opts=interactive]
----
skinparam componentStyle uml2
skinparam component {
Expand All @@ -47,8 +47,10 @@ classes().that().resideInAPackage("..foo..")

=== Class Dependency Checks

[plantuml, "class-naming-deps"]
[plantuml, "class-naming-deps", svg, opts=interactive]
----
@startuml
hide empty members
skinparam componentStyle uml2
skinparam component {
Expand All @@ -69,6 +71,7 @@ note top on link #crimson: forbidden
Bar --> FooBar #green
note left on link #green: allowed
@enduml
----

[source,java]
Expand All @@ -79,8 +82,11 @@ classes().that().haveNameMatching(".*Bar")

=== Class and Package Containment Checks

[plantuml, "class-package-contain"]
[plantuml, "class-package-contain", svg, opts=interactive]
----
@startuml
hide empty members
set separator none
skinparam componentStyle uml2
skinparam component {
Expand All @@ -103,6 +109,7 @@ package com.wrong {
note "resides in wrong package" as WrongPackage #crimson
FooController .. WrongPackage
@enduml
----

[source,java]
Expand All @@ -113,8 +120,10 @@ classes().that().haveSimpleNameStartingWith("Foo")

=== Inheritance Checks

[plantuml, "inheritance-naming-check"]
[plantuml, "inheritance-naming-check", svg, opts=interactive]
----
@startuml
hide empty members
skinparam componentStyle uml2
skinparam component {
Expand All @@ -137,6 +146,7 @@ FtpConnection --|> Connection #green
SshThing --|> Connection #crimson
note right on link #crimson: Has wrong name
@enduml
----

[source,java]
Expand All @@ -145,8 +155,11 @@ classes().that().implement(Connection.class)
.should().haveSimpleNameEndingWith("Connection")
----

[plantuml, "inheritance-access-check"]
[plantuml, "inheritance-access-check", svg, opts=interactive]
----
@startuml
hide empty members
set separator none
skinparam componentStyle uml2
skinparam component {
Expand All @@ -173,6 +186,7 @@ ValidPersistenceUser --> EntityManager #green
IllegalPersistenceUser --> EntityManager #crimson
note right on link #crimson: Accessor resides in wrong package
@enduml
----

[source,java]
Expand All @@ -183,8 +197,10 @@ classes().that().areAssignableTo(EntityManager.class)

=== Annotation Checks

[plantuml, "inheritance-annotation-check"]
[plantuml, "inheritance-annotation-check", svg, opts=interactive]
----
@startuml
hide empty members
skinparam componentStyle uml2
skinparam component {
Expand All @@ -206,6 +222,7 @@ ValidPersistenceUser --> EntityManager #green
IllegalPersistenceUser --> EntityManager #crimson
note right on link #crimson: Accessor is not annotated with @Transactional
@enduml
----

[source,java]
Expand All @@ -216,8 +233,11 @@ classes().that().areAssignableTo(EntityManager.class)

=== Layer Checks

[plantuml, "layer-check"]
[plantuml, "layer-check", svg, opts=interactive]
----
@startuml
hide empty members
set separator none
skinparam componentStyle uml2
skinparam component {
Expand Down Expand Up @@ -253,6 +273,7 @@ note right on link #crimson: Access goes against layers
SomePersistenceManager -up--> SomeServiceOne #crimson
note right on link #crimson: Access goes against layers
@enduml
----

[source,java]
Expand All @@ -270,8 +291,11 @@ layeredArchitecture()

=== Cycle Checks

[plantuml, "cycle-check"]
[plantuml, "cycle-check", svg, opts=interactive]
----
@startuml
hide empty members
set separator none
skinparam componentStyle uml2
skinparam component {
Expand Down Expand Up @@ -301,6 +325,7 @@ ClassOneInModuleOne --> ClassTwoInModuleTwo #crimson
ClassOneInModuleTwo --> ClassOneInModuleThree #crimson
ClassTwoInModuleThree --> ClassOneInModuleOne #crimson
note right on link #crimson: Combination of accesses forms cycle
@enduml
----

[source,java]
Expand Down
Loading

0 comments on commit 6e20006

Please sign in to comment.