You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2014/12/20 22:43:16 UTC
svn commit: r1647056 - in /directory/shared/trunk/integ-osgi: pom.xml
src/test/java/org/apache/directory/api/osgi/ApiOsgiTestBase.java
Author: seelmann
Date: Sat Dec 20 21:43:16 2014
New Revision: 1647056
URL: http://svn.apache.org/r1647056
Log:
Workaround to run pax exam tests on Jenkins
Modified:
directory/shared/trunk/integ-osgi/pom.xml
directory/shared/trunk/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiOsgiTestBase.java
Modified: directory/shared/trunk/integ-osgi/pom.xml
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ-osgi/pom.xml?rev=1647056&r1=1647055&r2=1647056&view=diff
==============================================================================
--- directory/shared/trunk/integ-osgi/pom.xml (original)
+++ directory/shared/trunk/integ-osgi/pom.xml Sat Dec 20 21:43:16 2014
@@ -128,7 +128,7 @@
<executions>
<execution>
<goals>
- <goal>list</goal>
+ <goal>copy-dependencies</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
@@ -161,7 +161,7 @@
[2.8,)
</versionRange>
<goals>
- <goal>list</goal>
+ <goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
Modified: directory/shared/trunk/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiOsgiTestBase.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiOsgiTestBase.java?rev=1647056&r1=1647055&r2=1647056&view=diff
==============================================================================
--- directory/shared/trunk/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiOsgiTestBase.java (original)
+++ directory/shared/trunk/integ-osgi/src/test/java/org/apache/directory/api/osgi/ApiOsgiTestBase.java Sat Dec 20 21:43:16 2014
@@ -26,20 +26,20 @@ import static org.ops4j.pax.exam.CoreOpt
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.systemProperty;
import static org.ops4j.pax.exam.CoreOptions.systemPackages;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.url;
+import java.io.File;
import java.io.IOException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import javax.inject.Inject;
-import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Configuration;
@@ -60,35 +60,33 @@ public abstract class ApiOsgiTestBase
@Inject
protected BundleContext context;
- private static Map<String, String> REPLACEMENTS = new HashMap<String, String>();
+ private static Map<String, Option> REPLACEMENTS = new HashMap<String, Option>();
static
{
- REPLACEMENTS.put( "antlr:antlr:jar:2.7.7:compile",
- "org.apache.directory.studio:org.antlr.antlr:jar:2.7.7:compile" );
- REPLACEMENTS.put( "xpp3:xpp3:jar:1.1.4c:compile",
- "org.apache.directory.studio:org.xpp3.xpp3:jar:1.1.4.c:compile" );
- REPLACEMENTS.put( "dom4j:dom4j:jar:1.6.1:compile",
- "org.apache.directory.studio:org.dom4j.dom4j:jar:1.6.1:compile" );
+ REPLACEMENTS.put( "antlr-2.7.7.jar", mavenBundle( "org.apache.directory.studio", "org.antlr.antlr", "2.7.7" ) );
+ REPLACEMENTS.put( "xpp3-1.1.4c.jar", mavenBundle( "org.apache.directory.studio", "org.xpp3.xpp3", "1.1.4.c" ) );
+ REPLACEMENTS.put( "dom4j-1.6.1.jar", mavenBundle( "org.apache.directory.studio", "org.dom4j.dom4j", "1.6.1" ) );
}
@Configuration
public Option[] config() throws IOException
{
- // read transitive dependencies from file which was generated by maven-dependency-plugin
- Pattern pattern = Pattern.compile( "\\s*(.+?)\\:(.+?)\\:jar\\:(.+?)\\:compile" );
- List<String> lines = IOUtils.readLines( getClass().getResourceAsStream( "/deps.txt" ) );
List<Option> dependencies = new ArrayList<Option>();
- for ( String line : lines )
+
+ URL resource = getClass().getResource( "/" );
+ File targetTestClassesDir = new File( resource.getFile() );
+ File targetDependenciesDir = new File( targetTestClassesDir.getParent(), "dependency" );
+ File[] files = targetDependenciesDir.listFiles();
+ for ( File file : files )
{
- line = fix( line );
- Matcher matcher = pattern.matcher( line );
- if ( matcher.matches() )
+ if ( REPLACEMENTS.containsKey( file.getName() ) )
{
- String group = matcher.group( 1 );
- String artifactId = matcher.group( 2 );
- String version = matcher.group( 3 );
- dependencies.add( mavenBundle( group, artifactId, version ) );
+ dependencies.add( REPLACEMENTS.get( file.getName() ) );
+ }
+ else
+ {
+ dependencies.add( url( file.toURI().toString() ) );
}
}
@@ -103,17 +101,6 @@ public abstract class ApiOsgiTestBase
}
- private String fix( String line )
- {
- line = line.trim();
- if ( REPLACEMENTS.containsKey( line ) )
- {
- return REPLACEMENTS.get( line );
- }
- return line;
- }
-
-
@Test
public void testInjectContext()
{