Author: julien(a)jboss.com
Date: 2007-10-23 09:57:28 -0400 (Tue, 23 Oct 2007)
New Revision: 8751
Added:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractServer.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractSynchronizedServer.java
modules/common/trunk/common/src/test/resources/log4j.properties
Removed:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLStreamOpeningThread.java
Modified:
modules/common/trunk/common/pom.xml
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/URLToolsTestCase.java
Log:
- switched URLTools timeout implementations to use Java 5
- removed dependency over HTTP Client
- added timeout and response 200 test cases for URLTools.exist and URLTools.performGET
Modified: modules/common/trunk/common/pom.xml
===================================================================
--- modules/common/trunk/common/pom.xml 2007-10-23 11:14:01 UTC (rev 8750)
+++ modules/common/trunk/common/pom.xml 2007-10-23 13:57:28 UTC (rev 8751)
@@ -145,6 +145,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+ <!-- To use in conjonctin with
+ export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000"
+ -->
<!--
<forkMode>never</forkMode>
<argLine>-enableassertions</argLine>
Deleted:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLStreamOpeningThread.java
===================================================================
---
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLStreamOpeningThread.java 2007-10-23
11:14:01 UTC (rev 8750)
+++
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLStreamOpeningThread.java 2007-10-23
13:57:28 UTC (rev 8751)
@@ -1,99 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-
-package
org.jboss.portal.common.net;
-
-import org.jboss.portal.common.util.ParameterValidation;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-/**
- * A class that opens an InputStream to a URL in a thread so that it doesn't block
normal operations and can be timed
- * out if needed.
- *
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision: 7379 $
- * @since 2.4.2
- */
-public class URLStreamOpeningThread extends Thread
-{
-
- /** . */
- private final URL url;
-
- /** . */
- private volatile InputStream inputStream;
-
- /** Exception in the event a connection error occurs */
- private volatile IOException exception;
-
- public URLStreamOpeningThread(URL url)
- {
- ParameterValidation.throwIllegalArgExceptionIfNull(url, "URL");
-
- //
- this.url = url;
- this.inputStream = null;
- this.exception = null;
- }
-
- public void run()
- {
- try
- {
- InputStream in = url.openStream();
- if (in == null)
- {
- throw new IllegalArgumentException("Cannot open stream from [" +
url + "]");
- }
-
- //
- inputStream = in;
- }
- catch (IOException e)
- {
- exception = e;
- }
- }
-
- public boolean isConnected()
- {
- return inputStream != null;
- }
-
- public boolean isError()
- {
- return exception != null;
- }
-
- public InputStream getInputStream()
- {
- return inputStream;
- }
-
- public IOException getException()
- {
- return exception;
- }
-}
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java
===================================================================
---
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java 2007-10-23
11:14:01 UTC (rev 8750)
+++
modules/common/trunk/common/src/main/java/org/jboss/portal/common/net/URLTools.java 2007-10-23
13:57:28 UTC (rev 8751)
@@ -22,17 +22,18 @@
******************************************************************************/
package
org.jboss.portal.common.net;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpMethod;
-import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.log4j.Logger;
import org.jboss.portal.common.io.IOTools;
import org.jboss.portal.common.util.ParameterValidation;
+import java.io.BufferedInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
+import java.net.SocketTimeoutException;
import java.net.URL;
+import java.net.URLConnection;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
@@ -56,18 +57,8 @@
public static final String FTP_PREFIX = "ftp://";
public static final String FILE_PREFIX = "/";
- public static final int PROXY_PORT;
- public static final String PROXY_HOST;
-
private static final Logger log = Logger.getLogger(URLTools.class);
- static
- {
- PROXY_HOST = System.getProperty("http.proxyHost");
- PROXY_PORT = Integer.parseInt(System.getProperty("http.proxyPort",
"-1"));
- log.debug("Proxy settings: host='" + PROXY_HOST + "',
port='" + PROXY_PORT + "'");
- }
-
public static boolean isURLAbsolute(String url)
{
return isNetworkURL(url) || url.startsWith(FILE_PREFIX);
@@ -81,9 +72,10 @@
* @param url the URL the URL of the resource
* @param soTimeoutMillis the socket connection timeout in millis
* @param connTimeoutMillis the connection timeout in millis
- * @return the retrieved byte array
+ * @return the retrieved byte array
+ * @throws IllegalArgumentException if the URL is null or any time out value is
negative
*/
- public static byte[] performGET(URL url, int soTimeoutMillis, int connTimeoutMillis)
throws IllegalArgumentException, IOException
+ public static byte[] performGET(URL url, int soTimeoutMillis, int connTimeoutMillis)
throws IllegalArgumentException
{
if (url == null)
{
@@ -91,55 +83,48 @@
}
if (soTimeoutMillis < 0)
{
- throw new IllegalArgumentException("No negative socket timeout");
+ throw new IllegalArgumentException("No negative socket timeout " +
soTimeoutMillis);
}
if (connTimeoutMillis < 0)
{
- throw new IllegalArgumentException("No negative connection timeout");
+ throw new IllegalArgumentException("No negative connection timeout" +
connTimeoutMillis);
}
- if ("http".equals(url.getProtocol()) ||
"https".equals(url.getProtocol()))
+
+ //
+ URLConnection conn;
+ try
{
- HttpClient client = new HttpClient();
+ conn = url.openConnection();
+ }
+ catch (IOException e)
+ {
+ return null;
+ }
- if (PROXY_HOST != null)
- {
- client.getHostConfiguration().setProxy(PROXY_HOST, PROXY_PORT);
- }
+ // Configure
+ conn.setConnectTimeout(soTimeoutMillis);
+ conn.setReadTimeout(connTimeoutMillis);
- // Yes deprecated but advocated way to do will not for with 2.0.2 which is what
today JBoss AS ships
- if (connTimeoutMillis > 0)
- {
- client.setConnectionTimeout(connTimeoutMillis);
- }
- if (soTimeoutMillis > 0)
- {
- client.setTimeout(soTimeoutMillis);
- }
-
- //
- HttpMethod method = null;
- try
- {
- method = new GetMethod(url.toString());
- method.setFollowRedirects(true);
- int statusCode = client.executeMethod(method);
- if (statusCode == 200)
- {
- return method.getResponseBody();
- }
- }
- finally
- {
- if (method != null)
- {
- method.releaseConnection();
- }
- }
-
- //
+ //
+ InputStream in = null;
+ try
+ {
+ conn.connect();
+ in = new BufferedInputStream(conn.getInputStream());
+ return IOTools.getBytes(in);
+ }
+ catch (SocketTimeoutException e)
+ {
return null;
}
- throw new IllegalArgumentException("Protocol " + url.getProtocol() +
" not accepted for url " + url);
+ catch (IOException e)
+ {
+ return null;
+ }
+ finally
+ {
+ IOTools.safeClose(in);
+ }
}
/**
@@ -210,72 +195,89 @@
*/
public static boolean exists(URL url)
{
- ParameterValidation.throwIllegalArgExceptionIfNull(url, "URL");
-
return exists(url, 1000);
}
/**
- * Determines if the specified URL corresponds to an existing resource by trying to
open a stream from it. The
- * connection attempt is made from a different thread on which we wait for the
specified amount of time before timing
- * out.
+ * Determines if the specified URL corresponds to an existing resource by trying to
open a stream from it.
*
* @param url the URL to be tested
* @param waitForMillis the number of milliseconds to wait before timing out, 0
meaning never timing out.
* @return
+ * @throws IllegalArgumentException if the url is null or the time out negative
* @since 2.4.2
*/
- public static boolean exists(URL url, long waitForMillis)
+ public static boolean exists(URL url, long waitForMillis) throws
IllegalArgumentException
{
- URLStreamOpeningThread thread = new URLStreamOpeningThread(url);
- thread.start();
+ if (url == null)
+ {
+ throw new IllegalArgumentException("No null URL accepted");
+ }
+ if (waitForMillis < 0)
+ {
+ throw new IllegalArgumentException("Read time out must be a positive value
instead of " + waitForMillis);
+ }
+ //
+ URLConnection conn;
try
{
- // Wait for the thread to finish but don't wait longer than the specified
time
- thread.join(waitForMillis);
+ conn = url.openConnection();
+ }
+ catch (IOException e)
+ {
+ log.debug("Could not open connection for " + url, e);
+ return false;
+ }
- if (thread.isAlive())
- {
- // Timeout occurred; thread has not finished
- throw new RuntimeException("Couldn't connect to " + url +
" within " + waitForMillis / 1000
- + " seconds. Check your connection parameters or the URL.");
- }
- else
- {
- // Finished
- return thread.isConnected() && !thread.isError();
- }
+ // Configure
+ conn.setConnectTimeout((int)waitForMillis);
+ conn.setReadTimeout((int)waitForMillis);
+
+ //
+ InputStream in = null;
+ try
+ {
+ conn.connect();
+ in = conn.getInputStream();
+ return true;
}
- catch (InterruptedException e)
+ catch (SocketTimeoutException e)
{
- // Thread was interrupted
- throw new RuntimeException("Connection thread to " + url + " was
interrupted!", e);
+ return false;
}
+ catch (IOException e)
+ {
+ return false;
+ }
finally
{
- IOTools.safeClose(thread.getInputStream());
+ IOTools.safeClose(in);
}
}
/**
- * @param urlAsString
+ * to remove : an API should not try to accomodate the client for that kind of
situation,
+ * why not also something like forbidStringLengthToDivisibleBy3 ?
+
+ * @param stringURL
* @param allowNull <code>true</code> if passing
<code>null</code> will be ignored and just return
* <code>false</code>, <code>false</code>
to throw an {@link IllegalArgumentException} is the
* given URL is <code>null</code>.
+ *
* @return
* @since 2.4.2
*/
- public static boolean exists(String urlAsString, boolean allowNull)
+ public static boolean exists(String stringURL, boolean allowNull)
{
if (!allowNull)
{
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(urlAsString,
"URL", null);
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(stringURL,
"URL", null);
}
try
{
- URL url = new URL(urlAsString);
+ URL url = new URL(stringURL);
return exists(url);
}
catch (MalformedURLException e)
Added:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractServer.java
===================================================================
---
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractServer.java
(rev 0)
+++
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractServer.java 2007-10-23
13:57:28 UTC (rev 8751)
@@ -0,0 +1,93 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package
org.jboss.portal.test.common.net;
+
+import java.net.ServerSocket;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractServer implements Runnable
+{
+
+ /** . */
+ private int port;
+
+ /** . */
+ private ServerSocket server;
+
+ public AbstractServer(int port)
+ {
+ this.port = port;
+ }
+
+ public final void start() throws Exception
+ {
+ server = new ServerSocket(port, 1);
+ new Thread(this).start();
+ }
+
+ public final void run()
+ {
+ try
+ {
+ run(server);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if (!server.isClosed())
+ {
+ try
+ {
+ server.close();
+ }
+ catch (IOException ignore)
+ {
+ }
+ }
+ }
+ }
+
+ protected abstract void run(ServerSocket server) throws Exception;
+
+ public final void stop()
+ {
+ if (server != null)
+ {
+ try
+ {
+ server.close();
+ }
+ catch (IOException ignore)
+ {
+ }
+ }
+ }
+
+}
Added:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractSynchronizedServer.java
===================================================================
---
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractSynchronizedServer.java
(rev 0)
+++
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/AbstractSynchronizedServer.java 2007-10-23
13:57:28 UTC (rev 8751)
@@ -0,0 +1,180 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package
org.jboss.portal.test.common.net;
+
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.junit.ExtendedAssert;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.io.BufferedInputStream;
+import java.io.LineNumberReader;
+import java.io.InputStreamReader;
+import java.io.BufferedOutputStream;
+import java.io.OutputStreamWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractSynchronizedServer extends AbstractServer
+{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(AbstractSynchronizedServer.class);
+
+ /** . */
+ private final Object lock = new Object();
+
+ /** . */
+ private final AtomicInteger b = new AtomicInteger(0);
+
+ /** . */
+ private Throwable failure;
+
+ protected AbstractSynchronizedServer(int port)
+ {
+ super(port);
+ }
+
+ protected void run(ServerSocket server) throws Exception
+ {
+ synchronized (lock)
+ {
+ b.set(1);
+ lock.notifyAll();
+ }
+
+ //
+ log.debug("Ready for accept");
+
+ //
+ try
+ {
+ doServer(server);
+ }
+ catch (Throwable throwable)
+ {
+ failure = throwable;
+ }
+
+ //
+ synchronized (lock)
+ {
+ lock.wait();
+ }
+
+ //
+ log.debug("Shutting down");
+ }
+
+ protected abstract void doServer(ServerSocket server) throws Exception;
+
+ protected abstract void doClient() throws Exception;
+
+ public void performInteraction() throws Exception
+ {
+ try
+ {
+ start();
+
+ // Wait until the we know the server will accept
+ synchronized (lock)
+ {
+ while (b.get() != 1)
+ {
+ lock.wait();
+ }
+ }
+
+ // Perform client action
+ doClient();
+ }
+ finally
+ {
+ synchronized (lock)
+ {
+ lock.notify();
+ }
+ stop();
+ }
+
+ //
+ if (failure != null)
+ {
+ log.error("The server reported a failure", failure);
+
+ ExtendedAssert.fail("The server reported a failure");
+ }
+ }
+
+ public static abstract class AbstractTimeoutServer extends AbstractSynchronizedServer
+ {
+
+ protected AbstractTimeoutServer(int port)
+ {
+ super(port);
+ }
+
+ protected void doServer(ServerSocket server) throws Exception
+ {
+ server.accept();
+ }
+
+ }
+
+ public static abstract class AbstractOKServer extends AbstractSynchronizedServer
+ {
+
+ protected AbstractOKServer(int port)
+ {
+ super(port);
+ }
+
+ protected void doServer(ServerSocket server) throws Exception
+ {
+ //
+ Socket s = server.accept();
+ BufferedInputStream in = new BufferedInputStream(s.getInputStream());
+ LineNumberReader reader = new LineNumberReader(new InputStreamReader(in,
"ISO-8859-1"));
+ for (String line = reader.readLine();line.length() > 0;line =
reader.readLine())
+ {
+ log.debug("server received = " + line);
+ }
+
+ //
+ log.debug("Finished reading");
+
+ //
+ BufferedOutputStream out = new BufferedOutputStream(s.getOutputStream());
+ OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
+ writer.write("HTTP/1.1 200 OK\r\n");
+ writer.write("\r\n");
+ writer.flush();
+ out.write("CAFEBABE".getBytes("UTF-8"));
+ out.close();
+ }
+ }
+
+}
Modified:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/URLToolsTestCase.java
===================================================================
---
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/URLToolsTestCase.java 2007-10-23
11:14:01 UTC (rev 8750)
+++
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/net/URLToolsTestCase.java 2007-10-23
13:57:28 UTC (rev 8751)
@@ -23,8 +23,17 @@
package
org.jboss.portal.test.common.net;
import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+import org.jboss.portal.common.io.IOTools;
+import org.jboss.portal.common.junit.ExtendedAssert;
import org.jboss.portal.common.net.URLTools;
+import java.io.BufferedInputStream;
+import java.net.MalformedURLException;
+import java.net.ServerSocket;
+import java.net.URL;
+import java.net.URLConnection;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision: 7379 $
@@ -32,6 +41,10 @@
*/
public class URLToolsTestCase extends TestCase
{
+
+ /** . */
+ private static final Logger log = Logger.getLogger(URLToolsTestCase.class);
+
private static final String MARKUP = "Hello, Anonymous!\n" +
"Counter: 0<a
href='wsrp_rewrite?wsrp-urlType=render&wsrp-navigationalState=rO0ABXNyACdvcmc"
+
"uamJvc3MucG9ydGFsLnNlcnZlci51dGlsLlBhcmFtZXRlcnOJoAlMQZGhngIAAUwAA21hcHQAD0xqYXZhL3V0aWwvTWFwO3hwc3IAEWphd"
+
@@ -163,7 +176,96 @@
public void testExistsURL()
{
- // todo: add more tests
assertFalse(URLTools.exists(null, true));
+
+
}
+
+ public void testURLExistsTimeout() throws Exception
+ {
+ AbstractSynchronizedServer server = new
AbstractSynchronizedServer.AbstractTimeoutServer(8080)
+ {
+ protected void doClient()
+ {
+ boolean exist = true;
+ try
+ {
+ URL url = new URL("http://localhost:8080/");
+ exist = URLTools.exists(url, 500);
+ }
+ catch (MalformedURLException e)
+ {
+ log.error("Cannot create URL", e);
+ fail("Cannot create URL " + e.getMessage());
+ }
+
+ //
+ assertFalse("Was not expecting the URL to exist", exist);
+ }
+ };
+
+ //
+ server.performInteraction();
+ }
+
+ public void testURLPerformGETTimeout() throws Exception
+ {
+ AbstractSynchronizedServer server = new
AbstractSynchronizedServer.AbstractTimeoutServer(8080)
+ {
+ protected void doClient()
+ {
+ byte[] bytes = null;
+ try
+ {
+ URL url = new URL("http://localhost:8080/");
+ bytes = URLTools.performGET(url, 500, 500);
+ }
+ catch (MalformedURLException e)
+ {
+ log.error("Cannot create URL", e);
+ fail("Cannot create URL " + e.getMessage());
+ }
+
+ //
+ assertNull("Was not expecting the URL GET to return a non null
value", bytes);
+ }
+ };
+
+ //
+ server.performInteraction();
+ }
+
+ public void testURLPerformGET() throws Exception
+ {
+ AbstractSynchronizedServer server = new
AbstractSynchronizedServer.AbstractOKServer(8080)
+ {
+
+ protected void doClient() throws Exception
+ {
+ URL url = new URL("http://localhost:8080/");
+ byte[] bytes = URLTools.performGET(url, 5000, 5000);
+ ExtendedAssert.assertEquals("CAFEBABE".getBytes("UTF-8"),
bytes);
+ }
+ };
+
+ //
+ server.performInteraction();
+ }
+
+ public void testURLExists() throws Exception
+ {
+ AbstractSynchronizedServer server = new
AbstractSynchronizedServer.AbstractOKServer(8080)
+ {
+
+ protected void doClient() throws Exception
+ {
+ URL url = new URL("http://localhost:8080/");
+ boolean exists = URLTools.exists(url, 5000);
+ ExtendedAssert.assertTrue("Was expecting the URL to exist",
exists);
+ }
+ };
+
+ //
+ server.performInteraction();
+ }
}
Added: modules/common/trunk/common/src/test/resources/log4j.properties
===================================================================
--- modules/common/trunk/common/src/test/resources/log4j.properties
(rev 0)
+++ modules/common/trunk/common/src/test/resources/log4j.properties 2007-10-23 13:57:28
UTC (rev 8751)
@@ -0,0 +1,7 @@
+log4j.rootCategory=DEBUG, CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=INFO
+log4j.appender.CONSOLE.Target=System.out
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p [%c{1}] %m%n
\ No newline at end of file