From e07fbd1d17103a07e04c790291d2b419b1a708ee Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 13 Jan 2006 14:06:10 +0000 Subject: [PATCH] extracted serial command processing for use by other test classes git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@107 be28352e-c001-0410-b1a7-c7978e42abec --- .../vamsas/test/simpleclient/ClientsFileTest.java | 394 +++++++++++++------- .../vamsas/test/simpleclient/CommandProcessor.java | 65 ++++ 2 files changed, 331 insertions(+), 128 deletions(-) create mode 100644 src/org/vamsas/test/simpleclient/CommandProcessor.java diff --git a/src/org/vamsas/test/simpleclient/ClientsFileTest.java b/src/org/vamsas/test/simpleclient/ClientsFileTest.java index 6ccd736..9ab68ac 100644 --- a/src/org/vamsas/test/simpleclient/ClientsFileTest.java +++ b/src/org/vamsas/test/simpleclient/ClientsFileTest.java @@ -10,162 +10,300 @@ import org.vamsas.client.simpleclient.FileWatcher; import org.vamsas.client.simpleclient.Lock; public class ClientsFileTest { + private static CommandProcessor cproc; + private static Vector commands; static { - ClientsFileTest.commands=new Vector(); + cproc = new CommandProcessor(); + ClientsFileTest.commands = new Vector(); ClientsFileTest.commands.add(new String("add")); + cproc.addCommand("add", 2, "for the Client's 'Name' and 'Version'"); ClientsFileTest.commands.add(new String("remove")); - ClientsFileTest.commands.add(new String("list")); + cproc.addCommand("remove", 3, "for the Client's 'Name', Version and URN"); + ClientsFileTest.commands.add(new String("list")); + cproc.addCommand("list", 0, "no args needed"); ClientsFileTest.commands.add(new String("clear")); - ClientsFileTest.commands.add(new String("watch")); - ClientsFileTest.commands.add(new String("monitor")); + cproc.addCommand("clear", 0, "no args needed"); + ClientsFileTest.commands.add(new String("watch")); + cproc.addCommand("watch", 0, "no args needed"); + ClientsFileTest.commands.add(new String("monitor")); + cproc.addCommand("monitor", 2, "for the Client's 'Name' and 'Version'"); } - private static void complainArgs(int argl, int argpos, String cmd, int argneed, String msg) { - if (argl-argpos2) + complainArgs(args.length, argc+1, comnext); + return com; + } + } + return -1; + + } +} -- 1.7.10.2