incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1124188 - in /sling/trunk/bundles/commons/osgi/src: main/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfo.java test/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfoTest.java
Date Wed, 18 May 2011 11:13:16 GMT
Author: cziegeler
Date: Wed May 18 11:13:16 2011
New Revision: 1124188

URL: http://svn.apache.org/viewvc?rev=1124188&view=rev
Log:
SLING-2081 : Bundle version manifest entry is a string (not a Version object)

Modified:
    sling/trunk/bundles/commons/osgi/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfo.java
    sling/trunk/bundles/commons/osgi/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfoTest.java

Modified: sling/trunk/bundles/commons/osgi/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfo.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/osgi/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfo.java?rev=1124188&r1=1124187&r2=1124188&view=diff
==============================================================================
--- sling/trunk/bundles/commons/osgi/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfo.java
(original)
+++ sling/trunk/bundles/commons/osgi/src/main/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfo.java
Wed May 18 11:13:16 2011
@@ -55,7 +55,8 @@ public class BundleBundleVersionInfo ext
     }
 
     public Version getVersion() {
-        return (Version)source.getHeaders().get(Constants.BUNDLE_VERSION);
+        final String versionInfo = (String)source.getHeaders().get(Constants.BUNDLE_VERSION);
+        return (versionInfo == null ? null : new Version(versionInfo));
     }
 
     public boolean isBundle() {

Modified: sling/trunk/bundles/commons/osgi/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfoTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/commons/osgi/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfoTest.java?rev=1124188&r1=1124187&r2=1124188&view=diff
==============================================================================
--- sling/trunk/bundles/commons/osgi/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfoTest.java
(original)
+++ sling/trunk/bundles/commons/osgi/src/test/java/org/apache/sling/commons/osgi/bundleversion/BundleBundleVersionInfoTest.java
Wed May 18 11:13:16 2011
@@ -40,7 +40,7 @@ import org.osgi.framework.Version;
  */
 public class BundleBundleVersionInfoTest {
     protected Mockery context;
-    
+
     @Before
     public void setUp() {
         context = new JUnit4Mockery();
@@ -48,11 +48,11 @@ public class BundleBundleVersionInfoTest
 
     private Bundle getMockBundle(final String symbolicName, final Version v, final long lastModified)
{
         final Dictionary<String, Object> h = new Hashtable<String, Object>();
-        h.put(Constants.BUNDLE_VERSION, v);
+        h.put(Constants.BUNDLE_VERSION, v.toString());
         if(lastModified > 0) {
             h.put(BundleVersionInfo.BND_LAST_MODIFIED, String.valueOf(lastModified));
         }
-        
+
         final Bundle b = context.mock(Bundle.class);
         context.checking(new Expectations() {{
             allowing(b).getHeaders();
@@ -64,14 +64,14 @@ public class BundleBundleVersionInfoTest
         }});
         return b;
     }
-    
+
     @Test
     public void testVersionInfo() {
         final String name = "some.bundle";
         final Version version = new Version("1.0.4");
         final long lastMod = 1234L;
-        final Bundle b = getMockBundle(name, version, lastMod); 
-        
+        final Bundle b = getMockBundle(name, version, lastMod);
+
         BundleVersionInfo<?> vi = new BundleBundleVersionInfo(b);
         assertEquals("Symbolic name matches", name, vi.getBundleSymbolicName());
         assertEquals("Version matches", version, vi.getVersion());
@@ -80,14 +80,14 @@ public class BundleBundleVersionInfoTest
         assertEquals("Last-Modified matches", lastMod, vi.getBundleLastModified());
         assertTrue("Bundle is stored as source", vi.getSource() == b);
     }
-    
+
     @Test
     public void testSnapshot() {
         final String name = "some.bundle";
         final Version version = new Version("1.0.4.SNAPSHOT");
         final long lastMod = 0;
-        final Bundle b = getMockBundle(name, version, lastMod); 
-        
+        final Bundle b = getMockBundle(name, version, lastMod);
+
         BundleVersionInfo<?> vi = new BundleBundleVersionInfo(b);
         assertEquals("Symbolic name matches", name, vi.getBundleSymbolicName());
         assertEquals("Version matches", version, vi.getVersion());



Mime
View raw message