use of org.archifacts.core.model.Application in project archifacts by archifacts.
the class AxonDescriptorsTest method assertThat_source_based_artifact_relationship_descriptor_are_recognized.
@ParameterizedTest
@MethodSource("getSourceBasedArtifactRelationshipDescriptors")
void assertThat_source_based_artifact_relationship_descriptor_are_recognized(final SourceBasedArtifactRelationshipDescriptor sourceBasedArtifactRelationshipDescriptor, final Tuple... expectedTuples) {
final Application application = Application.builder().descriptor(sourceBasedArtifactRelationshipDescriptor).buildApplication(DOMAIN);
assertThat(application.getRelationshipsOfRole(sourceBasedArtifactRelationshipDescriptor.role())).extracting(r -> r.getSource().getJavaClass().reflect(), r -> r.getTarget().getJavaClass().reflect()).containsExactlyInAnyOrder(expectedTuples);
}
use of org.archifacts.core.model.Application in project archifacts by archifacts.
the class C4ModelBuilderTest method assert_that_relationships_are_not_added_automatically.
@Test
void assert_that_relationships_are_not_added_automatically() {
final JavaClasses javaClasses = new ClassFileImporter().importPackages("org.archifacts.integration.c4.model.domain");
final Application application = Application.builder().descriptor(buildingBlockType1Descriptor).descriptor(defaultContainerDescriptor).descriptor(referenceDescriptor).buildApplication(javaClasses);
final C4ModelBuilder c4ModelBuilder = C4Model.builder(new Workspace(this.getClass().getSimpleName(), null));
application.getArtifacts().stream().forEach(c4ModelBuilder::artifact);
final C4Model c4Model = c4ModelBuilder.build();
final Set<Container> containers = c4Model.softwareSystem().getContainers();
assertThat(containers).hasSize(1).extracting(Container::getName, Container::getTechnology).containsExactly(tuple("DefaultContainer", "ContainerType1"));
final Set<Component> components = containers.iterator().next().getComponents();
assertThat(components).hasSize(2).extracting(Component::getName, Component::getTechnology).containsExactlyInAnyOrder(tuple("Class1ForBuildingBlockType1", "BuildingBlockType1"), tuple("MiscArtifact1", "Misc"));
assertThat(components).flatMap(Component::getRelationships).isEmpty();
}
Aggregations