Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement layer rules #1

Closed
2 tasks done
hohwille opened this issue Jan 9, 2023 · 1 comment · Fixed by #10
Closed
2 tasks done

Implement layer rules #1

hohwille opened this issue Jan 9, 2023 · 1 comment · Fixed by #10
Assignees

Comments

@hohwille
Copy link
Contributor

hohwille commented Jan 9, 2023

Implement the Layer-Rules with ArchUnit.

Acceptance-Criteria:

  • Rules L1-L12 are implemented with ArchUnit
  • Create Code that violates Layer Rules
@hohwille hohwille moved this to 🆕 New in ArchUnit Board Jan 9, 2023
@hohwille
Copy link
Contributor Author

hohwille commented Jan 9, 2023

Skeleton for such an ArchUnit test:

@AnalyzeClasses(packages = "com.customer.app", importOptions = ImportOption.DoNotIncludeTests.class)
class ArchitectureTest
{

  @ArchTest
  private static final ArchRule shouldOnlyAccessValidLayers = 
    layeredArchitecture()
        .layer("common").definedBy("..common..")
        .layer("logic").definedBy("..logic..")
        .layer("dataaccess").definedBy("..dataaccess..")
        .layer("service").definedBy("..service..")
        .layer("batch").definedBy("..batch..")
        .layer("ui").definedBy("..ui..")
        .whereLayer("logic").mayOnlyBeAccessedByLayers("service", "batch")
        .whereLayer("dataaccess").mayOnlyBeAccessedByLayers("logic" /*, "batch"*/ )
        .whereLayer("service").mayOnlyBeAccessedByLayers("ui")
        .whereLayer("batch").mayOnlyBeAccessedByLayers("logic", "service")
        .whereLayer("ui").mayNotBeAccessedByAnyLayer()
        //.ignoreDependency(fullNameMatching(".*\\.ui\\.excuse4711\\..*"), fullNameMatching(".*\\.dataaccess\\.excuse4711\\..*"))
        .because("Dependency of technical layers violates architecture rules.");
        
  // ...

}

@hohwille hohwille moved this from 🆕 New to 📋 Backlog in ArchUnit Board Jan 16, 2023
@vlad961 vlad961 moved this from 📋 Backlog to 🏗 In progress in ArchUnit Board Jan 18, 2023
@vlad961 vlad961 moved this from 🏗 In progress to 👀 In review in ArchUnit Board Jan 28, 2023
@hohwille hohwille linked a pull request Jan 30, 2023 that will close this issue
hohwille added a commit that referenced this issue Feb 6, 2023
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in ArchUnit Board Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants