-
Notifications
You must be signed in to change notification settings - Fork 12
Make BlackBox
provide a Client
linked to the context under-the-test
#1409
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1409 +/- ##
============================================
+ Coverage 91.10% 91.13% +0.03%
- Complexity 4908 4929 +21
============================================
Files 626 628 +2
Lines 15342 15420 +78
Branches 890 893 +3
============================================
+ Hits 13977 14053 +76
+ Misses 1065 1064 -1
- Partials 300 303 +3 |
# Conflicts: # license-report.md # pom.xml # version.gradle.kts
…more explicit manner.
BlackBox
provide a Client
linked to the context under-the-test
@yevhenii-nadtochii PTAL. Should you have any comments, let's discuss them vocally. |
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.
Please see my questions
testutil-server/src/main/java/io/spine/testing/server/blackbox/BlackBoxClients.java
Outdated
Show resolved
Hide resolved
testutil-server/src/main/java/io/spine/testing/server/blackbox/BlackBox.java
Outdated
Show resolved
Hide resolved
@@ -93,6 +94,11 @@ | |||
*/ | |||
private final BoundedContext context; | |||
|
|||
/** | |||
* A supplier of {@link Client}s which are linked to this context. |
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.
* A supplier of {@link Client}s which are linked to this context. | |
* A supplier of {@link Client}s which send requests to this context. |
if(!isOpen()) { | ||
return; | ||
} | ||
|
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(!isOpen()) { | |
return; | |
} | |
if (!isOpen()) { | |
return; | |
} |
import static com.google.common.base.Preconditions.checkNotNull; | ||
|
||
/** | ||
* Creates the {@link Client}s to a particular {@link BlackBox} instance. |
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.
Please check the grammar around articles here.
I'd expect:
Creates Clients for a ...
* <p>As {@code Client} requires a gRPC server to be connected to, the supplier assembles | ||
* and starts a {@link GrpcContainer}. The server and the created clients are working in-process. | ||
*/ | ||
class ClientSupplier implements Closeable { |
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 should be called Clients
so that it's coherent with the BlackBoxClients
. Maybe, ClientFactory
, but then the BlackBoxClients
should also be renamed.
This type is too complicated to be a "supplier".
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.
LGTM.
It's a migration of #1407 to the 2.x branch.
Problem
Previously, in scope of 2.x versions it was impossible to obtain a
Client
to someBlackBox
context. That was a problem, since in a multi-Bounded-Context environment, the contexts often communicated with each other with theClient
s. And the black-boxing of either clients made it very difficult to run the integration flow — as no properClient
could be created for the black-boxed Bounded Context.Solution
It is now possible to create an in-process
Client
to anyBlackBox
:The created
Client
instances are running through the in-process gRPC server. The lifecycle of this server is similar to the lifecycle of the associatedBlackBox
: once the box is closed, the server is closed as well.Other Changes
The versions of the dependencies and the own version of
core-java
modules were set to the latest available.