-
-
Notifications
You must be signed in to change notification settings - Fork 210
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
Redefining ArchUnit tests #3552
Redefining ArchUnit tests #3552
Conversation
Does it fix #2921 @onepunchmagne ? |
Work left:
|
Not sure to understand the question so I can only answer by saying that module is a shared kernel and project is a business context (I don't think we have a bounded context annotation as this would be really wrong and missleading !)
This is not a bug, JavaProject is a primary adapter, it's totally normal |
Here is the thing that should be discussed, the annotation is called
I think @pascalgrimaud and @hdurix aggried that JHLite generates If I may, I would suggest we rename to |
Ok, if I'm the only one finding that misleading let's rename it |
430c60f
to
814712a
Compare
Codecov ReportBase: 100.00% // Head: 100.00% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## main #3552 +/- ##
===========================================
Coverage 100.00% 100.00%
+ Complexity 2093 2074 -19
===========================================
Files 545 541 -4
Lines 8930 8876 -54
Branches 175 174 -1
===========================================
- Hits 8930 8876 -54
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -1,2 +1,2 @@ | |||
@tech.jhipster.lite.BusinessContext | |||
@tech.jhipster.lite.SharedKernel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Project is not a shared kernel, I don't understand this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible I'd like to take also this job but in issue #3540
because sticking to the architecture tests, we have a failure because project
is called directly by module
which is tagged as a shared kernel.
To be honest I have absolutely no clue currently of which package is a shared kernel and which is a "business" context, but there is something to do in this separate issue I think to realign the dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a mistake :D project is a business context and module is a SharedKernel, what is the link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so the whole thing about SharedKernels.shouldNotDependOnBoundedContexts
is wrong I suppose, I delete it. A shared kernel can actually call bounded contexts following the same rule as passing through its secondary adapter to call the bounded context primary adapter, is that right?
Thus the shouldBeAnHexagonalArchitecture
test should also be applied to shared kernel in the exact same way. Please check new change where I applied this logic
src/main/resources/generator/server/javatool/arch/HexagonalArchTest.java.mustache
Outdated
Show resolved
Hide resolved
src/main/resources/generator/server/javatool/arch/HexagonalArchTest.java.mustache
Outdated
Show resolved
Hide resolved
src/main/resources/generator/server/javatool/arch/HexagonalArchTest.java.mustache
Outdated
Show resolved
Hide resolved
src/main/resources/generator/server/javatool/arch/HexagonalArchTest.java.mustache
Outdated
Show resolved
Hide resolved
src/main/resources/generator/server/javatool/arch/HexagonalArchTest.java.mustache
Outdated
Show resolved
Hide resolved
src/main/resources/generator/server/javatool/arch/HexagonalArchTest.java.mustache
Outdated
Show resolved
Hide resolved
src/main/resources/generator/server/javatool/arch/HexagonalArchTest.java.mustache
Outdated
Show resolved
Hide resolved
classes() | ||
.that() | ||
.resideInAnyPackage(context + ".domain..") | ||
.resideInAPackage(".domain..") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get it, here we are allowing domain to depend on any domain no? No more check for domain dependencies to other domains?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but there were a lot of overlaying tests so I tried defining different separate responsibility tests such as:
BoundedContexts.shouldNotDependOnOtherBoundedContextDomains
which will verify our hexagons co-existence and boundariesDomain.shouldNotDependOnOutside
which does not even know it co-exists with other hexagons, it simply check its dependencies to "outside" of a domain package
814712a
to
ffb71fd
Compare
ffb71fd
to
ba03b58
Compare
Thanks for the correction you're right, I used the hint trying to define some basics rules, I get that it's hard to define "the" hexagonal architecture test but it should probably serve as a good base for people to update according to their definition. |
ba03b58
to
f6a04b0
Compare
f6a04b0
to
d38766e
Compare
src/main/resources/generator/server/javatool/arch/HexagonalArchTest.java.mustache
Outdated
Show resolved
Hide resolved
d38766e
to
73cddb0
Compare
* Shared kernels cannot depend on bounded contexts * Bounded context can calls each others only using secondary to primary Java adapters communications * Domain cannot use anything but its self-domain, Java vanilla features or some common utils libraries * Application cannot call infrastructure * Primary cannot directly call secondary * Secondary cannot call any application service Remove empty packages/"todo" contexts to restart from a clean implementation matching expected architecture.
73cddb0
to
2fcac00
Compare
@onepunchmagne approved |
Fix #2921