[logback-dev] svn commit: r1608 - in logback/trunk/logback-access/src: main/java/ch/qos/logback/access/jetty main/java/ch/qos/logback/access/spi main/java/ch/qos/logback/access/tomcat test/java/ch/qos/logback/access test/java/ch/qos/logback/access/db test/java/ch/qos/logback/access/dummy test/java/ch/qos/logback/access/net test/java/ch/qos/logback/access/pattern test/java/ch/qos/logback/access/pattern/helpers test/java/ch/qos/logback/access/spi

noreply.ceki at qos.ch noreply.ceki at qos.ch
Wed Jan 23 17:09:09 CET 2008


Author: ceki
Date: Wed Jan 23 17:09:08 2008
New Revision: 1608

Added:
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyAccessEventBuilder.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyRequest.java
      - copied, changed from r1604, /logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyRequest.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyResponse.java
      - copied, changed from r1604, /logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyResponse.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java
      - copied, changed from r1604, /logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyServerAdapter.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/spi/
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/spi/AccessEventTest.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/spi/PackageTest.java
Removed:
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyRequest.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyResponse.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyServerAdapter.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyValuesAdapter.java
Modified:
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java
   logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/AllTest.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTest.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SocketAppenderTest.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/URLEvaluatorTest.java
   logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java

Log:
- bug 109 (ONGOING WORK)

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/jetty/JettyServerAdapter.java	Wed Jan 23 17:09:08 2008
@@ -1,8 +1,8 @@
 package ch.qos.logback.access.jetty;
 
-import java.util.ArrayList;
 import java.util.Enumeration;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.mortbay.jetty.HttpFields;
 import org.mortbay.jetty.Request;
@@ -14,12 +14,13 @@
  * A jetty specific implementation of the {@link ServerAdapter} interface.
  * 
  * @author Sébastien Pennec
+ * @author Ceki Gulcu
  */
 public class JettyServerAdapter implements ServerAdapter {
 
   Request request;
   Response response;
-
+  
   public JettyServerAdapter(Request jettyRequest, Response jettyResponse) {
     this.request = jettyRequest;
     this.response = jettyResponse;
@@ -33,17 +34,17 @@
     return response.getStatus();
   }
 
-  public String getResponseHeader(String key) {
-    return response.getHeader(key);
-  }
-
-  public List<String> getResponseHeaderNameList() {
+  
+  public Map<String, String> builResponseHeaderMap() {
+    Map<String, String> responseHeaderMap = new HashMap<String, String>();
     HttpFields httpFields = response.getHttpFields();
-    List<String> hnList = new ArrayList<String>();
     Enumeration e = httpFields.getFieldNames();
     while (e.hasMoreElements()) {
-      hnList.add((String) e.nextElement());
+      String key = (String) e.nextElement();
+      String value = response.getHeader(key);
+      responseHeaderMap.put(key, value);
     }
-    return hnList;
+    return responseHeaderMap;
   }
+  
 }

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/AccessEvent.java	Wed Jan 23 17:09:08 2008
@@ -1,10 +1,13 @@
 package ch.qos.logback.access.spi;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Vector;
 
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
@@ -30,14 +33,14 @@
   private static final long serialVersionUID = -3118194368414470960L;
 
   public final static String NA = "-";
-  public final static String[] NA_STRING_ARRAY = new String[] {AccessEvent.NA};
-  
+  public final static String[] NA_STRING_ARRAY = new String[] { AccessEvent.NA };
+
   public final static String EMPTY = "";
   public static final int SENTINEL = -1;
 
   private transient final HttpServletRequest httpRequest;
   private transient final HttpServletResponse httpResponse;
-
+  
   String requestURI;
   String requestURL;
   String remoteHost;
@@ -51,7 +54,8 @@
 
   Map<String, String> requestHeaderMap;
   Map<String, String[]> requestParameterMap;
-
+  Map<String, String> responseHeaderMap;
+  
   long contentLength = SENTINEL;
   int statusCode = SENTINEL;
   int localPort = SENTINEL;
@@ -216,7 +220,13 @@
   }
 
   public Enumeration getRequestHeaderNames() {
+    // post-serialization
+    if (httpRequest == null) {
+      Vector<String> list = new Vector<String>(getRequestHeaderMap().keySet());
+      return list.elements();
+    }
     return httpRequest.getHeaderNames();
+    
   }
 
   public Map<String, String> getRequestHeaderMap() {
@@ -255,14 +265,6 @@
       buildRequestParameterMap();
     }
     return requestParameterMap;
