You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2011/09/04 16:27:52 UTC
svn commit: r1165031 - in
/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol:
RequestHandlerResolver.java TestHttpAsyncHandlers.java
Author: olegk
Date: Sun Sep 4 14:27:51 2011
New Revision: 1165031
URL: http://svn.apache.org/viewvc?rev=1165031&view=rev
Log:
Test case cleanup
Added:
httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/RequestHandlerResolver.java (with props)
Modified:
httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncHandlers.java
Added: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/RequestHandlerResolver.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/RequestHandlerResolver.java?rev=1165031&view=auto
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/RequestHandlerResolver.java (added)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/RequestHandlerResolver.java Sun Sep 4 14:27:51 2011
@@ -0,0 +1,43 @@
+/*
+ * ====================================================================
+ * 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.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.nio.protocol;
+
+final class RequestHandlerResolver implements HttpAsyncRequestHandlerResolver {
+
+ private final HttpAsyncRequestHandler<?> handler;
+
+ public RequestHandlerResolver(final HttpAsyncRequestHandler<?> handler) {
+ super();
+ this.handler = handler;
+ }
+
+ public HttpAsyncRequestHandler<?> lookup(String requestURI) {
+ return this.handler;
+ }
+
+}
\ No newline at end of file
Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/RequestHandlerResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/RequestHandlerResolver.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/RequestHandlerResolver.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncHandlers.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncHandlers.java?rev=1165031&r1=1165030&r2=1165031&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncHandlers.java (original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/test/java/org/apache/http/nio/protocol/TestHttpAsyncHandlers.java Sun Sep 4 14:27:51 2011
@@ -52,6 +52,7 @@ import org.apache.http.nio.reactor.Liste
import org.apache.http.nio.reactor.SessionRequest;
import org.apache.http.params.CoreProtocolPNames;
import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.HttpRequestHandler;
import org.apache.http.testserver.SimpleEventListener;
import org.junit.After;
import org.junit.Assert;
@@ -89,23 +90,8 @@ public class TestHttpAsyncHandlers exten
return new LoggingClientConnectionFactory(params);
}
- static class BasicHttpAsyncRequestHandlerResolver implements HttpAsyncRequestHandlerResolver {
-
- private final HttpAsyncRequestHandler<?> handler;
-
- public BasicHttpAsyncRequestHandlerResolver(final HttpAsyncRequestHandler<?> handler) {
- super();
- this.handler = handler;
- }
-
- public HttpAsyncRequestHandler<?> lookup(String requestURI) {
- return this.handler;
- }
-
- }
-
private void executeStandardTest(
- final HttpAsyncRequestHandler<?> requestHandler,
+ final HttpRequestHandler requestHandler,
final NHttpRequestExecutionHandler requestExecutionHandler) throws Exception {
int connNo = 3;
int reqNo = 20;
@@ -119,7 +105,7 @@ public class TestHttpAsyncHandlers exten
}
HttpAsyncServiceHandler serviceHandler = new HttpAsyncServiceHandler(
- new BasicHttpAsyncRequestHandlerResolver(requestHandler),
+ new RequestHandlerResolver(new BufferingAsyncRequestHandler(requestHandler)),
this.serverHttpProc,
new DefaultConnectionReuseStrategy(),
this.serverParams);
@@ -188,7 +174,7 @@ public class TestHttpAsyncHandlers exten
}
};
- executeStandardTest(new BufferingAsyncRequestHandler(new RequestHandler()), requestExecutionHandler);
+ executeStandardTest(new RequestHandler(), requestExecutionHandler);
}
/**
@@ -215,7 +201,7 @@ public class TestHttpAsyncHandlers exten
}
};
- executeStandardTest(new BufferingAsyncRequestHandler(new RequestHandler()), requestExecutionHandler);
+ executeStandardTest(new RequestHandler(), requestExecutionHandler);
}
/**
@@ -242,7 +228,7 @@ public class TestHttpAsyncHandlers exten
}
};
- executeStandardTest(new BufferingAsyncRequestHandler(new RequestHandler()), requestExecutionHandler);
+ executeStandardTest(new RequestHandler(), requestExecutionHandler);
}
/**
@@ -269,7 +255,7 @@ public class TestHttpAsyncHandlers exten
}
};
- executeStandardTest(new BufferingAsyncRequestHandler(new RequestHandler()), requestExecutionHandler);
+ executeStandardTest(new RequestHandler(), requestExecutionHandler);
}
/**
@@ -296,7 +282,7 @@ public class TestHttpAsyncHandlers exten
}
};
- executeStandardTest(new BufferingAsyncRequestHandler(new RequestHandler()), requestExecutionHandler);
+ executeStandardTest(new RequestHandler(), requestExecutionHandler);
}
}