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

#1: implement layer dependency violations #14

Open
wants to merge 23 commits into
base: violations/layer
Choose a base branch
from

Conversation

vlad961
Copy link
Contributor

@vlad961 vlad961 commented Jan 28, 2023

DO NOT MERGE.
This fork branch contains classes demonstrating archunit layer dependency rules violations.

#1
#8
#13

Removed rules from ArchitectureTest.java.
Because they were too restrictive.
Violation of L2 - Client layer doesnt depend
on any other layer.
Client Layer doesnt depend on logic layer.
Client Layer doesnt depend on dataaccess layer.
Added Violation of L8.
Service layer doesnt depend on dataaccess layer.
Dataaccess layer doesnt depend on service layer.
Added Violation of L12.
Dataaccess layer doesnt depend on logic layer.
Added sample tasklist and taskitem dump file.
Client layer doesnt depend on batch layer.
Service layer doesnt depend on batch layer.
Batch layer doesnt depend on service layer.
Batch layer doesnt depend on dataaccess layer.
@hohwille hohwille marked this pull request as draft January 30, 2023 09:42
LayerDependencyRulesTest.java includes all necessary tests.
Deleted LayerDependencyRulesTest.java.
Refactored L2Violation and moved into service layer.
Refactored TaskService and L9Violation to resemble to other Violations.
They equal those of add-layer-rules branch now.
@hohwille hohwille changed the title Issue/8 implement layer dependency violations #8: implement layer dependency violations Feb 7, 2023
@hohwille hohwille changed the title #8: implement layer dependency violations #1: implement layer dependency violations Feb 7, 2023
@hohwille
Copy link
Contributor

hohwille commented Feb 7, 2023

@vlad961 thanks for this demo PR. Very nice demonstration with good naming of «RuleId»Violation«Source»LayerDependsOn«Target»Layer resulting in readable violation output:

because Dependency of technical layers violates architecture rules.' was violated (12 times):
Field <com.devonfw.sample.archunit.batch.L11ViolationBatchLayerDependsOnDataaccessLayer.taskItemRepository> has type <com.devonfw.sample.archunit.task.dataaccess.TaskItemRepository> in (L11ViolationBatchLayerDependsOnDataaccessLayer.java:0)
Field <com.devonfw.sample.archunit.batch.L7ViolationBatchLayerDependsOnServiceLayer.taskService> has type <com.devonfw.sample.archunit.task.service.TaskService> in (L7ViolationBatchLayerDependsOnServiceLayer.java:0)
Field <com.devonfw.sample.archunit.client.L3ViolationClientLayerDependsOnLogicLayer.taskItemMapper> has type <com.devonfw.sample.archunit.task.logic.TaskItemMapper> in (L3ViolationClientLayerDependsOnLogicLayer.java:0)
Field <com.devonfw.sample.archunit.client.L4ViolationClientLayerDependsOnDataaccessLayer.taskItemRepository> has type <com.devonfw.sample.archunit.task.dataaccess.TaskItemRepository> in (L4ViolationClientLayerDependsOnDataaccessLayer.java:0)
Field <com.devonfw.sample.archunit.client.L5ViolationClientLayerDependsOnBatchLayer.taskImport> has type <com.devonfw.sample.archunit.batch.SampleTaskImport> in (L5ViolationClientLayerDependsOnBatchLayer.java:0)
Field <com.devonfw.sample.archunit.task.common.L1ViolationCommonLayerDependsOnOtherLayer.taskItemMapper> has type <com.devonfw.sample.archunit.task.logic.TaskItemMapper> in (L1ViolationCommonLayerDependsOnOtherLayer.java:0)
Field <com.devonfw.sample.archunit.task.dataaccess.L10ViolationDataaccessLayerDependsOnServiceLayer.taskService> has type <com.devonfw.sample.archunit.task.service.TaskService> in (L10ViolationDataaccessLayerDependsOnServiceLayer.java:0)
Field <com.devonfw.sample.archunit.task.dataaccess.L12ViolationDataaccessLayerDependsOnLogicLayer.taskItemMapper> has type <com.devonfw.sample.archunit.task.logic.TaskItemMapper> in (L12ViolationDataaccessLayerDependsOnLogicLayer.java:0)
Field <com.devonfw.sample.archunit.task.logic.L9ViolationLogicLayerDependsOnServiceLayer.taskService> has type <com.devonfw.sample.archunit.task.service.TaskService> in (L9ViolationLogicLayerDependsOnServiceLayer.java:0)
Field <com.devonfw.sample.archunit.task.service.L2ViolationNoLayerOtherThanClientDependsOnClientLayer.sampleClient> has type <com.devonfw.sample.archunit.client.SampleClient> in (L2ViolationNoLayerOtherThanClientDependsOnClientLayer.java:0)
Field <com.devonfw.sample.archunit.task.service.L6ViolationServiceLayerDependsOnBatchLayer.sampleTaskImport> has type <com.devonfw.sample.archunit.batch.SampleTaskImport> in (L6ViolationServiceLayerDependsOnBatchLayer.java:0)
Field <com.devonfw.sample.archunit.task.service.L8ViolationServiceLayerDependsOnDataaccessLayer.taskItemRepository> has type <com.devonfw.sample.archunit.task.dataaccess.TaskItemRepository> in (L8ViolationServiceLayerDependsOnDataaccessLayer.java:0)

vlad961 and others added 3 commits February 8, 2023 10:30
@hohwille hohwille changed the base branch from master to violations/layer April 25, 2023 06:01
@hohwille hohwille marked this pull request as ready for review April 25, 2023 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants