Class PlantUmlArchCondition
java.lang.Object
com.tngtech.archunit.lang.ArchCondition<JavaClass>
com.tngtech.archunit.library.plantuml.rules.PlantUmlArchCondition
Allows to evaluate PlantUML Component Diagrams
as ArchUnit rules.
The general syntax to use is
There are various factory method for different input formats (file, url, ...), compare
A PlantUML diagram used with ArchUnit must abide by a certain set of rules:
The general syntax to use is
classes().should(adhereToPlantUmlDiagram(someDiagramUrl, consideringAllDependencies()));
The supported diagram syntax uses component diagram stereotypes to associate package patterns
(compare PackageMatcher
) with components. An example could look like
[Some Source] <<..some.source..>>
[Some Target] <<..some.target..>>
[Some Source] --> [Some Target]
Applying such a diagram as an ArchUnit rule would demand dependencies only from ..some.source..
to ..some.target..
, but forbid them vice versa.There are various factory method for different input formats (file, url, ...), compare
adhereToPlantUmlDiagram(URL, Configuration)
adhereToPlantUmlDiagram(File, Configuration)
adhereToPlantUmlDiagram(Path, Configuration)
adhereToPlantUmlDiagram(String, Configuration)
PlantUmlArchCondition.Configuration
.
Candidates are
PlantUmlArchCondition.Configuration.consideringAllDependencies()
PlantUmlArchCondition.Configuration.consideringOnlyDependenciesInDiagram()
PlantUmlArchCondition.Configuration.consideringOnlyDependenciesInAnyPackage(String, String...)
A PlantUML diagram used with ArchUnit must abide by a certain set of rules:
- Components must have a name
- Components must have at least one stereotype. Each stereotype in the diagram must be unique
- Components may have an optional alias
- Components may have an optional color
- Components must be defined before declaring dependencies
- Dependencies must use arrows only consisting of dashes, pointing right, e.g.
-->
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Used to specify which dependencies should be checked by the condition.Nested classes/interfaces inherited from class com.tngtech.archunit.lang.ArchCondition
ArchCondition.ConditionByPredicate<T extends HasDescription & HasSourceCodeLocation>
-
Method Summary
Modifier and TypeMethodDescriptionstatic PlantUmlArchCondition
adhereToPlantUmlDiagram
(File file, PlantUmlArchCondition.Configuration configuration) static PlantUmlArchCondition
adhereToPlantUmlDiagram
(String fileName, PlantUmlArchCondition.Configuration configuration) static PlantUmlArchCondition
adhereToPlantUmlDiagram
(URL url, PlantUmlArchCondition.Configuration configuration) static PlantUmlArchCondition
adhereToPlantUmlDiagram
(Path path, PlantUmlArchCondition.Configuration configuration) void
check
(JavaClass javaClass, ConditionEvents events) ignoreDependencies
(DescribedPredicate<? super Dependency> ignorePredicate) Ignores alldependencies
matching the suppliedignorePredicate
.ignoreDependencies
(Class<?> origin, Class<?> target) ignoreDependencies
(String origin, String target) ignoreDependenciesWithOrigin
(DescribedPredicate<? super JavaClass> ignorePredicate) ignoreDependenciesWithTarget
(DescribedPredicate<? super JavaClass> ignorePredicate) Methods inherited from class com.tngtech.archunit.lang.ArchCondition
and, as, finish, forSubtype, from, getDescription, init, or, toString
-
Method Details
-
ignoreDependenciesWithOrigin
@PublicAPI(usage=ACCESS) public PlantUmlArchCondition ignoreDependenciesWithOrigin(DescribedPredicate<? super JavaClass> ignorePredicate) Ignores alldependencies
that have anorigin class
matching the suppliedignorePredicate
.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaClass
can be found withinJavaClass.Predicates
or one of the respective ancestors likeHasName.Predicates
. -
ignoreDependenciesWithTarget
@PublicAPI(usage=ACCESS) public PlantUmlArchCondition ignoreDependenciesWithTarget(DescribedPredicate<? super JavaClass> ignorePredicate) Ignores alldependencies
that have antarget class
matching the suppliedignorePredicate
.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingJavaClass
can be found withinJavaClass.Predicates
or one of the respective ancestors likeHasName.Predicates
. -
ignoreDependencies
@PublicAPI(usage=ACCESS) public PlantUmlArchCondition ignoreDependencies(Class<?> origin, Class<?> target) -
ignoreDependencies
@PublicAPI(usage=ACCESS) public PlantUmlArchCondition ignoreDependencies(String origin, String target) -
ignoreDependencies
@PublicAPI(usage=ACCESS) public PlantUmlArchCondition ignoreDependencies(DescribedPredicate<? super Dependency> ignorePredicate) Ignores alldependencies
matching the suppliedignorePredicate
.
Note that many predefinedpredicates
can be found within a subclassPredicates
of the respective domain object or a common ancestor. For example,predicates
targetingDependency
can be found withinDependency.Predicates
. -
check
- Specified by:
check
in classArchCondition<JavaClass>
-
adhereToPlantUmlDiagram
@PublicAPI(usage=ACCESS) public static PlantUmlArchCondition adhereToPlantUmlDiagram(URL url, PlantUmlArchCondition.Configuration configuration) - See Also:
-
adhereToPlantUmlDiagram
@PublicAPI(usage=ACCESS) public static PlantUmlArchCondition adhereToPlantUmlDiagram(String fileName, PlantUmlArchCondition.Configuration configuration) - See Also:
-
adhereToPlantUmlDiagram
@PublicAPI(usage=ACCESS) public static PlantUmlArchCondition adhereToPlantUmlDiagram(Path path, PlantUmlArchCondition.Configuration configuration) - See Also:
-
adhereToPlantUmlDiagram
@PublicAPI(usage=ACCESS) public static PlantUmlArchCondition adhereToPlantUmlDiagram(File file, PlantUmlArchCondition.Configuration configuration) - See Also:
-