incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject svn commit: r949717 - in /incubator/aries/trunk/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests: AbstractIntegrationTest.java BlogSampleTest.java
Date Mon, 31 May 2010 11:17:10 GMT
Author: zoe
Date: Mon May 31 11:17:10 2010
New Revision: 949717

URL: http://svn.apache.org/viewvc?rev=949717&view=rev
Log:
ARIES-313 Tidy code and comment out debug

Modified:
    incubator/aries/trunk/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/AbstractIntegrationTest.java
    incubator/aries/trunk/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/BlogSampleTest.java

Modified: incubator/aries/trunk/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/AbstractIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/AbstractIntegrationTest.java?rev=949717&r1=949716&r2=949717&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/AbstractIntegrationTest.java
(original)
+++ incubator/aries/trunk/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/AbstractIntegrationTest.java
Mon May 31 11:17:10 2010
@@ -144,17 +144,18 @@ public abstract class AbstractIntegratio
         }
     }
 
+	protected void listBundleServices(Bundle b) {
+    	ServiceReference []srb = b.getRegisteredServices();
+		for(ServiceReference sr:srb){
+			System.out.println(b.getSymbolicName() + " SERVICE: "+sr);
+    	}	
+	}
 
 	protected Boolean isServiceRegistered(Bundle b) {
-	ServiceReference []srb = b.getRegisteredServices();
-
-    	if(srb == null) {
+		ServiceReference []srb = b.getRegisteredServices();
+		if(srb == null) {
 			return false;
-    	}else {
-    		for(ServiceReference sr:srb){
-            	System.out.println(" ZZZZZZ SERVICES "+sr);
-        	}
-    	}
+		}
     	return true;
 	}
 
@@ -176,7 +177,7 @@ public abstract class AbstractIntegratio
 			return;
 		} 
 		catch (Exception e) {
-			//and do something with it
+			System.out.println("Failed to register services for " + b.getSymbolicName() + e.getMessage());

 		}
 	}
 

Modified: incubator/aries/trunk/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/BlogSampleTest.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/BlogSampleTest.java?rev=949717&r1=949716&r2=949717&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/BlogSampleTest.java
(original)
+++ incubator/aries/trunk/samples/blog/blog-itests/src/test/java/org/apache/aries/samples/blog/itests/BlogSampleTest.java
Mon May 31 11:17:10 2010
@@ -41,6 +41,8 @@ public class BlogSampleTest extends Abst
     @Test
     public void test() throws Exception {
 
+    /* Find and start all the blog sample bundles */
+
 	Bundle bapi = getInstalledBundle("org.apache.aries.samples.blog.api");
     assertNotNull(bapi);
     bapi.start();
@@ -56,43 +58,43 @@ public class BlogSampleTest extends Abst
 	Bundle bper = getInstalledBundle("org.apache.aries.samples.blog.persistence.jpa");
     assertNotNull(bper);
     bper.start();
-
+ 
+    /* Datasource and transaction manager services are used by the blog sample */
 	Bundle bds = getInstalledBundle("org.apache.aries.samples.blog.datasource");
 	Bundle txs = getInstalledBundle("org.apache.aries.transaction.manager");
 
-
+    /*Wait for all the required services to be registered */
     waitForServices(bbiz, "org.apache.aries.samples.api.BloggingService");
     waitForServices(bper, "org.apache.aries.samples.api.BloggingService");
     waitForServices(bds, "java.sql.XADataSource");
     waitForServices(txs, "javax.transaction.TransactionManager");
 
 
-
-	if(!isServiceRegistered(bbiz)) {
-		System.out.println("ZZZZZ No services registered for " +  bbiz.getSymbolicName());
-	}
-
-	if(!isServiceRegistered(bper)) {
-		System.out.println("ZZZZZ No services registered for " + bper.getSymbolicName());
-	}
-
-	if(!isServiceRegistered(bds)) {
-		System.out.println("ZZZZZ No services registered for " + bds.getSymbolicName());
-	}
+    /*Check that they haven't timed out trying to register*/
+	assertTrue("No services reistered for " + bbiz.getSymbolicName(), isServiceRegistered(bbiz));
+	assertTrue("No services reistered for " + bper.getSymbolicName(), isServiceRegistered(bper));
+	assertTrue("No services reistered for " + bds.getSymbolicName(), isServiceRegistered(bds));
+	assertTrue("No services reistered for " + txs.getSymbolicName(), isServiceRegistered(txs));
+
+	/*Check what services are registered - uncomment for additional debug */
+	/*
+	listBundleServices(bbiz);
+	listBundleServices(bper);
+	listBundleServices(bds);
+	listBundleServices(txs);
     
+	System.out.println("In test and trying to get connection....");
+    */
 
-	if(!isServiceRegistered(txs)) {
-		System.out.println("ZZZZZ No services registered for " + txs.getSymbolicName());
-	}
-
-
-	System.out.println("ZZZZZ in test and trying to get connection....");
 	HttpURLConnection conn = makeConnection("http://localhost:8080/org.apache.aries.samples.blog.web/ViewBlog");
     String response = getHTTPResponse(conn);
+
+	/* Uncomment for additional debug */
+	/*
 	System.out.println("ZZZZZ " + response);
     System.out.println("ZZZZZ " + conn.getResponseCode());
     System.out.println("ZZZZZ " + HttpURLConnection.HTTP_OK);
-
+	*/
 
 
     assertEquals(HttpURLConnection.HTTP_OK,



Mime
View raw message