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

#3: implementation component rules C5 - C7 - violations #42

Draft
wants to merge 5 commits into
base: violations/component
Choose a base branch
from

Conversation

NicolasVanBellen
Copy link
Contributor

#3
DO NOT MERGE
This fork branch contains classes demonstrating archunit component rules violations:
Rules C5 - C7

@hohwille hohwille marked this pull request as draft March 23, 2023 16:36
@@ -0,0 +1,7 @@
package com.devonfw.sample.batch.task.batchLayer;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/devonfw/devon4j/blob/master/documentation/architecture.asciidoc#technical-architecture

The term Layer is not part of the package definition. It is just logic, dataaccess, batch, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was a following mistake from my misunderstanding earlier. I will fix that now.

Copy link
Contributor

@hohwille hohwille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NicolasVanBellen thanks for your PR with the violations. Looks good. 👍
I left a small comment for you to have a look.

BTW: In Java by conventions package segments are lowercaseonly so no pascalCase like componentA would be used to follow best-practices. However, in this case where we actually demonstrate anti-patterns this is fully fine.

@hohwille
Copy link
Contributor

The violation messages from your ArchUnit rules look very clear and self-explanatory to me:

Error:  Failures: 
Error:    Architecture Violation [Priority: MEDIUM] - Rule 'Code from dataaccess layer shall not depend on dataaccess layer of a different component.' was violated (1 times):
'componentA.dataaccess' is dependend on 'task.dataaccess'. Violated in: (Class <com.devonfw.sample.archunit.componentA.dataaccess.C6ViolationDataaccessLayerOfComponentADependsOnDataaccessLayerOfComponentTask>). Dependency towards (Class <com.devonfw.sample.archunit.task.dataaccess.TaskItemEntity>)
Error:    Architecture Violation [Priority: MEDIUM] - Rule 'Code from logic layer of a component shall not depend on dataaccess layer of a different component.' was violated (1 times):
'componentA.logic' is dependend on 'task.dataaccess'. Violated in: (Class <com.devonfw.sample.archunit.componentA.logic.C5ViolationLogicLayerOfComponentADependsOnDataaccessLayerOfComponentTask>). Dependency towards (Class <com.devonfw.sample.archunit.task.dataaccess.TaskItemEntity>)

However, due to the comment I already left, you are violating a different rule than you actually intended:

Error:    Architecture Violation [Priority: MEDIUM] - Rule 'classes should check for the package structure to be valid' was violated (2 times):
C5ViolationLogicLayerOfComponentADependsOnDataaccessLayerOfComponentTask test result is false
C6ViolationDataaccessLayerOfComponentADependsOnDataaccessLayerOfComponentTask test result is false

@hohwille hohwille changed the base branch from master to violations/component April 25, 2023 06:00
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