1 |
8697
|
tao
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Copyright: 2000 Regents of the University of California and the
|
4 |
|
|
* National Center for Ecological Analysis and Synthesis
|
5 |
|
|
* Purpose: To test the MetaCatURL class by JUnit
|
6 |
|
|
* Authors: Jing Tao
|
7 |
|
|
*
|
8 |
|
|
* '$Author: tao $'
|
9 |
|
|
* '$Date: 2014-03-04 09:48:15 -0800 (Tue, 04 Mar 2014) $'
|
10 |
|
|
* '$Revision: 8695 $'
|
11 |
|
|
*
|
12 |
|
|
* This program is free software; you can redistribute it and/or modify
|
13 |
|
|
* it under the terms of the GNU General Public License as published by
|
14 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
15 |
|
|
* (at your option) any later version.
|
16 |
|
|
*
|
17 |
|
|
* This program is distributed in the hope that it will be useful,
|
18 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
|
|
* GNU General Public License for more details.
|
21 |
|
|
*
|
22 |
|
|
* You should have received a copy of the GNU General Public License
|
23 |
|
|
* along with this program; if not, write to the Free Software
|
24 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
25 |
|
|
*/
|
26 |
|
|
package edu.ucsb.nceas.metacattest;
|
27 |
|
|
|
28 |
|
|
import junit.framework.Test;
|
29 |
|
|
import junit.framework.TestSuite;
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**
|
33 |
|
|
* The reason to add this specific test for a PISCO account is some network env
|
34 |
|
|
* maybe fails since the PISCO ldap server have a fire wall. It seem the machines
|
35 |
|
|
* in NCEAS work.
|
36 |
|
|
* @author tao
|
37 |
|
|
*
|
38 |
|
|
*/
|
39 |
|
|
public class PISCOAccountTest extends MetaCatServletTest{
|
40 |
|
|
/**
|
41 |
|
|
* Constructor to build the test
|
42 |
|
|
*
|
43 |
|
|
* @param name
|
44 |
|
|
* the name of the test method
|
45 |
|
|
*/
|
46 |
|
|
public PISCOAccountTest(String name) {
|
47 |
|
|
super(name);
|
48 |
|
|
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
/**
|
52 |
|
|
* Establish a testing framework by initializing appropriate objects
|
53 |
|
|
*/
|
54 |
|
|
public void setUp() {
|
55 |
9195
|
tao
|
super.setUp();
|
56 |
8697
|
tao
|
}
|
57 |
|
|
|
58 |
|
|
/**
|
59 |
|
|
* Release any objects after tests are complete
|
60 |
|
|
*/
|
61 |
|
|
public void tearDown() {
|
62 |
|
|
}
|
63 |
|
|
|
64 |
|
|
/**
|
65 |
|
|
* Create a suite of tests to be run together
|
66 |
|
|
*/
|
67 |
|
|
public static Test suite() {
|
68 |
|
|
double number = 0;
|
69 |
|
|
|
70 |
|
|
TestSuite suite = new TestSuite();
|
71 |
|
|
suite.addTest(new PISCOAccountTest("testPiscoReferralLogin"));
|
72 |
|
|
suite.addTest(new PISCOAccountTest("testPiscoReferralLoginFail"));
|
73 |
|
|
return suite;
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
/**
|
77 |
|
|
* Test the login to Other succesfully
|
78 |
|
|
*/
|
79 |
|
|
public void testPiscoReferralLogin() {
|
80 |
|
|
debug("\nRunning: testPiscoReferralLogin test");
|
81 |
|
|
String user = piscouser;
|
82 |
|
|
String passwd = piscopassword;
|
83 |
|
|
debug("logging in pisco user: " + user + ":" + passwd);
|
84 |
|
|
assertTrue(logIn(user, passwd));
|
85 |
|
|
// assertTrue( withProtocol.getProtocol().equals("http"));
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
/**
|
89 |
|
|
* Test the login to Other failed
|
90 |
|
|
*/
|
91 |
|
|
public void testPiscoReferralLoginFail() {
|
92 |
|
|
debug("\nRunning: testPiscoReferralLoginFail test");
|
93 |
|
|
String user = piscouser;
|
94 |
|
|
String passwd = "wrong";
|
95 |
|
|
assertTrue(!logIn(user, passwd));
|
96 |
|
|
// assertTrue( withProtocol.getProtocol().equals("http"));
|
97 |
|
|
}
|
98 |
|
|
}
|