ClientsFileTest debugged and verified.
authorjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 11 Oct 2005 21:15:55 +0000 (21:15 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Tue, 11 Oct 2005 21:15:55 +0000 (21:15 +0000)
git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@61 be28352e-c001-0410-b1a7-c7978e42abec

.externalToolBuilders/ClientsFileTest.launch
src/org/vamsas/client/simpleclient/ClientsFile.java
src/org/vamsas/test/simpleclient/ClientsFileTest.java

index eb9c44d..ab2a7fe 100644 (file)
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.vamsas.test.simpleclient.ClientsFileTest"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="testClientList add jalview 1.0 add Jalview 2.0 list"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="testClientList add jalview 1.0 add Jalview 2.0 list remove jalview 1.0 vamsas://jalview:1.0/ list add VamsasTest 0.1 list clear list"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="VamsasClient"/>
 <listAttribute key="org.eclipse.debug.ui.favoriteGroups">
 <listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
 <listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
 </listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:VamsasClient}/test"/>
 <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
-<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="/tmp/testClietList"/>
 </launchConfiguration>
index 8f938f6..4d34039 100644 (file)
@@ -172,7 +172,7 @@ public class ClientsFile {
           for (int k=0,i = 0, j = clients.length; i < j; i++)
             if (i!=mynum)
               newlist[k++] = clients[i];
-          if (!putClientList(clients))
+          if (!putClientList(newlist))
             throw new Error("Failed to write new clientList!"); // failed to put the clientList to disk.
         }
       }
@@ -187,7 +187,7 @@ public class ClientsFile {
    * Note: Caller is left to release the lock on the ClientList.
    * @param me
    * @param disambiguate -
-   *          flag indicating if the URN for me should be disambiguate to
+   *          flag indicating if the URN for me should be disambiguated to
    *          differentiate between sessions.
    * @return index of clientHandle in new list, or -1-position of existing
    *         clientHandle (if disambiguate is true)
index 705c1fc..9339600 100644 (file)
@@ -30,9 +30,8 @@ public class ClientsFileTest {
       e.printStackTrace(System.err);
       return;
     }
-    int argc=0;
+    int argc=1;
     while (argc<args.length) {
-      argc++;
       Iterator coms = commands.iterator();
       int com=-1;
       while ((coms!=null) && coms.hasNext()) {
@@ -46,7 +45,7 @@ public class ClientsFileTest {
             // Add
             ClientsFileTest.complainArgs(args.length, argc, "add", 2, "for the Client's 'Name' and 'Version'");
             int pos = cfhand.addClient(ch=new ClientHandle(args[argc],args[argc+1]));
-            argc+=1;
+            argc+=2;
             if (pos!=0)
               System.out.println("Client added at "+pos+" as urn:"+ch.getClientUrn());
             else
@@ -57,7 +56,7 @@ public class ClientsFileTest {
             ClientsFileTest.complainArgs(args.length, argc, "remove", 3, "for the Client's 'Name', Version and URN");
             ch=new ClientHandle(args[argc], args[argc+1]);
             ch.setClientUrn(args[argc+2]);
-            argc+=2;
+            argc+=3;
             cfhand.removeClient(ch);
             System.out.println("Client removed (apparently)");
             break;
@@ -90,7 +89,7 @@ public class ClientsFileTest {
         }
       }
       if (coms!=null) {
-        System.err.println("Unknown command : "+args[argc] + "*Ignored!*");
+        System.err.println("Unknown command : "+args[argc++] + "*Ignored!*");
       };
     }
   }