You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by mc...@apache.org on 2011/10/26 23:14:28 UTC
svn commit: r1189463 - in /felix/trunk/bundleplugin/src:
main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
Author: mcculls
Date: Wed Oct 26 21:14:28 2011
New Revision: 1189463
URL: http://svn.apache.org/viewvc?rev=1189463&view=rev
Log:
Handle duplicate keys in Embed-Dependency
Modified:
felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java?rev=1189463&r1=1189462&r2=1189463&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java (original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AbstractDependencyFilter.java Wed Oct 26 21:14:28 2011
@@ -113,10 +113,10 @@ public abstract class AbstractDependency
// CLAUSE: REGEXP --> { ATTRIBUTE MAP }
Map.Entry clause = ( Map.Entry ) clauseIterator.next();
- String primaryKey = ( String ) clause.getKey();
+ String primaryKey = ( ( String ) clause.getKey() ).replaceFirst( "~+$", "" );
StringBuilder tag = new StringBuilder( primaryKey );
- if ( !primaryKey.matches( "\\*~*" ) )
+ if ( !"*".equals( primaryKey ) )
{
filter = new DependencyFilter( primaryKey )
{
Modified: felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java?rev=1189463&r1=1189462&r2=1189463&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java (original)
+++ felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java Wed Oct 26 21:14:28 2011
@@ -215,7 +215,7 @@ public class BundlePluginTest extends Ab
}
- public void testPositiveEmbedDependency() throws Exception
+ public void testEmbedDependencyPositiveClauses() throws Exception
{
ArtifactStubFactory artifactFactory = new ArtifactStubFactory( plugin.getOutputDirectory(), true );
@@ -245,7 +245,36 @@ public class BundlePluginTest extends Ab
}
- public void testNegativeEmbedDependency() throws Exception
+ public void testEmbedDependencyDuplicateKeys() throws Exception
+ {
+ ArtifactStubFactory artifactFactory = new ArtifactStubFactory( plugin.getOutputDirectory(), true );
+
+ Set artifacts = new LinkedHashSet();
+
+ artifacts.addAll( artifactFactory.getClassifiedArtifacts() );
+ artifacts.addAll( artifactFactory.getScopedArtifacts() );
+ artifacts.addAll( artifactFactory.getTypedArtifacts() );
+
+ MavenProject project = getMavenProjectStub();
+ project.setDependencyArtifacts( artifacts );
+
+ Map instructions = new HashMap();
+ instructions.put( DependencyEmbedder.EMBED_DEPENDENCY, "c;type=jar,c;type=sources" );
+ Properties props = new Properties();
+
+ Builder builder = plugin.buildOSGiBundle( project, instructions, props, plugin.getClasspath( project ) );
+ Manifest manifest = builder.getJar().getManifest();
+
+ String bcp = manifest.getMainAttributes().getValue( Constants.BUNDLE_CLASSPATH );
+ assertEquals( ".,c-1.0-three.jar," + "c-1.0.sources", bcp );
+
+ String eas = manifest.getMainAttributes().getValue( "Embedded-Artifacts" );
+ assertEquals( "c-1.0-three.jar;g=\"g\";a=\"c\";v=\"1.0\";c=\"three\","
+ + "c-1.0.sources;g=\"g\";a=\"c\";v=\"1.0\"", eas );
+ }
+
+
+ public void testEmbedDependencyNegativeClauses() throws Exception
{
}
}