ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r823529 - in /incubator/ace/trunk/test/src/org/apache/ace/test: osgi/dm/TestActivatorBase.java repositoryadmin/Activator.java
Date Fri, 09 Oct 2009 12:37:12 GMT
Author: marrs
Date: Fri Oct  9 12:37:11 2009
New Revision: 823529

URL: http://svn.apache.org/viewvc?rev=823529&view=rev
Log:
Removed some debug output and hopefully fixed the last integration test.

Modified:
    incubator/ace/trunk/test/src/org/apache/ace/test/osgi/dm/TestActivatorBase.java
    incubator/ace/trunk/test/src/org/apache/ace/test/repositoryadmin/Activator.java

Modified: incubator/ace/trunk/test/src/org/apache/ace/test/osgi/dm/TestActivatorBase.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/test/src/org/apache/ace/test/osgi/dm/TestActivatorBase.java?rev=823529&r1=823528&r2=823529&view=diff
==============================================================================
--- incubator/ace/trunk/test/src/org/apache/ace/test/osgi/dm/TestActivatorBase.java (original)
+++ incubator/ace/trunk/test/src/org/apache/ace/test/osgi/dm/TestActivatorBase.java Fri Oct
 9 12:37:11 2009
@@ -72,7 +72,7 @@
         String nonActiveBundles = "";
         do {
             if (System.currentTimeMillis() > timeout) {
-                fail(testng, "Waiting for all bundles to become active timed out. Inactive
bundles: " + nonActiveBundles);
+                fail(testng, "Test timed out, still waiting for " + nonActiveBundles + "
bundles to become active.");
             }
             StringBuffer nonActive = new StringBuffer("");
             allActive = true;
@@ -94,7 +94,6 @@
 
         // wait for the service to be started
         try {
-            System.out.println("Waiting for " + (1 - m_semaphore.availablePermits()) + "
to become available.");
             if (m_semaphore.tryAcquire(30, TimeUnit.SECONDS)) {
                 // perform tests
                 testng.setTestClasses(m_testClasses);
@@ -103,12 +102,11 @@
                 testng.run();
             }
             else {
-                int waitingFor = 1 - m_semaphore.availablePermits();
-                fail(testng, "Service(s) never started. Still waiting for " + waitingFor
+ " services.");
+                fail(testng, "Test timed out, still waiting for " + (1 - m_semaphore.availablePermits())
+ " service(s).");
             }
         }
         catch (InterruptedException ie) {
-            fail(testng, "Thread was interrupted.");
+            fail(testng, "Test thread was interrupted.");
         }
         // shutdown after the tests have been run
         try {
@@ -151,7 +149,6 @@
     }
 
     public void started(Service svc) {
-        System.out.println("Started service " + svc);
         m_semaphore.release();
     }
 
@@ -159,20 +156,8 @@
     }
 
     public void stopped(Service svc) {
-        // this is weird
-        System.out.println("Stopped service " + svc);
     }
 
     public void stopping(Service svc) {
     }
-
-    public static void main(String[] args) throws Exception {
-        Semaphore s = new Semaphore(-1);
-        System.out.println("#: " + (1 - s.availablePermits()));
-        s.release();
-        System.out.println("#: " + (1 - s.availablePermits()));
-        System.out.println("Trying...");
-        System.out.println(s.tryAcquire(3, TimeUnit.SECONDS));
-        System.out.println("#: " + (1 - s.availablePermits()));
-    }
 }

Modified: incubator/ace/trunk/test/src/org/apache/ace/test/repositoryadmin/Activator.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/test/src/org/apache/ace/test/repositoryadmin/Activator.java?rev=823529&r1=823528&r2=823529&view=diff
==============================================================================
--- incubator/ace/trunk/test/src/org/apache/ace/test/repositoryadmin/Activator.java (original)
+++ incubator/ace/trunk/test/src/org/apache/ace/test/repositoryadmin/Activator.java Fri Oct
 9 12:37:11 2009
@@ -25,6 +25,7 @@
 
 import org.apache.ace.client.repository.RepositoryAdmin;
 import org.apache.ace.client.repository.RepositoryObject;
+import org.apache.ace.client.repository.SessionFactory;
 import org.apache.ace.client.repository.repository.Artifact2GroupAssociationRepository;
 import org.apache.ace.client.repository.repository.ArtifactRepository;
 import org.apache.ace.client.repository.repository.DeploymentVersionRepository;
@@ -51,9 +52,15 @@
  */
 public class Activator extends TestActivatorBase {
     private volatile ConfigurationAdmin m_configAdmin;
+    private volatile SessionFactory m_sessionFactory;
 
     @Override
     protected void initServices(BundleContext context, DependencyManager manager) {
+        manager.add(createService()
+            .setImplementation(this)
+            .add(createServiceDependency().setService(SessionFactory.class).setRequired(true))
+            .add(createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true)));
+
         Dictionary<String, Object> topics = new Hashtable<String, Object>();
         topics.put(EventConstants.EVENT_TOPIC, new String[] {RepositoryObject.PUBLIC_TOPIC_ROOT
+ "*",
             RepositoryObject.PRIVATE_TOPIC_ROOT + "*",
@@ -76,9 +83,6 @@
             .add(createServiceDependency().setService(StatefulGatewayRepository.class).setRequired(true))
             .add(createServiceDependency().setService(LogStore.class, "(&(" + Constants.OBJECTCLASS
+ "=" + LogStore.class.getName() + ")(name=auditlog))").setRequired(true))
             .add(createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true)));
-        manager.add(createService()
-            .setImplementation(this)
-            .add(createServiceDependency().setService(ConfigurationAdmin.class).setRequired(true)));
     }
 
     public void start() throws IOException {
@@ -86,6 +90,12 @@
         props.put("name", "auditlog");
         Configuration config = m_configAdmin.createFactoryConfiguration("org.apache.ace.server.log.store.factory",
null);
         config.update(props);
+
+        m_sessionFactory.createSession("test-session-ID");
+    }
+
+    public void stop() {
+        m_sessionFactory.destroySession("test-session-ID");
     }
 
     @SuppressWarnings("unchecked")



Mime
View raw message