Author: djencks
Date: Thu Oct 25 18:00:08 2012
New Revision: 1402236

URL: http://svn.apache.org/viewvc?rev=1402236&view=rev
Log:
FELIX-3680 fix test so it is might pass, and add shutdown logic

Modified:
    
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/Felix3680_2Test.java
    
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680_2/Main.java
    felix/trunk/scr/src/test/resources/integration_test_FELIX_3880_2.xml

Modified: 
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/Felix3680_2Test.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/Felix3680_2Test.java?rev=1402236&r1=1402235&r2=1402236&view=diff
==============================================================================
--- 
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/Felix3680_2Test.java
 (original)
+++ 
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/Felix3680_2Test.java
 Thu Oct 25 18:00:08 2012
@@ -41,8 +41,9 @@ public class Felix3680_2Test extends Com
         //        paxRunnerVmOption = DEBUG_VM_OPTION;
         descriptorFile = "/integration_test_FELIX_3880_2.xml";
         
+        restrictedLogging = true;
         // Comment this for displaying debug messages
-        DS_LOGLEVEL = "debug";
+        DS_LOGLEVEL = "warn";
     }
 
     @Inject
@@ -69,6 +70,8 @@ public class Felix3680_2Test extends Com
         main.enable();
 
         delay( 30 );
+        main.disable();
+        delay(); //async deactivate
         for ( Iterator it = log.foundWarnings().iterator(); it.hasNext(); )
         {
             String message = ( String ) it.next();

Modified: 
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680_2/Main.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680_2/Main.java?rev=1402236&r1=1402235&r2=1402236&view=diff
==============================================================================
--- 
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680_2/Main.java
 (original)
+++ 
felix/trunk/scr/src/test/java/org/apache/felix/scr/integration/components/felix3680_2/Main.java
 Thu Oct 25 18:00:08 2012
@@ -47,6 +47,8 @@ public class Main implements Runnable
     volatile ConcurrentHashMap<Class, ServiceRegistration> m_registrations = 
new ConcurrentHashMap<Class, ServiceRegistration>();
     volatile Exception _bindStackTrace;
 
+    private volatile boolean running = true;
+
 
     /**
      * Helper used to randomly enable or disable a list of components.
@@ -189,19 +191,22 @@ public class Main implements Runnable
 
     void start( ComponentContext ctx )
     {
-        m_logService.log( LogService.LOG_WARNING, "Main.start" );
         m_ctx = ctx;
         m_bctx = ctx.getBundleContext();
         m_ctx.getBundleContext().registerService( Executor.class.getName(), 
m_exec, null );
         new Thread( this ).start();
     }
 
+    void stop()
+    {
+        running = false;
+    }
+
 
     public void run()
     {
-        m_logService.log( LogService.LOG_WARNING, "Main.run" );
         int loop = 0;
-        while ( true )
+        while ( running )
         {
             m_enabledLatch = new CountDownLatch( 11 ); // 10 for registrations 
of B,C,D,E,F,G,H,I,J,K + 1 for Main.bindA
             m_disabledLatch = new CountDownLatch( 11 ); // 10 for 
unregistrations of B,C,D,E,F,G,H,I,J,K + 1 for Main.unbindA
@@ -239,10 +244,10 @@ public class Main implements Runnable
             }
 
             ++loop;
-            //            if ( loop % 100 == 0 )
-            //            {
-            m_logService.log( LogService.LOG_WARNING, "Performed " + loop + " 
tests." );
-            // }
+            if ( loop % 100 == 0 )
+            {
+                m_logService.log( LogService.LOG_WARNING, "Performed " + loop 
+ " tests." );
+            }
         }
     }
 

Modified: felix/trunk/scr/src/test/resources/integration_test_FELIX_3880_2.xml
URL: 
http://svn.apache.org/viewvc/felix/trunk/scr/src/test/resources/integration_test_FELIX_3880_2.xml?rev=1402236&r1=1402235&r2=1402236&view=diff
==============================================================================
--- felix/trunk/scr/src/test/resources/integration_test_FELIX_3880_2.xml 
(original)
+++ felix/trunk/scr/src/test/resources/integration_test_FELIX_3880_2.xml Thu 
Oct 25 18:00:08 2012
@@ -12,7 +12,7 @@
 <components xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0";>
        <scr:component xmlns:scr='http://www.osgi.org/xmlns/scr/v1.1.0'
                enabled='false' 
name='org.apache.felix.scr.integration.components.felix3680_2.Main'
-               activate='start'>
+               activate='start' deactivate='stop'>
                <implementation
                        
class='org.apache.felix.scr.integration.components.felix3680_2.Main' />
                <reference name='a'


Reply via email to