1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
37
38
39
40
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 }