use of com.tngtech.archunit.core.importer.ClassFileImporter in project jhipster-sample-app-cassandra by jhipster.
the class ArchTest method servicesAndRepositoriesShouldNotDependOnWebLayer.
@Test
void servicesAndRepositoriesShouldNotDependOnWebLayer() {
JavaClasses importedClasses = new ClassFileImporter().withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS).importPackages("io.github.jhipster.sample");
noClasses().that().resideInAnyPackage("io.github.jhipster.sample.service..").or().resideInAnyPackage("io.github.jhipster.sample.repository..").should().dependOnClassesThat().resideInAnyPackage("..io.github.jhipster.sample.web..").because("Services and repositories should not depend on web layer").check(importedClasses);
}
use of com.tngtech.archunit.core.importer.ClassFileImporter in project jhipster-sample-app-hazelcast by jhipster.
the class ArchTest method servicesAndRepositoriesShouldNotDependOnWebLayer.
@Test
void servicesAndRepositoriesShouldNotDependOnWebLayer() {
JavaClasses importedClasses = new ClassFileImporter().withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS).importPackages("io.github.jhipster.sample");
noClasses().that().resideInAnyPackage("io.github.jhipster.sample.service..").or().resideInAnyPackage("io.github.jhipster.sample.repository..").should().dependOnClassesThat().resideInAnyPackage("..io.github.jhipster.sample.web..").because("Services and repositories should not depend on web layer").check(importedClasses);
}
use of com.tngtech.archunit.core.importer.ClassFileImporter in project jhipster-sample-app-mongodb by jhipster.
the class ArchTest method servicesAndRepositoriesShouldNotDependOnWebLayer.
@Test
void servicesAndRepositoriesShouldNotDependOnWebLayer() {
JavaClasses importedClasses = new ClassFileImporter().withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS).importPackages("io.github.jhipster.sample");
noClasses().that().resideInAnyPackage("io.github.jhipster.sample.service..").or().resideInAnyPackage("io.github.jhipster.sample.repository..").should().dependOnClassesThat().resideInAnyPackage("..io.github.jhipster.sample.web..").because("Services and repositories should not depend on web layer").check(importedClasses);
}
use of com.tngtech.archunit.core.importer.ClassFileImporter in project jhipster-sample-app-oauth2 by jhipster.
the class ArchTest method servicesAndRepositoriesShouldNotDependOnWebLayer.
@Test
void servicesAndRepositoriesShouldNotDependOnWebLayer() {
JavaClasses importedClasses = new ClassFileImporter().withImportOption(ImportOption.Predefined.DO_NOT_INCLUDE_TESTS).importPackages("io.github.jhipster.sample");
noClasses().that().resideInAnyPackage("io.github.jhipster.sample.service..").or().resideInAnyPackage("io.github.jhipster.sample.repository..").should().dependOnClassesThat().resideInAnyPackage("..io.github.jhipster.sample.web..").because("Services and repositories should not depend on web layer").check(importedClasses);
}
use of com.tngtech.archunit.core.importer.ClassFileImporter in project archifacts by archifacts.
the class C4ModelBuilderTest method assert_that_relationship_source_and_target_is_automatically_added_to_the_c4_model.
@Test
void assert_that_relationship_source_and_target_is_automatically_added_to_the_c4_model() {
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.getRelationships().stream().forEach(c4ModelBuilder::relationship);
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 Container container = containers.iterator().next();
final Component class1ForBuildingBlockType1 = container.getComponentWithName("Class1ForBuildingBlockType1");
assertThat(class1ForBuildingBlockType1).isNotNull();
final Component miscArtifact1 = container.getComponentWithName("MiscArtifact1");
assertThat(miscArtifact1).isNotNull();
assertThat(container.getComponents()).flatMap(Component::getRelationships).hasSize(1).extracting(Relationship::getDescription, Relationship::getSource, Relationship::getDestination).containsExactly(tuple("references", class1ForBuildingBlockType1, miscArtifact1));
}
Aggregations