-}
-  
-  public String getResponseHeader(String key) {
-    return serverAdapter.getResponseHeader(key);
-  }
-
-  public List<String> getResponseHeaderNameList() {
-    return serverAdapter.getResponseHeaderNameList();
   }
 
   /**
@@ -286,7 +288,7 @@
 
   public String[] getRequestParameter(String key) {
     if (httpRequest != null) {
-     String[] value = httpRequest.getParameterValues(key);
+      String[] value = httpRequest.getParameterValues(key);
       if (value == null) {
         return NA_STRING_ARRAY;
       } else {
@@ -424,6 +426,33 @@
     return serverAdapter;
   }
 
+  public String getResponseHeader(String key) {
+    synchronized (responseHeaderMap) {
+      if (responseHeaderMap == null) {
+        responseHeaderMap = serverAdapter.builResponseHeaderMap();
+      }
+      return responseHeaderMap.get(key);
+    }
+  }
+
+  public Map<String, String> getResponseHeaderMap() {
+    synchronized (responseHeaderMap) {
+      if (responseHeaderMap == null) {
+        responseHeaderMap = serverAdapter.builResponseHeaderMap();
+      }
+      return responseHeaderMap;
+    }
+  }
+
+  public List<String> getResponseHeaderNameList() {
+    synchronized (responseHeaderMap) {
+      if (responseHeaderMap == null) {
+        responseHeaderMap = serverAdapter.builResponseHeaderMap();
+      }
+      return new ArrayList<String>(responseHeaderMap.keySet());
+    }
+  }
+  
   public void prepareForDeferredProcessing() {
     buildRequestHeaderMap();
     buildRequestParameterMap();

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/spi/ServerAdapter.java	Wed Jan 23 17:09:08 2008
@@ -1,6 +1,6 @@
 package ch.qos.logback.access.spi;
 
-import java.util.List;
+import java.util.Map;
 
 /**
  * An interface to access server-specific methods from
@@ -13,7 +13,9 @@
 
   long getContentLength();
   int getStatusCode();
-  String getResponseHeader(String key);
-  List<String> getResponseHeaderNameList();
-
+//  String getResponseHeader(String key);
+//  List<String> getResponseHeaderNameList();
+//  Map<String, String> getResponseHeaderMap();
+  
+  Map<String, String> builResponseHeaderMap();
 }

Modified: logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java
==============================================================================
--- logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java	(original)
+++ logback/trunk/logback-access/src/main/java/ch/qos/logback/access/tomcat/TomcatServerAdapter.java	Wed Jan 23 17:09:08 2008
@@ -1,7 +1,7 @@
 package ch.qos.logback.access.tomcat;
 
-import java.util.ArrayList;
-import java.util.List;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.catalina.connector.Request;
 import org.apache.catalina.connector.Response;
@@ -17,7 +17,7 @@
 
   Request request;
   Response response;
-
+  
   public TomcatServerAdapter(Request tomcatRequest, Response tomcatResponse) {
     this.request = tomcatRequest;
     this.response = tomcatResponse;
@@ -31,15 +31,16 @@
     return response.getStatus();
   }
 
-  public String getResponseHeader(String key) {
-    return response.getHeader(key);
-  }
-
-  public List<String> getResponseHeaderNameList() {
-    List<String> hnList = new ArrayList<String>();
-    for (String name : response.getHeaderNames()) {
-      hnList.add(name);
+  
+  public Map<String, String> builResponseHeaderMap() {
+    Map<String, String> responseHeaderMap = new HashMap<String, String>();
+    for (String key : response.getHeaderNames()) {
+      String value = response.getHeader(key);
+      responseHeaderMap.put(key, value);
     }
-    return hnList;
+    return responseHeaderMap;
   }
+  
+
+
 }

Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/AllTest.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/AllTest.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/AllTest.java	Wed Jan 23 17:09:08 2008
@@ -17,6 +17,7 @@
 
   public static Test suite() {
     TestSuite suite = new TestSuite();
+    suite.addTest(ch.qos.logback.access.spi.PackageTest.suite());
     suite.addTest(ch.qos.logback.access.net.PackageTest.suite());
     suite.addTest(ch.qos.logback.access.pattern.PackageTest.suite());
     suite.addTest(ch.qos.logback.access.jetty.PackageTest.suite());

Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTest.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTest.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/db/DBAppenderTest.java	Wed Jan 23 17:09:08 2008
@@ -4,9 +4,9 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 
-import ch.qos.logback.access.pattern.helpers.DummyRequest;
-import ch.qos.logback.access.pattern.helpers.DummyResponse;
-import ch.qos.logback.access.pattern.helpers.DummyServerAdapter;
+import ch.qos.logback.access.dummy.DummyRequest;
+import ch.qos.logback.access.dummy.DummyResponse;
+import ch.qos.logback.access.dummy.DummyServerAdapter;
 import ch.qos.logback.access.spi.AccessEvent;
 import ch.qos.logback.access.spi.BasicContext;
 import ch.qos.logback.core.db.DriverManagerConnectionSource;

Added: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyAccessEventBuilder.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyAccessEventBuilder.java	Wed Jan 23 17:09:08 2008
@@ -0,0 +1,17 @@
+package ch.qos.logback.access.dummy;
+
+import ch.qos.logback.access.spi.AccessEvent;
+
+public class DummyAccessEventBuilder {
+
+  
+  static public AccessEvent buildNewAccessEvent() {
+    DummyRequest request = new DummyRequest();
+    DummyResponse response = new DummyResponse();
+    DummyServerAdapter adapter = new DummyServerAdapter(request, response);
+    
+    AccessEvent ae = new AccessEvent(request, response, adapter);
+    return ae;
+  }
+  
+}

Copied: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyRequest.java (from r1604, /logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyRequest.java)
==============================================================================
--- /logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyRequest.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyRequest.java	Wed Jan 23 17:09:08 2008
@@ -1,4 +1,4 @@
-package ch.qos.logback.access.pattern.helpers;
+package ch.qos.logback.access.dummy;
 
 import java.io.BufferedReader;
 import java.io.IOException;

Copied: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyResponse.java (from r1604, /logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyResponse.java)
==============================================================================
--- /logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyResponse.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyResponse.java	Wed Jan 23 17:09:08 2008
@@ -1,4 +1,4 @@
-package ch.qos.logback.access.pattern.helpers;
+package ch.qos.logback.access.dummy;
 
 import java.io.IOException;
 import java.io.PrintWriter;
@@ -13,7 +13,7 @@
 public class DummyResponse implements HttpServletResponse {
 
   int status;
-  Map<String, String> headerMap;
+  public Map<String, String> headerMap;
   
   public DummyResponse() {
     headerMap = new HashMap<String, String>();

Copied: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java (from r1604, /logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyServerAdapter.java)
==============================================================================
--- /logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/helpers/DummyServerAdapter.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/dummy/DummyServerAdapter.java	Wed Jan 23 17:09:08 2008
@@ -1,6 +1,6 @@
-package ch.qos.logback.access.pattern.helpers;
+package ch.qos.logback.access.dummy;
 
-import java.util.List;
+import java.util.Map;
 
 import ch.qos.logback.access.spi.ServerAdapter;
 
@@ -22,12 +22,8 @@
     return response.getStatus();
   }
   
-  public String getResponseHeader(String key) {
-    return response.getHeader(key);
-  }
-
-  public List<String> getResponseHeaderNameList() {
-    return null;
+  public Map<String, String> builResponseHeaderMap() {
+    return response.headerMap;
   }
 
 }

Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SerializationPerfTest.java	Wed Jan 23 17:09:08 2008
@@ -4,9 +4,7 @@
 import java.io.ObjectOutputStream;
 
 import junit.framework.TestCase;
-import ch.qos.logback.access.pattern.helpers.DummyRequest;
-import ch.qos.logback.access.pattern.helpers.DummyResponse;
-import ch.qos.logback.access.pattern.helpers.DummyServerAdapter;
+import ch.qos.logback.access.dummy.DummyAccessEventBuilder;
 import ch.qos.logback.access.spi.AccessEvent;
 
 public class SerializationPerfTest extends TestCase {
@@ -37,7 +35,7 @@
     int pauseCounter = 0;
     for (int i = 0; i < loopNumber; i++) {
       try {
-        AccessEvent ae = buildNewAccessEvent();
+        AccessEvent ae = DummyAccessEventBuilder.buildNewAccessEvent();
         //average time for the next method: 5000 nanos
         ae.prepareForDeferredProcessing();
         oos.writeObject(ae);
@@ -65,7 +63,7 @@
     // System.out.println("Beginning mesured run");
     for (int i = 0; i < loopNumber; i++) {
       try {
-        AccessEvent ae = buildNewAccessEvent();
+        AccessEvent ae = DummyAccessEventBuilder.buildNewAccessEvent();
         t1 = System.nanoTime();
         //average length of the next method: 4000 nanos
         ae.prepareForDeferredProcessing();
@@ -92,13 +90,6 @@
     //average time: 26-30 microsec = 0.030 millis
   }
   
-  private AccessEvent buildNewAccessEvent() {
-    DummyRequest request = new DummyRequest();
-    DummyResponse response = new DummyResponse();
-    DummyServerAdapter adapter = new DummyServerAdapter(request, response);
-    
-    AccessEvent ae = new AccessEvent(request, response, adapter);
-    return ae;
-  }
+  
 
 }

Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SocketAppenderTest.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SocketAppenderTest.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/SocketAppenderTest.java	Wed Jan 23 17:09:08 2008
@@ -10,9 +10,9 @@
 package ch.qos.logback.access.net;
 
 import junit.framework.TestCase;
-import ch.qos.logback.access.pattern.helpers.DummyRequest;
-import ch.qos.logback.access.pattern.helpers.DummyResponse;
-import ch.qos.logback.access.pattern.helpers.DummyServerAdapter;
+import ch.qos.logback.access.dummy.DummyRequest;
+import ch.qos.logback.access.dummy.DummyResponse;
+import ch.qos.logback.access.dummy.DummyServerAdapter;
 import ch.qos.logback.access.spi.AccessEvent;
 import ch.qos.logback.access.spi.BasicContext;
 

Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/URLEvaluatorTest.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/URLEvaluatorTest.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/net/URLEvaluatorTest.java	Wed Jan 23 17:09:08 2008
@@ -1,9 +1,9 @@
 package ch.qos.logback.access.net;
 
 import junit.framework.TestCase;
-import ch.qos.logback.access.pattern.helpers.DummyRequest;
-import ch.qos.logback.access.pattern.helpers.DummyResponse;
-import ch.qos.logback.access.pattern.helpers.DummyServerAdapter;
+import ch.qos.logback.access.dummy.DummyRequest;
+import ch.qos.logback.access.dummy.DummyResponse;
+import ch.qos.logback.access.dummy.DummyServerAdapter;
 import ch.qos.logback.access.spi.AccessEvent;
 import ch.qos.logback.core.Context;
 import ch.qos.logback.core.ContextBase;

Modified: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java
==============================================================================
--- logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java	(original)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/pattern/ConverterTest.java	Wed Jan 23 17:09:08 2008
@@ -4,20 +4,18 @@
 import java.util.List;
 
 import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
 
 import junit.framework.TestCase;
-import ch.qos.logback.access.pattern.helpers.DummyRequest;
-import ch.qos.logback.access.pattern.helpers.DummyResponse;
-import ch.qos.logback.access.pattern.helpers.DummyValuesAdapter;
+import ch.qos.logback.access.dummy.DummyRequest;
+import ch.qos.logback.access.dummy.DummyResponse;
+import ch.qos.logback.access.dummy.DummyServerAdapter;
 import ch.qos.logback.access.spi.AccessEvent;
 
 public class ConverterTest extends TestCase {
 
   AccessEvent event;
-  HttpServletRequest request;
-  HttpServletResponse response;
+  DummyRequest request;
+  DummyResponse response;
 
   public void setUp() throws Exception {
     super.setUp();
@@ -161,7 +159,7 @@
   }
 
   private AccessEvent createEvent() {
-    DummyValuesAdapter dummyAdapter = new DummyValuesAdapter(request, response);
+    DummyServerAdapter dummyAdapter = new DummyServerAdapter(request, response);
     AccessEvent ae = new AccessEvent(request, response, dummyAdapter);
     return ae;
   }

Added: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/spi/AccessEventTest.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/spi/AccessEventTest.java	Wed Jan 23 17:09:08 2008
@@ -0,0 +1,44 @@
+package ch.qos.logback.access.spi;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import junit.framework.TestCase;
+import ch.qos.logback.access.dummy.DummyAccessEventBuilder;
+
+public class AccessEventTest extends TestCase {
+
+  private Object buildSerializedAccessEvent() throws IOException, ClassNotFoundException{
+    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    ObjectOutputStream oos = new ObjectOutputStream(baos);
+    AccessEvent ae = DummyAccessEventBuilder.buildNewAccessEvent();
+    // average time for the next method: 5000 nanos
+    ae.prepareForDeferredProcessing();
+    oos.writeObject(ae);
+    oos.flush();
+
+    ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+    ObjectInputStream ois = new ObjectInputStream(bais);
+
+    return ois.readObject();
+  }
+
+  
+  public void testSerialization() throws IOException, ClassNotFoundException {
+    Object o = buildSerializedAccessEvent();
+    assertNotNull(o);
+    AccessEvent aeBack = (AccessEvent) o;
+
+    aeBack.getRequestHeaderNames();
+    aeBack.getResponseHeader("x");
+    aeBack.getResponseHeaderNameList();
+    aeBack.getContentLength();
+    aeBack.getStatusCode();
+    
+    
+  }
+
+}

Added: logback/trunk/logback-access/src/test/java/ch/qos/logback/access/spi/PackageTest.java
==============================================================================
--- (empty file)
+++ logback/trunk/logback-access/src/test/java/ch/qos/logback/access/spi/PackageTest.java	Wed Jan 23 17:09:08 2008
@@ -0,0 +1,21 @@
+/**
+ * Logback: the generic, reliable, fast and flexible logging framework for Java.
+ * 
+ * Copyright (C) 2000-2006, QOS.ch
+ * 
+ * This library 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.
+ */
+package ch.qos.logback.access.spi;
+
+import junit.framework.*;
+
+public class PackageTest extends TestCase {
+
+  public static Test suite() {
+    TestSuite suite = new TestSuite();
+    suite.addTestSuite(AccessEventTest.class);
+    return suite;
+  }
+}
\ No newline at end of file



More information about the logback-dev mailing list