1   /*
2    * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//httpclient/src/test/org/apache/commons/httpclient/TestEquals.java,v 1.2 2004/02/22 18:08:49 olegk Exp $
3    * $Revision: 155418 $
4    * $Date: 2005-02-26 08:01:52 -0500 (Sat, 26 Feb 2005) $
5    *
6    * ====================================================================
7    *
8    *  Copyright 2002-2004 The Apache Software Foundation
9    *
10   *  Licensed under the Apache License, Version 2.0 (the "License");
11   *  you may not use this file except in compliance with the License.
12   *  You may obtain a copy of the License at
13   *
14   *      http://www.apache.org/licenses/LICENSE-2.0
15   *
16   *  Unless required by applicable law or agreed to in writing, software
17   *  distributed under the License is distributed on an "AS IS" BASIS,
18   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   *  See the License for the specific language governing permissions and
20   *  limitations under the License.
21   * ====================================================================
22   *
23   * This software consists of voluntary contributions made by many
24   * individuals on behalf of the Apache Software Foundation.  For more
25   * information on the Apache Software Foundation, please see
26   * <http://www.apache.org/>.
27   *
28   * [Additional notices, if required by prior licensing conditions]
29   *
30   */
31   package> org.apache.commons.httpclient;
32  
33  import org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory;
34  import org.apache.commons.httpclient.protocol.Protocol;
35  import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
36  import org.apache.commons.httpclient.protocol.SSLProtocolSocketFactory;
37  
38  import junit.framework.Test;
39  import junit.framework.TestCase;
40  import junit.framework.TestSuite;
41  
42  /***
43   */
44  public class TestEquals extends TestCase {
45      
46      public static Test suite() {
47          return new TestSuite(TestEquals.class);
48      }
49      
50      /***
51       * 
52       */
53      public TestEquals() {
54          super();
55      }
56  
57      /***
58       * @param arg0
59       */
60      public TestEquals(String arg0) {
61          super(arg0);
62      }
63  
64      public void testProtocol() {
65          
66          Protocol p1 = new Protocol("test", new DefaultProtocolSocketFactory(), 123);
67          Protocol p2 = new Protocol("test", new DefaultProtocolSocketFactory(), 123);
68          
69          assertTrue(p1.equals(p2));
70          assertTrue(p2.equals(p1));
71      }
72      
73      public void testProtocolSocketFactory() {
74          
75          ProtocolSocketFactory p1 = new DefaultProtocolSocketFactory();
76          ProtocolSocketFactory p2 = new DefaultProtocolSocketFactory();
77  
78          assertTrue(p1.equals(p2));
79          assertTrue(p2.equals(p1));
80  
81          p1 = new SSLProtocolSocketFactory();
82          p2 = new SSLProtocolSocketFactory();
83  
84          assertTrue(p1.equals(p2));
85          assertTrue(p2.equals(p1));
86          
87      }
88      
89      public void testHostConfiguration() {
90          
91          HostConfiguration hc1 = new HostConfiguration();
92          hc1.setHost("http", 80, "http");
93  
94          HostConfiguration hc2 = new HostConfiguration();
95          hc2.setHost("http", 80, "http");
96  
97          assertTrue(hc1.equals(hc2));
98          assertTrue(hc2.equals(hc1));
99      }
100     
101 }