hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1463938 [2/2] - in /httpcomponents/httpclient/trunk: httpclient-cache/src/main/java/org/apache/http/impl/client/cache/ httpclient/src/main/java/org/apache/http/client/methods/ httpclient/src/main/java/org/apache/http/client/protocol/ httpc...
Date Wed, 03 Apr 2013 11:56:35 GMT
Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestAuthenticationStrategy.java Wed Apr  3 11:56:34 2013
@@ -46,7 +46,7 @@ import org.apache.http.client.AuthCache;
 import org.apache.http.client.CredentialsProvider;
 import org.apache.http.client.config.AuthSchemes;
 import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.config.Registry;
 import org.apache.http.config.RegistryBuilder;
 import org.apache.http.impl.auth.BasicScheme;
@@ -55,8 +55,6 @@ import org.apache.http.impl.auth.DigestS
 import org.apache.http.impl.auth.DigestSchemeFactory;
 import org.apache.http.message.BasicHeader;
 import org.apache.http.message.BasicHttpResponse;
-import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.HttpContext;
 import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -70,7 +68,7 @@ public class TestAuthenticationStrategy 
     public void testIsAuthenticationRequestedInvalidInput() throws Exception {
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
         final HttpHost host = new HttpHost("localhost", 80);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         authStrategy.isAuthenticationRequested(host, null, context);
     }
 
@@ -79,7 +77,7 @@ public class TestAuthenticationStrategy 
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_UNAUTHORIZED, "UNAUTHORIZED");
         final HttpHost host = new HttpHost("localhost", 80);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         Assert.assertTrue(authStrategy.isAuthenticationRequested(host, response, context));
     }
 
@@ -88,7 +86,7 @@ public class TestAuthenticationStrategy 
         final ProxyAuthenticationStrategy authStrategy = new ProxyAuthenticationStrategy();
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED, "UNAUTHORIZED");
         final HttpHost host = new HttpHost("localhost", 80);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         Assert.assertTrue(authStrategy.isAuthenticationRequested(host, response, context));
     }
 
@@ -96,14 +94,14 @@ public class TestAuthenticationStrategy 
     public void testGetChallengesInvalidInput() throws Exception {
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
         final HttpHost host = new HttpHost("localhost", 80);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         authStrategy.getChallenges(host, null, context);
     }
 
     @Test
     public void testGetChallenges() throws Exception {
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpHost host = new HttpHost("localhost", 80);
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_UNAUTHORIZED, "UNAUTHORIZED");
         final Header h1 = new BasicHeader(AUTH.WWW_AUTH, "  Basic  realm=\"test\"");
@@ -128,7 +126,7 @@ public class TestAuthenticationStrategy 
         final Map<String, Header> challenges = new HashMap<String, Header>();
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_UNAUTHORIZED, "UNAUTHORIZED");
         final HttpHost authhost = new HttpHost("locahost", 80);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         try {
             authStrategy.select(null, authhost, response, context);
             Assert.fail("IllegalArgumentException expected");
@@ -156,7 +154,7 @@ public class TestAuthenticationStrategy 
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_UNAUTHORIZED, "UNAUTHORIZED");
         final HttpHost authhost = new HttpHost("locahost", 80);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final Map<String, Header> challenges = new HashMap<String, Header>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"test\""));
@@ -172,7 +170,7 @@ public class TestAuthenticationStrategy 
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_UNAUTHORIZED, "UNAUTHORIZED");
         final HttpHost authhost = new HttpHost("locahost", 80);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final Map<String, Header> challenges = new HashMap<String, Header>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"test\""));
@@ -181,7 +179,7 @@ public class TestAuthenticationStrategy 
         final Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
             .register("basic", new BasicSchemeFactory())
             .register("digest", new DigestSchemeFactory()).build();
-        context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, authSchemeRegistry);
+        context.setAuthSchemeRegistry(authSchemeRegistry);
 
         final Queue<AuthOption> options = authStrategy.select(challenges, authhost, response, context);
         Assert.assertNotNull(options);
@@ -193,7 +191,7 @@ public class TestAuthenticationStrategy 
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_UNAUTHORIZED, "UNAUTHORIZED");
         final HttpHost authhost = new HttpHost("locahost", 80);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final Map<String, Header> challenges = new HashMap<String, Header>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"realm1\""));
@@ -202,10 +200,10 @@ public class TestAuthenticationStrategy 
         final Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
             .register("basic", new BasicSchemeFactory())
             .register("digest", new DigestSchemeFactory()).build();
-        context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, authSchemeRegistry);
+        context.setAuthSchemeRegistry(authSchemeRegistry);
 
         final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
-        context.setAttribute(ClientContext.CREDS_PROVIDER, credentialsProvider);
+        context.setCredentialsProvider(credentialsProvider);
 
         final Queue<AuthOption> options = authStrategy.select(challenges, authhost, response, context);
         Assert.assertNotNull(options);
@@ -217,7 +215,7 @@ public class TestAuthenticationStrategy 
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_UNAUTHORIZED, "UNAUTHORIZED");
         final HttpHost authhost = new HttpHost("somehost", 80);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final Map<String, Header> challenges = new HashMap<String, Header>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"realm1\""));
@@ -226,12 +224,12 @@ public class TestAuthenticationStrategy 
         final Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
             .register("basic", new BasicSchemeFactory())
             .register("digest", new DigestSchemeFactory()).build();
-        context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, authSchemeRegistry);
+        context.setAuthSchemeRegistry(authSchemeRegistry);
 
         final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
         credentialsProvider.setCredentials(new AuthScope("somehost", 80, "realm2"),
                 new UsernamePasswordCredentials("user", "pwd"));
-        context.setAttribute(ClientContext.CREDS_PROVIDER, credentialsProvider);
+        context.setCredentialsProvider(credentialsProvider);
 
         final Queue<AuthOption> options = authStrategy.select(challenges, authhost, response, context);
         Assert.assertNotNull(options);
