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

[SUREFIRE-1954] move inner class ProviderList to upper level #393

Merged
merged 1 commit into from Nov 19, 2021
Merged

[SUREFIRE-1954] move inner class ProviderList to upper level #393

merged 1 commit into from Nov 19, 2021

Conversation

slawekjaranowski
Copy link
Member

Before final change I did small refractor for easy testing by unit tests

@slawekjaranowski
Copy link
Member Author

Hi @Tibor17
I hope we can merge such improvement before change some of feature. It allow easier unit tests to do.

I used Plexus IoC ... because project use maven 3.0 and for JSR330 probably 3.1+ is required ... in next steps.

@Tibor17
Copy link
Contributor

Tibor17 commented Nov 10, 2021

Hi @slawekjaranowski , I am just having a look.

@@ -1,4 +1,4 @@
package org.apache.maven.plugin.surefire;
package org.apache.maven.surefire.providerapi;
Copy link
Contributor

@Tibor17 Tibor17 Nov 10, 2021

Choose a reason for hiding this comment

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

@slawekjaranowski Why the package has changed? There are probably many classes in the new package, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

I put all classes responsible for providers detecting in one package.

Before we have:
org.apache.maven.plugin.surefire.booterclient.ProviderDetector
which use
org.apache.maven.surefire.providerapi.ServiceLoader
and ProviderDetector was used only by AbstractSurefireMojo so one responsibility was in many package.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, I see there are now 5 classes. LGTM

@@ -22,7 +22,7 @@
/**
* @author Kristian Rosenvold
*/
interface ConfigurableProviderInfo
public interface ConfigurableProviderInfo
Copy link
Contributor

Choose a reason for hiding this comment

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

@slawekjaranowski This interface is only used ASM class or you think that other project which extends the ASM class can instantiate it in the subclass of ASM class?

Copy link
Member Author

Choose a reason for hiding this comment

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

before we have, in package: org.apache.maven.plugin.surefire

  • interface ConfigurableProviderInfo extends ProviderInfo
  • public interface ProviderInfo
    both used in AbstarctSurefireMojo for implementing inner class like xxxProviderInfo

Now are moved to providerapi and both must be public for technical purpose.

* @author Kristian Rosenvold
*/
@Component( role = ProviderDetector.class )
public final class ProviderDetector
Copy link
Contributor

Choose a reason for hiding this comment

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

Nicely extracted class. I want to ask about the modifiers public. Are they important?

Copy link
Member Author

Choose a reason for hiding this comment

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

used in ASM from another package ...

new JUnit4ProviderInfo( getJunitArtifact(), junitDepArtifact ),
new JUnit3ProviderInfo() )
.resolve();
return providerDetector.resolve( new DynamicProviderInfo( null ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this line has changed? Previously the line was return new ProviderList( new DynamicProviderInfo( null ),.

Copy link
Member Author

Choose a reason for hiding this comment

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

now providerDetector is component, so we use service method
Code from inner class ProviderList are in ProviderDetector

@Tibor17
Copy link
Contributor

Tibor17 commented Nov 14, 2021

@slawekjaranowski
The Jenkins build is under investigation in the jenkins branch
https://ci-maven.apache.org/job/Maven/job/maven-box/job/maven-surefire/job/jenkins/

@@ -42,7 +45,8 @@
*
* @since 2.20
*/
public final class ServiceLoader
@Component( role = ServiceLoader.class )
public class ServiceLoader
Copy link
Contributor

Choose a reason for hiding this comment

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

@slawekjaranowski Can this Component be also public final class as the other classes in this package? So that we indicate that the component class cannot be extended by the user in another project.

Copy link
Member Author

Choose a reason for hiding this comment

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

I use mock ServiceLoader of in ProviderDetectorTest but final clases can't be mocked.
I can introduce interfaces for components and mock on interface will be posible.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah ok, so let it be, the tests with mock are more important

@Tibor17
Copy link
Contributor

Tibor17 commented Nov 18, 2021

@slawekjaranowski
Pls rebase to remote master and resolve the conflicts in AbstractSurefireMojo and AbstractSurefireMojoTest.

@slawekjaranowski
Copy link
Member Author

Rebased

@Tibor17
Copy link
Contributor

Tibor17 commented Nov 19, 2021

Pls do not change the code conventions with another purpose of the PR because then the reviewer has more work to check every line. Some contributors use to add hacks along another purpose and they think we would not find it. It's better to have another PR for coding conventions.

@Tibor17 Tibor17 merged commit e71fec7 into apache:master Nov 19, 2021
@Tibor17
Copy link
Contributor

Tibor17 commented Nov 19, 2021

@slawekjaranowski gitbox is down, so i have to wait with your Jira ticket to close it.

@slawekjaranowski slawekjaranowski deleted the SUREFIRE-1954-refactor branch November 19, 2021 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants