hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rola...@apache.org
Subject svn commit: r558079 - in /jakarta/httpcomponents/httpclient/trunk: ./ module-client/src/main/java/org/apache/http/conn/ module-client/src/main/java/org/apache/http/conn/params/ module-client/src/main/java/org/apache/http/impl/conn/ module-client/src/te...
Date Fri, 20 Jul 2007 18:13:23 GMT
Author: rolandw
Date: Fri Jul 20 11:13:22 2007
New Revision: 558079

URL: http://svn.apache.org/viewvc?view=rev&rev=558079
Log:
HTTPCLIENT-618: class HostConfiguration is no more

Removed:
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/HostConfiguration.java
Modified:
    jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/HttpRoute.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/RouteTracker.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestHttpRoute.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestParams.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestRouteTracker.java
    jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java

Modified: jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt?view=diff&rev=558079&r1=558078&r2=558079
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt (original)
+++ jakarta/httpcomponents/httpclient/trunk/RELEASE_NOTES.txt Fri Jul 20 11:13:22 2007
@@ -1,5 +1,8 @@
 Changes since release 4.0 Alpha 1
 
+* [HTTPCLIENT-618] eliminate class HostConfiguration
+  Contributed by Roland Weber <rolandw at apache.org>
+
 * [HTTPCLIENT-672] re-sync with API changes in core alpha6-SNAPSHOT
   Contributed by Roland Weber <rolandw at apache.org>
 

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/HttpRoute.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/HttpRoute.java?view=diff&rev=558079&r1=558078&r2=558079
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/HttpRoute.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/HttpRoute.java
Fri Jul 20 11:13:22 2007
@@ -369,24 +369,6 @@
 
 
     /**
-     * Converts to the {@link HostConfiguration traditional} interface.
-     *
-     * @return  a host configuration matching this route as good as possible
-     *
-     * @deprecated No replacement.
-     *          This class will replace {@link HostConfiguration}
-     *          where routes need to be represented. No conversion necessary.
-     */
-    public final HostConfiguration toHostConfig() {
-        if ((this.proxyChain != null) && (this.proxyChain.length > 1)) {
-            throw new IllegalStateException("Cannot convert proxy chain.");
-        }
-        return new HostConfiguration
-            (this.targetHost, getProxyHost(), this.localAddress);
-    }
-
-
-    /**
      * Compares this route to another.
      *
      * @param o         the object to compare with

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/RouteTracker.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/RouteTracker.java?view=diff&rev=558079&r1=558078&r2=558079
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/RouteTracker.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/RouteTracker.java
Fri Jul 20 11:13:22 2007
@@ -356,28 +356,6 @@
 
 
     /**
-     * Obtains the tracked route.
-     * <br/><b>Note:</b>
-     * Currently, {@link HostConfiguration HostConfiguration} is used to
-     * represent the route. It does not cover all tracked attributes.
-     * In particular, it can not represent intermediate steps in establishing
-     * a route.
-     *
-     * @deprecated use {@link #toRoute toRoute} instead. Kept temporarily
-     *  until {@link HttpRoute} takes over from {@link HostConfiguration}.
-     *
-     * @return  a representation of the route tracked so far
-     */
-    public final HostConfiguration toHostConfig() {
-        if ((this.proxyChain != null) && (this.proxyChain.length > 1)) {
-            throw new IllegalStateException("Cannot convert proxy chain.");
-        }
-        return new HostConfiguration
-            (this.targetHost, getProxyHost(), this.localAddress);
-    }
-
-
-    /**
      * Compares this tracked route to another.
      *
      * @param o         the object to compare with

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java?view=diff&rev=558079&r1=558078&r2=558079
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/conn/params/HttpConnectionManagerParams.java
Fri Jul 20 11:13:22 2007
@@ -33,7 +33,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.http.conn.HostConfiguration;
+import org.apache.http.conn.HttpRoute;
 import org.apache.http.params.HttpParams;
 
 /**
@@ -56,15 +56,19 @@
     /** The default maximum number of connections allowed overall */
     public static final int DEFAULT_MAX_TOTAL_CONNECTIONS = 20;
 
+    /** A key to represent the default for route-specific settings. */
+    private static final String ROUTE_DEFAULT = "*Route*Default*";
+
+
     /** 
      * Defines the maximum number of connections allowed per host configuration. 
      * These values only apply to the number of connections from a particular instance 
      * of HttpConnectionManager.
      * <p>
      * This parameter expects a value of type {@link java.util.Map}.  The value
-     * should map instances of {@link HostConfiguration}
+     * should map instances of {@link HttpRoute}
      * to {@link Integer integers}.  The default value can be specified using
-     * {@link HostConfiguration#ANY_HOST_CONFIGURATION}.
+     * {@link HttpRoute#ANY_HOST_CONFIGURATION}.
      * </p>
      */
     public static final String MAX_HOST_CONNECTIONS = "http.connection-manager.max-per-host";
@@ -77,44 +81,57 @@
      * </p>
      */
     public static final String MAX_TOTAL_CONNECTIONS = "http.connection-manager.max-total";
-    
+
+
     /**
-     * Sets the default maximum number of connections allowed for a given
-     * host config.
+     * Sets the default maximum number of connections allowed for routes.
      *
-     * @param maxHostConnections The default maximum.
+     * @param max The default maximum.
      * 
      * @see #MAX_HOST_CONNECTIONS
      */
