1/**2 *3 * Copyright 2004 The Apache Software Foundation4 *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 at8 *9 * http://www.apache.org/licenses/LICENSE-2.010 *11 * Unless required by applicable law or agreed to in writing, software12 * 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 and15 * limitations under the License.16 */17package org.apache.ws.scout.registry;
1819importstatic org.junit.Assert.assertNotNull;
20importstatic org.junit.Assert.fail;
2122import java.net.PasswordAuthentication;
23import java.util.HashSet;
24import java.util.Set;
2526import javax.xml.registry.JAXRException;
2728import junit.framework.JUnit4TestAdapter;
2930import org.apache.ws.scout.BaseTestCase;
31import org.junit.After;
32import org.junit.Before;
33import org.junit.Test;
3435/**36 * Test to check Connection37 * Open source UDDI Browser <http://www.uddibrowser.org>38 * can be used to check your results39 * @author <mailto:kstam@apache.org>Kurt Stam40 * @since Nov 20, 200441 */42publicclassAConnectionTestextendsBaseTestCase43 {
44 @Before
45publicvoid setUp()
46 {
47super.setUp();
48 }
4950 @After
51publicvoid tearDown()
52 {
53super.tearDown();
54 }
5556 @Test
57publicvoid testConnection()
58 {
59 PasswordAuthentication passwdAuth = new PasswordAuthentication(userid,
60 passwd.toCharArray());
61 Set<PasswordAuthentication> creds = new HashSet<PasswordAuthentication>();
62 creds.add(passwdAuth);
6364try {
65 connection.setCredentials(creds);
66 assertNotNull(connection);
67 connection.close();
6869 } catch (JAXRException e) {
70 fail(e.getMessage());
71 e.printStackTrace();
72 }
73 }
7475publicstatic junit.framework.Test suite() {
76returnnew JUnit4TestAdapter(AConnectionTest.class);
77 }
78 }