@@ -245,7 +243,7 @@ public class TestAuthenticationStrategy 
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_UNAUTHORIZED, "UNAUTHORIZED");
         final HttpHost authhost = new HttpHost("somehost", 80);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final Map<String, Header> challenges = new HashMap<String, Header>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"realm1\""));
@@ -255,12 +253,12 @@ public class TestAuthenticationStrategy 
         final Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
             .register("basic", new BasicSchemeFactory())
             .register("digest", new DigestSchemeFactory()).build();
-        context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, authSchemeRegistry);
+        context.setAuthSchemeRegistry(authSchemeRegistry);
 
         final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
         credentialsProvider.setCredentials(new AuthScope("somehost", 80),
                 new UsernamePasswordCredentials("user", "pwd"));
-        context.setAttribute(ClientContext.CREDS_PROVIDER, credentialsProvider);
+        context.setCredentialsProvider(credentialsProvider);
 
         final Queue<AuthOption> options = authStrategy.select(challenges, authhost, response, context);
         Assert.assertNotNull(options);
@@ -280,7 +278,7 @@ public class TestAuthenticationStrategy 
             .build();
 
         final HttpHost authhost = new HttpHost("somehost", 80);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final Map<String, Header> challenges = new HashMap<String, Header>();
         challenges.put("basic", new BasicHeader(AUTH.WWW_AUTH, "Basic realm=\"realm1\""));
@@ -289,13 +287,13 @@ public class TestAuthenticationStrategy 
         final Registry<AuthSchemeProvider> authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
             .register("basic", new BasicSchemeFactory())
             .register("digest", new DigestSchemeFactory()).build();
-        context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, authSchemeRegistry);
-        context.setAttribute(ClientContext.REQUEST_CONFIG, config);
+        context.setAuthSchemeRegistry(authSchemeRegistry);
+        context.setRequestConfig(config);
 
         final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
         credentialsProvider.setCredentials(new AuthScope("somehost", 80),
                 new UsernamePasswordCredentials("user", "pwd"));
-        context.setAttribute(ClientContext.CREDS_PROVIDER, credentialsProvider);
+        context.setCredentialsProvider(credentialsProvider);
 
         final Queue<AuthOption> options = authStrategy.select(challenges, authhost, response, context);
         Assert.assertNotNull(options);
@@ -309,7 +307,7 @@ public class TestAuthenticationStrategy 
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
         final HttpHost authhost = new HttpHost("locahost", 80);
         final BasicScheme authScheme = new BasicScheme();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         try {
             authStrategy.authSucceeded(null, authScheme, context);
             Assert.fail("IllegalArgumentException expected");
@@ -336,8 +334,8 @@ public class TestAuthenticationStrategy 
 
         final AuthCache authCache = Mockito.mock(AuthCache.class);
 
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.AUTH_CACHE, authCache);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAuthCache(authCache);
 
         authStrategy.authSucceeded(authhost, authScheme, context);
         Mockito.verify(authCache).put(authhost, authScheme);
@@ -350,11 +348,11 @@ public class TestAuthenticationStrategy 
         final BasicScheme authScheme = new BasicScheme();
         authScheme.processChallenge(new BasicHeader(AUTH.WWW_AUTH, "Basic realm=test"));
 
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.AUTH_CACHE, null);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAuthCache(null);
 
         authStrategy.authSucceeded(authhost, authScheme, context);
-        final AuthCache authCache = (AuthCache) context.getAttribute(ClientContext.AUTH_CACHE);
+        final AuthCache authCache = context.getAuthCache();
         Assert.assertNotNull(authCache);
     }
 
@@ -366,8 +364,8 @@ public class TestAuthenticationStrategy 
 
         final AuthCache authCache = Mockito.mock(AuthCache.class);
 
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.AUTH_CACHE, authCache);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAuthCache(authCache);
 
         authStrategy.authSucceeded(authhost, authScheme, context);
         Mockito.verify(authCache, Mockito.never()).put(authhost, authScheme);
@@ -383,8 +381,8 @@ public class TestAuthenticationStrategy 
 
         final AuthCache authCache = Mockito.mock(AuthCache.class);
 
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.AUTH_CACHE, authCache);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAuthCache(authCache);
 
         authStrategy.authSucceeded(authhost, authScheme, context);
         Mockito.verify(authCache, Mockito.never()).put(authhost, authScheme);
@@ -395,7 +393,7 @@ public class TestAuthenticationStrategy 
         final TargetAuthenticationStrategy authStrategy = new TargetAuthenticationStrategy();
         final HttpHost authhost = new HttpHost("locahost", 80);
         final BasicScheme authScheme = new BasicScheme();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         try {
             authStrategy.authFailed(null, authScheme, context);
             Assert.fail("IllegalArgumentException expected");
@@ -417,8 +415,8 @@ public class TestAuthenticationStrategy 
 
         final AuthCache authCache = Mockito.mock(AuthCache.class);
 
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.AUTH_CACHE, authCache);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAuthCache(authCache);
 
         authStrategy.authFailed(authhost, authScheme, context);
         Mockito.verify(authCache).remove(authhost);
@@ -430,8 +428,8 @@ public class TestAuthenticationStrategy 
         final HttpHost authhost = new HttpHost("somehost", 80);
         final BasicScheme authScheme = new BasicScheme();
 
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.AUTH_CACHE, null);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAuthCache(null);
 
         authStrategy.authFailed(authhost, authScheme, context);
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultHttpRequestRetryHandler.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultHttpRequestRetryHandler.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultHttpRequestRetryHandler.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultHttpRequestRetryHandler.java Wed Apr  3 11:56:34 2013
@@ -34,8 +34,8 @@ import java.net.UnknownHostException;
 
 import org.apache.http.client.methods.HttpUriRequest;
 import org.apache.http.conn.ConnectTimeoutException;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpCoreContext;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -52,7 +52,7 @@ public class TestDefaultHttpRequestRetry
         Assert.assertEquals(3, retryHandler.getRetryCount());
 
         when(request.isAborted()).thenReturn(Boolean.FALSE);
