You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:20:56 UTC

[sling-org-apache-sling-commons-classloader] 07/15: attempting to fix build failure by using a customized version of the JUnitBundlesOption having the repository URL baked into it. code may require some cleanup, but since I can't reproduce this locally, committing it to see if it fixes the problem before investing too much cleanup time.

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.commons.classloader-1.3.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-classloader.git

commit bf7d6e1ea32ec793f7ff49939c877cade1442e05
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Wed Mar 21 00:00:36 2012 +0000

    attempting to fix build failure by using a customized version of the JUnitBundlesOption having the repository URL baked into it. code may require some cleanup, but since I can't reproduce this locally, committing it to see if it fixes the problem before investing too much cleanup time.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/classloader@1303224 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 14 -----
 .../classloader/it/DynamicClassLoaderIT.java       | 65 ++++++++++++++++++++--
 2 files changed, 60 insertions(+), 19 deletions(-)

diff --git a/pom.xml b/pom.xml
index cf6e9cb..d147154 100644
--- a/pom.xml
+++ b/pom.xml
@@ -204,24 +204,10 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.junit</groupId>
-            <artifactId>com.springsource.org.junit</artifactId>
-            <version>4.9.0</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.framework</artifactId>
             <version>4.0.2</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
-    <repositories>
-        <!-- springsource junit wrapping -->
-        <repository>
-            <id>com.springsource.repository.bundles.external</id>
-            <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
-            <url>http://repository.springsource.com/maven/bundles/external</url>
-        </repository>
-    </repositories>
 </project>
diff --git a/src/test/java/org/apache/sling/commons/classloader/it/DynamicClassLoaderIT.java b/src/test/java/org/apache/sling/commons/classloader/it/DynamicClassLoaderIT.java
index 512b2de..736a9d8 100644
--- a/src/test/java/org/apache/sling/commons/classloader/it/DynamicClassLoaderIT.java
+++ b/src/test/java/org/apache/sling/commons/classloader/it/DynamicClassLoaderIT.java
@@ -19,10 +19,8 @@ package org.apache.sling.commons.classloader.it;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
-import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
-import static org.ops4j.pax.exam.CoreOptions.options;
-import static org.ops4j.pax.exam.CoreOptions.provision;
+import static org.ops4j.pax.exam.Constants.*;
+import static org.ops4j.pax.exam.CoreOptions.*;
 
 import java.io.File;
 import java.io.IOException;
@@ -40,6 +38,10 @@ import org.ops4j.pax.exam.TestProbeBuilder;
 import org.ops4j.pax.exam.junit.Configuration;
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 import org.ops4j.pax.exam.junit.ProbeBuilder;
+import org.ops4j.pax.exam.options.AbstractDelegateProvisionOption;
+import org.ops4j.pax.exam.options.CompositeOption;
+import org.ops4j.pax.exam.options.DefaultCompositeOption;
+import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -110,10 +112,63 @@ public class DynamicClassLoaderIT {
                 mavenBundle("org.apache.felix", "org.apache.felix.eventadmin", "1.2.14"),
                 mavenBundle("org.ops4j.pax.url", "pax-url-mvn", "1.3.5")
              ),
-             junitBundles()
+             customJunitBundles()
 
         );
     }
+    
+    private static CompositeOption customJunitBundles() {
+        return new DefaultCompositeOption(new JUnitBundlesOption(), 
+            systemProperty( "pax.exam.invoker" ).value( "junit" ),  
+            bundle( "link:classpath:META-INF/links/org.ops4j.pax.exam.invoker.junit.link" ));
+    }
+    
+    public static class JUnitBundlesOption
+        extends AbstractDelegateProvisionOption<JUnitBundlesOption> {
+    
+        /**
+         * Constructor.
+         */
+        public JUnitBundlesOption(){
+            super(
+                bundle("mvn:http://repository.springsource.com/maven/bundles/external!org.junit/com.springsource.org.junit/4.9.0")
+            );
+            noUpdate();
+            startLevel( START_LEVEL_SYSTEM_BUNDLES );
+        }
+    
+        /**
+         * Sets the junit version.
+         *
+         * @param version junit version.
+         *
+         * @return itself, for fluent api usage
+         */
+        public JUnitBundlesOption version( final String version ) {
+            ( (MavenArtifactProvisionOption) getDelegate() ).version( version );
+            return this;
+        }
+    
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public String toString() {
+            final StringBuilder sb = new StringBuilder();
+            sb.append( "JUnitBundlesOption" );
+            sb.append( "{url=" ).append( getURL() );
+            sb.append( '}' );
+            return sb.toString();
+        }
+    
+        /**
+         * {@inheritDoc}
+         */
+        protected JUnitBundlesOption itself() {
+            return this;
+        }
+    
+    }
 
     @Test
     public void testPackageAdminClassLoader() throws Exception {

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.