Author: chris.laprun(a)jboss.com
Date: 2007-11-13 00:45:17 -0500 (Tue, 13 Nov 2007)
New Revision: 8892
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/support/AbstractSynchronizedServer.java
Log:
- Use JBoss logging instead of Log4J.
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/support/AbstractSynchronizedServer.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/support/AbstractSynchronizedServer.java 2007-11-12
22:40:53 UTC (rev 8891)
+++
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/support/AbstractSynchronizedServer.java 2007-11-13
05:45:17 UTC (rev 8892)
@@ -22,20 +22,20 @@
******************************************************************************/
package org.jboss.portal.test.widget.support;
-import org.apache.log4j.Logger;
+import org.jboss.logging.Logger;
import org.jboss.portal.common.io.IOTools;
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.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.LineNumberReader;
-import java.io.InputStreamReader;
-import java.io.BufferedOutputStream;
import java.io.OutputStreamWriter;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.concurrent.atomic.AtomicInteger;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -161,7 +161,7 @@
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())
+ for (String line = reader.readLine(); line.length() > 0; line =
reader.readLine())
{
log.debug("server received = " + line);
}
@@ -179,26 +179,26 @@
out.close();
}
}
-
+
public static abstract class AbstractReturnFileServer extends
AbstractSynchronizedServer
{
-
+
/** . */
private final String file;
-
+
protected AbstractReturnFileServer(int port, String file)
{
super(port);
this.file = file;
}
-
+
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())
+ for (String line = reader.readLine(); line.length() > 0; line =
reader.readLine())
{
log.debug("server received = " + line);
}
@@ -208,7 +208,7 @@
// get file content
byte[] bytes = getFileContent();
-
+
//
BufferedOutputStream out = new BufferedOutputStream(s.getOutputStream());
OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
@@ -218,7 +218,7 @@
out.write(bytes);
out.close();
}
-
+
private byte[] getFileContent() throws IllegalArgumentException, IOException
{
InputStream io =
Thread.currentThread().getContextClassLoader().getResourceAsStream(this.file);
@@ -226,9 +226,9 @@
io.close();
return bytes;
}
-
+
}
-
+
public static abstract class Abstract404Server extends AbstractSynchronizedServer
{
@@ -243,7 +243,7 @@
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())
+ for (String line = reader.readLine(); line.length() > 0; line =
reader.readLine())
{
log.debug("server received = " + line);
}
Show replies by date