felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r810723 - in /felix/trunk/bundleplugin/src: main/java/org/apache/felix/bundleplugin/BundlePlugin.java test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
Date Wed, 02 Sep 2009 22:45:35 GMT
Author: mcculls
Date: Wed Sep  2 22:45:33 2009
New Revision: 810723

URL: http://svn.apache.org/viewvc?rev=810723&view=rev
Log:
FELIX-1439: add project organization name/url properties

Modified:
    felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
    felix/trunk/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java

Modified: felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java?rev=810723&r1=810722&r2=810723&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
Wed Sep  2 22:45:33 2009
@@ -867,10 +867,16 @@
 
         if ( currentProject.getOrganization() != null )
         {
-            header( properties, Analyzer.BUNDLE_VENDOR, currentProject.getOrganization().getName()
);
+            String organizationName = currentProject.getOrganization().getName();
+            header( properties, Analyzer.BUNDLE_VENDOR, organizationName );
+            properties.put( "project.organization.name", organizationName );
+            properties.put( "pom.organization.name", organizationName );
             if ( currentProject.getOrganization().getUrl() != null )
             {
-                header( properties, Analyzer.BUNDLE_DOCURL, currentProject.getOrganization().getUrl()
);
+                String organizationUrl = currentProject.getOrganization().getUrl();
+                header( properties, Analyzer.BUNDLE_DOCURL, organizationUrl );
+                properties.put( "project.organization.url", organizationUrl );
+                properties.put( "pom.organization.url", organizationUrl );
             }
         }
 

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=810723&r1=810722&r2=810723&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 Sep  2 22:45:33 2009
@@ -23,10 +23,12 @@
 import java.io.File;
 import java.util.Map;
 import java.util.TreeMap;
+import java.util.Properties;
 
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
+import org.apache.maven.model.Organization;
 
 import aQute.lib.osgi.Analyzer;
 import aQute.lib.osgi.Builder;
@@ -163,6 +165,30 @@
         assertEquals( "", transformedInstructions.get( "-z" ) );
     }
 
+    public void testDefaultPropertiesIncludeOrganization()
+    {
+        final Organization organization = new Organization();
+        organization.setName( "Example Organization" );
+        organization.setUrl( "http://example.org" );
+
+        // MavenProjectStub.setOrganization(Organization) doesn't do anything, so we have
to make it work this way
+        MavenProject project = new MavenProjectStub()
+        {
+            @Override public Organization getOrganization()
+            {
+                return organization;
+            }
+        };
+        project.setGroupId( "group" );
+        project.setArtifactId( "artifact" );
+        project.setVersion( "1.1.0.0" );
+
+        Properties properties = plugin.getDefaultProperties( project );
+        assertEquals( organization.getName(), properties.getProperty( "project.organization.name"
) );
+        assertEquals( organization.getName(), properties.getProperty( "pom.organization.name"
) );
+        assertEquals( organization.getUrl(), properties.getProperty( "project.organization.url"
) );
+        assertEquals( organization.getUrl(), properties.getProperty( "pom.organization.url"
) );
+    }
 
     public void testVersion() throws Exception
     {



Mime
View raw message