[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Thu Jan 29 19:12:39 UTC 2009


kawas
Thu Jan 29 14:12:39 EST 2009
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared
In directory dev.open-bio.org:/tmp/cvs-serv12550/src/main/org/biomoby/shared

Modified Files:
	MobyService.java 
Log Message:
updated MobyService to reflect the fact that >= 0 test cases are available and not 0 or 1.
moby-live/Java/src/main/org/biomoby/shared MobyService.java,1.26,1.27
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java	2008/12/17 14:07:16	1.26
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/MobyService.java	2009/01/29 19:12:39	1.27
@@ -53,7 +53,7 @@
     protected String lsid = null;
     protected MobyServiceType serviceType;
     // moby unit test object
-    protected MobyUnitTest unitTest = null;
+    protected Vector<MobyUnitTest> unitTests = new Vector<MobyUnitTest>();
 
     public static final int UNCHECKED = 0;
     public static final int DEAD= 1;
@@ -150,7 +150,7 @@
 	clone.setSignatureURL(getSignatureURL());
 	clone.setPathToRDF(getPathToRDF());
 	clone.setRDF(getRDF());
-	clone.setUnitTest(getUnitTest());
+	clone.setUnitTests(getUnitTests());
 	
 	clone.serviceStatus = serviceStatus;
 	clone.statusChecks = statusChecks;
@@ -274,20 +274,59 @@
 
     /**
      * 
-     * @return the MobyUnitTest object associated with this service
+     * @return an array of MobyUnitTest objects set for this service
      */
-    public MobyUnitTest getUnitTest() {
-	return unitTest;
+    public MobyUnitTest[] getUnitTests() {
+	synchronized (unitTests) {
+	    MobyUnitTest[] tests = new MobyUnitTest[unitTests.size()];
+	    unitTests.copyInto(tests);
+	    return tests;
+	}
     }
 
     /**
      * 
-     * @param unitTest
-     *                the MobyUnitTest object to associate with this service
+     * @param unitTests
+     *                the tests to set for the service
+     */
+    public void setUnitTests(MobyUnitTest[] unitTests) {
+	if (unitTests == null) {
+	    this.unitTests.clear();
+	} else {
+	    for (MobyUnitTest mut : unitTests) {
+		addUnitTest(mut);
+	    }
+	}
+    }
+    
+    /**
+     * 
+     * @param unitTest the MobyUnitTest to add to our service
+     */
+    public void addUnitTest(MobyUnitTest unitTest) {
+	if (unitTest != null) {
+	    for (MobyUnitTest t : unitTests) {
+		// dont add duplicate tests
+		if (t.toString().equals(unitTest.toString()))
+		    return;
+	    }
+	    unitTests.add(unitTest);
+	}
+    }
+    
+    /**
+     * 
+     * @param unitTest the test to remove from the set of tests for the service
      */
-    public void setUnitTest(MobyUnitTest unitTest) {
-    	if (unitTest != null)
-	    this.unitTest = unitTest;
+    public void removeUnitTest(MobyUnitTest unitTest) {
+	if (unitTest != null) {
+	    for (int x = 0; x < unitTests.size(); x++) {
+		if (unitTest.toString().equals(unitTests.elementAt(x).toString())) {
+		    unitTests.removeElementAt(x);
+		    return;
+		}
+	    }
+	}
     }
 
 	/**
@@ -510,24 +549,26 @@
 	if (id != null) buf.append ("ID:            " + id + "\n");
 	
 	// print unitTest information for this service
-	if (unitTest != null) {
-		buf.append(unitTest.toString());
+	if (unitTests != null && unitTests.size() > 0) {
+	    buf.append("Unit Tests:\n");
+	    for (MobyUnitTest unitTest : unitTests)
+		buf.append(unitTest.toString()+"\n");
 	} else {
-		buf.append("Unit Test:     None available\n");
+	    buf.append("Unit Tests:     None available\n");
 	}
 
 	buf.append ("Primary inputs:\n");
-	for (Enumeration en = primaryInputs.elements(); en.hasMoreElements(); )
+	for (Enumeration<MobyData> en = primaryInputs.elements(); en.hasMoreElements(); )
 	    buf.append (((MobyData)en.nextElement()).format (1));
 
 	if (secondaryInputs.size() > 0) {
 	    buf.append ("Secondary inputs:\n");
-	    for (Enumeration en = secondaryInputs.elements(); en.hasMoreElements(); )
+	    for (Enumeration<MobyData> en = secondaryInputs.elements(); en.hasMoreElements(); )
 		buf.append (((MobyData)en.nextElement()).format (1));
 	}
 
 	buf.append ("Outputs:\n");
-	for (Enumeration en = primaryOutputs.elements(); en.hasMoreElements(); )
+	for (Enumeration<MobyData> en = primaryOutputs.elements(); en.hasMoreElements(); )
 	    buf.append (((MobyData)en.nextElement()).format (1));
 
 	return new String (buf);




More information about the MOBY-guts mailing list