diff options
Diffstat (limited to 'java/tests/netsvcs')
-rw-r--r-- | java/tests/netsvcs/Logger/LoggerTest.java | 122 | ||||
-rw-r--r-- | java/tests/netsvcs/Logger/Makefile | 19 | ||||
-rw-r--r-- | java/tests/netsvcs/Naming/ClientTest.java | 117 | ||||
-rw-r--r-- | java/tests/netsvcs/Naming/Makefile | 21 |
4 files changed, 0 insertions, 279 deletions
diff --git a/java/tests/netsvcs/Logger/LoggerTest.java b/java/tests/netsvcs/Logger/LoggerTest.java deleted file mode 100644 index 40ac903a1d3..00000000000 --- a/java/tests/netsvcs/Logger/LoggerTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/************************************************* - * - * = FILENAME - * LoggerTest.java - * - *@author Everett Anderson - * - *************************************************/ -package tests.netsvcs.Logger; - -import JACE.SOCK_SAP.*; -import java.io.*; -import java.net.*; -import JACE.OS.*; -import netsvcs.Logger.LogRecord; - -/** - * - * <p><h2>DESCRIPTION</h2> - * - * <blockquote> - * This is a simple test log client very similar to the direct_logging client of - * C++ ACE. The logging service should correctly receive messages from both - * the C++ and Java version. - * </blockquote> - * - * @see netsvcs.Logger.ServerLoggingAcceptor, netsvcs.Logger.LogRecord - */ -public class LoggerTest { - - /** Command line: <hostname> [<port>] - * - * Creates a "hello world" log message and sends it to the server logging service. - * If no command line arguments are given, it uses ACE.DEFAULT_SERVER_PORT, and the - * current machine for the service location. - * - */ - public static void main(String args[]) - { - if (args.length < 1) { - System.err.println("Use: LoggerTest <host name> [<port>]"); - System.exit(0); - } - - // Set the port - int port = args.length > 1 ? (new Integer(args[1])).intValue() : ACE.DEFAULT_SERVER_PORT; - - SOCKStream cli_stream = new SOCKStream(); - INETAddr remote_addr; - String host; - - // Try to find the host - try { - - host = args[0]; - - remote_addr = new INETAddr(port, host); - - } catch (UnknownHostException uhe) { - ACE.ERROR("UnknownHostException " + uhe); - return; - } - - System.out.println("Connecting to " + host + " on port " + port); - - SOCKConnector con = new SOCKConnector(); - - try { - - // Connect to the service - con.connect(cli_stream, remote_addr); - - } catch (SocketException se) { - - ACE.ERROR("Socket Exception " + se); - return; - - } catch (IOException ie) { - - ACE.ERROR("IOException " + ie); - return; - } - - - // Send a message with priority 4, the current time, - // and 0 for the process ID. - LogRecord record = new LogRecord(4, - System.currentTimeMillis(), - 0); - - // Set the text of the message - record.msgData("hello world"); - - try { - - // Get a transmission system from the socket - OutputStream os = cli_stream.socket().getOutputStream(); - DataOutputStream dos = new DataOutputStream(os); - - // Send it - record.streamOutTo(dos); - - // Close the socket - cli_stream.close(); - - } catch (IOException ie) { - - ACE.ERROR("IOException, loop: " + ie); - return; - } - } -}; - - - - - - - - - - diff --git a/java/tests/netsvcs/Logger/Makefile b/java/tests/netsvcs/Logger/Makefile deleted file mode 100644 index b61b785232a..00000000000 --- a/java/tests/netsvcs/Logger/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# $Id$ - -.SUFFIXES: .java .class - -JACE_WRAPPER = $(ACE_ROOT)/java - -all: - javac -d ${JACE_WRAPPER}/classes $(files) -doc: - javadoc -d ${JACE_WRAPPER}/doc $(files) $(packages) - -files = LoggerTest.java - -packages = netsvcs \ - netsvcs.Logger - -realclean: - /bin/rm -rf ${JACE_WRAPPER}/classes/tests/netsvcs/Logger - diff --git a/java/tests/netsvcs/Naming/ClientTest.java b/java/tests/netsvcs/Naming/ClientTest.java deleted file mode 100644 index c1189fecd7f..00000000000 --- a/java/tests/netsvcs/Naming/ClientTest.java +++ /dev/null @@ -1,117 +0,0 @@ -package tests.netsvcs.Naming; - -import java.io.*; -import java.net.*; -import java.util.*; -import JACE.OS.*; -import JACE.Connection.*; -import JACE.SOCK_SAP.*; -import netsvcs.Naming.*; - -public class ClientTest -{ - void print_usage_and_die () - { - System.out.println ("Usage: ClientTest <hostname> [<port>]"); - System.exit (0); - } - - public SOCKStream init (SOCKStream socket, String hostname, int port) - { - try - { - SOCKConnector sc = new SOCKConnector(socket, hostname, port); - } - catch (UnknownHostException e) - { - ACE.ERROR (e); - System.exit(0); - } - catch (SocketException e) - { - ACE.ERROR ("Connection refused"); - System.exit(0); - } - catch (IOException e) - { - ACE.ERROR (e); - System.exit(0); - } - - return socket; - } - - public static void main (String [] args) - { - SOCKStream socket; - int port = ACE.DEFAULT_SERVER_PORT; - ClientTest clientTest = new ClientTest (); - - if (args.length == 2) - { - try - { - port = Integer.parseInt (args[1]); - } - catch (NumberFormatException e) - { - clientTest.print_usage_and_die (); - } - } - System.out.println("Trying to open port " + port + " on " + args[0]); - - socket = clientTest.init (new SOCKStream(), args[0], port); - - NameProxy proxy = new NameProxy(socket); - - System.out.println("---- Beginning tests ----"); - - try { - - System.out.println("Binding (five, six, seven): " + proxy.bind("five", "six", "seven")); - System.out.println("Binding (filth, rat, eats): " + proxy.bind("filth", "rat", "eats")); - - Vector res = proxy.resolve("five"); - - System.out.println("Resolve (five) : " + (String)res.elementAt(1) + " " - + (String)res.elementAt(2)); - - System.out.println("Binding (fish, words, him): " + proxy.bind("fish", "words", "him")); - - System.out.println("Unbind (five, six, seven): " + proxy.unbind("five")); - - res = proxy.resolve("five"); - - System.out.println("Resolve (five) : " + (String)res.elementAt(1) + " " - + (String)res.elementAt(2)); - System.out.println("Binding (fiction, us, you): " + proxy.bind("fiction", "us", "you")); - - System.out.println("\nGetting all records whose names begin with fi:\n"); - Vector res2 = proxy.listNameEntries("fi"); - - Enumeration iter = res2.elements(); - - while (iter.hasMoreElements()) { - Vector res3 = (Vector)(iter.nextElement()); - - System.out.println((String)res3.elementAt(0) + "\t" + (String)res3.elementAt(1) - + "\t" + (String)res3.elementAt(2)); - } - - } catch (IOException e) - { - ACE.ERROR("" + e); - } - finally - { - try { - socket.close(); - } catch (IOException e) { - ACE.ERROR("" + e); - } - } - - } - -}; - diff --git a/java/tests/netsvcs/Naming/Makefile b/java/tests/netsvcs/Naming/Makefile deleted file mode 100644 index be6e9c45848..00000000000 --- a/java/tests/netsvcs/Naming/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile - -.SUFFIXES: .java .class - -JACE_WRAPPER = ../../.. -CLASSDIR = $(JACE_WRAPPER)/classes - -CLASSPATH := $(CLASSDIR):$(CLASSPATH) - -all: - javac -d ${JACE_WRAPPER}/classes $(files) -doc: - javadoc -d ${JACE_WRAPPER}/doc $(files) $(packages) - - -files = ClientTest.java - -packages = tests.netsvcs.Naming - -realclean: - find ${JACE_WRAPPER}/classes/tests/netsvcs/Naming -name '*.class' -print | xargs ${RM} |