-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Refactor Continuous Testing JSON/RPC #43119
Refactor Continuous Testing JSON/RPC #43119
Conversation
Here some more details about the changes. Improvement Details
Class DiagramI`m not sure whether the dependencies between the modules are correct - I didn't change them. Here's a class diagram visualizing the old (black) and the new code (red): |
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.
Thanks. I added a couple of questions. But I will let @phillip-kruger review it in depth.
In any case, when rebasing, please make sure the commit comment is meaningful.
import org.junit.platform.engine.TestExecutionResult; | ||
import org.junit.platform.engine.TestSource; | ||
import org.junit.platform.engine.UniqueId; | ||
import org.junit.platform.engine.*; |
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.
You will need to disable the star imports in your IDE.
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.
Done so, thanks for the hint. What about a .editorconfig
file in the project?
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 you can provide one that makes sense, that would be awesome.
Let's not be too strict though but this in particular could be added for sure.
|
||
import java.util.List; | ||
|
||
public interface TestClassResultInterface extends Comparable<TestClassResultInterface> { |
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.
Could you clarify the purpose of all these new interfaces?
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.
The test results are stored into objects of type TestRunResults
, TestClassResult
and TestResult
. They are returned to the ContinuousTestingJsonRPCService
as a generic java.lang.Object
and there transformed to JSON - then sent to the browser for UI rendering. Because my intention was to avoid passing the objects through the RPC service without any API awareness, validation..., the RPC service needs the objects typified.
Unfortunately, the module, where the JSON RPC service is placed, does not have a compile dependency to the module where the Test result types are declared. (And I did not want to change this, because this might lead to a cyclic dependency.) So I declared the interfaces (whose names might sound uncreative, because I did not want to change the implementation classes' names to avoid too much diffs) in one module where both have access to. (I'm not sure if this is the correct module, but I found the ContinuousTestingSharedStateManager
there, so I think it is intended so)
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.
Furthermore, the interfaces have the advantage that we can be aware of which informationen in required for the Continuous Testing UI, and which information is not. (that is not part of the interface) This makes further refactoring easier, because we now only have compile-time dependencies. (The test results are also used for printing out in the console for example.)
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.
What is unclear for me: Why are the classes TestRunResults
, TestClassResult
and TestResult
placed into a deployment module (core-deployment
)? They could also be placed into development-mode-spi
, where the interfaces are now? This might avoid the need of the interfaces. (see the class diagram)
Cool ! I'll have a look once the other PR is merged. One thing to check is if this is used only by Dev UI, as this might also be used in the cli / log ? We just need to make sure that still works. |
I'm aware of. For them, I only introduced the interfaces. That is the only change I made. The interfaces are more generic, e.g. their method's return types only use the interface type: Map<String, ? extends TestClassResultInterface> getResults(); Whereas the original implementation classes implement those interface methods by returning their original return types: @Override
public Map<String, TestClassResult> getResults() {
return Collections.unmodifiableMap(results);
} So this all should be compiler checked. But of course, we need to check the correct functionality. |
7f23428
to
497eb45
Compare
@phillip-kruger, the other PR is merged and this branch rebased. This PR is a draft, because I'm not sure if the classes shown in the class diagram are positioned at the correct position.
|
I must still look at this but until then:
Because it's not needed at runtime. If we can do it in deployment, we should.
Not too sure, but because Dev UI sits in Vert.x, some things (especially core / always available) was added there. |
@phillip-kruger - thanks for your notes.
It's only 3 or 4 classes, not doing any logic. The logic is done at runtime (only in dev mode, where deployment modules are handled differently anyway). It is triggered by the classes in I currently would refrain from moving the classes, unless there's a value, because there are too much dependencies that would lead to much more refactoring. So the current state would be fine for me. |
497eb45
to
093e274
Compare
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 comment has been minimized.
This comment has been minimized.
@ueberfuhr ^^^ |
- merge observers for test state and results - replace direct rendering of results and state by custom API object (DTO) - optimize size and structure of JSON message resolves quarkusio#43067
093e274
to
c0a3be0
Compare
@phillip-kruger , you're right - fixed it. |
Status for workflow
|
@gsmet - happy to merge ? |
Sure, let's merge! |
@ueberfuhr thanks for this awesome work and sorry it took so long for us to merge it! |
This PR resolves #43067 by refactoring the JSON that is exchanged with the RPC service for continuous testing.
_state
and_results
) to a single one (they were always published at the same time in the RPC service, so they triggered two events that led to rendering in the UI at the same time)