-        when(context.getAttribute(ExecutionContext.HTTP_REQUEST)).thenReturn(request);
+        when(context.getAttribute(HttpCoreContext.HTTP_REQUEST)).thenReturn(request);
 
         Assert.assertFalse(retryHandler.retryRequest(new ConnectTimeoutException(), 1, context));
     }
@@ -65,7 +65,7 @@ public class TestDefaultHttpRequestRetry
         final DefaultHttpRequestRetryHandler retryHandler = new DefaultHttpRequestRetryHandler();
 
         when(request.isAborted()).thenReturn(Boolean.FALSE);
-        when(context.getAttribute(ExecutionContext.HTTP_REQUEST)).thenReturn(request);
+        when(context.getAttribute(HttpCoreContext.HTTP_REQUEST)).thenReturn(request);
 
         Assert.assertFalse(retryHandler.retryRequest(new UnknownHostException(), 1, context));
     }
@@ -78,7 +78,7 @@ public class TestDefaultHttpRequestRetry
         final DefaultHttpRequestRetryHandler retryHandler = new DefaultHttpRequestRetryHandler();
 
         when(request.isAborted()).thenReturn(Boolean.TRUE);
-        when(context.getAttribute(ExecutionContext.HTTP_REQUEST)).thenReturn(request);
+        when(context.getAttribute(HttpCoreContext.HTTP_REQUEST)).thenReturn(request);
 
         Assert.assertFalse(retryHandler.retryRequest(new IOException(),3,context));
     }
@@ -92,7 +92,7 @@ public class TestDefaultHttpRequestRetry
         final DefaultHttpRequestRetryHandler retryHandler = new DefaultHttpRequestRetryHandler();
 
         when(request.isAborted()).thenReturn(Boolean.FALSE);
-        when(context.getAttribute(ExecutionContext.HTTP_REQUEST)).thenReturn(request);
+        when(context.getAttribute(HttpCoreContext.HTTP_REQUEST)).thenReturn(request);
 
         Assert.assertTrue(retryHandler.retryRequest(new IOException(),3,context));
     }
@@ -106,7 +106,7 @@ public class TestDefaultHttpRequestRetry
         final DefaultHttpRequestRetryHandler retryHandler = new DefaultHttpRequestRetryHandler();
 
         when(request.isAborted()).thenReturn(false);
-        when(context.getAttribute(ExecutionContext.HTTP_REQUEST)).thenReturn(request);
+        when(context.getAttribute(HttpCoreContext.HTTP_REQUEST)).thenReturn(request);
 
         Assert.assertFalse(retryHandler.retryRequest(new ConnectTimeoutException(),3,context));
     }

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultRedirectStrategy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultRedirectStrategy.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultRedirectStrategy.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/TestDefaultRedirectStrategy.java Wed Apr  3 11:56:34 2013
@@ -44,12 +44,12 @@ import org.apache.http.client.methods.Ht
 import org.apache.http.client.methods.HttpPut;
 import org.apache.http.client.methods.HttpTrace;
 import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.entity.BasicHttpEntity;
 import org.apache.http.message.BasicHttpResponse;
 import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpCoreContext;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -68,7 +68,7 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testIsRedirectedMovedTemporary() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
@@ -81,7 +81,7 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testIsRedirectedMovedTemporaryNoLocation() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
@@ -91,7 +91,7 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testIsRedirectedMovedPermanently() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_PERMANENTLY, "Redirect");
@@ -103,7 +103,7 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testIsRedirectedTemporaryRedirect() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_TEMPORARY_REDIRECT, "Redirect");
@@ -115,7 +115,7 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testIsRedirectedSeeOther() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_SEE_OTHER, "Redirect");
@@ -127,7 +127,7 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testIsRedirectedUnknownStatus() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, 333, "Redirect");
         Assert.assertFalse(redirectStrategy.isRedirected(httpget, response, context));
@@ -138,7 +138,7 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testIsRedirectedInvalidInput() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_SEE_OTHER, "Redirect");
@@ -157,7 +157,7 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testGetLocationUri() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
@@ -169,7 +169,7 @@ public class TestDefaultRedirectStrategy
     @Test(expected=ProtocolException.class)
     public void testGetLocationUriMissingHeader() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
@@ -179,7 +179,7 @@ public class TestDefaultRedirectStrategy
     @Test(expected=ProtocolException.class)
     public void testGetLocationUriInvalidLocation() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
@@ -190,8 +190,8 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testGetLocationUriRelative() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
@@ -203,7 +203,7 @@ public class TestDefaultRedirectStrategy
     @Test(expected=IllegalStateException.class)
     public void testGetLocationUriRelativeMissingTargetHost() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
@@ -215,8 +215,8 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testGetLocationUriRelativeWithFragment() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
@@ -228,8 +228,8 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testGetLocationUriAbsoluteWithFragment() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
@@ -241,8 +241,8 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testGetLocationUriNormalized() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
@@ -254,10 +254,10 @@ public class TestDefaultRedirectStrategy
     @Test(expected=ProtocolException.class)
     public void testGetLocationUriRelativeLocationNotAllowed() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final RequestConfig config = RequestConfig.custom().setRelativeRedirectsAllowed(false).build();
-        context.setAttribute(ClientContext.REQUEST_CONFIG, config);
+        context.setRequestConfig(config);
 
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
@@ -269,11 +269,11 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testGetLocationUriAllowCircularRedirects() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final HttpGet httpget = new HttpGet("http://localhost/");
         final RequestConfig config = RequestConfig.custom().setCircularRedirectsAllowed(true).build();
-        context.setAttribute(ClientContext.REQUEST_CONFIG, config);
+        context.setRequestConfig(config);
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response.addHeader("Location", "http://localhost/stuff");
@@ -297,11 +297,11 @@ public class TestDefaultRedirectStrategy
     @Test(expected=ProtocolException.class)
     public void testGetLocationUriDisallowCircularRedirects() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
+        final HttpClientContext context = HttpClientContext.create();
+        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, new HttpHost("localhost"));
         final HttpGet httpget = new HttpGet("http://localhost/");
         final RequestConfig config = RequestConfig.custom().setCircularRedirectsAllowed(false).build();
