This project has retired. For details please refer to its Attic page.
AConnectionTest xref
View Javadoc
1   /**
2    *
3    * Copyright 2004 The Apache Software Foundation
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   */
17  package org.apache.ws.scout.registry;
18  
19  import static org.junit.Assert.assertNotNull;
20  import static org.junit.Assert.fail;
21  
22  import java.net.PasswordAuthentication;
23  import java.util.HashSet;
24  import java.util.Set;
25  
26  import javax.xml.registry.JAXRException;
27  
28  import junit.framework.JUnit4TestAdapter;
29  
30  import org.apache.ws.scout.BaseTestCase;
31  import org.junit.After;
32  import org.junit.Before;
33  import org.junit.Test;
34  
35  /**
36   * Test to check Connection
37   * Open source UDDI Browser  <http://www.uddibrowser.org>
38   * can be used to check your results
39   * @author <mailto:kstam@apache.org>Kurt Stam
40   * @since Nov 20, 2004
41   */
42  public class AConnectionTest extends BaseTestCase
43  {
44      @Before
45      public void setUp()
46      {
47          super.setUp();
48      }
49      
50      @After
51      public void tearDown()
52      {
53        super.tearDown();
54      }
55      
56      @Test
57      public void testConnection()
58      {
59          PasswordAuthentication passwdAuth = new PasswordAuthentication(userid,
60                  passwd.toCharArray());
61          Set<PasswordAuthentication> creds = new HashSet<PasswordAuthentication>();
62          creds.add(passwdAuth);
63  
64          try {
65              connection.setCredentials(creds);
66              assertNotNull(connection);
67              connection.close();
68              
69          } catch (JAXRException e) {
70              fail(e.getMessage());
71              e.printStackTrace();
72          }
73      }
74      
75      public static junit.framework.Test suite() {
76          return new JUnit4TestAdapter(AConnectionTest.class);
77      }
78  }