-    public static void setDefaultMaxConnectionsPerHost(
-            final HttpParams params, 
-            int maxHostConnections) {
-        setMaxConnectionsPerHost(
-                params, 
-                HostConfiguration.ANY_HOST_CONFIGURATION, 
-                maxHostConnections);
+    public static void setDefaultMaxConnectionsPerHost(final HttpParams params,
+                                                       final int max) {
+        setMaxPerHost(params, ROUTE_DEFAULT, max);
     }
 
     /**
-     * Sets the maximum number of connections to be used for the given host config.
-     * 
-     * @param hostConfiguration The host config to set the maximum for.  Use 
-     * {@link HostConfiguration#ANY_HOST_CONFIGURATION} to configure the default value
-     * per host.
-     * @param maxHostConnections The maximum number of connections, <code>> 0</code>
+     * Sets the maximum number of connections to be used for a given route.
+     * 
+     * @param route     the route to set the maximum for
+     * @param max       the maximum number of connections,
+     *                  must be greater than 0
      * 
      * @see #MAX_HOST_CONNECTIONS
      */
-    public static void setMaxConnectionsPerHost(
-            final HttpParams params,
-            final HostConfiguration hostConfiguration,
-            int maxHostConnections) {
-        
+    public static void setMaxConnectionsPerHost(final HttpParams params,
+                                                final HttpRoute route,
+                                                final int max) {
+        if (route == null) {
+            throw new IllegalArgumentException
+                ("Route must not be null.");
+        }
+        setMaxPerHost(params, route, max);
+    }
+
+
+    /**
+     * Internal setter for a max-per-host value.
+     *
+     * @param params    the parameters in which to set a max-per-host value
+     * @param key       the key, either an {@link HttpRoute} or
+     *                  {@link #ROUTE_DEFAULT}
+     * @param max       the value to set for that key
+     */
+    private static void setMaxPerHost(HttpParams params,
+                                      Object key, int max) {
         if (params == null) {
-            throw new IllegalArgumentException("HTTP parameters may not be null");
+            throw new IllegalArgumentException
+                ("HTTP parameters must not be null.");
         }
-        if (maxHostConnections <= 0) {
-            throw new IllegalArgumentException("maxHostConnections must be greater than 0");
+        if (max <= 0) {
+            throw new IllegalArgumentException
+                ("The maximum must be greater than 0.");
         }
         
         Map currentValues = (Map) params.getParameter(MAX_HOST_CONNECTIONS);
@@ -126,9 +143,10 @@
         } else {
             newValues = new HashMap(currentValues);
         }
-        newValues.put(hostConfiguration, new Integer(maxHostConnections));
+        newValues.put(key, new Integer(max));
         params.setParameter(MAX_HOST_CONNECTIONS, newValues);
     }
+
     
     /**
      * Gets the default maximum number of connections allowed for a given
@@ -139,49 +157,67 @@
      * @see #MAX_HOST_CONNECTIONS
      */
     public static int getDefaultMaxConnectionsPerHost(
-            final HttpParams params) {
-        return getMaxConnectionsPerHost(
-                params, 
-                HostConfiguration.ANY_HOST_CONFIGURATION);
+        final HttpParams params) {
+        return getMaxPerHost( params, ROUTE_DEFAULT);
     }
 
     /**
-     * Gets the maximum number of connections to be used for a particular host config.  If
-     * the value has not been specified for the given host the default value will be
-     * returned.
+     * Gets the maximum number of connections allowed for a specific route.
+     * If the value has not been specified for the given route, the default
+     * value will be returned.
      * 
-     * @param hostConfiguration The host config.
-     * @return The maximum number of connections to be used for the given host config.
+     * @param route     the route for which to get the maximum connections
+     *
+     * @return The maximum number of connections allowed for the given route.
      * 
      * @see #MAX_HOST_CONNECTIONS
      */
-    public static int getMaxConnectionsPerHost(
-            final HttpParams params,
-            final HostConfiguration hostConfiguration) {
+    public static int getMaxConnectionsPerHost(final HttpParams params,
+                                               final HttpRoute route) {
+        if (route == null) {
+            throw new IllegalArgumentException
+                ("Route must not be null.");
+        }
+        return getMaxPerHost(params, route);
+    }
+
+
+    /**
+     * Internal getter for a max-per-host value.
+     *
+     * @param params    the parameters from which to get a max-per-host value
+     * @param key       the key, either an {@link HttpRoute} or
+     *                  {@link #ROUTE_DEFAULT}
+     *
+     * @return  the maximum for that key, or the default maximum
+     */
+    private static int getMaxPerHost(final HttpParams params,
+                                     final Object key) {
         
         if (params == null) {
-            throw new IllegalArgumentException("HTTP parameters may not be null");
+            throw new IllegalArgumentException
+                ("HTTP parameters must not be null.");
         }
+
+        // if neither a specific nor a default maximum is configured...
+        int result = DEFAULT_MAX_HOST_CONNECTIONS;
+
         Map m = (Map) params.getParameter(MAX_HOST_CONNECTIONS);
-        if (m == null) {
-            // MAX_HOST_CONNECTIONS have not been configured, using the default value
-            return DEFAULT_MAX_HOST_CONNECTIONS;
-        } else {
-            Integer max = (Integer) m.get(hostConfiguration);
-            if (max == null && hostConfiguration != HostConfiguration.ANY_HOST_CONFIGURATION)
{
-                // the value has not been configured specifically for this host config,
-                // use the default value
-                return getMaxConnectionsPerHost(params, HostConfiguration.ANY_HOST_CONFIGURATION);
-            } else {
-                return (
-                        max == null 
-                        ? DEFAULT_MAX_HOST_CONNECTIONS 
-                        : max.intValue()
-                    );
+        if (m != null) {
+            Integer max = (Integer) m.get(key);
+            if ((max == null) && (key != ROUTE_DEFAULT)) {
+                // no specific maximum, get the configured default
+                max = (Integer) m.get(ROUTE_DEFAULT);
+            }
+            if (max != null) {
+                result = max.intValue();
             }
         }
+
+        return result;
     }
 
+
     /**
      * Sets the maximum number of connections allowed.
      *
@@ -193,7 +229,8 @@
             final HttpParams params,
             int maxTotalConnections) {
         if (params == null) {
-            throw new IllegalArgumentException("HTTP parameters may not be null");
+            throw new IllegalArgumentException
+                ("HTTP parameters must not be null.");
         }
         params.setIntParameter(
             HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS,
@@ -210,7 +247,8 @@
     public static int getMaxTotalConnections(
             final HttpParams params) {
         if (params == null) {
-            throw new IllegalArgumentException("HTTP parameters may not be null");
+            throw new IllegalArgumentException
+                ("HTTP parameters must not be null.");
         }
         return params.getIntParameter(
             HttpConnectionManagerParams.MAX_TOTAL_CONNECTIONS,

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java?view=diff&rev=558079&r1=558078&r2=558079
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/main/java/org/apache/http/impl/conn/ThreadSafeClientConnManager.java
Fri Jul 20 11:13:22 2007
@@ -46,7 +46,7 @@
 import org.apache.http.conn.ClientConnectionManager;
 import org.apache.http.conn.ClientConnectionOperator;
 import org.apache.http.conn.ConnectionPoolTimeoutException;
-import org.apache.http.conn.HostConfiguration;
+import org.apache.http.conn.HttpRoute;
 import org.apache.http.conn.HttpRoute;
 import org.apache.http.conn.ManagedClientConnection;
 import org.apache.http.conn.OperatedClientConnection;
@@ -68,7 +68,7 @@
  *
  *
  * <!-- empty lines to avoid svn diff problems -->
- * @version   $Revision$ $Date$
+ * @version $Revision$ $Date$
  *
  * @since 4.0
  */
@@ -185,8 +185,7 @@
                 + route + ", timeout = " + timeout);
         }
 
-        final TrackingPoolEntry entry =
-            doGetConnection(route.toHostConfig(), timeout);
+        final TrackingPoolEntry entry = doGetConnection(route, timeout);
 
         return new HttpConnectionAdapter(entry);
     }
@@ -202,7 +201,7 @@
      *
      * @throws ConnectionPoolTimeoutException   if the timeout expired
      */
-    private TrackingPoolEntry doGetConnection(HostConfiguration route,
+    private TrackingPoolEntry doGetConnection(HttpRoute route,
                                               long timeout)
         throws ConnectionPoolTimeoutException {
 
@@ -216,7 +215,7 @@
         synchronized (connectionPool) {
 
             // we used to clone the hostconfig here, but it is now immutable:
-            //route = new HostConfiguration(route);
+            //route = new HttpRoute(route);
             HostConnectionPool hostPool = connectionPool.getHostPool(route);
             WaitingThread waitingThread = null;
 
@@ -329,7 +328,7 @@
      *
      * @return  the pool entry for the new connection
      */
-    private TrackingPoolEntry createPoolEntry(HostConfiguration route) {
+    private TrackingPoolEntry createPoolEntry(HttpRoute route) {
 
         OperatedClientConnection occ = connOperator.createConnection();
         return connectionPool.createEntry(route, occ);
@@ -491,7 +490,7 @@
      */
     private static void storeReferenceToConnection(
         TrackingPoolEntry connection,
-        HostConfiguration hostConfiguration,
+        HttpRoute hostConfiguration,
         ConnectionPool connectionPool
     ) {
 
@@ -605,7 +604,7 @@
      * @param hostConfiguration The host configuration
      * @return The total number of pooled connections
      */
-    public int getConnectionsInPool(HostConfiguration hostConfiguration) {
+    public int getConnectionsInPool(HttpRoute hostConfiguration) {
         synchronized (connectionPool) {
             HostConnectionPool hostPool = connectionPool.getHostPool(hostConfiguration);
             return hostPool.numConnections;
@@ -681,7 +680,7 @@
         private LinkedList waitingThreads = new LinkedList();
 
         /**
-         * Map where keys are {@link HostConfiguration}s and values are
+         * Map where keys are {@link HttpRoute}s and values are
          * {@link HostConnectionPool}s
          */
         private final Map mapHosts = new HashMap();
@@ -735,7 +734,7 @@
          * @return the new pool entry
          */
         protected synchronized
-            TrackingPoolEntry createEntry(HostConfiguration route,
+            TrackingPoolEntry createEntry(HttpRoute route,
                                           OperatedClientConnection conn) {
 
             HostConnectionPool hostPool = getHostPool(route);
@@ -762,7 +761,7 @@
          * @param config the host configuration of the connection that was lost
          */
         public synchronized
-            void handleLostConnection(HostConfiguration config) {
+            void handleLostConnection(HttpRoute config) {
 
             HostConnectionPool hostPool = getHostPool(config);
             hostPool.numConnections--;
@@ -780,7 +779,7 @@
          * @return a pool (list) of connections available for the given route
          */
         public synchronized
-            HostConnectionPool getHostPool(HostConfiguration route) {
+            HostConnectionPool getHostPool(HttpRoute route) {
 
             // Look for a list of connections for the given config
             HostConnectionPool listConnections =
@@ -802,7 +801,7 @@
          * @param hostConfiguration the configuraton for the connection pool
          * @return an available connection for the given config
          */
-        public synchronized TrackingPoolEntry getFreeConnection(HostConfiguration hostConfiguration)
{
+        public synchronized TrackingPoolEntry getFreeConnection(HttpRoute hostConfiguration)
{
 
             TrackingPoolEntry entry = null;
 
@@ -865,7 +864,7 @@
          */
         private synchronized void deleteConnection(TrackingPoolEntry entry) {
 
-            HostConfiguration route = entry.plannedRoute;
+            HttpRoute route = entry.plannedRoute;
 
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Reclaiming connection, hostConfig=" + route);
@@ -906,7 +905,7 @@
          * @param configuration the host config to use for notifying
          * @see #notifyWaitingThread(HostConnectionPool)
          */
-        public synchronized void notifyWaitingThread(HostConfiguration configuration) {
+        public synchronized void notifyWaitingThread(HttpRoute configuration) {
             notifyWaitingThread(getHostPool(configuration));
         }
 
@@ -954,7 +953,7 @@
          */
         private void freeConnection(TrackingPoolEntry entry) {
 
-            HostConfiguration route = entry.plannedRoute;
+            HttpRoute route = entry.plannedRoute;
 
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Freeing connection, hostConfig=" + route);
@@ -1020,7 +1019,7 @@
         public ConnectionPool connectionPool;
 
         /** The connection's host configuration */
-        public HostConfiguration hostConfiguration;
+        public HttpRoute hostConfiguration;
     }
     
     /**
@@ -1029,7 +1028,7 @@
      */
     private static class HostConnectionPool {
         /** The hostConfig this pool is for */
-        public HostConfiguration hostConfiguration;
+        public HttpRoute hostConfiguration;
         
         /** The list of free connections */
         public LinkedList freeConnections = new LinkedList();
@@ -1136,8 +1135,9 @@
      */
     private class TrackingPoolEntry extends AbstractPoolEntry {
 
+        //@@@ move to base class
         /** The route for which this entry gets allocated. */
-        private HostConfiguration plannedRoute;
+        private HttpRoute plannedRoute;
 
         /** The connection manager. */
         private ThreadSafeClientConnManager manager;

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestHttpRoute.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestHttpRoute.java?view=diff&rev=558079&r1=558078&r2=558079
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestHttpRoute.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestHttpRoute.java
Fri Jul 20 11:13:22 2007
@@ -581,21 +581,4 @@
     }
 
 
-    // for completeness, although it's deprecated
-    public void testHostConfig() {
-        // these tests are sloppy, the method is scheduled for removal anyway
-        HttpRoute route = new HttpRoute(TARGET1);
-        assertNotNull("no host config", route.toHostConfig());
-
-        route = new HttpRoute(TARGET2, null, new HttpHost[]{ PROXY1, PROXY2 },
-                              false, false, false);
-        try {
-            route.toHostConfig();
-            fail("proxy chain not detected");
-        } catch (IllegalStateException isx) {
-            // expected
-        }
-    }
-
-
 } // class TestHttpRoute

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestParams.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestParams.java?view=diff&rev=558079&r1=558078&r2=558079
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestParams.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestParams.java
Fri Jul 20 11:13:22 2007
@@ -50,7 +50,7 @@
     public final static
         HttpHost TARGET1 = new HttpHost("target1.test.invalid");
     public final static
-        HostConfiguration HOSTCFG1 = new HostConfiguration(TARGET1,null,null);
+        HttpRoute ROUTE1 = new HttpRoute(TARGET1);
 
 
     public TestParams(String testName) {
@@ -82,7 +82,7 @@
 
         try {
             HttpConnectionManagerParams.
-                setMaxConnectionsPerHost(null, HOSTCFG1, 3);
+                setMaxConnectionsPerHost(null, ROUTE1, 3);
             fail();
         } catch (IllegalArgumentException iax) {
             // expected
@@ -90,7 +90,7 @@
 
         try {
             HttpConnectionManagerParams.
-                setMaxConnectionsPerHost(params, HOSTCFG1, 0);
+                setMaxConnectionsPerHost(params, ROUTE1, 0);
             fail();
         } catch (IllegalArgumentException iax) {
             // expected
@@ -108,7 +108,7 @@
 
         try {
             HttpConnectionManagerParams.
-                getMaxConnectionsPerHost(null, HOSTCFG1);
+                getMaxConnectionsPerHost(null, ROUTE1);
             fail();
         } catch (IllegalArgumentException iax) {
             // expected
@@ -151,7 +151,7 @@
             getDefaultMaxConnectionsPerHost(params);
 
         int fmcph = HttpConnectionManagerParams.
-            getMaxConnectionsPerHost(params, HOSTCFG1);
+            getMaxConnectionsPerHost(params, ROUTE1);
 
         assertEquals(fdmcph, fmcph);
 
@@ -164,7 +164,7 @@
 
 
         int mcph = HttpConnectionManagerParams.
-            getMaxConnectionsPerHost(params, HOSTCFG1);
+            getMaxConnectionsPerHost(params, ROUTE1);
         assertEquals(ndmcph, mcph);
     }
 

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestRouteTracker.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestRouteTracker.java?view=diff&rev=558079&r1=558078&r2=558079
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestRouteTracker.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/conn/TestRouteTracker.java
Fri Jul 20 11:13:22 2007
@@ -548,15 +548,6 @@
             rt = (RouteTracker) iter.next();
             final String rts = checkToString(rt);
             assertTrue("duplicate toString: " + rts, rtstrings.add(rts));
-
-            // it's scheduled for removal, but keep Clover happy...
-            try {
-                rt.toHostConfig();
-            } catch (IllegalStateException isx) {
-                if (rt.getHopCount() < 3)
-                    fail("could not get HostConfig for " + rt);
-                // else expected
-            }
         }
     }
 

Modified: jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java?view=diff&rev=558079&r1=558078&r2=558079
==============================================================================
--- jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java
(original)
+++ jakarta/httpcomponents/httpclient/trunk/module-client/src/test/java/org/apache/http/impl/conn/TestTSCCMNoServer.java
Fri Jul 20 11:13:22 2007
@@ -37,7 +37,6 @@
 import org.apache.http.HttpHost;
 import org.apache.http.HttpVersion;
 import org.apache.http.conn.ConnectionPoolTimeoutException;
-import org.apache.http.conn.HostConfiguration;
 import org.apache.http.conn.HttpRoute;
 import org.apache.http.conn.ManagedClientConnection;
 import org.apache.http.conn.PlainSocketFactory;
@@ -236,13 +235,8 @@
         HttpParams params = createDefaultParams();
         HttpConnectionManagerParams.setMaxTotalConnections(params, 100);
         HttpConnectionManagerParams.setDefaultMaxConnectionsPerHost(params, 1);
-        //@@@ HostConfiguration is deprecated
-        //@@@ should it be mapped to HttpHost or HttpRoute here?
-        //@@@ provide setter in TSCCM, it is implementation specific
-        HttpConnectionManagerParams.setMaxConnectionsPerHost
-            (params, route2.toHostConfig(), 2);
-        HttpConnectionManagerParams.setMaxConnectionsPerHost
-            (params, route3.toHostConfig(), 3);
+        HttpConnectionManagerParams.setMaxConnectionsPerHost(params,route2, 2);
+        HttpConnectionManagerParams.setMaxConnectionsPerHost(params,route3, 3);
 
         ThreadSafeClientConnManager mgr = createTSCCM(params, null);
 
@@ -371,27 +365,26 @@
 
         HttpHost target = new HttpHost("www.test.invalid", 80, "http");
         HttpRoute route = new HttpRoute(target, null, false);
-        HostConfiguration hcfg = route.toHostConfig(); //@@@ deprecated
 
         ManagedClientConnection conn = mgr.getConnection(route);
 
         assertEquals("connectionsInPool",
                      mgr.getConnectionsInPool(), 1);
         assertEquals("connectionsInPool(host)",
-                     mgr.getConnectionsInPool(hcfg), 1);
+                     mgr.getConnectionsInPool(route), 1);
         mgr.releaseConnection(conn);
 
         assertEquals("connectionsInPool",
                      mgr.getConnectionsInPool(), 1);
         assertEquals("connectionsInPool(host)",
-                     mgr.getConnectionsInPool(hcfg), 1);
+                     mgr.getConnectionsInPool(route), 1);
 
         mgr.closeIdleConnections(0L); // implicitly deletes them, too
 
         assertEquals("connectionsInPool",
                      mgr.getConnectionsInPool(), 0);
         assertEquals("connectionsInPool(host)",
-                     mgr.getConnectionsInPool(hcfg), 0);
+                     mgr.getConnectionsInPool(route), 0);
 
         mgr.shutdown();
     }



Mime
View raw message