-        context.setAttribute(ClientContext.REQUEST_CONFIG, config);
+        context.setRequestConfig(config);
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");
         response.addHeader("Location", "http://localhost/stuff");
@@ -313,7 +313,7 @@ public class TestDefaultRedirectStrategy
     @Test
     public void testGetLocationUriInvalidInput() throws Exception {
         final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStrategy();
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final HttpGet httpget = new HttpGet("http://localhost/");
         final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1,
                 HttpStatus.SC_MOVED_TEMPORARILY, "Redirect");

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestAbortHandling.java Wed Apr  3 11:56:34 2013
@@ -42,6 +42,7 @@ import org.apache.http.HttpStatus;
 import org.apache.http.ProtocolVersion;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.concurrent.Cancellable;
 import org.apache.http.conn.ConnectionPoolTimeoutException;
 import org.apache.http.conn.ConnectionRequest;
@@ -53,7 +54,6 @@ import org.apache.http.impl.client.HttpC
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 import org.apache.http.message.BasicHeader;
 import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpRequestHandler;
 import org.junit.Assert;
@@ -108,14 +108,14 @@ public class TestAbortHandling extends I
 
         this.httpclient = HttpClients.createDefault();
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         try {
             this.httpclient.execute(getServerHttp(), httpget, context);
         } catch (final IllegalStateException e) {
         } catch (final IOException e) {
         }
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
         Assert.assertNotNull("Request should exist",reqWrapper);
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientAuthentication.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientAuthentication.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientAuthentication.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientAuthentication.java Wed Apr  3 11:56:34 2013
@@ -48,7 +48,7 @@ import org.apache.http.client.config.Req
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.client.methods.HttpPut;
-import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.auth.BasicScheme;
@@ -60,7 +60,6 @@ import org.apache.http.localserver.Basic
 import org.apache.http.localserver.LocalTestServer;
 import org.apache.http.localserver.RequestBasicAuth;
 import org.apache.http.localserver.ResponseBasicUnauthorized;
-import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpExpectationVerifier;
 import org.apache.http.protocol.HttpProcessor;
@@ -370,7 +369,7 @@ public class TestClientAuthentication ex
             .setTargetAuthenticationStrategy(authStrategy)
             .build();
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpHost targethost = getServerHttp();
         final HttpGet httpget = new HttpGet("/");
@@ -467,10 +466,10 @@ public class TestClientAuthentication ex
 
         final HttpHost targethost = getServerHttp();
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final AuthCache authCache = new BasicAuthCache();
         authCache.put(targethost, new BasicScheme());
-        context.setAttribute(ClientContext.AUTH_CACHE, authCache);
+        context.setAuthCache(authCache);
 
         final HttpGet httpget = new HttpGet("/");
 
@@ -498,10 +497,10 @@ public class TestClientAuthentication ex
 
         final HttpHost targethost = getServerHttp();
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final AuthCache authCache = new BasicAuthCache();
         authCache.put(targethost, new BasicScheme());
-        context.setAttribute(ClientContext.AUTH_CACHE, authCache);
+        context.setAuthCache(authCache);
 
         final HttpGet httpget = new HttpGet("/");
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientReauthentication.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientReauthentication.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientReauthentication.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientReauthentication.java Wed Apr  3 11:56:34 2013
@@ -46,6 +46,7 @@ import org.apache.http.auth.UsernamePass
 import org.apache.http.client.CredentialsProvider;
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.config.Registry;
 import org.apache.http.config.RegistryBuilder;
 import org.apache.http.entity.StringEntity;
@@ -55,7 +56,6 @@ import org.apache.http.impl.client.HttpC
 import org.apache.http.impl.client.TargetAuthenticationStrategy;
 import org.apache.http.localserver.LocalTestServer;
 import org.apache.http.localserver.RequestBasicAuth;
-import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpProcessor;
 import org.apache.http.protocol.HttpProcessorBuilder;
@@ -193,7 +193,7 @@ public class TestClientReauthentication 
             .setDefaultCredentialsProvider(credsProvider)
             .build();
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         for (int i = 0; i < 10; i++) {
             final HttpGet httpget = new HttpGet("/");
             httpget.setConfig(config);

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientRequestExecution.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientRequestExecution.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientRequestExecution.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestClientRequestExecution.java Wed Apr  3 11:56:34 2013
@@ -43,14 +43,14 @@ import org.apache.http.client.HttpReques
 import org.apache.http.client.NonRepeatableRequestException;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.client.utils.URIBuilder;
 import org.apache.http.entity.InputStreamEntity;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpRequestExecutor;
 import org.apache.http.protocol.HttpRequestHandler;
 import org.apache.http.util.EntityUtils;
@@ -143,7 +143,7 @@ public class TestClientRequestExecution 
             .setRetryHandler(requestRetryHandler)
             .build();
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final String s = "http://localhost:" + port;
         final HttpGet httpget = new HttpGet(s);
@@ -151,8 +151,7 @@ public class TestClientRequestExecution 
         final HttpResponse response = this.httpclient.execute(getServerHttp(), httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
 
@@ -182,7 +181,7 @@ public class TestClientRequestExecution 
             .setRetryHandler(requestRetryHandler)
             .build();
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final String s = "http://localhost:" + port;
         final HttpPost httppost = new HttpPost(s);
@@ -207,15 +206,14 @@ public class TestClientRequestExecution 
         this.localServer.register("*", new SimpleService());
         this.httpclient = HttpClients.createDefault();
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
         final BasicHttpRequest request = new BasicHttpRequest("GET", "blah.:.blah.:.");
         final HttpResponse response = this.httpclient.execute(getServerHttp(), request, context);
         EntityUtils.consume(response.getEntity());
 
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         Assert.assertEquals("blah.:.blah.:.", reqWrapper.getRequestLine().getUri());
     }
@@ -227,13 +225,13 @@ public class TestClientRequestExecution 
         final HttpHost target = getServerHttp();
 
         final HttpGet httpget = new HttpGet("/stuff#blahblah");
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest request = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
+        final HttpRequest request = context.getRequest();
         Assert.assertEquals("/stuff", request.getRequestLine().getUri());
     }
 
