You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2008/11/23 17:06:14 UTC

svn commit: r720000 - in /webservices/commons/trunk/modules/transport/modules/testkit: ./ src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/ src/main/java/org/apache/axis2/transport/testkit/doclet/ src/main/java/org/apache/axis2/transport...

Author: veithen
Date: Sun Nov 23 08:06:14 2008
New Revision: 720000

URL: http://svn.apache.org/viewvc?rev=720000&view=rev
Log:
Test kit:
* Improved Javadoc.
* Reduced the visibility of some internal classes/methods so that they don't show up in the Javadoc.
* Some small refactorings to make some pieced of code more reusable.

Added:
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/InOnlyEndpointSupport.java   (with props)
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/package-info.java   (with props)
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/package-info.java   (with props)
Modified:
    webservices/commons/trunk/modules/transport/modules/testkit/pom.xml
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisAsyncEndpoint.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisEchoEndpoint.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisTestEndpoint.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/TestkitJavadocDoclet.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/AsyncEndpoint.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/InOutEndpoint.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/AndExpression.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/EqualityExpression.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/FilterExpression.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/FilterExpressionParser.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/NotExpression.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/OrExpression.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/PresenceExpression.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/http/JettyAsyncEndpoint.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Acceptor.java
    webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Relay.java

Modified: webservices/commons/trunk/modules/transport/modules/testkit/pom.xml
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/pom.xml?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/pom.xml (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/pom.xml Sun Nov 23 08:06:14 2008
@@ -196,7 +196,15 @@
                     </docletArtifacts>
                     <doclet>org.apache.axis2.transport.testkit.doclet.TestkitJavadocDoclet</doclet>
                     <useStandardDocletOptions>true</useStandardDocletOptions>
-                    <additionalparam>-resource-info ${project.build.directory}/resource-info.dat</additionalparam>
+                    <additionalparam>
+                        -resource-info ${project.build.directory}/resource-info.dat
+                        -link http://java.sun.com/j2se/1.5.0/docs/api/
+                        -link http://java.sun.com/j2ee/1.4/docs/api/
+                        -link http://ws.apache.org/axis2/1_4_1/api/
+                        -link http://ws.apache.org/commons/axiom/apidocs/
+                        -link http://junit.org/junit/javadoc/3.8.1/
+                        -link http://www.eclipse.org/aspectj/doc/released/runtime-api/
+                    </additionalparam>
                 </configuration>
             </plugin>
         </plugins>

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisAsyncEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisAsyncEndpoint.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisAsyncEndpoint.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisAsyncEndpoint.java Sun Nov 23 08:06:14 2008
@@ -19,51 +19,47 @@
 
 package org.apache.axis2.transport.testkit.axis2.endpoint;
 
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
 import javax.xml.namespace.QName;
 
 import junit.framework.Assert;
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.InOnlyAxisOperation;
 import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.transport.testkit.axis2.MessageContextValidator;
 import org.apache.axis2.transport.testkit.endpoint.AsyncEndpoint;
+import org.apache.axis2.transport.testkit.endpoint.InOnlyEndpointSupport;
 import org.apache.axis2.transport.testkit.message.AxisMessage;
 import org.apache.axis2.transport.testkit.message.IncomingMessage;
 import org.apache.axis2.transport.testkit.tests.Setup;
 import org.apache.axis2.transport.testkit.tests.Transient;
 
-public class AxisAsyncEndpoint extends AxisTestEndpoint implements AsyncEndpoint<AxisMessage>, MessageReceiver {
-    private interface Event {
-        IncomingMessage<AxisMessage> process() throws Throwable;
-    }
-    
+public class AxisAsyncEndpoint extends AxisTestEndpoint implements AsyncEndpoint<AxisMessage> {
     private @Transient AxisTestEndpointContext context;
     private @Transient MessageContextValidator[] validators;
-    private @Transient BlockingQueue<Event> queue;
+    private @Transient InOnlyEndpointSupport<AxisMessage> support;
     
     @Setup @SuppressWarnings("unused")
     private void setUp(AxisTestEndpointContext context, MessageContextValidator[] validators) {
         this.context = context;
         this.validators = validators;
-        queue = new LinkedBlockingQueue<Event>();
+        support = new InOnlyEndpointSupport<AxisMessage>();
     }
     
     @Override
-    protected AxisOperation createOperation() {
-        AxisOperation operation = new InOnlyAxisOperation(new QName("default"));
-        operation.setMessageReceiver(this);
+    protected InOnlyAxisOperation createOperation() {
+        InOnlyAxisOperation operation = new InOnlyAxisOperation(new QName("default"));
+        operation.setMessageReceiver(new MessageReceiver() {
+            public void receive(MessageContext messageCtx) throws AxisFault {
+                AxisAsyncEndpoint.this.receive(messageCtx);
+            }
+        });
         return operation;
     }
 
-    public void receive(MessageContext messageCtx) throws AxisFault {
+    void receive(MessageContext messageCtx) throws AxisFault {
         final AxisMessage messageData;
         try {
             Assert.assertTrue(messageCtx.isServerSide());
@@ -79,36 +75,23 @@
             }
             messageData = new AxisMessage(messageCtx);
         }
-        catch (final Throwable ex) {
-            queue.add(new Event() {
-                public IncomingMessage<AxisMessage> process() throws Throwable {
-                    throw ex;
-                }
-            });
+        catch (Throwable ex) {
+            support.putException(ex);
             return;
         }
-        queue.add(new Event() {
-            public IncomingMessage<AxisMessage> process() throws Throwable {
-                return new IncomingMessage<AxisMessage>(null, messageData);
-            }
-        });
+        support.putMessage(null, messageData);
     }
 
     @Override
-    protected void onTransportError(final Throwable ex) {
-        queue.add(new Event() {
-            public IncomingMessage<AxisMessage> process() throws Throwable {
-                throw ex;
-            }
-        });
+    protected void onTransportError(Throwable ex) {
+        support.putException(ex);
     }
     
     public void clear() throws Exception {
-        queue.clear();
+        support.clear();
     }
 
     public IncomingMessage<AxisMessage> waitForMessage(int timeout) throws Throwable {
-        Event event = queue.poll(timeout, TimeUnit.MILLISECONDS);
-        return event == null ? null : event.process();
+        return support.waitForMessage(timeout);
     }
 }

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisEchoEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisEchoEndpoint.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisEchoEndpoint.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisEchoEndpoint.java Sun Nov 23 08:06:14 2008
@@ -23,7 +23,6 @@
 
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.InOutAxisOperation;
 import org.apache.axis2.receivers.AbstractInOutMessageReceiver;
 import org.apache.axis2.transport.testkit.endpoint.EndpointErrorListener;
@@ -34,8 +33,8 @@
     private final InOutEndpointSupport support = new InOutEndpointSupport();
     
     @Override
-    protected AxisOperation createOperation() {
-        AxisOperation operation = new InOutAxisOperation(new QName("echo"));
+    protected InOutAxisOperation createOperation() {
+        InOutAxisOperation operation = new InOutAxisOperation(new QName("echo"));
         operation.setMessageReceiver(new AbstractInOutMessageReceiver() {
             @Override
             public void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage) throws AxisFault {

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisTestEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisTestEndpoint.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisTestEndpoint.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/axis2/endpoint/AxisTestEndpoint.java Sun Nov 23 08:06:14 2008
@@ -30,6 +30,7 @@
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.transport.base.BaseUtils;
 import org.apache.axis2.transport.base.event.TransportError;
@@ -43,11 +44,15 @@
 import org.apache.axis2.transport.testkit.tests.Transient;
 import org.apache.axis2.transport.testkit.util.LogManager;
 
+/**
+ * Base class for Axis2 based test endpoints.
+ */
 @Name("axis")
-public abstract class AxisTestEndpoint implements TransportErrorListener {
+public abstract class AxisTestEndpoint {
     private @Transient AxisTestEndpointContext context;
     private @Transient TransportErrorSource transportErrorSource;
-    private @Transient AxisService service;
+    private @Transient TransportErrorListener errorListener;
+    @Transient AxisService service;
     
     @Setup @SuppressWarnings("unused")
     private void setUp(LogManager logManager, AxisTestEndpointContext context, Channel channel,
@@ -58,7 +63,15 @@
         TransportListener listener = context.getTransportListener();
         if (listener instanceof TransportErrorSource) {
             transportErrorSource = (TransportErrorSource)listener;
-            transportErrorSource.addErrorListener(this);
+            errorListener = new TransportErrorListener() {
+                public void error(TransportError error) {
+                    AxisService s = error.getService();
+                    if (s == null || s == service) {
+                        onTransportError(error.getException());
+                    }
+                }
+            };
+            transportErrorSource.addErrorListener(errorListener);
         } else {
             transportErrorSource = null;
         }
@@ -114,19 +127,25 @@
     @TearDown @SuppressWarnings("unused")
     private void tearDown() throws Exception {
         if (transportErrorSource != null) {
-            transportErrorSource.removeErrorListener(this);
+            transportErrorSource.removeErrorListener(errorListener);
         }
         context.getAxisConfiguration().removeService(service.getName());
     }
     
-    public void error(TransportError error) {
-        AxisService s = error.getService();
-        if (s == null || s == service) {
-            onTransportError(error.getException());
-        }
-    }
-
+    /**
+     * Create an operation appropriate for the message exchange pattern implemented
+     * by the test endpoint. The operation returned should have a 
+     * {@link MessageReceiver} set.
+     * 
+     * @return the operation
+     */
     protected abstract AxisOperation createOperation();
     
+    /**
+     * Process a transport error. Note that this method will only be called if
+     * the underlying transport supports reporting of transport errors.
+     * 
+     * @param ex the exception describing the transport error
+     */
     protected abstract void onTransportError(Throwable ex);
 }

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/TestkitJavadocDoclet.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/TestkitJavadocDoclet.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/TestkitJavadocDoclet.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/doclet/TestkitJavadocDoclet.java Sun Nov 23 08:06:14 2008
@@ -26,12 +26,17 @@
 
 import com.sun.javadoc.ClassDoc;
 import com.sun.javadoc.DocErrorReporter;
+import com.sun.javadoc.LanguageVersion;
 import com.sun.javadoc.RootDoc;
 import com.sun.tools.doclets.standard.Standard;
 
 public class TestkitJavadocDoclet {
     private static File resourceInfoFile;
     
+    public static LanguageVersion languageVersion() {
+        return Standard.languageVersion();
+    }
+    
     public static int optionLength(String option) {
         if (option.equals("-resource-info")) {
             return 2;

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/AsyncEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/AsyncEndpoint.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/AsyncEndpoint.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/AsyncEndpoint.java Sun Nov 23 08:06:14 2008
@@ -22,6 +22,35 @@
 import org.apache.axis2.transport.testkit.message.IncomingMessage;
 import org.apache.axis2.transport.testkit.name.Key;
 
+/**
+ * Interface implemented by in-only test endpoints.
+ * <p>
+ * The endpoint must be ready to receive messages immediately after it
+ * has been set up. In particular implementations must not make the
+ * assumption that messages are only during a call to {@link #waitForMessage(int)}.
+ * Indeed, a typical test case will set up the endpoint, send a message and only
+ * afterwards call {@link #waitForMessage(int)}.
+ * <p>
+ * There are two strategies to guarantee this behavior:
+ * <ul>
+ *   <li>The underlying transport internally queues incoming messages.
+ *       In that case {@link #waitForMessage(int)} should simply poll
+ *       for new messages. An example of this type of transport is
+ *       the mail transport.</li>
+ *   <li>The underlying transport requires that incoming messages are
+ *       processed immediately. In that case the implementation should
+ *       set up the required receiver or message processor and add
+ *       incoming messages to an internal queue that is polled
+ *       when {@link #waitForMessage(int)} is called. An example of
+ *       this kind of transport is HTTP. Implementations can use
+ *       {@link InOnlyEndpointSupport} to manage the message queue.</li>
+ * </ul>
+ * 
+ * @see org.apache.axis2.transport.testkit.endpoint
+ * 
+ * @param <M>
+ */
+// TODO: rename this to InOnlyEndpoint
 @Key("endpoint")
 public interface AsyncEndpoint<M> {
     /**

Added: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/InOnlyEndpointSupport.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/InOnlyEndpointSupport.java?rev=720000&view=auto
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/InOnlyEndpointSupport.java (added)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/InOnlyEndpointSupport.java Sun Nov 23 08:06:14 2008
@@ -0,0 +1,69 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.axis2.transport.testkit.endpoint;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+import javax.mail.internet.ContentType;
+
+import org.apache.axis2.transport.testkit.message.IncomingMessage;
+
+public class InOnlyEndpointSupport<M> {
+    private final BlockingQueue<Event<M>> queue = new LinkedBlockingQueue<Event<M>>();
+    
+    private interface Event<M> {
+        IncomingMessage<M> process() throws Throwable;
+    }
+    
+    public void putException(final Throwable ex) {
+        queue.add(new Event<M>() {
+            public IncomingMessage<M> process() throws Throwable {
+                throw ex;
+            }
+        });
+    }
+    
+    public void putMessage(final ContentType contentType, final M data) {
+        queue.add(new Event<M>() {
+            public IncomingMessage<M> process() throws Throwable {
+                return new IncomingMessage<M>(contentType, data);
+            }
+        });
+    }
+    
+    public void putMessage(final IncomingMessage<M> message) {
+        queue.add(new Event<M>() {
+            public IncomingMessage<M> process() throws Throwable {
+                return message;
+            }
+        });
+    }
+
+    public void clear() {
+        queue.clear();
+    }
+
+    public IncomingMessage<M> waitForMessage(int timeout) throws Throwable {
+        Event<M> event = queue.poll(timeout, TimeUnit.MILLISECONDS);
+        return event == null ? null : event.process();
+    }
+}

Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/InOnlyEndpointSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/InOutEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/InOutEndpoint.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/InOutEndpoint.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/InOutEndpoint.java Sun Nov 23 08:06:14 2008
@@ -21,6 +21,11 @@
 
 import org.apache.axis2.transport.testkit.name.Key;
 
+/**
+ * Interface implemented by in-out test endpoints.
+ * 
+ * @see org.apache.axis2.transport.testkit.endpoint
+ */
 @Key("endpoint")
 public interface InOutEndpoint {
     void addEndpointErrorListener(EndpointErrorListener listener);

Added: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/package-info.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/package-info.java?rev=720000&view=auto
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/package-info.java (added)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/package-info.java Sun Nov 23 08:06:14 2008
@@ -0,0 +1,41 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ */
+
+/**
+ * Provides interface and support classes for test endpoints.
+ * <p>
+ * The test kit uses in-only and in-out test endpoints. See
+ * {@link org.apache.axis2.transport.testkit.endpoint.InOnlyEndpoint} and
+ * {@link org.apache.axis2.transport.testkit.endpoint.InOutEndpoint} for
+ * more details.
+ * <p>
+ * Note that an endpoint is assumed to be a lightweight test resource, i.e.
+ * setting up and tearing down an endpoint should be inexpensive to
+ * moderately expensive. If endpoint implementations require a server environment that is
+ * expensive to set up, this environment should be provided by a different test
+ * resource on which the endpoint implementations depend. This pattern is used for example
+ * by {@link org.apache.axis2.transport.testkit.axis2.endpoint.AxisTestEndpoint} and its subclasses
+ * which depend on {@link org.apache.axis2.transport.testkit.axis2.endpoint.AxisTestEndpointContext}
+ * to provide the server environment.
+ * <p>
+ * An endpoint implementation should use a dependency on the appropriate subclass of
+ * {@link org.apache.axis2.transport.testkit.channel.Channel} in order to get the
+ * required information to bind the endpoint to the underlying transport protocol.
+ */
+package org.apache.axis2.transport.testkit.endpoint;

Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/endpoint/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/AndExpression.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/AndExpression.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/AndExpression.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/AndExpression.java Sun Nov 23 08:06:14 2008
@@ -21,6 +21,9 @@
 
 import java.util.Map;
 
+/**
+ * Implementation of the <em>and</em> (<tt>&amp;</tt>) operator.
+ */
 public class AndExpression implements FilterExpression {
     private final FilterExpression[] operands;
 

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/EqualityExpression.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/EqualityExpression.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/EqualityExpression.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/EqualityExpression.java Sun Nov 23 08:06:14 2008
@@ -21,6 +21,9 @@
 
 import java.util.Map;
 
+/**
+ * Implementation of the <em>equal</em> (<tt>=</tt>) operator.
+ */
 public class EqualityExpression implements FilterExpression {
     private final String key;
     private final String value;

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/FilterExpression.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/FilterExpression.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/FilterExpression.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/FilterExpression.java Sun Nov 23 08:06:14 2008
@@ -21,6 +21,15 @@
 
 import java.util.Map;
 
+/**
+ * Interface representing an abstract filter expression.
+ */
 public interface FilterExpression {
+    /**
+     * Evaluate the filter expression.
+     * 
+     * @param map the data on which the filter expression is evaluated
+     * @return true if the data matches the filter represented by this object
+     */
     boolean matches(Map<String,String> map);
 }

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/FilterExpressionParser.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/FilterExpressionParser.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/FilterExpressionParser.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/FilterExpressionParser.java Sun Nov 23 08:06:14 2008
@@ -30,6 +30,9 @@
 import org.apache.directory.shared.ldap.filter.OrNode;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 
+/**
+ * Parser for LDAP filter expressions.
+ */
 public class FilterExpressionParser {
     private FilterExpressionParser() {}
     
@@ -59,6 +62,13 @@
         }
     }
     
+    /**
+     * Parse an LDAP filter expression.
+     * 
+     * @param filter an LDAP filter as defined by <a href="http://www.ietf.org/rfc/rfc2254.txt">RFC2254</a>
+     * @return the parsed filter
+     * @throws ParseException if the filter is syntactically incorrect
+     */
     public static FilterExpression parse(String filter) throws ParseException {
         return buildExpression(FilterParser.parse(filter));
     }

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/NotExpression.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/NotExpression.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/NotExpression.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/NotExpression.java Sun Nov 23 08:06:14 2008
@@ -21,6 +21,9 @@
 
 import java.util.Map;
 
+/**
+ * Implementation of the <em>not</em> (<tt>!</tt>) operator.
+ */
 public class NotExpression implements FilterExpression {
     private final FilterExpression operand;
     

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/OrExpression.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/OrExpression.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/OrExpression.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/OrExpression.java Sun Nov 23 08:06:14 2008
@@ -21,6 +21,9 @@
 
 import java.util.Map;
 
+/**
+ * Implementation of the <em>or</em> (<tt>|</tt>) operator.
+ */
 public class OrExpression implements FilterExpression {
     private final FilterExpression[] operands;
 

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/PresenceExpression.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/PresenceExpression.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/PresenceExpression.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/PresenceExpression.java Sun Nov 23 08:06:14 2008
@@ -21,6 +21,9 @@
 
 import java.util.Map;
 
+/**
+ * Implementation of the <em>present</em> (<tt>=*</tt>) operator.
+ */
 public class PresenceExpression implements FilterExpression {
     private final String key;
 

Added: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/package-info.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/package-info.java?rev=720000&view=auto
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/package-info.java (added)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/package-info.java Sun Nov 23 08:06:14 2008
@@ -0,0 +1,30 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you 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.
+ */
+
+/**
+ * Provides classes to evaluate LDAP filters against {@link java.util.Map} objects.
+ * <p>
+ * LDAP filter expressions are parsed using
+ * {@link org.apache.axis2.transport.testkit.filter.FilterExpressionParser#parse(String)}.
+ * The resulting {@link org.apache.axis2.transport.testkit.filter.FilterExpression} object can
+ * then be used to evaluate the filter against a given {@link java.util.Map} object.
+ * 
+ * @see <a href="http://www.ietf.org/rfc/rfc2254.txt">RFC2254: The String Representation of LDAP Search Filters</a>
+ */
+package org.apache.axis2.transport.testkit.filter;
\ No newline at end of file

Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/filter/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/http/JettyAsyncEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/http/JettyAsyncEndpoint.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/http/JettyAsyncEndpoint.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/http/JettyAsyncEndpoint.java Sun Nov 23 08:06:14 2008
@@ -20,11 +20,9 @@
 package org.apache.axis2.transport.testkit.http;
 
 import java.io.IOException;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.axis2.transport.testkit.endpoint.AsyncEndpoint;
+import org.apache.axis2.transport.testkit.endpoint.InOnlyEndpointSupport;
 import org.apache.axis2.transport.testkit.message.IncomingMessage;
 import org.apache.axis2.transport.testkit.name.Name;
 import org.apache.axis2.transport.testkit.tests.Setup;
@@ -35,27 +33,27 @@
 
 @Name("jetty")
 public abstract class JettyAsyncEndpoint<M> extends JettyEndpoint implements AsyncEndpoint<M> {
-    private @Transient BlockingQueue<IncomingMessage<M>> queue;
+    private @Transient InOnlyEndpointSupport<M> support;
     
     @Setup @SuppressWarnings("unused")
     private void setUp() throws Exception {
-        queue = new LinkedBlockingQueue<IncomingMessage<M>>();
+        support = new InOnlyEndpointSupport<M>();
     }
     
     @Override
     protected void handle(String pathParams, HttpRequest request, HttpResponse response)
             throws HttpException, IOException {
         
-        queue.add(handle(request));
+        support.putMessage(handle(request));
     }
     
     protected abstract IncomingMessage<M> handle(HttpRequest request) throws HttpException, IOException;
     
     public void clear() throws Exception {
-        queue.clear();
+        support.clear();
     }
 
     public IncomingMessage<M> waitForMessage(int timeout) throws Throwable {
-        return queue.poll(timeout, TimeUnit.MILLISECONDS);
+        return support.waitForMessage(timeout);
     }
 }

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Acceptor.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Acceptor.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Acceptor.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Acceptor.java Sun Nov 23 08:06:14 2008
@@ -28,7 +28,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class Acceptor implements Runnable {
+class Acceptor implements Runnable {
     private static final Log log = LogFactory.getLog(Acceptor.class);
     
     private final ServerSocket serverSocket;

Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Relay.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Relay.java?rev=720000&r1=719999&r2=720000&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Relay.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Relay.java Sun Nov 23 08:06:14 2008
@@ -29,7 +29,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class Relay implements Runnable {
+class Relay implements Runnable {
     private static final Log log = LogFactory.getLog(Relay.class);
     
     private final String tag;