krysalis-update/src/test/java/org/apache/depot/update/misc VfsTests.java,NONE,1.1 HttpClientTest.java,NONE,1.1
Nick Chalko <[email protected]> Wed, 08 Dec 2004 09:06:39 +0000
| Newsgroups | gmane.comp.krysalis.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/krysalis/krysalis-update/src/test/java/org/apache/depot/update/misc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24726/src/test/java/org/apache/depot/update/misc
Added Files:
VfsTests.java HttpClientTest.java
Log Message:
Copied from the apache incubator.
--- NEW FILE: VfsTests.java ---
/*
* Copyright 2004 The Apache Software Foundation
*
* 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 org.apache.depot.update.misc;
import java.util.List;
import org.apache.commons.vfs.FileObject;
import org.apache.depot.common.util.debug.DebugUtils;
import org.apache.depot.update.util.io.VfsUtils;
/**
* @author ajack
*/
public class VfsTests {
public static void main(String args[]) throws Exception {
DebugUtils.enableHttpClientDebug();
String url = "http://www.ibiblio.org/maven/junit/jars";
FileObject fo = VfsUtils.getDefaultFSM().resolveFile(url);
for (int i = 0; i < 100; ++i) {
boolean exists = fo.exists();
System.out.println("--------------------------------------");
System.out.println("Doing " + i);
List kids = VfsUtils.getChildren(fo);
}
System.out.println("Done...");
}
}
--- NEW FILE: HttpClientTest.java ---
/*
* Copyright 2004 The Apache Software Foundation
*
* 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 org.apache.depot.update.misc;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.HeadMethod;
/**
* @author ajack
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class HttpClientTest {
public static void main(String args[]) throws Exception {
System.setProperty(
"org.apache.commons.logging.Log",
"org.apache.commons.logging.impl.SimpleLog");
System.setProperty(
"org.apache.commons.logging.simplelog.showdatetime",
"true");
System.setProperty(
"org.apache.commons.logging.simplelog.log.httpclient.wire",
"debug");
System.setProperty(
"org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
"debug");
String url = "http://www.ibiblio.org/maven/HTTPClient/jars/";
for (int i = 0; i < 100; ++i) {
System.out.println("--------------------------------------");
System.out.println("Doing " + i);
HttpClient client =
new HttpClient(new MultiThreadedHttpConnectionManager());
HeadMethod head = new HeadMethod(url);
client.executeMethod(head);
GetMethod get = new GetMethod(url);
client.executeMethod(get);
get.getResponseBody();
GetMethod get2 = new GetMethod(url);
client.executeMethod(get);
get2.getResponseBody();
}
System.out.println("Done...");
}
}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/