01: /**
02: *
03: * Copyright 2004 The Apache Software Foundation
04: *
05: * Licensed under the Apache License, Version 2.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * 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: */package org.apache.ws.scout.registry;
17:
18: import static org.junit.Assert.assertNotNull;
19: import static org.junit.Assert.fail;
20:
21: import java.net.PasswordAuthentication;
22: import java.util.HashSet;
23: import java.util.Set;
24:
25: import javax.xml.registry.JAXRException;
26:
27: import junit.framework.JUnit4TestAdapter;
28:
29: import org.apache.ws.scout.BaseTestCase;
30: import org.junit.After;
31: import org.junit.Before;
32: import org.junit.Test;
33:
34: /**
35: * Test to check Connection
36: * Open source UDDI Browser <http://www.uddibrowser.org>
37: * can be used to check your results
38: * @author <mailto:kstam@apache.org>Kurt Stam
39: * @since Nov 20, 2004
40: */
41: public class AConnectionTest extends BaseTestCase {
42: @Before
43: public void setUp() {
44: super .setUp();
45: }
46:
47: @After
48: public void tearDown() {
49: super .tearDown();
50: }
51:
52: @Test
53: public void testConnection() {
54: PasswordAuthentication passwdAuth = new PasswordAuthentication(
55: userid, passwd.toCharArray());
56: Set<PasswordAuthentication> creds = new HashSet<PasswordAuthentication>();
57: creds.add(passwdAuth);
58:
59: try {
60: connection.setCredentials(creds);
61: assertNotNull(connection);
62: connection.close();
63:
64: } catch (JAXRException e) {
65: fail(e.getMessage());
66: e.printStackTrace();
67: }
68: }
69:
70: public static junit.framework.Test suite() {
71: return new JUnit4TestAdapter(AConnectionTest.class);
72: }
73: }
|