harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r440340 [2/5] - /incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/
Date Tue, 05 Sep 2006 13:39:20 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DummyPKCS12Keystore.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DummyPKCS12Keystore.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DummyPKCS12Keystore.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DummyPKCS12Keystore.java Tue Sep  5 06:39:17 2006
@@ -1,211 +1,211 @@
-/* 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.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.security.Key;
-import java.security.KeyStoreException;
-import java.security.KeyStoreSpi;
-import java.security.NoSuchAlgorithmException;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.util.Date;
-import java.util.Enumeration;
-
-/**
- * Empty implementation used to enable unit tests to run.
- */
-public class Support_DummyPKCS12Keystore extends KeyStoreSpi {
-
-	/**
-	 * 
-	 */
-	public Support_DummyPKCS12Keystore() {
-		super();
-		// TODO Auto-generated constructor stub
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineGetKey(java.lang.String, char[])
-	 */
-	public Key engineGetKey(String arg0, char[] arg1)
-			throws NoSuchAlgorithmException, UnrecoverableKeyException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineGetCertificateChain(java.lang.String)
-	 */
-	public Certificate[] engineGetCertificateChain(String arg0) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineGetCertificate(java.lang.String)
-	 */
-	public Certificate engineGetCertificate(String arg0) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineGetCreationDate(java.lang.String)
-	 */
-	public Date engineGetCreationDate(String arg0) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineSetKeyEntry(java.lang.String,
-	 *      java.security.Key, char[], java.security.cert.Certificate[])
-	 */
-	public void engineSetKeyEntry(String arg0, Key arg1, char[] arg2,
-			Certificate[] arg3) throws KeyStoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineSetKeyEntry(java.lang.String,
-	 *      byte[], java.security.cert.Certificate[])
-	 */
-	public void engineSetKeyEntry(String arg0, byte[] arg1, Certificate[] arg2)
-			throws KeyStoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineSetCertificateEntry(java.lang.String,
-	 *      java.security.cert.Certificate)
-	 */
-	public void engineSetCertificateEntry(String arg0, Certificate arg1)
-			throws KeyStoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineDeleteEntry(java.lang.String)
-	 */
-	public void engineDeleteEntry(String arg0) throws KeyStoreException {
-		// TODO Auto-generated method stub
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineAliases()
-	 */
-	public Enumeration engineAliases() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineContainsAlias(java.lang.String)
-	 */
-	public boolean engineContainsAlias(String arg0) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineSize()
-	 */
-	public int engineSize() {
-		// TODO Auto-generated method stub
-		return 0;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineIsKeyEntry(java.lang.String)
-	 */
-	public boolean engineIsKeyEntry(String arg0) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineIsCertificateEntry(java.lang.String)
-	 */
-	public boolean engineIsCertificateEntry(String arg0) {
-		// TODO Auto-generated method stub
-		return false;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineGetCertificateAlias(java.security.cert.Certificate)
-	 */
-	public String engineGetCertificateAlias(Certificate arg0) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineStore(java.io.OutputStream, char[])
-	 */
-	public void engineStore(OutputStream arg0, char[] arg1) throws IOException,
-			NoSuchAlgorithmException, CertificateException {
-		// TODO Auto-generated method stub
-
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.security.KeyStoreSpi#engineLoad(java.io.InputStream, char[])
-	 */
-	public void engineLoad(InputStream arg0, char[] arg1) throws IOException,
-			NoSuchAlgorithmException, CertificateException {
-		// TODO Auto-generated method stub
-	}
-}
+/* 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.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.Key;
+import java.security.KeyStoreException;
+import java.security.KeyStoreSpi;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.util.Date;
+import java.util.Enumeration;
+
+/**
+ * Empty implementation used to enable unit tests to run.
+ */
+public class Support_DummyPKCS12Keystore extends KeyStoreSpi {
+
+	/**
+	 * 
+	 */
+	public Support_DummyPKCS12Keystore() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineGetKey(java.lang.String, char[])
+	 */
+	public Key engineGetKey(String arg0, char[] arg1)
+			throws NoSuchAlgorithmException, UnrecoverableKeyException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineGetCertificateChain(java.lang.String)
+	 */
+	public Certificate[] engineGetCertificateChain(String arg0) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineGetCertificate(java.lang.String)
+	 */
+	public Certificate engineGetCertificate(String arg0) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineGetCreationDate(java.lang.String)
+	 */
+	public Date engineGetCreationDate(String arg0) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineSetKeyEntry(java.lang.String,
+	 *      java.security.Key, char[], java.security.cert.Certificate[])
+	 */
+	public void engineSetKeyEntry(String arg0, Key arg1, char[] arg2,
+			Certificate[] arg3) throws KeyStoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineSetKeyEntry(java.lang.String,
+	 *      byte[], java.security.cert.Certificate[])
+	 */
+	public void engineSetKeyEntry(String arg0, byte[] arg1, Certificate[] arg2)
+			throws KeyStoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineSetCertificateEntry(java.lang.String,
+	 *      java.security.cert.Certificate)
+	 */
+	public void engineSetCertificateEntry(String arg0, Certificate arg1)
+			throws KeyStoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineDeleteEntry(java.lang.String)
+	 */
+	public void engineDeleteEntry(String arg0) throws KeyStoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineAliases()
+	 */
+	public Enumeration engineAliases() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineContainsAlias(java.lang.String)
+	 */
+	public boolean engineContainsAlias(String arg0) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineSize()
+	 */
+	public int engineSize() {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineIsKeyEntry(java.lang.String)
+	 */
+	public boolean engineIsKeyEntry(String arg0) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineIsCertificateEntry(java.lang.String)
+	 */
+	public boolean engineIsCertificateEntry(String arg0) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineGetCertificateAlias(java.security.cert.Certificate)
+	 */
+	public String engineGetCertificateAlias(Certificate arg0) {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineStore(java.io.OutputStream, char[])
+	 */
+	public void engineStore(OutputStream arg0, char[] arg1) throws IOException,
+			NoSuchAlgorithmException, CertificateException {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.security.KeyStoreSpi#engineLoad(java.io.InputStream, char[])
+	 */
+	public void engineLoad(InputStream arg0, char[] arg1) throws IOException,
+			NoSuchAlgorithmException, CertificateException {
+		// TODO Auto-generated method stub
+	}
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_DummyPKCS12Keystore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Exec.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Exec.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Exec.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Exec.java Tue Sep  5 06:39:17 2006
@@ -1,152 +1,152 @@
-/* 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.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintStream;
-
-import junit.framework.TestCase;
-
-public class Support_Exec extends TestCase {
-
-	public static String execJava(String[] args, String[] classpath,
-			boolean displayOutput) throws IOException, InterruptedException {
-		// this function returns the output of the process as a string
-		Object[] execArgs = execJava2(args, classpath, displayOutput);
-		Process proc = (Process) execArgs[0];
-
-		StringBuffer output = new StringBuffer();
-		InputStream in = proc.getInputStream();
-		int result;
-		byte[] bytes = new byte[1024];
-		while ((result = in.read(bytes)) != -1) {
-			output.append(new String(bytes, 0, result));
-			if (displayOutput)
-				System.out.write(bytes, 0, result);
-		}
-		in.close();
-		proc.waitFor();
-		checkStderr(execArgs);
-		proc.destroy();
-		return output.toString();
-	}
-
-	public static void checkStderr(Object[] execArgs) {
-		Process proc = (Process) execArgs[0];
-		StringBuffer errBuf = (StringBuffer) execArgs[1];
-		synchronized (errBuf) {
-			if (errBuf.length() > 0) {
-				fail(errBuf.toString());
-			}
-		}
-	}
-
-	public static Object[] execJava2(String[] args, String[] classpath,
-			boolean displayOutput) throws IOException, InterruptedException {
-		// this function returns the resulting process from the exec
-		int baseArgs = 0;
-		String[] execArgs = null;
-		String vendor = System.getProperty("java.vendor");
-		boolean onUnix = File.separatorChar == '/';
-		String classPathString = "";
-		if (classpath != null)
-			for (int i = 0; i < classpath.length; i++)
-				classPathString += File.pathSeparator + classpath[i];
-		if (vendor.indexOf("Sun") != -1) {
-			baseArgs = 3;
-			execArgs = new String[baseArgs + args.length];
-			String executable = System.getProperty("java.home");
-			if (!executable.endsWith(File.separator))
-				executable += File.separator;
-			executable += "bin" + File.separator;
-			execArgs[0] = executable + "java";
-			execArgs[1] = "-cp";
-			execArgs[2] = "\"" + System.getProperty("java.class.path")
-					+ classPathString + "\"";
-		} else if (vendor.indexOf("IBM") != -1) {
-			baseArgs = 5;
-			String full = System.getProperty("java.fullversion");
-			if (full != null && full.indexOf("(JIT disabled") >= 0)
-				baseArgs++;
-			execArgs = new String[baseArgs + args.length];
-			execArgs[0] = System.getProperty("com.ibm.oti.vm.exe");
-			// stop passing -jcl:null into the VM
-			execArgs[1] = "";
-			if (onUnix) {
-				execArgs[2] = "-Xbootclasspath:"
-						+ System.getProperty("org.apache.harmony.boot.class.path");
-				execArgs[3] = "-cp";
-				execArgs[4] = System.getProperty("java.class.path")
-						+ classPathString;
-			} else {
-				execArgs[2] = "\"-Xbootclasspath:"
-						+ System.getProperty("org.apache.harmony.boot.class.path")
-						+ "\"";
-				execArgs[3] = "-cp";
-				execArgs[4] = "\"" + System.getProperty("java.class.path")
-						+ classPathString + "\"";
-			}
-			if (baseArgs > 5)
-				execArgs[5] = "-Xint";
-		}
-		for (int i = 0; i < args.length; i++)
-			execArgs[baseArgs + i] = args[i];
-		StringBuffer command = new StringBuffer(execArgs[0]);
-		for (int i = 1; i < execArgs.length; i++)
-			command.append(" " + execArgs[i]);
-		System.out.println();
-		System.out.println("Exec: " + command.toString());
-
-		final Process proc = Runtime.getRuntime().exec(execArgs);
-		final StringBuffer errBuf = new StringBuffer();
-		Thread errThread = new Thread(new Runnable() {
-			public void run() {
-				synchronized (errBuf) {
-					synchronized (proc) {
-						proc.notifyAll();
-					}
-					InputStream err = proc.getErrorStream();
-					int result;
-					byte[] bytes = new byte[1024];
-					try {
-						while ((result = err.read(bytes)) != -1) {
-							System.err.write(bytes, 0, result);
-							errBuf.append(new String(bytes));
-						}
-						err.close();
-					} catch (IOException e) {
-						e.printStackTrace();
-						ByteArrayOutputStream out = new ByteArrayOutputStream();
-						PrintStream printer = new PrintStream(out);
-						e.printStackTrace(printer);
-						printer.close();
-						errBuf.append(new String(out.toByteArray()));
-					}
-				}
-			}
-		});
-		synchronized (proc) {
-			errThread.start();
-			// wait for errThread to start
-			proc.wait();
-		}
-		return new Object[] { proc, errBuf };
-	}
-
-}
+/* 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.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+
+import junit.framework.TestCase;
+
+public class Support_Exec extends TestCase {
+
+	public static String execJava(String[] args, String[] classpath,
+			boolean displayOutput) throws IOException, InterruptedException {
+		// this function returns the output of the process as a string
+		Object[] execArgs = execJava2(args, classpath, displayOutput);
+		Process proc = (Process) execArgs[0];
+
+		StringBuffer output = new StringBuffer();
+		InputStream in = proc.getInputStream();
+		int result;
+		byte[] bytes = new byte[1024];
+		while ((result = in.read(bytes)) != -1) {
+			output.append(new String(bytes, 0, result));
+			if (displayOutput)
+				System.out.write(bytes, 0, result);
+		}
+		in.close();
+		proc.waitFor();
+		checkStderr(execArgs);
+		proc.destroy();
+		return output.toString();
+	}
+
+	public static void checkStderr(Object[] execArgs) {
+		Process proc = (Process) execArgs[0];
+		StringBuffer errBuf = (StringBuffer) execArgs[1];
+		synchronized (errBuf) {
+			if (errBuf.length() > 0) {
+				fail(errBuf.toString());
+			}
+		}
+	}
+
+	public static Object[] execJava2(String[] args, String[] classpath,
+			boolean displayOutput) throws IOException, InterruptedException {
+		// this function returns the resulting process from the exec
+		int baseArgs = 0;
+		String[] execArgs = null;
+		String vendor = System.getProperty("java.vendor");
+		boolean onUnix = File.separatorChar == '/';
+		String classPathString = "";
+		if (classpath != null)
+			for (int i = 0; i < classpath.length; i++)
+				classPathString += File.pathSeparator + classpath[i];
+		if (vendor.indexOf("Sun") != -1) {
+			baseArgs = 3;
+			execArgs = new String[baseArgs + args.length];
+			String executable = System.getProperty("java.home");
+			if (!executable.endsWith(File.separator))
+				executable += File.separator;
+			executable += "bin" + File.separator;
+			execArgs[0] = executable + "java";
+			execArgs[1] = "-cp";
+			execArgs[2] = "\"" + System.getProperty("java.class.path")
+					+ classPathString + "\"";
+		} else if (vendor.indexOf("IBM") != -1) {
+			baseArgs = 5;
+			String full = System.getProperty("java.fullversion");
+			if (full != null && full.indexOf("(JIT disabled") >= 0)
+				baseArgs++;
+			execArgs = new String[baseArgs + args.length];
+			execArgs[0] = System.getProperty("com.ibm.oti.vm.exe");
+			// stop passing -jcl:null into the VM
+			execArgs[1] = "";
+			if (onUnix) {
+				execArgs[2] = "-Xbootclasspath:"
+						+ System.getProperty("org.apache.harmony.boot.class.path");
+				execArgs[3] = "-cp";
+				execArgs[4] = System.getProperty("java.class.path")
+						+ classPathString;
+			} else {
+				execArgs[2] = "\"-Xbootclasspath:"
+						+ System.getProperty("org.apache.harmony.boot.class.path")
+						+ "\"";
+				execArgs[3] = "-cp";
+				execArgs[4] = "\"" + System.getProperty("java.class.path")
+						+ classPathString + "\"";
+			}
+			if (baseArgs > 5)
+				execArgs[5] = "-Xint";
+		}
+		for (int i = 0; i < args.length; i++)
+			execArgs[baseArgs + i] = args[i];
+		StringBuffer command = new StringBuffer(execArgs[0]);
+		for (int i = 1; i < execArgs.length; i++)
+			command.append(" " + execArgs[i]);
+		System.out.println();
+		System.out.println("Exec: " + command.toString());
+
+		final Process proc = Runtime.getRuntime().exec(execArgs);
+		final StringBuffer errBuf = new StringBuffer();
+		Thread errThread = new Thread(new Runnable() {
+			public void run() {
+				synchronized (errBuf) {
+					synchronized (proc) {
+						proc.notifyAll();
+					}
+					InputStream err = proc.getErrorStream();
+					int result;
+					byte[] bytes = new byte[1024];
+					try {
+						while ((result = err.read(bytes)) != -1) {
+							System.err.write(bytes, 0, result);
+							errBuf.append(new String(bytes));
+						}
+						err.close();
+					} catch (IOException e) {
+						e.printStackTrace();
+						ByteArrayOutputStream out = new ByteArrayOutputStream();
+						PrintStream printer = new PrintStream(out);
+						e.printStackTrace(printer);
+						printer.close();
+						errBuf.append(new String(out.toByteArray()));
+					}
+				}
+			}
+		});
+		synchronized (proc) {
+			errThread.start();
+			// wait for errThread to start
+			proc.wait();
+		}
+		return new Object[] { proc, errBuf };
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Exec.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Field.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Field.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Field.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Field.java Tue Sep  5 06:39:17 2006
@@ -1,43 +1,43 @@
-/* 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_Field {
-
-	protected Object objectField;
-
-	protected boolean booleanField;
-
-	protected byte byteField;
-
-	protected char charField;
-
-	protected short shortField;
-
-	protected int intField;
-
-	protected long longField;
-
-	protected float floatField;
-
-	protected double doubleField;
-
-	/**
-	 * 
-	 */
-	public Support_Field() {
-	}
+/* 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_Field {
+
+	protected Object objectField;
+
+	protected boolean booleanField;
+
+	protected byte byteField;
+
+	protected char charField;
+
+	protected short shortField;
+
+	protected int intField;
+
+	protected long longField;
+
+	protected float floatField;
+
+	protected double doubleField;
+
+	/**
+	 * 
+	 */
+	public Support_Field() {
+	}
 }

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Field.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Format.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Format.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Format.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Format.java Tue Sep  5 06:39:17 2006
@@ -1,138 +1,138 @@
-/* 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.AttributedCharacterIterator;
-import java.text.FieldPosition;
-import java.text.Format;
-import java.text.AttributedCharacterIterator.Attribute;
-import java.util.Iterator;
-import java.util.Vector;
-
-public class Support_Format extends junit.framework.TestCase {
-
-	protected String text = null;
-
-	public Support_Format(String p1) {
-		super(p1);
-	}
-
-	protected void t_FormatWithField(int count, Format format, Object object,
-			String text, Format.Field field, int begin, int end) {
-		StringBuffer buffer = new StringBuffer();
-		FieldPosition pos = new FieldPosition(field);
-		format.format(object, buffer, pos);
-
-		// System.out.println(buffer);
-		// System.out.println(pos);
-
-		if (text == null)
-			assertEquals("Test " + count + ": incorrect formatted text",
-					this.text, buffer.toString());
-		else
-			assertEquals("Test " + count + ": incorrect formatted text", text,
-					buffer.toString());
-
-		assertEquals("Test " + count + ": incorrect begin index for field "
-				+ field, begin, pos.getBeginIndex());
-		assertEquals("Test " + count + ": incorrect end index for field"
-				+ field, end, pos.getEndIndex());
-	}
-
-	protected void t_Format(int count, Object object, Format format,
-			Vector expectedResults) {
-		// System.out.println(format.format(object));
-		Vector results = findFields(format.formatToCharacterIterator(object));
-		assertTrue("Test " + count
-				+ ": Format returned incorrect CharacterIterator for "
-				+ format.format(object), compare(results, expectedResults));
-	}
-
-	/**
-	 * compares two vectors regardless of the order of their elements
-	 */
-	protected static boolean compare(Vector vector1, Vector vector2) {
-		return vector1.size() == vector2.size() && vector1.containsAll(vector2);
-	}
-
-	/**
-	 * finds attributes with regards to char index in this
-	 * AttributedCharacterIterator, and puts them in a vector
-	 * 
-	 * @param iterator
-	 * @return a vector, each entry in this vector are of type FieldContainer ,
-	 *         which stores start and end indexes and an attribute this range
-	 *         has
-	 */
-	protected static Vector findFields(AttributedCharacterIterator iterator) {
-		Vector result = new Vector();
-		while (iterator.getIndex() != iterator.getEndIndex()) {
-			int start = iterator.getRunStart();
-			int end = iterator.getRunLimit();
-
-			Iterator it = iterator.getAttributes().keySet().iterator();
-			while (it.hasNext()) {
-				AttributedCharacterIterator.Attribute attribute = (AttributedCharacterIterator.Attribute) it
-						.next();
-				Object value = iterator.getAttribute(attribute);
-				result.add(new FieldContainer(start, end, attribute, value));
-				// System.out.println(start + " " + end + ": " + attribute + ",
-				// " + value );
-				// System.out.println("v.add(new FieldContainer(" + start +"," +
-				// end +"," + attribute+ "," + value+ "));");
-			}
-			iterator.setIndex(end);
-		}
-		return result;
-	}
-
-	protected static class FieldContainer {
-		int start, end;
-
-		AttributedCharacterIterator.Attribute attribute;
-
-		Object value;
-
-		// called from support_decimalformat and support_simpledateformat tests
-		public FieldContainer(int start, int end,
-				AttributedCharacterIterator.Attribute attribute) {
-			this(start, end, attribute, attribute);
-		}
-
-		// called from support_messageformat tests
-		public FieldContainer(int start, int end, Attribute attribute, int value) {
-			this(start, end, attribute, new Integer(value));
-		}
-
-		// called from support_messageformat tests
-		public FieldContainer(int start, int end, Attribute attribute,
-				Object value) {
-			this.start = start;
-			this.end = end;
-			this.attribute = attribute;
-			this.value = value;
-		}
-
-		public boolean equals(Object obj) {
-			if (!(obj instanceof FieldContainer))
-				return false;
-
-			FieldContainer fc = (FieldContainer) obj;
-			return (start == fc.start && end == fc.end
-					&& attribute == fc.attribute && value.equals(fc.value));
-		}
-	}
-}
+/* 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.AttributedCharacterIterator;
+import java.text.FieldPosition;
+import java.text.Format;
+import java.text.AttributedCharacterIterator.Attribute;
+import java.util.Iterator;
+import java.util.Vector;
+
+public class Support_Format extends junit.framework.TestCase {
+
+	protected String text = null;
+
+	public Support_Format(String p1) {
+		super(p1);
+	}
+
+	protected void t_FormatWithField(int count, Format format, Object object,
+			String text, Format.Field field, int begin, int end) {
+		StringBuffer buffer = new StringBuffer();
+		FieldPosition pos = new FieldPosition(field);
+		format.format(object, buffer, pos);
+
+		// System.out.println(buffer);
+		// System.out.println(pos);
+
+		if (text == null)
+			assertEquals("Test " + count + ": incorrect formatted text",
+					this.text, buffer.toString());
+		else
+			assertEquals("Test " + count + ": incorrect formatted text", text,
+					buffer.toString());
+
+		assertEquals("Test " + count + ": incorrect begin index for field "
+				+ field, begin, pos.getBeginIndex());
+		assertEquals("Test " + count + ": incorrect end index for field"
+				+ field, end, pos.getEndIndex());
+	}
+
+	protected void t_Format(int count, Object object, Format format,
+			Vector expectedResults) {
+		// System.out.println(format.format(object));
+		Vector results = findFields(format.formatToCharacterIterator(object));
+		assertTrue("Test " + count
+				+ ": Format returned incorrect CharacterIterator for "
+				+ format.format(object), compare(results, expectedResults));
+	}
+
+	/**
+	 * compares two vectors regardless of the order of their elements
+	 */
+	protected static boolean compare(Vector vector1, Vector vector2) {
+		return vector1.size() == vector2.size() && vector1.containsAll(vector2);
+	}
+
+	/**
+	 * finds attributes with regards to char index in this
+	 * AttributedCharacterIterator, and puts them in a vector
+	 * 
+	 * @param iterator
+	 * @return a vector, each entry in this vector are of type FieldContainer ,
+	 *         which stores start and end indexes and an attribute this range
+	 *         has
+	 */
+	protected static Vector findFields(AttributedCharacterIterator iterator) {
+		Vector result = new Vector();
+		while (iterator.getIndex() != iterator.getEndIndex()) {
+			int start = iterator.getRunStart();
+			int end = iterator.getRunLimit();
+
+			Iterator it = iterator.getAttributes().keySet().iterator();
+			while (it.hasNext()) {
+				AttributedCharacterIterator.Attribute attribute = (AttributedCharacterIterator.Attribute) it
+						.next();
+				Object value = iterator.getAttribute(attribute);
+				result.add(new FieldContainer(start, end, attribute, value));
+				// System.out.println(start + " " + end + ": " + attribute + ",
+				// " + value );
+				// System.out.println("v.add(new FieldContainer(" + start +"," +
+				// end +"," + attribute+ "," + value+ "));");
+			}
+			iterator.setIndex(end);
+		}
+		return result;
+	}
+
+	protected static class FieldContainer {
+		int start, end;
+
+		AttributedCharacterIterator.Attribute attribute;
+
+		Object value;
+
+		// called from support_decimalformat and support_simpledateformat tests
+		public FieldContainer(int start, int end,
+				AttributedCharacterIterator.Attribute attribute) {
+			this(start, end, attribute, attribute);
+		}
+
+		// called from support_messageformat tests
+		public FieldContainer(int start, int end, Attribute attribute, int value) {
+			this(start, end, attribute, new Integer(value));
+		}
+
+		// called from support_messageformat tests
+		public FieldContainer(int start, int end, Attribute attribute,
+				Object value) {
+			this.start = start;
+			this.end = end;
+			this.attribute = attribute;
+			this.value = value;
+		}
+
+		public boolean equals(Object obj) {
+			if (!(obj instanceof FieldContainer))
+				return false;
+
+			FieldContainer fc = (FieldContainer) obj;
+			return (start == fc.start && end == fc.end
+					&& attribute == fc.attribute && value.equals(fc.value));
+		}
+	}
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_Format.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetLocal.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetLocal.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetLocal.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetLocal.java Tue Sep  5 06:39:17 2006
@@ -1,96 +1,96 @@
-/* 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.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.JarURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Hashtable;
-
-import tests.support.resource.Support_Resources;
-
-public class Support_GetLocal {
-
-	static Hashtable cache = new Hashtable(20);
-
-	public static File getLocalFile(String url) throws IOException,
-			MalformedURLException {
-		url = Support_Resources.RESOURCE_PACKAGE + url;
-		File temp = (File) cache.get(url);
-		if (temp == null) {
-			InputStream in = Support_GetLocal.class.getResourceAsStream(url);
-			temp = File.createTempFile("hyts_local", ".tmp", null);
-			temp.deleteOnExit();
-			FileOutputStream out = new FileOutputStream(temp);
-			int result;
-			byte[] buf = new byte[4096];
-			while ((result = in.read(buf)) != -1)
-				out.write(buf, 0, result);
-			in.close();
-			out.close();
-			cache.put(url, temp);
-		}
-		return temp;
-	}
-
-	public static File getExternalLocalFile(String url) throws IOException,
-			MalformedURLException {
-		File temp = (File) cache.get(url);
-		if (temp == null) {
-			InputStream in = new URL(url).openStream();
-			temp = File.createTempFile("hyts_local", ".tmp", null);
-			temp.deleteOnExit();
-			FileOutputStream out = new FileOutputStream(temp);
-			int result;
-			byte[] buf = new byte[4096];
-			while ((result = in.read(buf)) != -1)
-				out.write(buf, 0, result);
-			in.close();
-			out.close();
-			cache.put(url, temp);
-		}
-		return temp;
-	}
-
-	static ByteArrayInputStream getStream(String url) throws IOException,
-			MalformedURLException {
-		InputStream in = new URL(url).openStream();
-		ByteArrayOutputStream out = new ByteArrayOutputStream(256);
-		int result;
-		byte[] buf = new byte[256];
-		while ((result = in.read(buf)) != -1)
-			out.write(buf, 0, result);
-		return new ByteArrayInputStream(out.toByteArray());
-	}
-
-	public static File createTempFile(String suffix) throws IOException {
-		return File.createTempFile("hyts_", suffix, null);
-	}
-
-	public static JarURLConnection getJarURLConnection() throws IOException {
-		JarURLConnection con1 = null;
-		File file = getLocalFile("hyts_att.jar");
-		URL fUrl1 = new URL("jar:file:" + file.getPath() + "!/");
-		con1 = (JarURLConnection) fUrl1.openConnection();
-		return con1;
-	}
+/* 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.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Hashtable;
+
+import tests.support.resource.Support_Resources;
+
+public class Support_GetLocal {
+
+	static Hashtable cache = new Hashtable(20);
+
+	public static File getLocalFile(String url) throws IOException,
+			MalformedURLException {
+		url = Support_Resources.RESOURCE_PACKAGE + url;
+		File temp = (File) cache.get(url);
+		if (temp == null) {
+			InputStream in = Support_GetLocal.class.getResourceAsStream(url);
+			temp = File.createTempFile("hyts_local", ".tmp", null);
+			temp.deleteOnExit();
+			FileOutputStream out = new FileOutputStream(temp);
+			int result;
+			byte[] buf = new byte[4096];
+			while ((result = in.read(buf)) != -1)
+				out.write(buf, 0, result);
+			in.close();
+			out.close();
+			cache.put(url, temp);
+		}
+		return temp;
+	}
+
+	public static File getExternalLocalFile(String url) throws IOException,
+			MalformedURLException {
+		File temp = (File) cache.get(url);
+		if (temp == null) {
+			InputStream in = new URL(url).openStream();
+			temp = File.createTempFile("hyts_local", ".tmp", null);
+			temp.deleteOnExit();
+			FileOutputStream out = new FileOutputStream(temp);
+			int result;
+			byte[] buf = new byte[4096];
+			while ((result = in.read(buf)) != -1)
+				out.write(buf, 0, result);
+			in.close();
+			out.close();
+			cache.put(url, temp);
+		}
+		return temp;
+	}
+
+	static ByteArrayInputStream getStream(String url) throws IOException,
+			MalformedURLException {
+		InputStream in = new URL(url).openStream();
+		ByteArrayOutputStream out = new ByteArrayOutputStream(256);
+		int result;
+		byte[] buf = new byte[256];
+		while ((result = in.read(buf)) != -1)
+			out.write(buf, 0, result);
+		return new ByteArrayInputStream(out.toByteArray());
+	}
+
+	public static File createTempFile(String suffix) throws IOException {
+		return File.createTempFile("hyts_", suffix, null);
+	}
+
+	public static JarURLConnection getJarURLConnection() throws IOException {
+		JarURLConnection con1 = null;
+		File file = getLocalFile("hyts_att.jar");
+		URL fUrl1 = new URL("jar:file:" + file.getPath() + "!/");
+		con1 = (JarURLConnection) fUrl1.openConnection();
+		return con1;
+	}
 }

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetLocal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_GetResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpConnector.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpConnector.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpConnector.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpConnector.java Tue Sep  5 06:39:17 2006
@@ -1,45 +1,45 @@
-/* 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 contains the basic methods necessary to open and use a
- * connection to an HTTP server.
- * 
- */
-public interface Support_HttpConnector {
-
-	public void open(String address) throws IOException;
-
-	public void close() throws IOException;
-
-	public InputStream getInputStream() throws IOException;
-
-	public OutputStream getOutputStream() throws IOException;
-
-	public boolean isChunkedOnFlush();
-
-	public void setRequestProperty(String key, String value) throws IOException;
-
-	public String getHeaderField(int index) throws IOException;
-
-	public String getHeaderFieldKey(int index) throws IOException;
-
-}
+/* 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 contains the basic methods necessary to open and use a
+ * connection to an HTTP server.
+ * 
+ */
+public interface Support_HttpConnector {
+
+	public void open(String address) throws IOException;
+
+	public void close() throws IOException;
+
+	public InputStream getInputStream() throws IOException;
+
+	public OutputStream getOutputStream() throws IOException;
+
+	public boolean isChunkedOnFlush();
+
+	public void setRequestProperty(String key, String value) throws IOException;
+
+	public String getHeaderField(int index) throws IOException;
+
+	public String getHeaderFieldKey(int index) throws IOException;
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpConnector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServer.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServer.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServer.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServer.java Tue Sep  5 06:39:17 2006
@@ -1,510 +1,510 @@
-/* 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.InterruptedIOException;
-import java.io.OutputStream;
-import java.util.Vector;
-
-import junit.framework.TestCase;
-
-public class Support_HttpServer {
-
-	private static final int timeout = 10000;
-
-	public static final String AUTHTEST = "/authTest";
-
-	public static final String CHUNKEDTEST = "/chunkedTest.html";
-
-	public static final String CONTENTTEST = "/contentTest.html";
-
-	public static final String REDIRECTTEST = "/redirectTest.html";
-
-	public static final String PORTREDIRTEST = "/portredirTest.html";
-
-	public static final String OTHERTEST = "/otherTest.html";
-
-	public static final String POSTTEST = "/postTest.html";
-
-	public static final String HEADERSTEST = "/headersTest.html";
-
-	public static final int OK = 200;
-
-	public static final int MULT_CHOICE = 300;
-
-	public static final int MOVED_PERM = 301;
-
-	public static final int FOUND = 302;
-
-	public static final int SEE_OTHER = 303;
-
-	public static final int NOT_MODIFIED = 304;
-
-	public static final int UNUSED = 306;
-
-	public static final int TEMP_REDIRECT = 307;
-
-	public static final int UNAUTHORIZED = 401;
-
-	public static final int NOT_FOUND = 404;
-
-	private int port;
-
-	private boolean proxy = false;
-
-	private boolean started = false;
-
-	private boolean portRedirectTestEnable = false;
-
-	private volatile Support_ServerSocket serversocket;
-
-	private boolean shuttingDown = false;
-
-	// synchronization
-	private Object lock = new Object();
-
-	TestCase testcase = null;
-
-	public Support_HttpServer(Support_ServerSocket serversocket, TestCase test) {
-		this.serversocket = serversocket;
-		this.testcase = test;
-	}
-
-	public int getPort() {
-		return port;
-	}
-
-	public void startServer(final int port) {
-		if (started)
-			return;
-		started = true;
-		this.port = port;
-		Thread serverThread = new Thread(new Runnable() {
-			public void run() {
-				try {
-
-					synchronized (lock) {
-						serversocket.setPort(port);
-						serversocket.setTimeout(timeout);
-						serversocket.open();
-						lock.notifyAll();
-					}
-
-					while (true) {
-						// wait for a connection to be made
-						Support_Socket socket = serversocket.accept();
-						Thread thread = new Thread(new ServerThread(socket));
-						thread.start();
-					}
-				} catch (InterruptedIOException e) {
-					System.out
-							.println("Wait timed out.  Test HTTP Server shut down.");
-					started = false;
-					try {
-						if (serversocket != null)
-							serversocket.close();
-					} catch (IOException e2) {
-					}
-				} catch (IOException e) {
-					// release the lock so the tests will finish running
-					if (!shuttingDown) {
-						e.printStackTrace();
-						TestCase.fail("Test server error on HTTP Server on port "
-										+ port + ": " + e);
-					}
-					synchronized (lock) {
-						lock.notifyAll();
-					}
-				} finally {
-					try {
-						if (serversocket != null)
-							serversocket.close();
-					} catch (IOException e) {
-						e.printStackTrace();
-					}
-				}
-			}
-		});
-
-		// start the server and continue
-		synchronized (lock) {
-			serverThread.start();
-
-			// wait for the port to be opened before continuing
-			// to eliminate a race condition between starting the
-			// server and the clients accessing the server
-			try {
-				lock.wait();
-			} catch (InterruptedException e) {
-				System.err.println("Unexpected interrupt 2");
-				e.printStackTrace();
-			}
-		}
-
-	}
-
-	public void stopServer() {
-		try {
-			shuttingDown = true;
-			serversocket.close();
-		} catch (IOException e) {
-		}
-	}
-
-	class ServerThread implements Runnable {
-
-		Support_Socket socket;
-
-		ServerThread(Support_Socket s) {
-			socket = s;
-		}
-
-		String readln(InputStream is) throws IOException {
-			boolean lastCr = false;
-			StringBuffer result = new StringBuffer();
-			int c = is.read();
-			if (c < 0)
-				return null;
-			while (c != '\n') {
-				if (lastCr) {
-					result.append('\r');
-					lastCr = false;
-				}
-				if (c == '\r')
-					lastCr = true;
-				else
-					result.append((char) c);
-				c = is.read();
-				if (c < 0)
-					break;
-			}
-			return result.toString();
-		}
-
-		void print(OutputStream os, String text) throws IOException {
-			os.write(text.getBytes("ISO8859_1"));
-		}
-
-		public void run() {
-			try {
-				// get the input stream
-
-				// parse the result headers until the first blank line
-				InputStream in = socket.getInputStream();
-				String line;
-				boolean authenticated = false, contentLength = false, chunked = false;
-				int length = -1;
-				String resourceName = "";
-				Vector headers = new Vector();
-				while (((line = readln(in)) != null) && (line.length() > 1)) {
-					headers.addElement(line);
-					String lline = line.toLowerCase();
-					// determine the resource requested in the first line
-					if (lline.startsWith("get") || lline.startsWith("post")) {
-						int start = line.indexOf(' ') + 1;
-						int end = line.indexOf(' ', start);
-						if (start > 0 && end > -1)
-							resourceName = line.substring(start, end);
-					}
-					if (lline.startsWith("authorization:")) {
-						authenticated = true;
-					}
-					if (lline.startsWith("content-length")) {
-						if (contentLength)
-							TestCase.fail("Duplicate Content-Length: " + line);
-						contentLength = true;
-						length = Integer.parseInt(line.substring(line
-								.indexOf(' ') + 1));
-					}
-					if (line.startsWith("transfer-encoding")) {
-						if (chunked)
-							TestCase.fail("Duplicate Transfer-Encoding: "
-									+ line);
-						chunked = true;
-						String encoding = line.substring(line.indexOf(' ') + 1);
-						if ("chunked".equals(encoding))
-							TestCase.fail("Unknown Transfer-Encoding: "
-									+ encoding);
-					}
-
-				}
-				if (contentLength && chunked)
-					TestCase.fail("Found both Content-Length and Transfer-Encoding");
-
-				// call the test function based on the requested resource
-				if (resourceName.equals(CHUNKEDTEST))
-					chunkedTest();
-				else if (resourceName.equals(CONTENTTEST))
-					contentTest();
-				else if (resourceName.equals(AUTHTEST))
-					authenticateTest(authenticated);
-				else if (resourceName.startsWith(REDIRECTTEST))
-					redirectTest(resourceName);
-				else if (portRedirectTestEnable
-						&& resourceName.equals(PORTREDIRTEST))
-					contentTest();
-				else if (resourceName.equals(OTHERTEST))
-					otherTest();
-				else if (resourceName.equals(HEADERSTEST))
-					headersTest(headers);
-				else if (resourceName.startsWith("http://")
-						&& resourceName.indexOf(OTHERTEST) > -1)
-					// redirection to a proxy passes an absolute URI to the
-					// proxy server
-					otherTest();
-				else if (resourceName.equals(POSTTEST)) {
-					postTest(length, in);
-				} else
-					notFound(); // return a not found error
-
-				in.close();
-				socket.close();
-
-			} catch (IOException e) {
-				System.err.println("Error performing http server test.");
-				e.printStackTrace();
-			}
-
-		}
-
-		private void contentTest() {
-			// send 5 bytes of data, specifying a content-length
-			try {
-				OutputStream os = socket.getOutputStream();
-				print(os, "HTTP/1.1 " + OK + " OK\r\n");
-				print(os, "Content-Length: 5\r\n");
-				print(os, "\r\nABCDE");
-				os.flush();
-				os.close();
-			} catch (IOException e) {
-				System.err.println("Error performing content coding test.");
-				e.printStackTrace();
-			}
-
-		}
-
-		private void chunkedTest() {
-			// send 5 bytes of chunked data
-			try {
-				OutputStream os = socket.getOutputStream();
-				print(os, "HTTP/1.1 " + OK + " OK\r\n");
-				print(os, "Transfer-Encoding: chunked\r\n");
-				print(os, "\r\n");
-				print(os, "5\r\nFGHIJ");
-				print(os, "\r\n0\r\n\r\n");
-				os.flush();
-				os.close();
-			} catch (IOException e) {
-				System.err
-						.println("Error performing chunked transfer coding test.");
-				e.printStackTrace();
-			}
-
-		}
-
-		private void authenticateTest(boolean authenticated) {
-			// send an authentication required response
-			// the client should respond with a new request
-			// that includes authorization credentials
-			try {
-				OutputStream os = socket.getOutputStream();
-
-				// if the user has not sent along credentials, return
-				// unauthorized, which should prompt them to repeat
-				// the request with an authorization header added
-				if (!authenticated) {
-					print(os, "HTTP/1.1 " + UNAUTHORIZED + " Unauthorized\r\n");
-					print(os, "WWW-Authenticate: Basic realm=\"test\"\r\n");
-				} else {
-					print(os, "HTTP/1.1 " + OK + " OK\r\n");
-				}
-
-				print(os, "Content-Length: 5\r\n");
-				print(os, "\r\nKLMNO");
-				os.flush();
-				os.close();
-			} catch (IOException e) {
-				System.err.println("Error performing authentication test.");
-				e.printStackTrace();
-			}
-		}
-
-		private void redirectTest(String test) {
-			// send a redirect response
-
-			// the URL was in the format:
-			// "http://localhost:<port>/redirectTest.html/<3XX level response
-			// code>-<new URL>"
-			// "eg.
-			// http://localhost:8080/redirectTest.html/301-http://www.apache.org"
-			int responseNum = Integer.parseInt(test.substring(
-					test.indexOf('3'), test.indexOf('3') + 3));
-			String location = test.substring(test.lastIndexOf('-') + 1);
-
-			try {
-				OutputStream os = socket.getOutputStream();
-				print(os, "HTTP/1.1 " + responseNum + " Irrelevant\r\n");
-				print(os, "Location: " + location + "\r\n");
-				print(os, "Content-Length: 5\r\n");
-				print(os, "\r\nPQRST");
-				os.flush();
-				os.close();
-
-			} catch (IOException e) {
-				System.err.println("Error performing redirection test.");
-				e.printStackTrace();
-			}
-
-		}
-
-		private void otherTest() {
-			// send 5 bytes of content coded data
-			try {
-				OutputStream os = socket.getOutputStream();
-				if (!proxy) {
-					print(os, "HTTP/1.1 " + 305 + " Use Proxy\r\n");
-					// print(os, "Location: http://intl2000.ott.oti.com\r\n");
-					print(os, "Location: http://localhost:" + (port + 1)
-							+ "/otherTest.html\r\n");
-					print(os, "Content-Length: 9\r\n");
-					print(os, "\r\nNOT PROXY");
-				} else {
-					print(os, "HTTP/1.1 " + OK + " OK\r\n");
-					print(os, "Content-Length: 5\r\n");
-					print(os, "\r\nPROXY");
-				}
-				os.flush();
-				os.close();
-
-			} catch (IOException e) {
-				System.err.println("Error performing content coding test.");
-				e.printStackTrace();
-			}
-
-		}
-
-		private void headersTest(Vector headers) {
-			int found = 0;
-			for (int i = 0; i < headers.size(); i++) {
-				String header = (String) headers.elementAt(i);
-				if (header.startsWith("header1:")) {
-					found++;
-					TestCase.assertTrue("unexpected header: " + header,
-							found == 1);
-					TestCase.assertTrue("invalid header: " + header,
-							"header1: value2".equals(header));
-				}
-			}
-			// send duplicate headers
-			try {
-				OutputStream os = socket.getOutputStream();
-				print(os, "HTTP/1.1 " + OK + " OK\r\n");
-				print(os, "Cache-Control: no-cache=\"set-cookie\"\r\n");
-				print(os, "Cache-Control: private\r\n");
-				print(os, "Cache-Control: no-transform\r\n\r\n");
-				os.flush();
-				os.close();
-			} catch (IOException e) {
-				System.err.println("Error performing headers test.");
-				e.printStackTrace();
-			}
-		}
-
-		/**
-		 * Method postTest.
-		 */
-		private void postTest(int length, InputStream in) {
-			try {
-				ByteArrayOutputStream data = new ByteArrayOutputStream();
-				// read content-length specified data
-				for (int i = 0; i < length; i++)
-					data.write(in.read());
-
-				// read chunked-encoding data
-				if (length == -1) {
-					int len = in.read() - 48;
-					in.read();
-					in.read();
-					while (len > 0) {
-						data.write('C');
-						for (int i = 0; i < len; i++) {
-							data.write(in.read());
-						}
-						in.read();
-						in.read();
-						len = in.read() - 48;
-						in.read();
-						in.read();
-					}
-					in.read();
-					in.read();
-				}
-
-				OutputStream os = socket.getOutputStream();
-				print(os, "HTTP/1.1 " + OK + " OK\r\n");
-				print(os, "Content-Length: " + data.size() + "\r\n\r\n");
-				os.write(data.toByteArray());
-				os.flush();
-				os.close();
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-
-		private void notFound() {
-			try {
-				// System.out.println("File not found on test server.");
-				OutputStream os = socket.getOutputStream();
-				print(os, "HTTP/1.1 " + NOT_FOUND + " Not Found\r\n");
-				print(os, "Content-Length: 1\r\n");
-				print(os, "\r\nZ");
-				os.flush();
-				os.close();
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-
-	}
-
-	/**
-	 * Sets portRedirectTestEnable.
-	 * 
-	 * @param portRedirectTestEnable
-	 *            The portRedirectTestEnable to set
-	 */
-	public void setPortRedirectTestEnable(boolean portRedirectTestEnable) {
-		// enables an additional resource ("portredirTest.html") to be returned
-		// so that the port redirection test can distinguish
-		// between the two servers (on different ports).
-
-		this.portRedirectTestEnable = portRedirectTestEnable;
-	}
-
-	/**
-	 * Sets the proxy.
-	 * 
-	 * @param proxy
-	 *            The proxy to set
-	 */
-	public void setProxy(boolean proxy) {
-		this.proxy = proxy;
-	}
-
-}
+/* 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.InterruptedIOException;
+import java.io.OutputStream;
+import java.util.Vector;
+
+import junit.framework.TestCase;
+
+public class Support_HttpServer {
+
+	private static final int timeout = 10000;
+
+	public static final String AUTHTEST = "/authTest";
+
+	public static final String CHUNKEDTEST = "/chunkedTest.html";
+
+	public static final String CONTENTTEST = "/contentTest.html";
+
+	public static final String REDIRECTTEST = "/redirectTest.html";
+
+	public static final String PORTREDIRTEST = "/portredirTest.html";
+
+	public static final String OTHERTEST = "/otherTest.html";
+
+	public static final String POSTTEST = "/postTest.html";
+
+	public static final String HEADERSTEST = "/headersTest.html";
+
+	public static final int OK = 200;
+
+	public static final int MULT_CHOICE = 300;
+
+	public static final int MOVED_PERM = 301;
+
+	public static final int FOUND = 302;
+
+	public static final int SEE_OTHER = 303;
+
+	public static final int NOT_MODIFIED = 304;
+
+	public static final int UNUSED = 306;
+
+	public static final int TEMP_REDIRECT = 307;
+
+	public static final int UNAUTHORIZED = 401;
+
+	public static final int NOT_FOUND = 404;
+
+	private int port;
+
+	private boolean proxy = false;
+
+	private boolean started = false;
+
+	private boolean portRedirectTestEnable = false;
+
+	private volatile Support_ServerSocket serversocket;
+
+	private boolean shuttingDown = false;
+
+	// synchronization
+	private Object lock = new Object();
+
+	TestCase testcase = null;
+
+	public Support_HttpServer(Support_ServerSocket serversocket, TestCase test) {
+		this.serversocket = serversocket;
+		this.testcase = test;
+	}
+
+	public int getPort() {
+		return port;
+	}
+
+	public void startServer(final int port) {
+		if (started)
+			return;
+		started = true;
+		this.port = port;
+		Thread serverThread = new Thread(new Runnable() {
+			public void run() {
+				try {
+
+					synchronized (lock) {
+						serversocket.setPort(port);
+						serversocket.setTimeout(timeout);
+						serversocket.open();
+						lock.notifyAll();
+					}
+
+					while (true) {
+						// wait for a connection to be made
+						Support_Socket socket = serversocket.accept();
+						Thread thread = new Thread(new ServerThread(socket));
+						thread.start();
+					}
+				} catch (InterruptedIOException e) {
+					System.out
+							.println("Wait timed out.  Test HTTP Server shut down.");
+					started = false;
+					try {
+						if (serversocket != null)
+							serversocket.close();
+					} catch (IOException e2) {
+					}
+				} catch (IOException e) {
+					// release the lock so the tests will finish running
+					if (!shuttingDown) {
+						e.printStackTrace();
+						TestCase.fail("Test server error on HTTP Server on port "
+										+ port + ": " + e);
+					}
+					synchronized (lock) {
+						lock.notifyAll();
+					}
+				} finally {
+					try {
+						if (serversocket != null)
+							serversocket.close();
+					} catch (IOException e) {
+						e.printStackTrace();
+					}
+				}
+			}
+		});
+
+		// start the server and continue
+		synchronized (lock) {
+			serverThread.start();
+
+			// wait for the port to be opened before continuing
+			// to eliminate a race condition between starting the
+			// server and the clients accessing the server
+			try {
+				lock.wait();
+			} catch (InterruptedException e) {
+				System.err.println("Unexpected interrupt 2");
+				e.printStackTrace();
+			}
+		}
+
+	}
+
+	public void stopServer() {
+		try {
+			shuttingDown = true;
+			serversocket.close();
+		} catch (IOException e) {
+		}
+	}
+
+	class ServerThread implements Runnable {
+
+		Support_Socket socket;
+
+		ServerThread(Support_Socket s) {
+			socket = s;
+		}
+
+		String readln(InputStream is) throws IOException {
+			boolean lastCr = false;
+			StringBuffer result = new StringBuffer();
+			int c = is.read();
+			if (c < 0)
+				return null;
+			while (c != '\n') {
+				if (lastCr) {
+					result.append('\r');
+					lastCr = false;
+				}
+				if (c == '\r')
+					lastCr = true;
+				else
+					result.append((char) c);
+				c = is.read();
+				if (c < 0)
+					break;
+			}
+			return result.toString();
+		}
+
+		void print(OutputStream os, String text) throws IOException {
+			os.write(text.getBytes("ISO8859_1"));
+		}
+
+		public void run() {
+			try {
+				// get the input stream
+
+				// parse the result headers until the first blank line
+				InputStream in = socket.getInputStream();
+				String line;
+				boolean authenticated = false, contentLength = false, chunked = false;
+				int length = -1;
+				String resourceName = "";
+				Vector headers = new Vector();
+				while (((line = readln(in)) != null) && (line.length() > 1)) {
+					headers.addElement(line);
+					String lline = line.toLowerCase();
+					// determine the resource requested in the first line
+					if (lline.startsWith("get") || lline.startsWith("post")) {
+						int start = line.indexOf(' ') + 1;
+						int end = line.indexOf(' ', start);
+						if (start > 0 && end > -1)
+							resourceName = line.substring(start, end);
+					}
+					if (lline.startsWith("authorization:")) {
+						authenticated = true;
+					}
+					if (lline.startsWith("content-length")) {
+						if (contentLength)
+							TestCase.fail("Duplicate Content-Length: " + line);
+						contentLength = true;
+						length = Integer.parseInt(line.substring(line
+								.indexOf(' ') + 1));
+					}
+					if (line.startsWith("transfer-encoding")) {
+						if (chunked)
+							TestCase.fail("Duplicate Transfer-Encoding: "
+									+ line);
+						chunked = true;
+						String encoding = line.substring(line.indexOf(' ') + 1);
+						if ("chunked".equals(encoding))
+							TestCase.fail("Unknown Transfer-Encoding: "
+									+ encoding);
+					}
+
+				}
+				if (contentLength && chunked)
+					TestCase.fail("Found both Content-Length and Transfer-Encoding");
+
+				// call the test function based on the requested resource
+				if (resourceName.equals(CHUNKEDTEST))
+					chunkedTest();
+				else if (resourceName.equals(CONTENTTEST))
+					contentTest();
+				else if (resourceName.equals(AUTHTEST))
+					authenticateTest(authenticated);
+				else if (resourceName.startsWith(REDIRECTTEST))
+					redirectTest(resourceName);
+				else if (portRedirectTestEnable
+						&& resourceName.equals(PORTREDIRTEST))
+					contentTest();
+				else if (resourceName.equals(OTHERTEST))
+					otherTest();
+				else if (resourceName.equals(HEADERSTEST))
+					headersTest(headers);
+				else if (resourceName.startsWith("http://")
+						&& resourceName.indexOf(OTHERTEST) > -1)
+					// redirection to a proxy passes an absolute URI to the
+					// proxy server
+					otherTest();
+				else if (resourceName.equals(POSTTEST)) {
+					postTest(length, in);
+				} else
+					notFound(); // return a not found error
+
+				in.close();
+				socket.close();
+
+			} catch (IOException e) {
+				System.err.println("Error performing http server test.");
+				e.printStackTrace();
+			}
+
+		}
+
+		private void contentTest() {
+			// send 5 bytes of data, specifying a content-length
+			try {
+				OutputStream os = socket.getOutputStream();
+				print(os, "HTTP/1.1 " + OK + " OK\r\n");
+				print(os, "Content-Length: 5\r\n");
+				print(os, "\r\nABCDE");
+				os.flush();
+				os.close();
+			} catch (IOException e) {
+				System.err.println("Error performing content coding test.");
+				e.printStackTrace();
+			}
+
+		}
+
+		private void chunkedTest() {
+			// send 5 bytes of chunked data
+			try {
+				OutputStream os = socket.getOutputStream();
+				print(os, "HTTP/1.1 " + OK + " OK\r\n");
+				print(os, "Transfer-Encoding: chunked\r\n");
+				print(os, "\r\n");
+				print(os, "5\r\nFGHIJ");
+				print(os, "\r\n0\r\n\r\n");
+				os.flush();
+				os.close();
+			} catch (IOException e) {
+				System.err
+						.println("Error performing chunked transfer coding test.");
+				e.printStackTrace();
+			}
+
+		}
+
+		private void authenticateTest(boolean authenticated) {
+			// send an authentication required response
+			// the client should respond with a new request
+			// that includes authorization credentials
+			try {
+				OutputStream os = socket.getOutputStream();
+
+				// if the user has not sent along credentials, return
+				// unauthorized, which should prompt them to repeat
+				// the request with an authorization header added
+				if (!authenticated) {
+					print(os, "HTTP/1.1 " + UNAUTHORIZED + " Unauthorized\r\n");
+					print(os, "WWW-Authenticate: Basic realm=\"test\"\r\n");
+				} else {
+					print(os, "HTTP/1.1 " + OK + " OK\r\n");
+				}
+
+				print(os, "Content-Length: 5\r\n");
+				print(os, "\r\nKLMNO");
+				os.flush();
+				os.close();
+			} catch (IOException e) {
+				System.err.println("Error performing authentication test.");
+				e.printStackTrace();
+			}
+		}
+
+		private void redirectTest(String test) {
+			// send a redirect response
+
+			// the URL was in the format:
+			// "http://localhost:<port>/redirectTest.html/<3XX level response
+			// code>-<new URL>"
+			// "eg.
+			// http://localhost:8080/redirectTest.html/301-http://www.apache.org"
+			int responseNum = Integer.parseInt(test.substring(
+					test.indexOf('3'), test.indexOf('3') + 3));
+			String location = test.substring(test.lastIndexOf('-') + 1);
+
+			try {
+				OutputStream os = socket.getOutputStream();
+				print(os, "HTTP/1.1 " + responseNum + " Irrelevant\r\n");
+				print(os, "Location: " + location + "\r\n");
+				print(os, "Content-Length: 5\r\n");
+				print(os, "\r\nPQRST");
+				os.flush();
+				os.close();
+
+			} catch (IOException e) {
+				System.err.println("Error performing redirection test.");
+				e.printStackTrace();
+			}
+
+		}
+
+		private void otherTest() {
+			// send 5 bytes of content coded data
+			try {
+				OutputStream os = socket.getOutputStream();
+				if (!proxy) {
+					print(os, "HTTP/1.1 " + 305 + " Use Proxy\r\n");
+					// print(os, "Location: http://intl2000.ott.oti.com\r\n");
+					print(os, "Location: http://localhost:" + (port + 1)
+							+ "/otherTest.html\r\n");
+					print(os, "Content-Length: 9\r\n");
+					print(os, "\r\nNOT PROXY");
+				} else {
+					print(os, "HTTP/1.1 " + OK + " OK\r\n");
+					print(os, "Content-Length: 5\r\n");
+					print(os, "\r\nPROXY");
+				}
+				os.flush();
+				os.close();
+
+			} catch (IOException e) {
+				System.err.println("Error performing content coding test.");
+				e.printStackTrace();
+			}
+
+		}
+
+		private void headersTest(Vector headers) {
+			int found = 0;
+			for (int i = 0; i < headers.size(); i++) {
+				String header = (String) headers.elementAt(i);
+				if (header.startsWith("header1:")) {
+					found++;
+					TestCase.assertTrue("unexpected header: " + header,
+							found == 1);
+					TestCase.assertTrue("invalid header: " + header,
+							"header1: value2".equals(header));
+				}
+			}
+			// send duplicate headers
+			try {
+				OutputStream os = socket.getOutputStream();
+				print(os, "HTTP/1.1 " + OK + " OK\r\n");
+				print(os, "Cache-Control: no-cache=\"set-cookie\"\r\n");
+				print(os, "Cache-Control: private\r\n");
+				print(os, "Cache-Control: no-transform\r\n\r\n");
+				os.flush();
+				os.close();
+			} catch (IOException e) {
+				System.err.println("Error performing headers test.");
+				e.printStackTrace();
+			}
+		}
+
+		/**
+		 * Method postTest.
+		 */
+		private void postTest(int length, InputStream in) {
+			try {
+				ByteArrayOutputStream data = new ByteArrayOutputStream();
+				// read content-length specified data
+				for (int i = 0; i < length; i++)
+					data.write(in.read());
+
+				// read chunked-encoding data
+				if (length == -1) {
+					int len = in.read() - 48;
+					in.read();
+					in.read();
+					while (len > 0) {
+						data.write('C');
+						for (int i = 0; i < len; i++) {
+							data.write(in.read());
+						}
+						in.read();
+						in.read();
+						len = in.read() - 48;
+						in.read();
+						in.read();
+					}
+					in.read();
+					in.read();
+				}
+
+				OutputStream os = socket.getOutputStream();
+				print(os, "HTTP/1.1 " + OK + " OK\r\n");
+				print(os, "Content-Length: " + data.size() + "\r\n\r\n");
+				os.write(data.toByteArray());
+				os.flush();
+				os.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+
+		private void notFound() {
+			try {
+				// System.out.println("File not found on test server.");
+				OutputStream os = socket.getOutputStream();
+				print(os, "HTTP/1.1 " + NOT_FOUND + " Not Found\r\n");
+				print(os, "Content-Length: 1\r\n");
+				print(os, "\r\nZ");
+				os.flush();
+				os.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+
+	}
+
+	/**
+	 * Sets portRedirectTestEnable.
+	 * 
+	 * @param portRedirectTestEnable
+	 *            The portRedirectTestEnable to set
+	 */
+	public void setPortRedirectTestEnable(boolean portRedirectTestEnable) {
+		// enables an additional resource ("portredirTest.html") to be returned
+		// so that the port redirection test can distinguish
+		// between the two servers (on different ports).
+
+		this.portRedirectTestEnable = portRedirectTestEnable;
+	}
+
+	/**
+	 * Sets the proxy.
+	 * 
+	 * @param proxy
+	 *            The proxy to set
+	 */
+	public void setProxy(boolean proxy) {
+		this.proxy = proxy;
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServerSocket.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServerSocket.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServerSocket.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServerSocket.java Tue Sep  5 06:39:17 2006
@@ -1,76 +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();
-	}
-
-}
+/* 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();
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpServerSocket.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpSocket.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpSocket.java?view=diff&rev=440340&r1=440339&r2=440340
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpSocket.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpSocket.java Tue Sep  5 06:39:17 2006
@@ -1,51 +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();
-	}
-
-}
+/* 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();
+	}
+
+}

Propchange: incubator/harmony/enhanced/classlib/trunk/support/src/test/java/tests/support/Support_HttpSocket.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message