harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r386058 [48/49] - in /incubator/harmony/enhanced/classlib/trunk: make/ modules/archive/make/common/ modules/archive/src/test/java/tests/ modules/archive/src/test/java/tests/api/ modules/archive/src/test/java/tests/api/java/ modules/archive/...
Date Wed, 15 Mar 2006 11:47:39 GMT
Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServerSocket.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServerSocket.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServerSocket.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServerSocket.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,76 @@
+/* Copyright 2002, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * This class implements the Support_ServerSocket interface using java.net
+ * Serversockets
+ */
+
+public class Support_HttpServerSocket implements Support_ServerSocket {
+	private ServerSocket instance = null;
+
+	private int port = -1;
+
+	private int timeout = 8000;
+
+	/**
+	 * Blocks until a connection is made, or the socket times out.
+	 * 
+	 * @see tests.support.Support_ServerSocket#accept()
+	 */
+	public Support_Socket accept() throws IOException {
+		if (port == -1)
+			return null;
+		if (instance == null)
+			return null;
+		instance.setSoTimeout(timeout);
+		Socket s = instance.accept();
+		return new Support_HttpSocket(s);
+	}
+
+	/**
+	 * @see tests.support.Support_ServerSocket#setTimeout(int) Sets the
+	 *      timeout for the server.
+	 */
+	public void setTimeout(int timeout) {
+		this.timeout = timeout;
+	}
+
+	/**
+	 * @see tests.support.Support_ServerSocket#setPort(int)
+	 */
+	public void setPort(int port) {
+		this.port = port;
+	}
+
+	public void open() throws IOException {
+		instance = new ServerSocket(port);
+	}
+
+	/**
+	 * @see tests.support.Support_ServerSocket#close()
+	 */
+	public void close() throws IOException {
+		if (instance != null)
+			instance.close();
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpSocket.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpSocket.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpSocket.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpSocket.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,51 @@
+/* Copyright 2002, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+
+/**
+ * This class implements the Support_Socket interface using java.net Sockets.
+ */
+public class Support_HttpSocket implements Support_Socket {
+
+	private Socket instance;
+
+	private boolean streamOpen = false;
+
+	Support_HttpSocket(Socket socket) {
+		instance = socket;
+	}
+
+	public InputStream getInputStream() throws IOException {
+		streamOpen = true;
+		return instance.getInputStream();
+	}
+
+	public OutputStream getOutputStream() throws IOException {
+		streamOpen = true;
+		return instance.getOutputStream();
+	}
+
+	public void close() throws IOException {
+		if (!streamOpen && instance != null)
+			instance.close();
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpTests.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,422 @@
+/* Copyright 2002, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * Performs some basic testing of either HttpConnection or HttpURLConnection
+ * depending on the Support_ServerSocket and Support_HttpConnector passed to the
+ * constructor.
+ * 
+ */
+public class Support_HttpTests {
+
+	private Support_ServerSocket serversocket;
+
+	private Support_HttpConnector connector;
+
+	public Support_HttpTests(Support_ServerSocket serversocket,
+			Support_HttpConnector client) {
+		this.serversocket = serversocket;
+		this.connector = client;
+	}
+
+	public void runTests(junit.framework.TestCase test) {
+
+		// get a port to use for the test
+		int portNumber = Support_PortManager.getNextPort();
+
+		// url's for the various tests
+		final String chunkedTestUrl = "http://localhost:" + portNumber
+				+ Support_HttpServer.CHUNKEDTEST;
+		final String contentTestUrl = "http://localhost:" + portNumber
+				+ Support_HttpServer.CONTENTTEST;
+		final String redirectTestUrl = "http://localhost:" + portNumber
+				+ Support_HttpServer.REDIRECTTEST;
+		final String postTestUrl = "http://localhost:" + portNumber
+				+ Support_HttpServer.POSTTEST;
+		final String headersTestUrl = "http://localhost:" + portNumber
+				+ Support_HttpServer.HEADERSTEST;
+
+		// start the test server. It will timeout and shut down after
+		// 5 seconds of inactivity
+		Support_HttpServer server = new Support_HttpServer(serversocket, test);
+		server.startServer(portNumber);
+
+		ByteArrayOutputStream bout = new ByteArrayOutputStream();
+		InputStream is;
+		int c;
+
+		// Chunked HTTP Transfer Coding Test
+		try {
+			// access the url and open a stream
+			connector.open(chunkedTestUrl);
+			is = connector.getInputStream();
+
+			// receive the data, and then read again after EOF
+			c = is.read();
+			while (c > 0)
+				c = is.read();
+			c = is.read();
+			is.close();
+			connector.close();
+			test.assertTrue("Error receiving chunked transfer coded data",
+					c == -1);
+		} catch (Exception e) {
+			e.printStackTrace();
+			test.fail("Exception during test a: " + e);
+		}
+
+		// Content-Length Test
+		try {
+			connector.open(contentTestUrl);
+			is = connector.getInputStream();
+			bout.reset();
+			do {
+				c = is.read();
+				if (c != -1)
+					bout.write(c);
+			} while (c != -1);
+			is.close();
+			connector.close();
+			String result = new String(bout.toByteArray(), "ISO8859_1");
+			test.assertTrue("Error receiving content coded data: " + result,
+					"ABCDE".equals(result));
+		} catch (Exception e) {
+			e.printStackTrace();
+			test.fail("Exception during test b: " + e);
+		}
+
+		// Headers Test
+		try {
+			connector.open(headersTestUrl);
+			connector.setRequestProperty("header1", "value1");
+			connector.setRequestProperty("header1", "value2");
+			int i = 0, found = 0;
+			String[] expected = new String[] { "no-cache=\"set-cookie\"",
+					"private", "no-transform" };
+			while (true) {
+				String key = connector.getHeaderFieldKey(i);
+				if (key == null && i > 0)
+					break;
+				if ("Cache-Control".equals(key)) {
+					test.assertTrue("Too many headers at: " + i, found <= 2);
+					String value = connector.getHeaderField(i);
+					test.assertTrue("Invalid header value: " + found + ": "
+							+ value, expected[found].equals(value));
+					found++;
+				}
+				i++;
+			}
+			test.assertTrue("Invalid headers: " + found, found == 3);
+			connector.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+			test.fail("Exception during test c: " + e);
+		}
+
+		// Post Test
+		// Same as "Basic post" test below, but uses read() instead
+		// of read(buf, offset, length) to read the results
+		try {
+			String toWrite = "abcdef";
+			connector.open(postTestUrl);
+			OutputStream out = connector.getOutputStream();
+			out.write(toWrite.getBytes("ISO8859_1"));
+			out.close();
+			is = connector.getInputStream();
+			bout.reset();
+			do {
+				c = is.read();
+				if (c != -1)
+					bout.write(c);
+			} while (c != -1);
+			is.close();
+			connector.close();
+			String result = new String(bout.toByteArray(), "ISO8859_1");
+			test.assertTrue("Error sending data 1: " + result, toWrite
+					.equals(result));
+		} catch (Exception e) {
+			e.printStackTrace();
+			test.fail("Exception during test d: " + e);
+		}
+
+		// Post Test chunked
+		try {
+			String toWrite = "zyxwvuts";
+			connector.open(postTestUrl);
+			connector.setRequestProperty("Transfer-encoding", "chunked");
+			OutputStream out = connector.getOutputStream();
+			out.write(toWrite.getBytes("ISO8859_1"));
+			out.close();
+			is = connector.getInputStream();
+			bout.reset();
+			do {
+				c = is.read();
+				if (c != -1)
+					bout.write(c);
+			} while (c != -1);
+			is.close();
+			connector.close();
+			String result = new String(bout.toByteArray(), "ISO8859_1");
+			test.assertTrue("Error sending data 2: " + result, ("C" + toWrite)
+					.equals(result));
+		} catch (Exception e) {
+			e.printStackTrace();
+			test.fail("Exception during test e: " + e);
+		}
+
+		OutputStream os = null;
+
+		byte[] data = new byte[1024];
+		int len = 0;
+
+		// Basic post
+		try {
+			String message = "test";
+			connector.open(postTestUrl);
+			os = connector.getOutputStream();
+			os.write(message.getBytes("ISO8859_1"));
+			os.close();
+			is = connector.getInputStream();
+			len = 0;
+			do {
+				int r = is.read(data, len, data.length - len);
+				if (r == -1)
+					break;
+				len += r;
+			} while (true);
+			is.close();
+			connector.close();
+			String result = new String(data, 0, len, "ISO8859_1");
+			test.assertTrue("Basic port error: " + result, message
+					.equals(result));
+		} catch (IOException e) {
+			e.printStackTrace();
+			test.fail("Exception during basic post test: " + e);
+		}
+
+		String chunkChar = connector.isChunkedOnFlush() ? "C" : "";
+
+		// Flushing with post
+		try {
+			String message1 = "test2", message2 = "test3";
+			connector.open(postTestUrl);
+			os = connector.getOutputStream();
+			os.write(message1.getBytes("ISO8859_1"));
+			os.flush();
+			os.write(message2.getBytes("ISO8859_1"));
+			os.close();
+			is = connector.getInputStream();
+			len = 0;
+			do {
+				int r = is.read(data, len, data.length - len);
+				if (r == -1)
+					break;
+				len += r;
+			} while (true);
+			is.close();
+			connector.close();
+			String result = new String(data, 0, len, "ISO8859_1");
+			test.assertTrue("Flushing with post: " + result, (chunkChar
+					+ message1 + chunkChar + message2).equals(result));
+		} catch (IOException e) {
+			e.printStackTrace();
+			test.fail("Exception during flushing post test: " + e);
+		}
+
+		// Flushing with post and setting content-length
+		try {
+			String message1 = "test4", message2 = "test5";
+			connector.open(postTestUrl);
+			connector.setRequestProperty("Content-Length", "10");
+			os = connector.getOutputStream();
+			os.write(message1.getBytes());
+			os.flush();
+			os.write(message2.getBytes());
+			os.close();
+			is = connector.getInputStream();
+			len = 0;
+			do {
+				int r = is.read(data, len, data.length - len);
+				if (r == -1)
+					break;
+				len += r;
+			} while (true);
+			is.close();
+			connector.close();
+			String result = new String(data, 0, len, "ISO8859_1");
+			test.assertTrue("Flushing with post and setting content-length: "
+					+ result, (chunkChar + message1 + chunkChar + message2)
+					.equals(result));
+		} catch (IOException e) {
+			e.printStackTrace();
+			test
+					.fail("Exception during flushing with content-length post test: "
+							+ e);
+		}
+
+		// Flushing followed immediately by a close()
+		try {
+			String message = "test6";
+			connector.open(postTestUrl);
+			os = connector.getOutputStream();
+			os.write(message.getBytes("ISO8859_1"));
+			os.flush();
+			os.close();
+			is = connector.getInputStream();
+			len = 0;
+			do {
+				int r = is.read(data, len, data.length - len);
+				if (r == -1)
+					break;
+				len += r;
+			} while (true);
+			is.close();
+			connector.close();
+			String result = new String(data, 0, len, "ISO8859_1");
+			test.assertTrue("Flushing followed immediately by a close(): "
+					+ result, (chunkChar + message).equals(result));
+		} catch (IOException e) {
+			e.printStackTrace();
+			test.fail("Exception during flush followed by close post test: "
+					+ e);
+		}
+
+		// Redirection Tests
+		final int[] testCodes = { Support_HttpServer.MULT_CHOICE,
+				Support_HttpServer.MOVED_PERM, Support_HttpServer.FOUND,
+				Support_HttpServer.SEE_OTHER, Support_HttpServer.NOT_MODIFIED,
+				Support_HttpServer.UNUSED, Support_HttpServer.TEMP_REDIRECT, };
+
+		final int[] results = { 'A', 'A', 'A', 'A', 'P', 'P', 'P' };
+		// see Support_HTTPServer for the source of this data
+
+		final String fullLocalLocation = contentTestUrl;
+		final String partLocalLocation = Support_HttpServer.CONTENTTEST;
+
+		for (int i = 0; i < testCodes.length; i++) {
+
+			// test each of the redirection response codes
+			try {
+				// append the response code for the server to return
+				// and the location to redirect to
+				connector.open(redirectTestUrl + "/" + testCodes[i] + "-"
+						+ fullLocalLocation);
+				is = connector.getInputStream();
+				connector.close();
+
+				c = is.read();
+
+				if (testCodes[i] == Support_HttpServer.NOT_MODIFIED) {
+					// accept either the message-body or nothing, since the spec
+					// says there MUST NOT be a message body on 304 responses.
+					// But Java returns the message-body
+					if (!(c == results[i] || c == -1)) {
+						test
+								.fail("Incorrect data returned on test of HTTP response "
+										+ testCodes[i]);
+					}
+				} else if (c != results[i]) {
+					test
+							.fail("Incorrect data returned on test of HTTP response "
+									+ testCodes[i]);
+				}
+				while (c > 0)
+					c = is.read();
+				c = is.read();
+				is.close();
+			} catch (Exception e) {
+				e.printStackTrace();
+				test.fail("Error during redirection test " + i + ": " + e);
+			}
+		}
+
+		// Test redirecting to a location on a different port
+		Class serversocketclass = serversocket.getClass();
+		try {
+			Support_ServerSocket serversocket2 = (Support_ServerSocket) serversocketclass
+					.newInstance();
+
+			Support_HttpServer server2 = new Support_HttpServer(serversocket2,
+					test);
+			int newport = Support_PortManager.getNextPort();
+			server2.startServer(newport);
+			server2.setPortRedirectTestEnable(true);
+
+			// Test if redirection to a different port works
+			final String otherPortLocation = "http://localhost:" + newport
+					+ Support_HttpServer.PORTREDIRTEST;
+
+			try {
+				// append the response code for the server to return
+				// and the location to redirect to
+
+				connector.open(redirectTestUrl + "/"
+						+ Support_HttpServer.MOVED_PERM + "-"
+						+ otherPortLocation);
+				is = connector.getInputStream();
+				connector.close();
+
+				c = is.read();
+				test
+						.assertTrue(
+								"Incorrect data returned on redirection to a different port.",
+								c == 'A');
+				while (c > 0)
+					c = is.read();
+				c = is.read();
+				is.close();
+			} catch (Exception e) {
+				e.printStackTrace();
+				test.fail("Exception during test f: " + e);
+			}
+			server2.stopServer();
+		} catch (IllegalAccessException e) {
+			test.fail("Exception during redirection to a different port:" + e);
+		} catch (InstantiationException e) {
+			test.fail("Exception during redirection to a different port:" + e);
+		}
+
+		// test redirecting to a relative URL on the same host
+		try {
+			// append the response code for the server to return
+			connector.open(redirectTestUrl + "/"
+					+ Support_HttpServer.MOVED_PERM + "-" + partLocalLocation);
+			is = connector.getInputStream();
+			connector.close();
+
+			c = is.read();
+			test.assertTrue(
+					"Incorrect data returned on redirect to relative URI.",
+					c == 'A');
+			while (c > 0)
+				c = is.read();
+			c = is.read();
+			is.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+			test.fail("Exception during redirection test to a relative URL: "
+					+ e);
+		}
+		server.stopServer();
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ListTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ListTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ListTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ListTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,214 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.NoSuchElementException;
+
+public class Support_ListTest extends junit.framework.TestCase {
+
+	List list; // must contain the Integers 0 to 99 in order
+
+	public Support_ListTest(String p1) {
+		super(p1);
+	}
+
+	public Support_ListTest(String p1, List l) {
+		super(p1);
+		list = l;
+	}
+
+	public void runTest() {
+		int hashCode = 1;
+		for (int counter = 0; counter < 100; counter++) {
+			Object elem;
+			elem = list.get(counter);
+			hashCode = 31 * hashCode + elem.hashCode();
+			assertTrue("ListTest - get failed", elem
+					.equals(new Integer(counter)));
+		}
+		assertTrue("ListTest - hashCode failed", hashCode == list.hashCode());
+
+		list.add(50, new Integer(1000));
+		assertTrue("ListTest - a) add with index failed--did not insert", list
+				.get(50).equals(new Integer(1000)));
+		assertTrue(
+				"ListTest - b) add with index failed--did not move following elements",
+				list.get(51).equals(new Integer(50)));
+		assertTrue(
+				"ListTest - c) add with index failed--affected previous elements",
+				list.get(49).equals(new Integer(49)));
+
+		list.set(50, new Integer(2000));
+		assertTrue("ListTest - a) set failed--did not set", list.get(50)
+				.equals(new Integer(2000)));
+		assertTrue("ListTest - b) set failed--affected following elements",
+				list.get(51).equals(new Integer(50)));
+		assertTrue("ListTest - c) set failed--affected previous elements", list
+				.get(49).equals(new Integer(49)));
+
+		list.remove(50);
+		assertTrue("ListTest - a) remove with index failed--did not remove",
+				list.get(50).equals(new Integer(50)));
+		assertTrue(
+				"ListTest - b) remove with index failed--did not move following elements",
+				list.get(51).equals(new Integer(51)));
+		assertTrue(
+				"ListTest - c) remove with index failed--affected previous elements",
+				list.get(49).equals(new Integer(49)));
+
+		List myList = new LinkedList();
+		myList.add(new Integer(500));
+		myList.add(new Integer(501));
+		myList.add(new Integer(502));
+
+		list.addAll(50, myList);
+		assertTrue("ListTest - a) addAll with index failed--did not insert",
+				list.get(50).equals(new Integer(500)));
+		assertTrue("ListTest - b) addAll with index failed--did not insert",
+				list.get(51).equals(new Integer(501)));
+		assertTrue("ListTest - c) addAll with index failed--did not insert",
+				list.get(52).equals(new Integer(502)));
+		assertTrue(
+				"ListTest - d) addAll with index failed--did not move following elements",
+				list.get(53).equals(new Integer(50)));
+		assertTrue(
+				"ListTest - e) addAll with index failed--affected previous elements",
+				list.get(49).equals(new Integer(49)));
+
+		List mySubList = list.subList(50, 53);
+		assertTrue(mySubList.size() == 3);
+		assertTrue(
+				"ListTest - a) sublist Failed--does not contain correct elements",
+				mySubList.get(0).equals(new Integer(500)));
+		assertTrue(
+				"ListTest - b) sublist Failed--does not contain correct elements",
+				mySubList.get(1).equals(new Integer(501)));
+		assertTrue(
+				"ListTest - c) sublist Failed--does not contain correct elements",
+				mySubList.get(2).equals(new Integer(502)));
+
+		t_listIterator(mySubList);
+
+		mySubList.clear();
+		assertTrue(
+				"ListTest - Clearing the sublist did not remove the appropriate elements from the original list",
+				list.size() == 100);
+
+		t_listIterator(list);
+		ListIterator li = list.listIterator();
+		for (int counter = 0; li.hasNext(); counter++) {
+			Object elem;
+			elem = li.next();
+			assertTrue("ListTest - listIterator failed", elem
+					.equals(new Integer(counter)));
+		}
+
+		new Support_CollectionTest("", list).runTest();
+
+	}
+
+	public void t_listIterator(List list) {
+		ListIterator li = list.listIterator(1);
+		assertTrue("listIterator(1)", li.next() == list.get(1));
+
+		int orgSize = list.size();
+		li = list.listIterator();
+		for (int i = 0; i <= orgSize; i++) {
+			if (i == 0)
+				assertTrue("list iterator hasPrevious(): " + i, !li
+						.hasPrevious());
+			else
+				assertTrue("list iterator hasPrevious(): " + i, li
+						.hasPrevious());
+			if (i == list.size())
+				assertTrue("list iterator hasNext(): " + i, !li.hasNext());
+			else
+				assertTrue("list iterator hasNext(): " + i, li.hasNext());
+			assertTrue("list iterator nextIndex(): " + i, li.nextIndex() == i);
+			assertTrue("list iterator previousIndex(): " + i, li
+					.previousIndex() == i - 1);
+			boolean exception = false;
+			try {
+				assertTrue("list iterator next(): " + i, li.next() == list
+						.get(i));
+			} catch (NoSuchElementException e) {
+				exception = true;
+			}
+			if (i == list.size())
+				assertTrue("list iterator next() exception: " + i, exception);
+			else
+				assertTrue("list iterator next() exception: " + i, !exception);
+		}
+
+		for (int i = orgSize - 1; i >= 0; i--) {
+			assertTrue("list iterator previous(): " + i, li.previous() == list
+					.get(i));
+			assertTrue("list iterator nextIndex()2: " + i, li.nextIndex() == i);
+			assertTrue("list iterator previousIndex()2: " + i, li
+					.previousIndex() == i - 1);
+			if (i == 0)
+				assertTrue("list iterator hasPrevious()2: " + i, !li
+						.hasPrevious());
+			else
+				assertTrue("list iterator hasPrevious()2: " + i, li
+						.hasPrevious());
+			assertTrue("list iterator hasNext()2: " + i, li.hasNext());
+		}
+		boolean exception = false;
+		try {
+			li.previous();
+		} catch (NoSuchElementException e) {
+			exception = true;
+		}
+		assertTrue("list iterator previous() exception", exception);
+
+		Integer add1 = new Integer(600);
+		Integer add2 = new Integer(601);
+		li.add(add1);
+		assertTrue("list iterator add(), size()", list.size() == (orgSize + 1));
+		assertTrue("list iterator add(), nextIndex()", li.nextIndex() == 1);
+		assertTrue("list iterator add(), previousIndex()",
+				li.previousIndex() == 0);
+		Object next = li.next();
+		assertTrue("list iterator add(), next(): " + next, next == list.get(1));
+		li.add(add2);
+		Object previous = li.previous();
+		assertTrue("list iterator add(), previous(): " + previous,
+				previous == add2);
+		assertTrue("list iterator add(), nextIndex()2", li.nextIndex() == 2);
+		assertTrue("list iterator add(), previousIndex()2",
+				li.previousIndex() == 1);
+
+		li.remove();
+		assertTrue("list iterator remove(), size()",
+				list.size() == (orgSize + 1));
+		assertTrue("list iterator remove(), nextIndex()", li.nextIndex() == 2);
+		assertTrue("list iterator remove(), previousIndex()", li
+				.previousIndex() == 1);
+		assertTrue("list iterator previous()2", li.previous() == list.get(1));
+		assertTrue("list iterator previous()3", li.previous() == list.get(0));
+		assertTrue("list iterator next()2", li.next() == list.get(0));
+		li.remove();
+		assertTrue("list iterator hasPrevious()3", !li.hasPrevious());
+		assertTrue("list iterator hasNext()3", li.hasNext());
+		assertTrue("list iterator size()", list.size() == orgSize);
+		assertTrue("list iterator nextIndex()3", li.nextIndex() == 0);
+		assertTrue("list iterator previousIndex()3", li.previousIndex() == -1);
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MapTest2.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MapTest2.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MapTest2.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MapTest2.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,62 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.util.Map;
+
+public class Support_MapTest2 extends junit.framework.TestCase {
+
+	Map map;
+
+	public Support_MapTest2(Map m) {
+		super();
+		map = m;
+		if (!map.isEmpty()) {
+			fail("Map must be empty");
+		}
+	}
+
+	public void runTest() {
+		try {
+			map.put("one", "1");
+			assertTrue("size should be one", map.size() == 1);
+			map.clear();
+			assertTrue("size should be zero", map.size() == 0);
+			assertTrue("Should not have entries", !map.entrySet().iterator()
+					.hasNext());
+			assertTrue("Should not have keys", !map.keySet().iterator()
+					.hasNext());
+			assertTrue("Should not have values", !map.values().iterator()
+					.hasNext());
+		} catch (UnsupportedOperationException e) {
+		}
+
+		try {
+			map.put("one", "1");
+			assertTrue("size should be one", map.size() == 1);
+			map.remove("one");
+			assertTrue("size should be zero", map.size() == 0);
+			assertTrue("Should not have entries", !map.entrySet().iterator()
+					.hasNext());
+			assertTrue("Should not have keys", !map.keySet().iterator()
+					.hasNext());
+			assertTrue("Should not have values", !map.values().iterator()
+					.hasNext());
+		} catch (UnsupportedOperationException e) {
+		}
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MessageFormat.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MessageFormat.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MessageFormat.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_MessageFormat.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,116 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.text.DateFormat;
+import java.text.MessageFormat;
+import java.text.NumberFormat;
+import java.text.MessageFormat.Field;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import java.util.Vector;
+
+public class Support_MessageFormat extends Support_Format {
+
+	public Support_MessageFormat(String p1) {
+		super(p1);
+	}
+
+	public void runTest() {
+		t_formatToCharacterIterator();
+		t_format_with_FieldPosition();
+	}
+
+	public static void main(String[] args) {
+		new Support_MessageFormat("").runTest();
+	}
+
+	public void t_format_with_FieldPosition() {
+
+		String pattern = "On {4,date} at {3,time}, he ate {2,number, integer} hamburger{2,choice,1#|1<s} and drank {1, number} litres of coke. That was {0,choice,1#just enough|1<more than enough} food!";
+		MessageFormat format = new MessageFormat(pattern, Locale.US);
+
+		Date date = new GregorianCalendar(2005, 1, 28, 14, 20, 16).getTime();
+		Integer hamburgers = new Integer(8);
+		Object[] objects = new Object[] { hamburgers, new Double(3.5),
+				hamburgers, date, date };
+
+		super.text = "On Feb 28, 2005 at 2:20:16 PM, he ate 8 hamburgers and drank 3.5 litres of coke. That was more than enough food!";
+
+		// test with MessageFormat.Field.ARGUMENT
+		t_FormatWithField(1, format, objects, null, Field.ARGUMENT, 3, 15);
+
+		// test other format fields that are included in the formatted text
+		t_FormatWithField(2, format, objects, null, DateFormat.Field.AM_PM, 0,
+				0);
+		t_FormatWithField(3, format, objects, null,
+				NumberFormat.Field.FRACTION, 0, 0);
+
+		// test fields that are not included in the formatted text
+		t_FormatWithField(4, format, objects, null, DateFormat.Field.ERA, 0, 0);
+		t_FormatWithField(5, format, objects, null,
+				NumberFormat.Field.EXPONENT_SIGN, 0, 0);
+	}
+
+	public void t_formatToCharacterIterator() {
+
+		String pattern = "On {4,date} at {3,time}, he ate {2,number, integer} hamburger{2,choice,1#|1<s} and drank {1, number} litres of coke. That was {0,choice,1#just enough|1<more than enough} food!";
+		MessageFormat format = new MessageFormat(pattern, Locale.US);
+
+		Date date = new GregorianCalendar(2005, 1, 28, 14, 20, 16).getTime();
+		Integer hamburgers = new Integer(8);
+		Object[] objects = new Object[] { hamburgers, new Double(3.5),
+				hamburgers, date, date };
+
+		t_Format(1, objects, format, getMessageVector1());
+	}
+
+	private Vector getMessageVector1() {
+		Vector v = new Vector();
+		v.add(new FieldContainer(3, 6, Field.ARGUMENT, 4));
+		v.add(new FieldContainer(3, 6, DateFormat.Field.MONTH));
+		v.add(new FieldContainer(6, 7, Field.ARGUMENT, 4));
+		v.add(new FieldContainer(7, 9, Field.ARGUMENT, 4));
+		v.add(new FieldContainer(7, 9, DateFormat.Field.DAY_OF_MONTH));
+		v.add(new FieldContainer(9, 11, Field.ARGUMENT, 4));
+		v.add(new FieldContainer(11, 15, Field.ARGUMENT, 4));
+		v.add(new FieldContainer(11, 15, DateFormat.Field.YEAR));
+		v.add(new FieldContainer(19, 20, Field.ARGUMENT, 3));
+		v.add(new FieldContainer(19, 20, DateFormat.Field.HOUR1));
+		v.add(new FieldContainer(20, 21, Field.ARGUMENT, 3));
+		v.add(new FieldContainer(21, 23, Field.ARGUMENT, 3));
+		v.add(new FieldContainer(21, 23, DateFormat.Field.MINUTE));
+		v.add(new FieldContainer(23, 24, Field.ARGUMENT, 3));
+		v.add(new FieldContainer(24, 26, Field.ARGUMENT, 3));
+		v.add(new FieldContainer(24, 26, DateFormat.Field.SECOND));
+		v.add(new FieldContainer(26, 27, Field.ARGUMENT, 3));
+		v.add(new FieldContainer(27, 29, Field.ARGUMENT, 3));
+		v.add(new FieldContainer(27, 29, DateFormat.Field.AM_PM));
+		v.add(new FieldContainer(38, 39, Field.ARGUMENT, 2));
+		v.add(new FieldContainer(38, 39, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(49, 50, Field.ARGUMENT, 2));
+		v.add(new FieldContainer(61, 62, Field.ARGUMENT, 1));
+		v.add(new FieldContainer(61, 62, NumberFormat.Field.INTEGER));
+		v.add(new FieldContainer(62, 63, Field.ARGUMENT, 1));
+		v.add(new FieldContainer(62, 63, NumberFormat.Field.DECIMAL_SEPARATOR));
+		v.add(new FieldContainer(63, 64, Field.ARGUMENT, 1));
+		v.add(new FieldContainer(63, 64, NumberFormat.Field.FRACTION));
+		v.add(new FieldContainer(90, 106, Field.ARGUMENT, 0));
+		return v;
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_NetworkInterface.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_NetworkInterface.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_NetworkInterface.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_NetworkInterface.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,45 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package tests.support;
+
+
+import java.net.NetworkInterface;
+
+public class Support_NetworkInterface {
+
+	/**
+	 * On windows platforms with IPV6 enabled there are a number of pseudo
+	 * interfaces which don't work with our tests. This function is called to
+	 * make sure we only use the non-pseudo interfaces
+	 */
+	public static boolean useInterface(NetworkInterface theInterface) {
+		boolean result = true;
+		String platform = System.getProperty("os.name");
+		// only use these on windows platforms
+		if (platform.startsWith("Windows")) {
+			if ((theInterface.getDisplayName()
+					.equals("Teredo Tunneling Pseudo-Interface"))
+					|| (theInterface.getDisplayName()
+							.equals("6to4 Tunneling Pseudo-Interface"))
+					|| (theInterface.getDisplayName()
+							.equals("Automatic Tunneling Pseudo-Interface"))
+					|| (theInterface.getDisplayName()
+							.equals("Loopback Pseudo-Interface"))) {
+				result = false;
+			}
+		}
+		return result;
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PlatformFile.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PlatformFile.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PlatformFile.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PlatformFile.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,34 @@
+/* Copyright 2002, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public class Support_PlatformFile {
+
+	private static String platformId = null;
+
+	public static String getNewPlatformFile(String pre, String post) {
+		if (platformId == null) {
+			String property = System.getProperty("com.ibm.oti.configuration");
+			if (property == null) {
+				property = "JDK";
+			}
+			platformId = property
+					+ System.getProperty("java.vm.version").replace('.', '-');
+		}
+		return pre + platformId + post;
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PortManager.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PortManager.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PortManager.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_PortManager.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,41 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.util.Date;
+
+public class Support_PortManager extends java.lang.Object {
+
+	private static int lastAssignedPort = somewhatRandomPort();
+
+	public static synchronized int getNextPort() {
+		if (++lastAssignedPort > 65534)
+			lastAssignedPort = 6000;
+		return lastAssignedPort;
+	}
+
+	/*
+	 * Returns a different port number every 6 seconds or so. The port number
+	 * should be about += 100 at each 6 second interval
+	 */
+	private static int somewhatRandomPort() {
+		Date date = new Date();
+		int minutes = date.getMinutes();
+		int seconds = date.getSeconds();
+		return 6000 + (1000 * minutes) + ((seconds / 6) * 100);
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProcessReadWriteTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProcessReadWriteTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProcessReadWriteTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ProcessReadWriteTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,46 @@
+/* Copyright 2002, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+public class Support_ProcessReadWriteTest {
+
+	public static void main(String[] args) {
+		try {
+			FileInputStream input = new FileInputStream(FileDescriptor.in);
+			FileOutputStream output = new FileOutputStream(FileDescriptor.out);
+
+			// read just three lines since EOF isn't working properly. It would
+			// be better to read to the end and echo it all
+			for (int i = 0; i < 3; i++) {
+				int c = input.read();
+				while (c != '\n') {
+					output.write(c);
+					c = input.read();
+				}
+				output.write(c);
+			}
+			input.close();
+			output.close();
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_I1.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_I1.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_I1.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_I1.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,26 @@
+/* Copyright 2001, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public interface Support_Proxy_I1 {
+	boolean equals(Object o);
+
+	int[] array(long[] f);
+
+	void foo(int i, boolean b);
+
+	String string(String s) throws Support_Proxy_ParentException, LinkageError;
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_I2.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_I2.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_I2.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_I2.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,25 @@
+/* Copyright 2001, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public interface Support_Proxy_I2 {
+
+	int[] array(long[] f);
+
+	void foo(boolean b, int i);
+
+	String string(String s) throws Support_Proxy_SubException, Error;
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_ParentException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_ParentException.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_ParentException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_ParentException.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,20 @@
+/* Copyright 2001, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public class Support_Proxy_ParentException extends Exception {
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_SubException.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_SubException.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_SubException.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Proxy_SubException.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,20 @@
+/* Copyright 2001, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public class Support_Proxy_SubException extends Support_Proxy_ParentException {
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ServerSocket.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ServerSocket.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ServerSocket.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_ServerSocket.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,35 @@
+/* Copyright 2002, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.IOException;
+
+/**
+ * The interface for a generic server socket.
+ * 
+ */
+public interface Support_ServerSocket {
+
+	public Support_Socket accept() throws IOException;
+
+	public void setTimeout(int timeout);
+
+	public void setPort(int port);
+
+	public void open() throws IOException;
+
+	public void close() throws IOException;
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SetTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SetTest.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SetTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SetTest.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,45 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.util.Set;
+
+public class Support_SetTest extends junit.framework.TestCase {
+
+	Set set; // must contain only the Integers 0 to 99
+
+	public Support_SetTest(String p1) {
+		super(p1);
+	}
+
+	public Support_SetTest(String p1, Set s) {
+		super(p1);
+		set = s;
+	}
+
+	public void runTest() {
+		// add
+		assertTrue("Set Test - Adding a duplicate element changed the set",
+				!set.add(new Integer(50)));
+		assertTrue("Set Test - Removing an element did not change the set", set
+				.remove(new Integer(50)));
+		assertTrue(
+				"Set Test - Adding and removing a duplicate element failed to remove it",
+				!set.contains(new Integer(50)));
+		set.add(new Integer(50));
+		new Support_CollectionTest("", set).runTest();
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SimpleDateFormat.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SimpleDateFormat.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SimpleDateFormat.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_SimpleDateFormat.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,259 @@
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.text.DateFormat;
+import java.text.NumberFormat;
+import java.text.SimpleDateFormat;
+import java.text.DateFormat.Field;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+import java.util.Vector;
+
+public class Support_SimpleDateFormat extends Support_Format {
+
+	public Support_SimpleDateFormat(String p1) {
+		super(p1);
+	}
+
+	public void runTest() {
+		t_formatToCharacterIterator();
+		t_format_with_FieldPosition();
+	}
+
+	public static void main(String[] args) {
+		new Support_SimpleDateFormat("").runTest();
+	}
+
+	public void t_format_with_FieldPosition() {
+		TimeZone tz = TimeZone.getTimeZone("EST");
+		Calendar cal = new GregorianCalendar(tz);
+		cal.set(1999, Calendar.SEPTEMBER, 13, 17, 19, 01);
+		cal.set(Calendar.MILLISECOND, 0);
+		Date date = cal.getTime();
+		SimpleDateFormat format = (SimpleDateFormat) DateFormat
+				.getDateInstance();
+		format.setTimeZone(tz);
+
+		// test with all pattern chars, and multiple occurances
+		format
+				.applyPattern("G GGGG y yy yyyy M MM MMM MMMM d dd ddd k kk kkk H HH HHH h hh hhh m mmm s ss sss S SS SSS EE EEEE D DD DDD F FF w www W WWW a  aaa  K KKK z zzzz Z ZZZZ");
+
+		StringBuffer textbuffer = new StringBuffer(
+				"AD AD 99 99 1999 9 09 Sep September 13 13 013 17 17 017 17 17 017 5 05");
+		textbuffer
+				.append(" 005 19 019 1 01 001 0 00 000 Mon Monday 256 256 256 2 02 38 038 3 003 PM");
+		textbuffer.append("  PM  5 005 EDT Eastern Daylight Time -0400 -0400");
+
+		// to avoid passing the huge Stringbuffer each time.
+		super.text = textbuffer.toString();
+
+		// test if field positions are set correctly for these fields occuring
+		// multiple times.
+		t_FormatWithField(0, format, date, null, Field.ERA, 0, 2);
+		t_FormatWithField(1, format, date, null, Field.YEAR, 6, 8);
+		t_FormatWithField(2, format, date, null, Field.MONTH, 17, 18);
+		t_FormatWithField(3, format, date, null, Field.DAY_OF_MONTH, 36, 38);
+		t_FormatWithField(4, format, date, null, Field.HOUR_OF_DAY1, 46, 48);
+		t_FormatWithField(5, format, date, null, Field.HOUR_OF_DAY0, 56, 58);
+		t_FormatWithField(6, format, date, null, Field.HOUR1, 66, 67);
+		t_FormatWithField(7, format, date, null, Field.MINUTE, 75, 77);
+		t_FormatWithField(8, format, date, null, Field.SECOND, 82, 83);
+		t_FormatWithField(9, format, date, null, Field.MILLISECOND, 91, 92);
+		t_FormatWithField(10, format, date, null, Field.DAY_OF_WEEK, 100, 103);
+		t_FormatWithField(11, format, date, null, Field.DAY_OF_YEAR, 111, 114);
+		t_FormatWithField(12, format, date, null, Field.DAY_OF_WEEK_IN_MONTH,
+				123, 124);
+		t_FormatWithField(13, format, date, null, Field.WEEK_OF_YEAR, 128, 130);
+		t_FormatWithField(14, format, date, null, Field.WEEK_OF_MONTH, 135, 136);
+		t_FormatWithField(15, format, date, null, Field.AM_PM, 141, 143);
+		t_FormatWithField(16, format, date, null, Field.HOUR0, 149, 150);
+		t_FormatWithField(17, format, date, null, Field.TIME_ZONE, 155, 158);
+
+		// test fields that are not included in the formatted text
+		t_FormatWithField(18, format, date, null,
+				NumberFormat.Field.EXPONENT_SIGN, 0, 0);
+
+		// test with simple example
+		format.applyPattern("h:m z");
+
+		super.text = "5:19 EDT";
+		t_FormatWithField(21, format, date, null, Field.HOUR1, 0, 1);
+		t_FormatWithField(22, format, date, null, Field.MINUTE, 2, 4);
+		t_FormatWithField(23, format, date, null, Field.TIME_ZONE, 5, 8);
+
+		// test fields that are not included in the formatted text
+
+		t_FormatWithField(24, format, date, null, Field.ERA, 0, 0);
+		t_FormatWithField(25, format, date, null, Field.YEAR, 0, 0);
+		t_FormatWithField(26, format, date, null, Field.MONTH, 0, 0);
+		t_FormatWithField(27, format, date, null, Field.DAY_OF_MONTH, 0, 0);
+		t_FormatWithField(28, format, date, null, Field.HOUR_OF_DAY1, 0, 0);
+		t_FormatWithField(29, format, date, null, Field.HOUR_OF_DAY0, 0, 0);
+		t_FormatWithField(30, format, date, null, Field.SECOND, 0, 0);
+		t_FormatWithField(31, format, date, null, Field.MILLISECOND, 0, 0);
+		t_FormatWithField(32, format, date, null, Field.DAY_OF_WEEK, 0, 0);
+		t_FormatWithField(33, format, date, null, Field.DAY_OF_YEAR, 0, 0);
+		t_FormatWithField(34, format, date, null, Field.DAY_OF_WEEK_IN_MONTH,
+				0, 0);
+		t_FormatWithField(35, format, date, null, Field.WEEK_OF_YEAR, 0, 0);
+		t_FormatWithField(36, format, date, null, Field.WEEK_OF_MONTH, 0, 0);
+		t_FormatWithField(37, format, date, null, Field.AM_PM, 0, 0);
+		t_FormatWithField(38, format, date, null, Field.HOUR0, 0, 0);
+
+		t_FormatWithField(39, format, date, null, NumberFormat.Field.EXPONENT,
+				0, 0);
+
+		// test with simple example with pattern char Z
+		format.applyPattern("h:m Z z");
+		super.text = "5:19 -0400 EDT";
+		t_FormatWithField(40, format, date, null, Field.HOUR1, 0, 1);
+		t_FormatWithField(41, format, date, null, Field.MINUTE, 2, 4);
+		t_FormatWithField(42, format, date, null, Field.TIME_ZONE, 5, 10);
+	}
+
+	public void t_formatToCharacterIterator() {
+		TimeZone tz = TimeZone.getTimeZone("EST");
+		Calendar cal = new GregorianCalendar(tz);
+		cal.set(1999, Calendar.SEPTEMBER, 13, 17, 19, 01);
+		cal.set(Calendar.MILLISECOND, 0);
+		Date date = cal.getTime();
+		SimpleDateFormat format = (SimpleDateFormat) DateFormat
+				.getDateInstance();
+		format.setTimeZone(tz);
+
+		format.applyPattern("yyyyMMddHHmmss");
+		t_Format(1, date, format, getDateVector1());
+
+		format.applyPattern("w W dd MMMM yyyy EEEE");
+		t_Format(2, date, format, getDateVector2());
+
+		format.applyPattern("h:m z");
+		t_Format(3, date, format, getDateVector3());
+
+		format.applyPattern("h:m Z");
+		t_Format(5, date, format, getDateVector5());
+
+		// with all pattern chars, and multiple occurances
+		format
+				.applyPattern("G GGGG y yy yyyy M MM MMM MMMM d dd ddd k kk kkk H HH HHH h hh hhh m mmm s ss sss S SS SSS EE EEEE D DD DDD F FF w www W WWW a  aaa  K KKK z zzzz Z ZZZZ");
+		t_Format(4, date, format, getDateVector4());
+	}
+
+	private Vector getDateVector1() {
+		// "19990913171901"
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 4, Field.YEAR));
+		v.add(new FieldContainer(4, 6, Field.MONTH));
+		v.add(new FieldContainer(6, 8, Field.DAY_OF_MONTH));
+		v.add(new FieldContainer(8, 10, Field.HOUR_OF_DAY0));
+		v.add(new FieldContainer(10, 12, Field.MINUTE));
+		v.add(new FieldContainer(12, 14, Field.SECOND));
+		return v;
+	}
+
+	private Vector getDateVector2() {
+		// "12 3 5 March 2002 Monday"
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 2, Field.WEEK_OF_YEAR));
+		v.add(new FieldContainer(3, 4, Field.WEEK_OF_MONTH));
+		v.add(new FieldContainer(5, 7, Field.DAY_OF_MONTH));
+		v.add(new FieldContainer(8, 17, Field.MONTH));
+		v.add(new FieldContainer(18, 22, Field.YEAR));
+		v.add(new FieldContainer(23, 29, Field.DAY_OF_WEEK));
+		return v;
+	}
+
+	private Vector getDateVector3() {
+		// "5:19 EDT"
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 1, Field.HOUR1));
+		v.add(new FieldContainer(2, 4, Field.MINUTE));
+		v.add(new FieldContainer(5, 8, Field.TIME_ZONE));
+		return v;
+	}
+
+	private Vector getDateVector5() {
+		// "5:19 -0400"
+		Vector v = new Vector();
+		v.add(new FieldContainer(0, 1, Field.HOUR1));
+		v.add(new FieldContainer(2, 4, Field.MINUTE));
+		v.add(new FieldContainer(5, 10, Field.TIME_ZONE));
+		return v;
+	}
+
+	private Vector getDateVector4() {
+		Vector v = new Vector();
+
+		// "AD AD 99 99 1999 9 09 Sep September 13 13 013 17 17 017 17 17 017 5
+		// 05
+		// 005 19 019 1 01 001 0 00 000 Mon Monday 256 256 256 2 02 38 038 3 003
+		// PM
+		// PM 5 005 EDT Eastern Daylight Time -0400 -0400"
+		v.add(new FieldContainer(0, 2, Field.ERA));
+		v.add(new FieldContainer(3, 5, Field.ERA));
+		v.add(new FieldContainer(6, 8, Field.YEAR));
+		v.add(new FieldContainer(9, 11, Field.YEAR));
+		v.add(new FieldContainer(12, 16, Field.YEAR));
+		v.add(new FieldContainer(17, 18, Field.MONTH));
+		v.add(new FieldContainer(19, 21, Field.MONTH));
+		v.add(new FieldContainer(22, 25, Field.MONTH));
+		v.add(new FieldContainer(26, 35, Field.MONTH));
+		v.add(new FieldContainer(36, 38, Field.DAY_OF_MONTH));
+		v.add(new FieldContainer(39, 41, Field.DAY_OF_MONTH));
+		v.add(new FieldContainer(42, 45, Field.DAY_OF_MONTH));
+		v.add(new FieldContainer(46, 48, Field.HOUR_OF_DAY1));
+		v.add(new FieldContainer(49, 51, Field.HOUR_OF_DAY1));
+		v.add(new FieldContainer(52, 55, Field.HOUR_OF_DAY1));
+		v.add(new FieldContainer(56, 58, Field.HOUR_OF_DAY0));
+		v.add(new FieldContainer(59, 61, Field.HOUR_OF_DAY0));
+		v.add(new FieldContainer(62, 65, Field.HOUR_OF_DAY0));
+		v.add(new FieldContainer(66, 67, Field.HOUR1));
+		v.add(new FieldContainer(68, 70, Field.HOUR1));
+		v.add(new FieldContainer(71, 74, Field.HOUR1));
+		v.add(new FieldContainer(75, 77, Field.MINUTE));
+		v.add(new FieldContainer(78, 81, Field.MINUTE));
+		v.add(new FieldContainer(82, 83, Field.SECOND));
+		v.add(new FieldContainer(84, 86, Field.SECOND));
+		v.add(new FieldContainer(87, 90, Field.SECOND));
+		v.add(new FieldContainer(91, 92, Field.MILLISECOND));
+		v.add(new FieldContainer(93, 95, Field.MILLISECOND));
+		v.add(new FieldContainer(96, 99, Field.MILLISECOND));
+		v.add(new FieldContainer(100, 103, Field.DAY_OF_WEEK));
+		v.add(new FieldContainer(104, 110, Field.DAY_OF_WEEK));
+		v.add(new FieldContainer(111, 114, Field.DAY_OF_YEAR));
+		v.add(new FieldContainer(115, 118, Field.DAY_OF_YEAR));
+		v.add(new FieldContainer(119, 122, Field.DAY_OF_YEAR));
+		v.add(new FieldContainer(123, 124, Field.DAY_OF_WEEK_IN_MONTH));
+		v.add(new FieldContainer(125, 127, Field.DAY_OF_WEEK_IN_MONTH));
+		v.add(new FieldContainer(128, 130, Field.WEEK_OF_YEAR));
+		v.add(new FieldContainer(131, 134, Field.WEEK_OF_YEAR));
+		v.add(new FieldContainer(135, 136, Field.WEEK_OF_MONTH));
+		v.add(new FieldContainer(137, 140, Field.WEEK_OF_MONTH));
+		v.add(new FieldContainer(141, 143, Field.AM_PM));
+		v.add(new FieldContainer(145, 147, Field.AM_PM));
+		v.add(new FieldContainer(149, 150, Field.HOUR0));
+		v.add(new FieldContainer(151, 154, Field.HOUR0));
+		v.add(new FieldContainer(155, 158, Field.TIME_ZONE));
+		v.add(new FieldContainer(159, 180, Field.TIME_ZONE));
+		v.add(new FieldContainer(181, 186, Field.TIME_ZONE));
+		v.add(new FieldContainer(187, 192, Field.TIME_ZONE));
+		return v;
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Socket.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Socket.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Socket.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Socket.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,32 @@
+/* Copyright 2002, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * This interface provides an extremely basic set of socket operations.
+ */
+public interface Support_Socket {
+
+	public InputStream getInputStream() throws IOException;
+
+	public OutputStream getOutputStream() throws IOException;
+
+	public void close() throws IOException;
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringReader.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringReader.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringReader.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringReader.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,229 @@
+/* Copyright 2001, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.IOException;
+import java.io.Reader;
+
+public class Support_StringReader extends Reader {
+	private String str;
+
+	private int markpos = -1;
+
+	private int pos = 0;
+
+	private int count;
+
+	/**
+	 * Construct a StringReader on the String <code>str</code>. The size of
+	 * the reader is set to the <code>length()</code> of the String and the
+	 * Object to synchronize access through is set to <code>str</code>.
+	 * 
+	 * @param str
+	 *            the String to filter reads on.
+	 */
+	public Support_StringReader(String str) {
+		super(str);
+		this.str = str;
+		this.count = str.length();
+	}
+
+	/**
+	 * This method closes this StringReader. Once it is closed, you can no
+	 * longer read from it. Only the first invocation of this method has any
+	 * effect.
+	 * 
+	 */
+	public void close() {
+		synchronized (lock) {
+			if (isOpen())
+				str = null;
+		}
+	}
+
+	/**
+	 * Answer a boolean indicating whether or not this StringReader is open.
+	 */
+	private boolean isOpen() {
+		return str != null;
+	}
+
+	/**
+	 * Set a Mark position in this Reader. The parameter <code>readLimit</code>
+	 * is ignored for StringReaders. Sending reset() will reposition the reader
+	 * back to the marked position provided the mark has not been invalidated.
+	 * 
+	 * @param readlimit
+	 *            ignored for StringReaders.
+	 * 
+	 * @exception java.io.IOException
+	 *                If an error occurs attempting mark this StringReader.
+	 */
+	public void mark(int readLimit) throws IOException {
+		if (readLimit >= 0) {
+			synchronized (lock) {
+				if (isOpen())
+					markpos = pos;
+				else
+					throw new IOException("StringReader is closed");
+			}
+		} else
+			throw new IllegalArgumentException();
+	}
+
+	/**
+	 * Answers a boolean indicating whether or not this StringReader supports
+	 * mark() and reset(). This method always returns true.
+	 * 
+	 * @return <code>true</code> if mark() and reset() are supported,
+	 *         <code>false</code> otherwise. This implementation always
+	 *         returns <code>true</code>.
+	 */
+	public boolean markSupported() {
+		return true;
+	}
+
+	/**
+	 * Reads a single character from this StringReader and returns the result as
+	 * an int. The 2 higher-order bytes are set to 0. If the end of reader was
+	 * encountered then return -1.
+	 * 
+	 * @return the character read or -1 if end of reader.
+	 * 
+	 * @exception java.io.IOException
+	 *                If the StringReader is already closed.
+	 */
+	public int read() throws IOException {
+		synchronized (lock) {
+			if (isOpen()) {
+				if (pos != count)
+					return str.charAt(pos++);
+				return -1;
+			} else
+				throw new IOException("StringReader is closed");
+		}
+	}
+
+	/**
+	 * Reads at most <code>count</code> characters from this StringReader and
+	 * stores them at <code>offset</code> in the character array
+	 * <code>buf</code>. Returns the number of characters actually read or -1
+	 * if the end of reader was encountered.
+	 * 
+	 * @param buf
+	 *            character array to store the read characters
+	 * @param offset
+	 *            offset in buf to store the read characters
+	 * @param count
+	 *            maximum number of characters to read
+	 * @return the number of characters read or -1 if end of reader.
+	 * 
+	 * @exception java.io.IOException
+	 *                If the StringReader is closed.
+	 */
+	public int read(char buf[], int offset, int count) throws IOException {
+		// avoid int overflow
+		if (0 <= offset && offset <= buf.length && 0 <= count
+				&& count <= buf.length - offset) {
+			synchronized (lock) {
+				if (isOpen()) {
+					if (pos == this.count)
+						return -1;
+					int end = pos + count > this.count ? this.count : pos
+							+ count;
+					str.getChars(pos, end, buf, offset);
+					int read = end - pos;
+					pos = end;
+					return read;
+				} else
+					throw new IOException("StringReader is closed");
+			}
+		} else
+			throw new ArrayIndexOutOfBoundsException();
+	}
+
+	/**
+	 * Answers a <code>boolean</code> indicating whether or not this
+	 * StringReader is ready to be read without blocking. If the result is
+	 * <code>true</code>, the next <code>read()</code> will not block. If
+	 * the result is <code>false</code> this Reader may or may not block when
+	 * <code>read()</code> is sent. The implementation in StringReader always
+	 * returns <code>true</code> even when it has been closed.
+	 * 
+	 * @return <code>true</code> if the receiver will not block when
+	 *         <code>read()</code> is called, <code>false</code> if unknown
+	 *         or blocking will occur.
+	 * 
+	 * @exception java.io.IOException
+	 *                If an IO error occurs.
+	 */
+	public boolean ready() throws IOException {
+		synchronized (lock) {
+			if (isOpen())
+				return true;
+			throw new IOException("StringReader is closed");
+		}
+	}
+
+	/**
+	 * Reset this StringReader's position to the last <code>mark()</code>
+	 * location. Invocations of <code>read()/skip()</code> will occur from
+	 * this new location. If this Reader was not marked, the StringReader is
+	 * reset to the beginning of the String.
+	 * 
+	 * @exception java.io.IOException
+	 *                If this StringReader has already been closed.
+	 */
+	public void reset() throws IOException {
+		synchronized (lock) {
+			if (isOpen())
+				pos = markpos != -1 ? markpos : 0;
+			else
+				throw new IOException("StringReader is closed");
+		}
+	}
+
+	/**
+	 * Skips <code>count</code> number of characters in this StringReader.
+	 * Subsequent <code>read()</code>'s will not return these characters
+	 * unless <code>reset()</code> is used.
+	 * 
+	 * @param count
+	 *            The number of characters to skip.
+	 * @return the number of characters actually skipped.
+	 * 
+	 * @exception java.io.IOException
+	 *                If this StringReader has already been closed.
+	 */
+	public long skip(long count) throws IOException {
+		synchronized (lock) {
+			if (isOpen()) {
+				if (count <= 0)
+					return 0;
+				long skipped = 0;
+				if (count < this.count - pos) {
+					pos = pos + (int) count;
+					skipped = count;
+				} else {
+					skipped = this.count - pos;
+					pos = this.count;
+				}
+				return skipped;
+			} else
+				throw new IOException("StringReader is closed");
+		}
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringWriter.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringWriter.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringWriter.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_StringWriter.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,167 @@
+/* Copyright 2001, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+import java.io.IOException;
+import java.io.Writer;
+
+public class Support_StringWriter extends Writer {
+	private StringBuffer buf;
+
+	/**
+	 * Constructs a new StringWriter which has a StringBuffer allocated with the
+	 * default size of 16 characters. The StringBuffer is also the
+	 * <code>lock</code> used to synchronize access to this Writer.
+	 */
+	public Support_StringWriter() {
+		super();
+		buf = new StringBuffer(16);
+		lock = buf;
+	}
+
+	/**
+	 * Constructs a new StringWriter which has a StringBuffer allocated with the
+	 * size of <code>initialSize</code> characters. The StringBuffer is also
+	 * the <code>lock</code> used to synchronize access to this Writer.
+	 */
+	public Support_StringWriter(int initialSize) {
+		if (initialSize >= 0) {
+			buf = new StringBuffer(initialSize);
+			lock = buf;
+		} else
+			throw new IllegalArgumentException();
+	}
+
+	/**
+	 * Close this Writer. This is the concrete implementation required. This
+	 * particular implementation does nothing.
+	 * 
+	 * @exception java.io.IOException
+	 *                If an IO error occurs closing this StringWriter.
+	 */
+	public void close() throws IOException {
+	}
+
+	/**
+	 * Flush this Writer. This is the concrete implementation required. This
+	 * particular implementation does nothing.
+	 * 
+	 */
+	public void flush() {
+	}
+
+	/**
+	 * Answer the contents of this StringWriter as a StringBuffer. Any changes
+	 * made to the StringBuffer by the receiver or the caller are reflected in
+	 * this StringWriter.
+	 * 
+	 * @return this StringWriters local StringBuffer.
+	 */
+	public StringBuffer getBuffer() {
+		synchronized (lock) {
+			return buf;
+		}
+	}
+
+	/**
+	 * Answer the contents of this StringWriter as a String. Any changes made to
+	 * the StringBuffer by the receiver after returning will not be reflected in
+	 * the String returned to the caller.
+	 * 
+	 * @return this StringWriters current contents as a String.
+	 */
+	public String toString() {
+		synchronized (lock) {
+			return buf.toString();
+		}
+	}
+
+	/**
+	 * Writes <code>count</code> characters starting at <code>offset</code>
+	 * in <code>buf</code> to this StringWriter.
+	 * 
+	 * @param buf
+	 *            the non-null array containing characters to write.
+	 * @param offset
+	 *            offset in buf to retrieve characters
+	 * @param count
+	 *            maximum number of characters to write
+	 * 
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                If offset or count are outside of bounds.
+	 */
+	public void write(char[] buf, int offset, int count) {
+		// avoid int overflow
+		if (0 <= offset && offset <= buf.length && 0 <= count
+				&& count <= buf.length - offset) {
+			synchronized (lock) {
+				this.buf.append(buf, offset, count);
+			}
+		} else
+			throw new ArrayIndexOutOfBoundsException();
+	}
+
+	/**
+	 * Writes the specified character <code>oneChar</code> to this
+	 * StringWriter. This implementation writes the low order two bytes to the
+	 * Stream.
+	 * 
+	 * @param oneChar
+	 *            The character to write
+	 * 
+	 */
+	public void write(int oneChar) {
+		synchronized (lock) {
+			buf.append((char) oneChar);
+		}
+	}
+
+	/**
+	 * Writes the characters from the String <code>str</code> to this
+	 * StringWriter.
+	 * 
+	 * @param str
+	 *            the non-null String containing the characters to write.
+	 * 
+	 */
+	public void write(String str) {
+		synchronized (lock) {
+			buf.append(str);
+		}
+	}
+
+	/**
+	 * Writes <code>count</code> number of characters starting at
+	 * <code>offset</code> from the String <code>str</code> to this
+	 * StringWriter.
+	 * 
+	 * @param str
+	 *            the non-null String containing the characters to write.
+	 * @param offset
+	 *            the starting point to retrieve characters.
+	 * @param count
+	 *            the number of characters to retrieve and write.
+	 * 
+	 * @exception java.lang.ArrayIndexOutOfBoundsException
+	 *                If offset or count are outside of bounds.
+	 */
+	public void write(String str, int offset, int count) {
+		String sub = str.substring(offset, offset + count);
+		synchronized (lock) {
+			buf.append(sub);
+		}
+	}
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,27 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public class Support_TestResource extends java.util.ListResourceBundle {
+
+	protected Object[][] getContents() {
+		Object[][] contents = { { "parent1", "parentValue1" },
+				{ "parent2", "parentValue2" }, { "parent3", "parentValue3" },
+				{ "parent4", "parentValue4" }, };
+		return contents;
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,27 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public class Support_TestResource_en extends java.util.ListResourceBundle {
+
+	protected Object[][] getContents() {
+		Object[][] contents = { { "parent2", "enValue2" },
+				{ "parent3", "enValue3" }, { "parent4", "enValue4" },
+				{ "child1", "enChildValue1" }, };
+		return contents;
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en_US.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en_US.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en_US.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_en_US.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,27 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public class Support_TestResource_en_US extends java.util.ListResourceBundle {
+
+	protected Object[][] getContents() {
+		Object[][] contents = { { "parent3", "enUSValue3" },
+				{ "parent4", "enUSValue4" }, { "child1", "enUSChildValue1" },
+				{ "child2", "enUSChildValue2" }, };
+		return contents;
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,27 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public class Support_TestResource_fr extends java.util.ListResourceBundle {
+
+	protected Object[][] getContents() {
+		Object[][] contents = { { "parent2", "frValue2" },
+				{ "parent3", "frValue3" }, { "parent4", "frValue4" },
+				{ "child1", "frChildValue1" }, };
+		return contents;
+	}
+
+}

Added: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR.java?rev=386058&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_TestResource_fr_FR.java Wed Mar 15 03:46:17 2006
@@ -0,0 +1,27 @@
+/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package tests.support;
+
+public class Support_TestResource_fr_FR extends java.util.ListResourceBundle {
+
+	protected Object[][] getContents() {
+		Object[][] contents = { { "parent3", "frFRValue3" },
+				{ "parent4", "frFRValue4" }, { "child1", "frFRChildValue1" },
+				{ "child2", "frFRChildValue2" }, };
+		return contents;
+	}
+
+}



Mime
View raw message