[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Tue Apr 3 02:39:52 UTC 2007


gordonp
Mon Apr  2 22:39:51 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/test
In directory dev.open-bio.org:/tmp/cvs-serv7142/src/main/org/biomoby/client/test

Modified Files:
	AsyncClientTestCase.java 
Added Files:
	TestAASeq.xml 
Removed Files:
	TestFASTACollection.xml 
Log Message:
Updated test case service to run, and made a hard timeout too
moby-live/Java/src/main/org/biomoby/client/test TestAASeq.xml,NONE,1.1 AsyncClientTestCase.java,1.1,1.2 TestFASTACollection.xml,1.1,NONE
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/test/AsyncClientTestCase.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/test/AsyncClientTestCase.java	2007/03/30 21:17:27	1.1
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/test/AsyncClientTestCase.java	2007/04/03 02:39:51	1.2
@@ -18,10 +18,11 @@
 import java.util.Set;
 
 public class AsyncClientTestCase extends TestCase{
-    private final static String TEST_INPUT_RESOURCE = "org/biomoby/client/test/TestFASTACollection.xml";
-    private final static String TEST_SERVICE_NAME = "runClustalwFast";
-    private final static String TEST_SERVICE_AUTHORITY = "inb.bsc.es";
+    private final static String TEST_INPUT_RESOURCE = "org/biomoby/client/test/TestAASeq.xml";
+    private final static String TEST_SERVICE_NAME = "runFunCUT";
+    private final static String TEST_SERVICE_AUTHORITY = "cnio.es";
     private final static int POLLING_WAITTIME_MS = 5000;  // ms between checks to see if the job is done
+    private final static int MAX_WAITTIME_MS = 600000;  // allow 10 minutes for the service to run
 
     /**
      * @param name Test case name.
@@ -92,12 +93,17 @@
 	assertNotNull("Could not load the test data (" + dataURL + ")", data);
 
 	for(MobyDataJob job: data.values()){
+	    String jobKeys = "";
+	    for(String key: job.keySet()){
+		jobKeys += key + " ";
+	    }
+
 	    for(MobyPrimaryData input: inputs){
 		if(!job.containsKey(input.getName())){
 		    System.err.println("Test Input Data: " + job);
 		    fail("The service requires an input ("+input.getName() + 
 			 ") that was not provided in the test input data (" +
-			 dataURL + ")");
+			 dataURL + ").  The provided input: "+jobKeys);
 		}
 		if(!(job.get(input.getName()) instanceof MobyPrimaryData)){
 		    System.err.println("Test Input Data: " + job);
@@ -128,18 +134,28 @@
 	    fail("Exception while sending request to service: " + e);
 	}
 
+	long startTime = System.currentTimeMillis();
 	// Essentially cloning, so removing ids doesn't change the 
 	// MobyContentInstance "data" (which we will use again later on)
 	Set<String> queryIDs = new HashSet(data.keySet());
 	try {
-	    // Should add some timeout here...
 	    while(!queryIDs.isEmpty()){
+		if(System.currentTimeMillis()-startTime > MAX_WAITTIME_MS){
+		    destroyEPR(epr);
+		    fail("The service ("+serviceName + 
+			 ") took longer than the maximum allowed time to execute ("+
+			 MAX_WAITTIME_MS+"ms)");
+		}
+
 		Thread.sleep(POLLING_WAITTIME_MS);
 		AnalysisEvent[] events = 
 		    AsyncClient.poll(epr, queryIDs);
 		for(AnalysisEvent event: events){
-		    if(event != null && event.isCompleted()){
-			queryIDs.remove(event.getQueryId());
+		    if(event != null){
+			System.err.println("Event: " + event);
+			if(event.isCompleted()){
+			    queryIDs.remove(event.getQueryId());
+			}
 		    }
 		}
 	    }

rcsdiff: /home/repository/moby/moby-live/Java/src/main/org/biomoby/client/test/RCS/TestFASTACollection.xml,v: No such file or directory




More information about the MOBY-guts mailing list