felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r953718 - in /felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb: recipes/ src/org/apache/felix/framework/vb/ src/org/apache/felix/framework/vb/b001/ src/org/apache/felix/framework/vb/b002/ src/org/apache/felix/framework/vb/b0...
Date Fri, 11 Jun 2010 15:14:35 GMT
Author: rickhall
Date: Fri Jun 11 15:14:35 2010
New Revision: 953718

URL: http://svn.apache.org/viewvc?rev=953718&view=rev
Log:
Cleanup initial test.

Added:
    felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b002/service/
    felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b002/service/Service.java
      - copied unchanged from r953702, felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b002/Service.java
Removed:
    felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b002/Service.java
Modified:
    felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/recipes/vb.b001.bnd
    felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/TestVirtualBundle.java
    felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b001/Activator.java
    felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b001/JarVirtualModule.java
    felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b002/Activator.java

Modified: felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/recipes/vb.b001.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/recipes/vb.b001.bnd?rev=953718&r1=953717&r2=953718&view=diff
==============================================================================
--- felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/recipes/vb.b001.bnd (original)
+++ felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/recipes/vb.b001.bnd Fri
Jun 11 15:14:35 2010
@@ -1,2 +1,3 @@
 Bundle-SymbolicName: org.apache.felix.framework.vb.b001
+Bundle-Activator: org.apache.felix.framework.vb.b001.Activator
 Private-Package: org.apache.felix.framework.vb.b001

Modified: felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/TestVirtualBundle.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/TestVirtualBundle.java?rev=953718&r1=953717&r2=953718&view=diff
==============================================================================
--- felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/TestVirtualBundle.java
(original)
+++ felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/TestVirtualBundle.java
Fri Jun 11 15:14:35 2010
@@ -37,9 +37,12 @@ public class TestVirtualBundle extends F
 
         try
         {
+            // Install and start handler bundle, which will install a
+            // virtual bundle.
             is = this.getClass().getClassLoader().getResourceAsStream("vb.b001.jar");
             m_bundleA = getBundleContext().installBundle("resolver.b001.jar", is);
 
+            int before = getBundleContext().getBundles().length;
             try
             {
                 m_bundleA.start();
@@ -48,6 +51,28 @@ public class TestVirtualBundle extends F
             {
                 assertTrue("Bundle should resolve", false);
             }
+            assertEquals("A virtual bundle should have been installed.",
+                before + 1, getBundleContext().getBundles().length);
+
+            // Get the virtual bundle.
+            Bundle vb = getBundle("org.apache.felix.framework.vb.b002");
+            assertEquals("Virtual bundle should be INSTALLED", Bundle.INSTALLED, vb.getState());
+
+            // Resolve the virtual bundle.
+            PackageAdmin pa = getPackageAdmin();
+            pa.resolveBundles(new Bundle[] { vb });
+            assertEquals("Virtual bundle should be RESOLVED", Bundle.RESOLVED, vb.getState());
+
+            // Resolve the virtual bundle.
+            try
+            {
+                vb.start();
+            }
+            catch (BundleException ex)
+            {
+                assertTrue("Virtual bundle should start: " + ex, false);
+            }
+            assertEquals("Virtual bundle should be ACTIVE", Bundle.ACTIVE, vb.getState());
         }
         finally
         {
@@ -55,6 +80,19 @@ public class TestVirtualBundle extends F
         }
     }
 
+    private Bundle getBundle(String symName)
+    {
+
+        for (Bundle bundle : getBundleContext().getBundles())
+        {
+            if (bundle.getSymbolicName().equals(symName))
+            {
+                return bundle;
+            }
+        }
+        return null;
+    }
+
     private void cleanup()
     {
         if (m_bundleA != null)

Modified: felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b001/Activator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b001/Activator.java?rev=953718&r1=953717&r2=953718&view=diff
==============================================================================
--- felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b001/Activator.java
(original)
+++ felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b001/Activator.java
Fri Jun 11 15:14:35 2010
@@ -19,7 +19,7 @@ public class Activator implements Bundle
             FelixBundleContext fbc = (FelixBundleContext) bc;
             try
             {
-                JarFile jarFile = new JarFile("/Users/rickhall/Projects/tmp/vb2/vb2.jar");
+                JarFile jarFile = new JarFile("/Users/rickhall/Projects/felix-sandbox/vb-bnd-test/org.apache.felix.framework.vb/vb.b002.jar");
                 // Get the embedded resource.
                 Manifest mf = jarFile.getManifest();
                 // Use an empty map if there is no manifest.

Modified: felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b001/JarVirtualModule.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b001/JarVirtualModule.java?rev=953718&r1=953717&r2=953718&view=diff
==============================================================================
--- felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b001/JarVirtualModule.java
(original)
+++ felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b001/JarVirtualModule.java
Fri Jun 11 15:14:35 2010
@@ -43,7 +43,14 @@ class JarVirtualModule implements Virtua
 
     public void resolve(List<VBWire> wires) throws BundleException
     {
-        m_loader = new JarFileClassLoader(m_jarFile, m_headers, wires);
+        if (wires != null)
+        {
+            m_loader = new JarFileClassLoader(m_jarFile, m_headers, wires);
+        }
+        else
+        {
+            m_loader = null;
+        }
     }
 
     public BundleActivator getActivator()

Modified: felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b002/Activator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b002/Activator.java?rev=953718&r1=953717&r2=953718&view=diff
==============================================================================
--- felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b002/Activator.java
(original)
+++ felix/sandbox/rickhall/vb-bnd-test/org.apache.felix.framework.vb/src/org/apache/felix/framework/vb/b002/Activator.java
Fri Jun 11 15:14:35 2010
@@ -1,15 +1,16 @@
 package org.apache.felix.framework.vb.b002;
 
+import org.apache.felix.framework.vb.b002.service.Service;
 import org.osgi.framework.*;
 
 public class Activator implements BundleActivator
 {
     public void start(BundleContext bc)
     {
-        bc.registerService("vb2.service.Service", new ServiceImpl(), null);
+        bc.registerService(Service.class.getName(), new ServiceImpl(), null);
     }
 
     public void stop(BundleContext bc)
     {
     }
-}
+}
\ No newline at end of file



Mime
View raw message