[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpcomponents-commits
Subject:    svn commit: r1522842 - in /httpcomponents/httpasyncclient/trunk: ./ httpasyncclient-cache/ httpasync
From:       olegk () apache ! org
Date:       2013-09-13 10:07:44
Message-ID: 20130913100744.B4E682388831 () eris ! apache ! org
[Download RAW message or body]

Author: olegk
Date: Fri Sep 13 10:07:43 2013
New Revision: 1522842

URL: http://svn.apache.org/r1522842
Log:
HTTPASYNC-46: Test cases for HttpAsyncClient Cache
Contributed by James Leigh <james at 3roundstones.com>

Added:
    httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/
    httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/
    httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/
    httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/
  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/
  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/
  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/
  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/
  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/CachingHttpAsyncClientExecChain.java \
(with props)  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/ClientExecChainAsyncClient.java \
(with props)  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolAllowedBehavior.java \
(with props)  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolDeviations.java \
(with props)  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolRequirements.java \
(with props)  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpAsyncClient.java \
(with props)  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpAsyncCacheJiraNumber1147.java \
(with props)  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/resources/
  httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/resources/commons-logging.properties \
(with props) Modified:
    httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/pom.xml
    httpcomponents/httpasyncclient/trunk/pom.xml

Modified: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/pom.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/pom.xml?rev=1522842&r1=1522841&r2=1522842&view=diff
 ==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/pom.xml (original)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/pom.xml Fri Sep 13 \
10:07:43 2013 @@ -53,10 +53,26 @@
       <scope>compile</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.httpcomponents</groupId>
+      <artifactId>httpclient-cache</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymock</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.easymock</groupId>
+      <artifactId>easymockclassextension</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>

Added: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/CachingHttpAsyncClientExecChain.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient \
-cache/src/test/java/org/apache/http/impl/client/cache/CachingHttpAsyncClientExecChain.java?rev=1522842&view=auto
 ==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/CachingHttpAsyncClientExecChain.java \
                (added)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/CachingHttpAsyncClientExecChain.java \
Fri Sep 13 10:07:43 2013 @@ -0,0 +1,178 @@
+/*
+ * ====================================================================
+ * 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.impl.client.cache;
+
+import org.apache.http.HttpException;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.cache.HttpCacheEntry;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpExecutionAware;
+import org.apache.http.client.methods.HttpRequestWrapper;
+import org.apache.http.client.protocol.HttpClientContext;
+import org.apache.http.concurrent.FutureCallback;
+import org.apache.http.conn.routing.HttpRoute;
+import org.apache.http.impl.execchain.ClientExecChain;
+
+import java.io.IOException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.concurrent.ExecutionException;
+
+public class CachingHttpAsyncClientExecChain implements ClientExecChain {
+
+    private final CachingHttpAsyncClient client;
+    private final FutureCallback<HttpResponse> dummyCallback = new \
FutureCallback<HttpResponse>() { +        public void failed(final Exception ex) {
+            // failed
+        }
+
+        public void completed(final HttpResponse result) {
+            // completed
+        }
+
+        public void cancelled() {
+            // cancelled
+        }
+    };
+
+    public CachingHttpAsyncClientExecChain(final ClientExecChain backend) {
+        this(backend, new BasicHttpCache(), CacheConfig.DEFAULT);
+    }
+
+    public CachingHttpAsyncClientExecChain(
+            final ClientExecChain backend,
+            final HttpCache cache,
+            final CacheConfig config) {
+        this.client = new CachingHttpAsyncClient(
+                new ClientExecChainAsyncClient(backend), cache, config);
+    }
+
+    CachingHttpAsyncClientExecChain(
+            final ClientExecChain backend, final HttpCache responseCache,
+            final CacheValidityPolicy validityPolicy,
+            final ResponseCachingPolicy responseCachingPolicy,
+            final CachedHttpResponseGenerator responseGenerator,
+            final CacheableRequestPolicy cacheableRequestPolicy,
+            final CachedResponseSuitabilityChecker suitabilityChecker,
+            final ConditionalRequestBuilder conditionalRequestBuilder,
+            final ResponseProtocolCompliance responseCompliance,
+            final RequestProtocolCompliance requestCompliance) {
+        this.client = new CachingHttpAsyncClient(
+                new ClientExecChainAsyncClient(backend), validityPolicy,
+                responseCachingPolicy, responseCache, responseGenerator,
+                cacheableRequestPolicy, suitabilityChecker,
+                conditionalRequestBuilder, responseCompliance,
+                requestCompliance);
+    }
+
+    public boolean supportsRangeAndContentRangeHeaders() {
+        return client.supportsRangeAndContentRangeHeaders();
+    }
+
+    public CloseableHttpResponse execute(
+            final HttpRoute route,
+            final HttpRequestWrapper request) throws IOException, HttpException {
+        return execute(route, request, HttpClientContext.create(), null);
+    }
+
+    public CloseableHttpResponse execute(
+            final HttpRoute route,
+            final HttpRequestWrapper request,
+            final HttpClientContext context) throws IOException, HttpException {
+        return execute(route, request, context, null);
+    }
+
+    public CloseableHttpResponse execute(
+            final HttpRoute route,
+            final HttpRequestWrapper request,
+            final HttpClientContext context,
+            final HttpExecutionAware execAware) throws IOException, HttpException {
+        try {
+            return Proxies.enhanceResponse(client.execute(
+                    route.getTargetHost(), request, context, dummyCallback)
+                    .get());
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            return null;
+        } catch (ExecutionException e) {
+            try {
+                throw e.getCause();
+            } catch (IOException ex) {
+                throw ex;
+            } catch (HttpException ex) {
+                throw ex;
+            } catch (RuntimeException ex) {
+                throw ex;
+            } catch (Error ex) {
+                throw ex;
+            } catch (Throwable ex) {
+                throw new UndeclaredThrowableException(ex);
+            }
+        }
+    }
+
+    public long getCacheHits() {
+        return client.getCacheHits();
+    }
+
+    public long getCacheMisses() {
+        return client.getCacheMisses();
+    }
+
+    public long getCacheUpdates() {
+        return client.getCacheUpdates();
+    }
+
+    CloseableHttpResponse revalidateCacheEntry(
+            final HttpRoute route,
+            final HttpRequestWrapper request,
+            final HttpClientContext context,
+            final HttpCacheEntry cacheEntry) throws IOException, HttpException {
+        try {
+            return Proxies.enhanceResponse(client.revalidateCacheEntry(
+                    route.getTargetHost(), request, context, cacheEntry,
+                    dummyCallback).get());
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            return null;
+        } catch (ExecutionException e) {
+            try {
+                throw e.getCause();
+            } catch (IOException ex) {
+                throw ex;
+            } catch (HttpException ex) {
+                throw ex;
+            } catch (RuntimeException ex) {
+                throw ex;
+            } catch (Error ex) {
+                throw ex;
+            } catch (Throwable ex) {
+                throw new UndeclaredThrowableException(ex);
+            }
+        }
+    }
+
+}

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/CachingHttpAsyncClientExecChain.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/CachingHttpAsyncClientExecChain.java
                
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/CachingHttpAsyncClientExecChain.java
                
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/ClientExecChainAsyncClient.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient \
-cache/src/test/java/org/apache/http/impl/client/cache/ClientExecChainAsyncClient.java?rev=1522842&view=auto
 ==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/ClientExecChainAsyncClient.java \
                (added)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/ClientExecChainAsyncClient.java \
Fri Sep 13 10:07:43 2013 @@ -0,0 +1,120 @@
+/*
+ * ====================================================================
+ * 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.impl.client.cache;
+
+import org.apache.http.HttpException;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.methods.HttpRequestWrapper;
+import org.apache.http.client.protocol.HttpClientContext;
+import org.apache.http.concurrent.BasicFuture;
+import org.apache.http.concurrent.FutureCallback;
+import org.apache.http.conn.routing.HttpRoute;
+import org.apache.http.impl.execchain.ClientExecChain;
+import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
+import org.apache.http.nio.conn.ClientAsyncConnectionManager;
+import org.apache.http.nio.protocol.HttpAsyncRequestProducer;
+import org.apache.http.nio.protocol.HttpAsyncResponseConsumer;
+import org.apache.http.nio.reactor.IOReactorStatus;
+import org.apache.http.params.HttpParams;
+import org.apache.http.protocol.HttpContext;
+
+import java.io.IOException;
+import java.util.concurrent.Future;
+
+public class ClientExecChainAsyncClient extends CloseableHttpAsyncClient {
+
+    private final ClientExecChain backend;
+
+    public ClientExecChainAsyncClient(final ClientExecChain backend) {
+        super();
+        this.backend = backend;
+    }
+
+    @Override
+    public void start() {
+        // no-op
+    }
+
+    @Override
+    public boolean isRunning() {
+        return true;
+    }
+
+    public void shutdown() throws InterruptedException {
+        // no-op
+    }
+
+    public IOReactorStatus getStatus() {
+        return null;
+    }
+
+    @SuppressWarnings("deprecation")
+    public ClientAsyncConnectionManager getConnectionManager() {
+        return null;
+    }
+
+    @SuppressWarnings("deprecation")
+    public HttpParams getParams() {
+        return null;
+    }
+
+    public void close() throws IOException {
+        // no-op
+    }
+
+    public <T> Future<T> execute(
+            final HttpAsyncRequestProducer requestProducer,
+            final HttpAsyncResponseConsumer<T> responseConsumer,
+            final HttpContext context,
+            final FutureCallback<T> callback) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Future<HttpResponse> execute(
+            final HttpHost target,
+            final HttpRequest request,
+            final HttpContext context,
+            final FutureCallback<HttpResponse> callback) {
+        final BasicFuture<HttpResponse> future = new BasicFuture<HttpResponse>(
+                callback);
+        try {
+            final HttpResponse result = backend.execute(new HttpRoute(target),
+                    HttpRequestWrapper.wrap(request),
+                    HttpClientContext.adapt(context), null);
+            future.completed(result);
+        } catch (IOException e) {
+            future.failed(e);
+        } catch (HttpException e) {
+            future.failed(e);
+        }
+        return future;
+    }
+
+}

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/ClientExecChainAsyncClient.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/ClientExecChainAsyncClient.java
                
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/ClientExecChainAsyncClient.java
                
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolAllowedBehavior.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient \
-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolAllowedBehavior.java?rev=1522842&view=auto
 ==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolAllowedBehavior.java \
                (added)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolAllowedBehavior.java \
Fri Sep 13 10:07:43 2013 @@ -0,0 +1,52 @@
+/*
+ * ====================================================================
+ * 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.impl.client.cache;
+
+import org.apache.http.impl.execchain.ClientExecChain;
+
+/**
+ * This class tests behavior that is allowed (MAY) by the HTTP/1.1 protocol \
specification and for + * which we have implemented the behavior in the caching HTTP \
client. + */
+public class TestAsyncProtocolAllowedBehavior extends TestProtocolAllowedBehavior {
+
+    @Override
+    protected ClientExecChain createCachingExecChain(
+            final ClientExecChain backend,
+            final HttpCache cache,
+            final CacheConfig config) {
+        return new CachingHttpAsyncClientExecChain(backend, cache, config);
+    }
+
+    @Override
+    protected boolean supportsRangeAndContentRangeHeaders(final ClientExecChain \
impl) { +        return impl instanceof CachingHttpAsyncClientExecChain
+                && ((CachingHttpAsyncClientExecChain) impl)
+                .supportsRangeAndContentRangeHeaders();
+    }
+
+}

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolAllowedBehavior.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolAllowedBehavior.java
                
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolAllowedBehavior.java
                
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolDeviations.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient \
-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolDeviations.java?rev=1522842&view=auto
 ==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolDeviations.java \
                (added)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolDeviations.java \
Fri Sep 13 10:07:43 2013 @@ -0,0 +1,52 @@
+/*
+ * ====================================================================
+ * 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.impl.client.cache;
+
+import org.apache.http.impl.execchain.ClientExecChain;
+
+/**
+ * We are a conditionally-compliant HTTP/1.1 client with a cache. However, a lot of \
the rules for + * proxies apply to us, as far as proper operation of the requests \
that pass through us. Generally + * speaking, we want to make sure that any response \
returned from our HttpClient.execute() methods + * is conditionally compliant with \
the rules for an HTTP/1.1 server, and that any requests we pass + * downstream to the \
backend HttpClient are are conditionally compliant with the rules for an + * HTTP/1.1 \
client. + * <p/>
+ * There are some cases where strictly behaving as a compliant caching proxy would \
result in strange + * behavior, since we're attached as part of a client and are \
expected to be a drop-in replacement. + * The test cases captured here document the \
places where we differ from the HTTP RFC. + */
+public class TestAsyncProtocolDeviations extends TestProtocolDeviations {
+
+    @Override
+    protected ClientExecChain createCachingExecChain(
+            final ClientExecChain backend,
+            final HttpCache cache,
+            final CacheConfig config) {
+        return new CachingHttpAsyncClientExecChain(backend, cache, config);
+    }
+}

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolDeviations.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolDeviations.java
                
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolDeviations.java
                
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolRequirements.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient \
-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolRequirements.java?rev=1522842&view=auto
 ==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolRequirements.java \
                (added)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolRequirements.java \
Fri Sep 13 10:07:43 2013 @@ -0,0 +1,55 @@
+/*
+ * ====================================================================
+ * 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.impl.client.cache;
+
+import org.apache.http.impl.execchain.ClientExecChain;
+
+/**
+ * We are a conditionally-compliant HTTP/1.1 client with a cache. However, a lot of \
the rules for + * proxies apply to us, as far as proper operation of the requests \
that pass through us. Generally + * speaking, we want to make sure that any response \
returned from our HttpClient.execute() methods + * is conditionally compliant with \
the rules for an HTTP/1.1 server, and that any requests we pass + * downstream to the \
backend HttpClient are are conditionally compliant with the rules for an + * HTTP/1.1 \
client. + */
+public class TestAsyncProtocolRequirements extends TestProtocolRequirements {
+
+    @Override
+    protected ClientExecChain createCachingExecChain(
+            final ClientExecChain backend,
+            final HttpCache cache,
+            final CacheConfig config) {
+        return new CachingHttpAsyncClientExecChain(backend, cache, config);
+    }
+
+    @Override
+    protected boolean supportsRangeAndContentRangeHeaders(final ClientExecChain \
impl) { +        return impl instanceof CachingHttpAsyncClientExecChain
+                && ((CachingHttpAsyncClientExecChain) impl)
+                .supportsRangeAndContentRangeHeaders();
+    }
+}

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolRequirements.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolRequirements.java
                
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestAsyncProtocolRequirements.java
                
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpAsyncClient.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient \
-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpAsyncClient.java?rev=1522842&view=auto
 ==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpAsyncClient.java \
                (added)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpAsyncClient.java \
Fri Sep 13 10:07:43 2013 @@ -0,0 +1,62 @@
+/*
+ * ====================================================================
+ * 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.impl.client.cache;
+
+import org.apache.http.impl.execchain.ClientExecChain;
+
+public class TestCachingHttpAsyncClient extends TestCachingExecChain {
+
+    @Override
+    public ClientExecChain createCachingExecChain(
+            final ClientExecChain backend,
+            final HttpCache responseCache,
+            final CacheValidityPolicy validityPolicy,
+            final ResponseCachingPolicy responseCachingPolicy,
+            final CachedHttpResponseGenerator responseGenerator,
+            final CacheableRequestPolicy cacheableRequestPolicy,
+            final CachedResponseSuitabilityChecker suitabilityChecker,
+            final ConditionalRequestBuilder conditionalRequestBuilder,
+            final ResponseProtocolCompliance responseCompliance,
+            final RequestProtocolCompliance requestCompliance,
+            final CacheConfig config,
+            final AsynchronousValidator asynchRevalidator) {
+        return new CachingHttpAsyncClientExecChain(backend, responseCache, \
validityPolicy, +                responseCachingPolicy, responseGenerator,
+                cacheableRequestPolicy, suitabilityChecker,
+                conditionalRequestBuilder, responseCompliance,
+                requestCompliance);
+    }
+
+    @Override
+    public ClientExecChain createCachingExecChain(
+            final ClientExecChain backend,
+            final HttpCache cache,
+            final CacheConfig config) {
+        return new CachingHttpAsyncClientExecChain(backend, cache, config);
+    }
+
+}

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpAsyncClient.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpAsyncClient.java
                
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestCachingHttpAsyncClient.java
                
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpAsyncCacheJiraNumber1147.java
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient \
-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpAsyncCacheJiraNumber1147.java?rev=1522842&view=auto
 ==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpAsyncCacheJiraNumber1147.java \
                (added)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpAsyncCacheJiraNumber1147.java \
Fri Sep 13 10:07:43 2013 @@ -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.
+ * ====================================================================
+ *
+ * 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.impl.client.cache;
+
+import org.apache.http.impl.execchain.ClientExecChain;
+
+public class TestHttpAsyncCacheJiraNumber1147 extends TestHttpCacheJiraNumber1147 {
+
+    @Override
+    protected ClientExecChain createCachingExecChain(
+            final ClientExecChain backend,
+            final BasicHttpCache cache,
+            final CacheConfig config) {
+        return new CachingHttpAsyncClientExecChain(backend, cache, config);
+    }
+
+}

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpAsyncCacheJiraNumber1147.java
                
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpAsyncCacheJiraNumber1147.java
                
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/java/org/apache/http/impl/client/cache/TestHttpAsyncCacheJiraNumber1147.java
                
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/resources/commons-logging.properties
                
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/resources/commons-logging.properties?rev=1522842&view=auto
 ==============================================================================
--- httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/resources/commons-logging.properties \
                (added)
+++ httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/resources/commons-logging.properties \
Fri Sep 13 10:07:43 2013 @@ -0,0 +1,26 @@
+# ====================================================================
+# 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/>.
+
+# Disable logging for unit tests
+org.apache.commons.logging.Log=org.apache.commons.logging.impl.NoOpLog

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/resources/commons-logging.properties
                
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/resources/commons-logging.properties
                
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: httpcomponents/httpasyncclient/trunk/httpasyncclient-cache/src/test/resources/commons-logging.properties
                
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: httpcomponents/httpasyncclient/trunk/pom.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpasyncclient/trunk/pom.xml?rev=1522842&r1=1522841&r2=1522842&view=diff
 ==============================================================================
--- httpcomponents/httpasyncclient/trunk/pom.xml (original)
+++ httpcomponents/httpasyncclient/trunk/pom.xml Fri Sep 13 10:07:43 2013
@@ -26,12 +26,12 @@
  -->
 <project xmlns="http://maven.apache.org/POM/4.0.0" \
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 \
http://maven.apache.org/maven-v4_0_0.xsd">  <parent>
-    <artifactId>project</artifactId>
-    <groupId>org.apache.httpcomponents</groupId>
-    <version>7</version>
-    <relativePath>../project/pom.xml</relativePath>
-  </parent>
-  <modelVersion>4.0.0</modelVersion>
+      <artifactId>project</artifactId>
+      <groupId>org.apache.httpcomponents</groupId>
+      <version>7</version>
+      <relativePath>../project/pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
   <artifactId>httpcomponents-asyncclient</artifactId>
   <name>HttpComponents AsyncClient</name>
   <version>4.0-beta5-SNAPSHOT</version>
@@ -71,6 +71,7 @@
     <!-- Note IO 2.3+ requires Java 6 -->
     <commons-io.version>2.2</commons-io.version>
     <junit.version>4.8.1</junit.version>
+    <easymock.version>2.5.2</easymock.version>
     <mockito.version>1.8.5</mockito.version>
   </properties>
 
@@ -114,11 +115,30 @@
         <scope>test</scope>
       </dependency>
       <dependency>
+        <groupId>org.easymock</groupId>
+        <artifactId>easymock</artifactId>
+        <version>${easymock.version}</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.easymock</groupId>
+        <artifactId>easymockclassextension</artifactId>
+        <version>${easymock.version}</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
         <groupId>commons-io</groupId>
         <artifactId>commons-io</artifactId>
         <version>${commons-io.version}</version>
         <scope>test</scope>
       </dependency>
+      <dependency>
+        <groupId>org.apache.httpcomponents</groupId>
+        <artifactId>httpclient-cache</artifactId>
+        <version>${httpclient.version}</version>
+        <type>test-jar</type>
+        <scope>test</scope>
+      </dependency>
     </dependencies>
   </dependencyManagement>
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic