felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r784331 - /felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestActivationPolicy.java
Date Sat, 13 Jun 2009 05:01:42 GMT
Author: rickhall
Date: Sat Jun 13 05:01:41 2009
New Revision: 784331

URL: http://svn.apache.org/viewvc?rev=784331&view=rev
Log:
Add another activation policy test.

Modified:
    felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestActivationPolicy.java

Modified: felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestActivationPolicy.java
URL: http://svn.apache.org/viewvc/felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestActivationPolicy.java?rev=784331&r1=784330&r2=784331&view=diff
==============================================================================
--- felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestActivationPolicy.java
(original)
+++ felix/sandbox/rickhall/bnd-test/org.apache.felix.framework.test/src/org/apache/felix/framework/test/TestActivationPolicy.java
Sat Jun 13 05:01:41 2009
@@ -37,15 +37,50 @@
     private Bundle m_bundleC = null;
     private Bundle m_bundleD = null;
 
+    public void testChain() throws Exception
+    {
+        InputStream is = null;
+
+        // Scenario #1
+        //
+        // Install a base class bundle and a subclass bundle and start both
+        // with deferred activation. Install and start a third bundle that
+        // creates an instance of the subclass, which will trigger deferred
+        // activation in the other two bundles.
+        try
+        {
+            is = this.getClass().getClassLoader().getResourceAsStream("activationpolicy.b1.jar");
+            m_bundleA = getBundleContext().installBundle("activationpolicy.b1.jar", is);
+            m_bundleA.start(Bundle.START_ACTIVATION_POLICY);
+            assertFalse("Bundle should not be active", m_bundleA.getState() == Bundle.ACTIVE);
+
+            is = this.getClass().getClassLoader().getResourceAsStream("activationpolicy.b2.jar");
+            m_bundleB = getBundleContext().installBundle("activationpolicy.b2.jar", is);
+            m_bundleB.start(Bundle.START_ACTIVATION_POLICY);
+            assertFalse("Bundle should not be active", m_bundleB.getState() == Bundle.ACTIVE);
+
+            is = this.getClass().getClassLoader().getResourceAsStream("activationpolicy.b3.jar");
+            m_bundleC = getBundleContext().installBundle("activationpolicy.b3.jar", is);
+            m_bundleC.start();
+
+            assertTrue("Bundle should be active", m_bundleA.getState() == Bundle.ACTIVE);
+            assertTrue("Bundle should be active", m_bundleB.getState() == Bundle.ACTIVE);
+        }
+        finally
+        {
+            cleanup();
+        }
+    }
+
     public void testDirectives() throws Exception
     {
         InputStream is = null;
 
         // Scenario #1
         //
-        // Install host, fragment, and bundle importing fragment package.
-        // Start the importing bundle and verify that it is wired to the
-        // host bundle, not the fragment bundle.
+        // Install a bundle with deferred activation and an included package.
+        // Make sure excluded classes do not trigger deferred activation, while
+        // included classes do.
         try
         {
             is = this.getClass().getClassLoader().getResourceAsStream("activationpolicy.b4a.jar");
@@ -66,9 +101,9 @@
 
         // Scenario #2
         //
-        // Install host, fragment, and bundle importing fragment package.
-        // Start the importing bundle and verify that it is wired to the
-        // host bundle, not the fragment bundle.
+        // Install a bundle with deferred activation and an excluded package.
+        // Make sure excluded classes do not trigger deferred activation, while
+        // included classes do.
         try
         {
             is = this.getClass().getClassLoader().getResourceAsStream("activationpolicy.b4b.jar");



Mime
View raw message