01: package com.sun.addressbook.wabp;
02:
03: import junit.framework.TestCase;
04:
05: import java.util.Properties;
06:
07: import com.sun.addressbook.ABSession;
08: import com.sun.addressbook.ABStoreException;
09: import com.sun.addressbook.AddressBook;
10: import com.sun.addressbook.tests.Configuration;
11: import com.iplanet.iabs.iabsapi.PStoreException;
12:
13: public class TestWabpABStore extends TestCase {
14:
15: private Properties props = new Properties();
16: private WabpABStore store;
17:
18: protected void setUp() throws Exception {
19:
20: }
21:
22: public void testOpen() throws Exception {
23:
24: props.setProperty("ab.protocol", "http");
25: props.setProperty("ab.host", Configuration.host);
26: props.setProperty("ab.port", Configuration.port);
27: props.setProperty("ab.userName", Configuration.testLogin);
28: props.setProperty("ab.userPassword", Configuration.testPasswd);
29: props.setProperty("ab.contextURI", Configuration.uwcContextURI);
30: store = new WabpABStore();
31: store.init(ABSession.getInstance(props));
32:
33: AddressBook ab = null;
34: try {
35: store.connect();
36: ab = store.openAddressBook();
37: } catch (ABStoreException e) {
38: fail(e.toString());
39: }
40: assertTrue(ab instanceof AddressBook);
41: try {
42: assertEquals(Configuration.testLogin, store.getUserString());
43: } catch (PStoreException e) {
44: fail(e.toString());
45: }
46: }
47:
48: public void testProxyAuthOpen() throws Exception {
49:
50: props.setProperty("ab.protocol", "http");
51: props.setProperty("ab.host", Configuration.host);
52: props.setProperty("ab.port", Configuration.port);
53: props.setProperty("ab.userName", Configuration.testLogin);
54: props.setProperty("ab.contextURI", Configuration.uwcContextURI);
55: props.setProperty("ab.enableProxyAuth", "true");
56: props.setProperty("ab.proxyAdminUid",
57: Configuration.proxyAdminUid);
58: props.setProperty("ab.proxyAdminPassword",
59: Configuration.proxyAdminPassword);
60: store = new WabpABStore();
61: store.init(ABSession.getInstance(props));
62:
63: AddressBook ab = null;
64: try {
65: store.connect();
66: ab = store.openAddressBook();
67: } catch (ABStoreException e) {
68: fail(e.toString());
69: }
70: assertTrue(ab instanceof AddressBook);
71: try {
72: assertEquals(Configuration.testLogin, store.getUserString());
73: } catch (PStoreException e) {
74: fail(e.toString());
75: }
76:
77: }
78: }
|