GH-11, GH-66, GH-67, GH-68 - Improve module canvas.

Overhauled the module canvas in various ways. By default, we now skip "empty" rows. In other words, if we do not find any published events for example, we skip the entire row. CanvasOptions.revealEmptyRows() can be used to keep those empty rows around. We now also expose all value types and Spring bean references.

Refactored the dependency lookup APIs on ApplicationModule. Both DependencyType and DependencyDepth are now top-level types. Also, ApplicationModuleDependency and ApplicationModuleDependencies were introduced as explicit types. In the course of that, ApplicationModule.getDependencies(…) has got its return type changed from List<ApplicationModule> to ApplicationModuleDependencies. The internal ModuleDependency type has been renamed to QualifiedDependency.
This commit is contained in:
Oliver Drotbohm
2022-11-11 13:52:42 +01:00
parent 62ac231ce4
commit d96263fe30
14 changed files with 784 additions and 373 deletions

View File

@@ -71,7 +71,7 @@ class ArchitecturallyEvidentTypeUnitTest {
void detectsSpringAnnotatedRepositories() {
ArchitecturallyEvidentType type = new SpringAwareArchitecturallyEvidentType(
classes.getRequiredClass(SpringRepository.class));
classes.getRequiredClass(SpringRepository.class), Classes.NONE);
assertThat(type.isRepository()).isTrue();
}
@@ -80,7 +80,7 @@ class ArchitecturallyEvidentTypeUnitTest {
void doesNotConsiderEntityAggregateRoot() {
ArchitecturallyEvidentType type = new SpringAwareArchitecturallyEvidentType(
classes.getRequiredClass(SampleEntity.class));
classes.getRequiredClass(SampleEntity.class), Classes.NONE);
assertThat(type.isEntity()).isTrue();
assertThat(type.isAggregateRoot()).isFalse();

View File

@@ -21,13 +21,13 @@ import java.util.stream.Stream;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.modulith.model.ApplicationModule.ModuleDependency;
import org.springframework.modulith.model.ApplicationModule.QualifiedDependency;
import com.tngtech.archunit.core.domain.JavaClass;
import com.tngtech.archunit.core.importer.ClassFileImporter;
/**
* Unit tests for {@link ModuleDependency}.
* Unit tests for {@link QualifiedDependency}.
*
* @author Oliver Drotbohm
*/
@@ -61,8 +61,8 @@ class ModuleDependencyUnitTest {
var imported = importer.importClass(type);
var evidentType = ArchitecturallyEvidentType.of(imported, Classes.NONE);
return ModuleDependency.fromType(evidentType) //
.map(ModuleDependency::getTarget) //
return QualifiedDependency.fromType(evidentType) //
.map(QualifiedDependency::getTarget) //
.map(JavaClass::reflect);
}