You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2021/04/27 10:10:39 UTC

[GitHub] [maven-resolver] cstamas opened a new pull request #99: Fix bindings and do test them

cstamas opened a new pull request #99:
URL: https://github.com/apache/maven-resolver/pull/99


   So far with c17902add6435d228038c6ed5d117604dc66bd41 we did run "demo snippets" (can be understood as some sort of "integration testing", but as backward compatibility testing, as it used Maven Resolver provider 3.5.0). As during recent work discovered, there were some problems with three kinds of "bindings" we provide: service locator, guice and sisu. This PR fixes those, and also changes the introduced test, by expanding it to run demos using serviceLocator, Guice and SISU.
   
   Changes:
   - up demo snippets maven-resolver-provider to 3.5.4 (was 3.5.0, contained relevant bugs re binding)
   - modify booter and demos to be able to select factory
   - modify existing UT to run same demos with all 3 factories
   - to be able to retain binary backward compat across all 3 factories, smaller changes were needed in impl module: introduced "deprecated" DefaultSyncContextFactory as well, that delegates to "latest" syncContextFactory. This is must to make things work same way in all factories. Hence, SL, guice and sisu also does this same thing, effective component dependencies are now same across all 3 factories.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-resolver] asfgit closed pull request #99: Fix bindings and do test them

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #99:
URL: https://github.com/apache/maven-resolver/pull/99


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [maven-resolver] michael-o commented on a change in pull request #99: Fix bindings and do test them

Posted by GitBox <gi...@apache.org>.
michael-o commented on a change in pull request #99:
URL: https://github.com/apache/maven-resolver/pull/99#discussion_r621071001



##########
File path: maven-resolver-demos/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples/util/Booter.java
##########
@@ -35,12 +35,42 @@
  */
 public class Booter
 {
+    public static final String SERVICE_LOCATOR = "serviceLocator";
 
-    public static RepositorySystem newRepositorySystem()
+    public static final String GUICE = "guice";
+
+    public static final String SISU = "sisu";
+
+    public static String selectFactory( String[] args )
+    {
+        if ( args == null || args.length == 0 )
+        {
+            return SERVICE_LOCATOR;
+        }
+        else
+        {
+            return args[0];
+        }
+    }
+
+    public static RepositorySystem newRepositorySystem( final String factory )
     {
-        return org.apache.maven.resolver.examples.manual.ManualRepositorySystemFactory.newRepositorySystem();
-        // return org.apache.maven.resolver.examples.guice.GuiceRepositorySystemFactory.newRepositorySystem();
-        // return org.apache.maven.resolver.examples.sisu.SisuRepositorySystemFactory.newRepositorySystem();
+        if ( SERVICE_LOCATOR.equals( factory ) )
+        {
+            return org.apache.maven.resolver.examples.manual.ManualRepositorySystemFactory.newRepositorySystem();
+        }
+        else if ( GUICE.equals( factory ) )
+        {
+            return org.apache.maven.resolver.examples.guice.GuiceRepositorySystemFactory.newRepositorySystem();
+        }
+        else if ( SISU.equals( factory ) )
+        {
+            return org.apache.maven.resolver.examples.sisu.SisuRepositorySystemFactory.newRepositorySystem();
+        }
+        else
+        {
+            throw new IllegalArgumentException( "Unknown factory: " + factory );
+        }

Review comment:
       You can use a switch case on strings here to make it more compact.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org