@@ -252,13 +250,13 @@ public class TestClientRequestExecution 
             .build();
 
         final HttpGet httpget = new HttpGet(uri);
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpResponse response = this.httpclient.execute(httpget, context);
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest request = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
+        final HttpRequest request = (HttpRequest) context.getAttribute(HttpCoreContext.HTTP_REQUEST);
         Assert.assertEquals("/stuff", request.getRequestLine().getUri());
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionAutoRelease.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionAutoRelease.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionAutoRelease.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionAutoRelease.java Wed Apr  3 11:56:34 2013
@@ -48,8 +48,8 @@ import org.apache.http.impl.DefaultBHttp
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 import org.apache.http.pool.PoolStats;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpRequestHandler;
 import org.apache.http.util.EntityUtils;
 import org.junit.Assert;
@@ -198,7 +198,7 @@ public class TestConnectionAutoRelease e
                         // do something comletely ugly in order to trigger
                         // MalformedChunkCodingException
                         final DefaultBHttpServerConnection conn = (DefaultBHttpServerConnection)
-                            context.getAttribute(ExecutionContext.HTTP_CONNECTION);
+                            context.getAttribute(HttpCoreContext.HTTP_CONNECTION);
                         try {
                             conn.sendResponseHeader(response);
                         } catch (final HttpException ignore) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestConnectionManagement.java Wed Apr  3 11:56:34 2013
@@ -56,8 +56,8 @@ import org.apache.http.impl.conn.Pooling
 import org.apache.http.localserver.LocalServerTestBase;
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpProcessor;
 import org.apache.http.protocol.HttpRequestExecutor;
 import org.apache.http.protocol.ImmutableHttpProcessor;
@@ -116,8 +116,8 @@ public class TestConnectionManagement ex
         mgr.connect(conn, route, 0, context);
         mgr.routeComplete(conn, route, context);
 
-        context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
-        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, target);
+        context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
+        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, target);
 
         final HttpProcessor httpProcessor = new ImmutableHttpProcessor(
                 new HttpRequestInterceptor[] { new RequestContent(), new RequestConnControl() });
@@ -152,7 +152,7 @@ public class TestConnectionManagement ex
         mgr.routeComplete(conn, route, context);
 
         // repeat the communication, no need to prepare the request again
-        context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+        context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
         response = exec.execute(request, conn, context);
 
         Assert.assertEquals("wrong status in second response",
@@ -170,7 +170,7 @@ public class TestConnectionManagement ex
         Assert.assertTrue("connection should have been open", conn.isOpen());
 
         // repeat the communication, no need to prepare the request again
-        context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+        context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
         response = exec.execute(request, conn, context);
 
         Assert.assertEquals("wrong status in third response",
@@ -206,8 +206,8 @@ public class TestConnectionManagement ex
         mgr.connect(conn, route, 0, context);
         mgr.routeComplete(conn, route, context);
 
-        context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
-        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, target);
+        context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
+        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, target);
 
         final HttpProcessor httpProcessor = new ImmutableHttpProcessor(
                 new HttpRequestInterceptor[] { new RequestContent(), new RequestConnControl() });
@@ -242,7 +242,7 @@ public class TestConnectionManagement ex
         mgr.connect(conn, route, 0, context);
         mgr.routeComplete(conn, route, context);
 
-        context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+        context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
         response = exec.execute(request, conn, context);
 
         Assert.assertEquals("wrong status in second response",
@@ -258,7 +258,7 @@ public class TestConnectionManagement ex
         Assert.assertTrue("connection should have been open", conn.isOpen());
 
         // repeat the communication, no need to prepare the request again
-        context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+        context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
         response = exec.execute(request, conn, context);
 
         Assert.assertEquals("wrong status in third response",
@@ -278,7 +278,7 @@ public class TestConnectionManagement ex
         mgr.connect(conn, route, 0, context);
         mgr.routeComplete(conn, route, context);
 
-        context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
+        context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
         response = exec.execute(request, conn, context);
 
         Assert.assertEquals("wrong status in third response",
@@ -396,8 +396,8 @@ public class TestConnectionManagement ex
         mgr.connect(conn, route, 0, context);
         mgr.routeComplete(conn, route, context);
 
-        context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
-        context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, target);
+        context.setAttribute(HttpCoreContext.HTTP_CONNECTION, conn);
+        context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, target);
 
         final HttpProcessor httpProcessor = new ImmutableHttpProcessor(
                 new HttpRequestInterceptor[] { new RequestContent(), new RequestConnControl() });

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookie2Support.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookie2Support.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookie2Support.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookie2Support.java Wed Apr  3 11:56:34 2013
@@ -38,7 +38,7 @@ import org.apache.http.HttpStatus;
 import org.apache.http.ProtocolVersion;
 import org.apache.http.client.CookieStore;
 import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.cookie.Cookie;
 import org.apache.http.cookie.SM;
 import org.apache.http.cookie.SetCookie2;
@@ -46,8 +46,6 @@ import org.apache.http.entity.StringEnti
 import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.message.BasicHeader;
-import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpRequestHandler;
 import org.apache.http.util.EntityUtils;
@@ -86,8 +84,8 @@ public class TestCookie2Support extends 
         this.localServer.register("*", new CookieVer0Service());
 
         final CookieStore cookieStore = new BasicCookieStore();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setCookieStore(cookieStore);
 
         final HttpGet httpget = new HttpGet("/test/");
 
@@ -103,7 +101,7 @@ public class TestCookie2Support extends 
         final HttpEntity e2 = response2.getEntity();
         EntityUtils.consume(e2);
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         final Header cookiesupport = reqWrapper.getFirstHeader("Cookie2");
         Assert.assertNotNull(cookiesupport);
@@ -131,8 +129,8 @@ public class TestCookie2Support extends 
         this.localServer.register("*", new CookieVer1Service());
 
         final CookieStore cookieStore = new BasicCookieStore();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setCookieStore(cookieStore);
 
         final HttpGet httpget = new HttpGet("/test/");
 
@@ -148,7 +146,7 @@ public class TestCookie2Support extends 
         final HttpEntity e2 = response2.getEntity();
         EntityUtils.consume(e2);
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         final Header cookiesupport = reqWrapper.getFirstHeader(SM.COOKIE2);
         Assert.assertNotNull(cookiesupport);
@@ -175,8 +173,8 @@ public class TestCookie2Support extends 
         this.localServer.register("*", new CookieVer2Service());
 
         final CookieStore cookieStore = new BasicCookieStore();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setCookieStore(cookieStore);
 
         final HttpGet httpget = new HttpGet("/test/");
 
@@ -192,7 +190,7 @@ public class TestCookie2Support extends 
         final HttpEntity e2 = response2.getEntity();
         EntityUtils.consume(e2);
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         final Header cookiesupport = reqWrapper.getFirstHeader("Cookie2");
         Assert.assertNotNull(cookiesupport);
@@ -220,8 +218,8 @@ public class TestCookie2Support extends 
         this.localServer.register("*", new SetCookieVersionMixService());
 
         final CookieStore cookieStore = new BasicCookieStore();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setCookieStore(cookieStore);
 
         final HttpGet httpget = new HttpGet("/test/");
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java Wed Apr  3 11:56:34 2013
@@ -38,13 +38,12 @@ import org.apache.http.HttpStatus;
 import org.apache.http.HttpVersion;
 import org.apache.http.client.CookieStore;
 import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.cookie.Cookie;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.localserver.LocalTestServer;
 import org.apache.http.message.BasicHeader;
-import org.apache.http.protocol.BasicHttpContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpRequestHandler;
 import org.apache.http.util.EntityUtils;
@@ -115,8 +114,8 @@ public class TestCookieVirtualHost exten
         this.httpclient = HttpClients.createDefault();
 
         final CookieStore cookieStore = new BasicCookieStore();
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setCookieStore(cookieStore);
 
         // First request : retrieve a domain cookie from remote server.
         URI uri = new URI("http://app.mydomain.fr");

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestRedirects.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestRedirects.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestRedirects.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestRedirects.java Wed Apr  3 11:56:34 2013
@@ -45,17 +45,16 @@ import org.apache.http.client.RedirectEx
 import org.apache.http.client.config.RequestConfig;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.cookie.SM;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.impl.cookie.BasicClientCookie;
 import org.apache.http.message.BasicHeader;
-import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpCoreContext;
 import org.apache.http.protocol.HttpRequestHandler;
 import org.apache.http.util.EntityUtils;
 import org.junit.Assert;
@@ -90,7 +89,7 @@ public class TestRedirects extends Integ
                 final HttpRequest request,
                 final HttpResponse response,
                 final HttpContext context) throws HttpException, IOException {
-            final HttpInetConnection conn = (HttpInetConnection) context.getAttribute(ExecutionContext.HTTP_CONNECTION);
+            final HttpInetConnection conn = (HttpInetConnection) context.getAttribute(HttpCoreContext.HTTP_CONNECTION);
             final String localhost = conn.getLocalAddress().getHostName();
             final int port = conn.getLocalPort();
             final ProtocolVersion ver = request.getRequestLine().getProtocolVersion();
@@ -218,15 +217,14 @@ public class TestRedirects extends Integ
         this.localServer.register("*",
                 new BasicRedirectService(HttpStatus.SC_MULTIPLE_CHOICES));
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpGet httpget = new HttpGet("/oldlocation/");
 
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         Assert.assertEquals(HttpStatus.SC_MULTIPLE_CHOICES, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/oldlocation/", reqWrapper.getRequestLine().getUri());
@@ -238,17 +236,15 @@ public class TestRedirects extends Integ
         this.localServer.register("*",
                 new BasicRedirectService(HttpStatus.SC_MOVED_PERMANENTLY));
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpGet httpget = new HttpGet("/oldlocation/");
 
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
-        final HttpHost host = (HttpHost) context.getAttribute(
-                ExecutionContext.HTTP_TARGET_HOST);
+        final HttpRequest reqWrapper = context.getRequest();
+        final HttpHost host = context.getTargetHost();
 
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/newlocation/", reqWrapper.getRequestLine().getUri());
@@ -261,17 +257,15 @@ public class TestRedirects extends Integ
         this.localServer.register("*",
                 new BasicRedirectService(HttpStatus.SC_MOVED_TEMPORARILY));
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpGet httpget = new HttpGet("/oldlocation/");
 
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
-        final HttpHost host = (HttpHost) context.getAttribute(
-                ExecutionContext.HTTP_TARGET_HOST);
+        final HttpRequest reqWrapper = context.getRequest();
+        final HttpHost host = context.getTargetHost();
 
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/newlocation/", reqWrapper.getRequestLine().getUri());
@@ -292,17 +286,15 @@ public class TestRedirects extends Integ
 
         });
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpGet httpget = new HttpGet("/oldlocation/");
 
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
-        final HttpHost host = (HttpHost) context.getAttribute(
-                ExecutionContext.HTTP_TARGET_HOST);
+        final HttpRequest reqWrapper = context.getRequest();
+        final HttpHost host = context.getTargetHost();
 
         Assert.assertEquals(HttpStatus.SC_MOVED_TEMPORARILY, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/oldlocation/", reqWrapper.getRequestLine().getUri());
@@ -315,17 +307,15 @@ public class TestRedirects extends Integ
         this.localServer.register("*",
                 new BasicRedirectService(HttpStatus.SC_SEE_OTHER));
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpGet httpget = new HttpGet("/oldlocation/");
 
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
-        final HttpHost host = (HttpHost) context.getAttribute(
-                ExecutionContext.HTTP_TARGET_HOST);
+        final HttpRequest reqWrapper = context.getRequest();
+        final HttpHost host = context.getTargetHost();
 
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/newlocation/", reqWrapper.getRequestLine().getUri());
@@ -338,15 +328,14 @@ public class TestRedirects extends Integ
         this.localServer.register("*",
                 new BasicRedirectService(HttpStatus.SC_NOT_MODIFIED));
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpGet httpget = new HttpGet("/oldlocation/");
 
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         Assert.assertEquals(HttpStatus.SC_NOT_MODIFIED, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/oldlocation/", reqWrapper.getRequestLine().getUri());
@@ -357,15 +346,14 @@ public class TestRedirects extends Integ
         final HttpHost target = getServerHttp();
         this.localServer.register("*",
                 new BasicRedirectService(HttpStatus.SC_USE_PROXY));
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpGet httpget = new HttpGet("/oldlocation/");
 
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         Assert.assertEquals(HttpStatus.SC_USE_PROXY, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/oldlocation/", reqWrapper.getRequestLine().getUri());
@@ -377,17 +365,15 @@ public class TestRedirects extends Integ
         this.localServer.register("*",
                 new BasicRedirectService(HttpStatus.SC_TEMPORARY_REDIRECT));
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpGet httpget = new HttpGet("/oldlocation/");
 
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
-        final HttpHost host = (HttpHost) context.getAttribute(
-                ExecutionContext.HTTP_TARGET_HOST);
+        final HttpRequest reqWrapper = context.getRequest();
+        final HttpHost host = context.getTargetHost();
 
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/newlocation/", reqWrapper.getRequestLine().getUri());
@@ -438,7 +424,7 @@ public class TestRedirects extends Integ
         final HttpHost target = getServerHttp();
         this.localServer.register("*", new BasicRedirectService());
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpPost httppost = new HttpPost("/oldlocation/");
         httppost.setEntity(new StringEntity("stuff"));
@@ -446,8 +432,7 @@ public class TestRedirects extends Integ
         final HttpResponse response = this.httpclient.execute(target, httppost, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         Assert.assertEquals(HttpStatus.SC_MOVED_TEMPORARILY, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/oldlocation/", reqWrapper.getRequestLine().getUri());
@@ -459,7 +444,7 @@ public class TestRedirects extends Integ
         final HttpHost target = getServerHttp();
         this.localServer.register("*", new BasicRedirectService(HttpStatus.SC_SEE_OTHER));
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpPost httppost = new HttpPost("/oldlocation/");
         httppost.setEntity(new StringEntity("stuff"));
@@ -467,8 +452,7 @@ public class TestRedirects extends Integ
         final HttpResponse response = this.httpclient.execute(target, httppost, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/newlocation/", reqWrapper.getRequestLine().getUri());
@@ -480,7 +464,7 @@ public class TestRedirects extends Integ
         final HttpHost target = getServerHttp();
         this.localServer.register("*", new RelativeRedirectService());
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final RequestConfig config = RequestConfig.custom().setRelativeRedirectsAllowed(true).build();
         final HttpGet httpget = new HttpGet("/oldlocation/");
@@ -489,10 +473,8 @@ public class TestRedirects extends Integ
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
-        final HttpHost host = (HttpHost) context.getAttribute(
-                ExecutionContext.HTTP_TARGET_HOST);
+        final HttpRequest reqWrapper = context.getRequest();
+        final HttpHost host = context.getTargetHost();
 
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/relativelocation/", reqWrapper.getRequestLine().getUri());
@@ -504,7 +486,7 @@ public class TestRedirects extends Integ
         final HttpHost target = getServerHttp();
         this.localServer.register("*", new RelativeRedirectService2());
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final RequestConfig config = RequestConfig.custom().setRelativeRedirectsAllowed(true).build();
         final HttpGet httpget = new HttpGet("/test/oldlocation");
@@ -513,10 +495,8 @@ public class TestRedirects extends Integ
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
-        final HttpHost host = (HttpHost) context.getAttribute(
-                ExecutionContext.HTTP_TARGET_HOST);
+        final HttpRequest reqWrapper = context.getRequest();
+        final HttpHost host = context.getTargetHost();
 
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/test/relativelocation", reqWrapper.getRequestLine().getUri());
@@ -580,16 +560,15 @@ public class TestRedirects extends Integ
 
         cookieStore.addCookie(cookie);
 
-        final HttpContext context = new BasicHttpContext();
-        context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
+        final HttpClientContext context = HttpClientContext.create();
+        context.setCookieStore(cookieStore);
         final HttpGet httpget = new HttpGet("/oldlocation/");
 
 
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/newlocation/", reqWrapper.getRequestLine().getUri());
@@ -607,7 +586,7 @@ public class TestRedirects extends Integ
 
         this.localServer.register("*", new BasicRedirectService());
 
-        final HttpContext context = new BasicHttpContext();
+        final HttpClientContext context = HttpClientContext.create();
 
         final HttpGet httpget = new HttpGet("/oldlocation/");
 
@@ -615,8 +594,7 @@ public class TestRedirects extends Integ
         final HttpResponse response = this.httpclient.execute(target, httpget, context);
         EntityUtils.consume(response.getEntity());
 
-        final HttpRequest reqWrapper = (HttpRequest) context.getAttribute(
-                ExecutionContext.HTTP_REQUEST);
+        final HttpRequest reqWrapper = context.getRequest();
 
         Assert.assertEquals(HttpStatus.SC_OK, response.getStatusLine().getStatusCode());
         Assert.assertEquals("/newlocation/", reqWrapper.getRequestLine().getUri());

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestStatefulConnManagement.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestStatefulConnManagement.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestStatefulConnManagement.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/client/integration/TestStatefulConnManagement.java Wed Apr  3 11:56:34 2013
@@ -37,11 +37,11 @@ import org.apache.http.HttpStatus;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.UserTokenHandler;
 import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
 import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
 import org.apache.http.protocol.HttpRequestHandler;
 import org.apache.http.util.EntityUtils;
@@ -104,10 +104,10 @@ public class TestStatefulConnManagement 
             .setUserTokenHandler(userTokenHandler)
             .build();
 
-        final HttpContext[] contexts = new HttpContext[workerCount];
+        final HttpClientContext[] contexts = new HttpClientContext[workerCount];
         final HttpWorker[] workers = new HttpWorker[workerCount];
         for (int i = 0; i < contexts.length; i++) {
-            final HttpContext context = new BasicHttpContext();
+            final HttpClientContext context = HttpClientContext.create();
             contexts[i] = context;
             workers[i] = new HttpWorker(
                     "user" + i,
@@ -143,7 +143,7 @@ public class TestStatefulConnManagement 
     static class HttpWorker extends Thread {
 
         private final String uid;
-        private final HttpContext context;
+        private final HttpClientContext context;
         private final int requestCount;
         private final HttpHost target;
         private final HttpClient httpclient;
@@ -153,7 +153,7 @@ public class TestStatefulConnManagement 
 
         public HttpWorker(
                 final String uid,
-                final HttpContext context,
+                final HttpClientContext context,
                 final int requestCount,
                 final HttpHost target,
                 final HttpClient httpclient) {
@@ -186,8 +186,7 @@ public class TestStatefulConnManagement 
                             this.context);
                     this.count++;
 
-                    final HttpClientConnection conn = (HttpClientConnection) this.context.getAttribute(
-                            ExecutionContext.HTTP_CONNECTION);
+                    final HttpClientConnection conn = this.context.getConnection(HttpClientConnection.class);
                     final HttpContext connContext = (HttpContext) conn;
                     String connuid = (String) connContext.getAttribute("user");
                     if (connuid == null) {

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestHttpAuthenticator.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestHttpAuthenticator.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestHttpAuthenticator.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestHttpAuthenticator.java Wed Apr  3 11:56:34 2013
@@ -48,7 +48,7 @@ import org.apache.http.auth.Credentials;
 import org.apache.http.auth.MalformedChallengeException;
 import org.apache.http.client.AuthCache;
 import org.apache.http.client.AuthenticationStrategy;
-import org.apache.http.client.protocol.ClientContext;
+import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.config.Lookup;
 import org.apache.http.config.RegistryBuilder;
 import org.apache.http.impl.auth.BasicScheme;
@@ -62,8 +62,8 @@ import org.apache.http.message.BasicHead
 import org.apache.http.message.BasicHttpRequest;
 import org.apache.http.message.BasicHttpResponse;
 import org.apache.http.protocol.BasicHttpContext;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;
+import org.apache.http.protocol.HttpCoreContext;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -91,18 +91,18 @@ public class TestHttpAuthenticator {
         Mockito.when(this.authScheme.isComplete()).thenReturn(Boolean.TRUE);
         this.context = new BasicHttpContext();
         this.host = new HttpHost("localhost", 80);
-        this.context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, this.host);
+        this.context.setAttribute(HttpCoreContext.HTTP_TARGET_HOST, this.host);
         this.credentials = Mockito.mock(Credentials.class);
         this.credentialsProvider = new BasicCredentialsProvider();
         this.credentialsProvider.setCredentials(AuthScope.ANY, this.credentials);
-        this.context.setAttribute(ClientContext.CREDS_PROVIDER, this.credentialsProvider);
+        this.context.setAttribute(HttpClientContext.CREDS_PROVIDER, this.credentialsProvider);
         this.authSchemeRegistry = RegistryBuilder.<AuthSchemeProvider>create()
             .register("basic", new BasicSchemeFactory())
             .register("digest", new DigestSchemeFactory())
             .register("ntlm", new NTLMSchemeFactory()).build();
-        this.context.setAttribute(ClientContext.AUTHSCHEME_REGISTRY, this.authSchemeRegistry);
+        this.context.setAttribute(HttpClientContext.AUTHSCHEME_REGISTRY, this.authSchemeRegistry);
         this.authCache = Mockito.mock(AuthCache.class);
-        this.context.setAttribute(ClientContext.AUTH_CACHE, this.authCache);
+        this.context.setAttribute(HttpClientContext.AUTH_CACHE, this.authCache);
         this.httpAuthenticator = new HttpAuthenticator();
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestProtocolExec.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestProtocolExec.java?rev=1463938&r1=1463937&r2=1463938&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestProtocolExec.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/test/java/org/apache/http/impl/execchain/TestProtocolExec.java Wed Apr  3 11:56:34 2013
@@ -32,9 +32,6 @@ import org.apache.http.client.methods.Ht
 import org.apache.http.client.protocol.HttpClientContext;
 import org.apache.http.conn.routing.HttpRoute;
 import org.apache.http.message.BasicHttpRequest;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.HttpParams;
-import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpProcessor;
 import org.junit.Assert;
 import org.junit.Before;
@@ -50,7 +47,6 @@ public class TestProtocolExec {
     private HttpRequestWrapper request;
     private HttpExecutionAware execAware;
     private HttpRoute route;
-    private HttpParams params = new BasicHttpParams();
 
     @Before
     public void setup() throws Exception {
@@ -67,8 +63,7 @@ public class TestProtocolExec {
         request = HttpRequestWrapper.wrap(new BasicHttpRequest("GET", "http://bar/test"));
         protocolExec.execute(route, request, context, execAware);
         // ProtocolExect should have extracted the host from request URI
-        Assert.assertEquals(new HttpHost("bar", -1, "http"),
-            context.getAttribute(ExecutionContext.HTTP_TARGET_HOST));
+        Assert.assertEquals(new HttpHost("bar", -1, "http"), context.getTargetHost());
     }
 
     @Test
@@ -77,8 +72,7 @@ public class TestProtocolExec {
         protocolExec.execute(route, request, context, execAware);
         // ProtocolExect should have fall back to physical host as request URI
         // is not parseable
-        Assert.assertEquals(new HttpHost("foo", 8080, "http"),
-            context.getAttribute(ExecutionContext.HTTP_TARGET_HOST));
+        Assert.assertEquals(new HttpHost("foo", 8080, "http"), context.getTargetHost());
     }
 
 }



Mime
View raw message