Project

General

Profile

« Previous | Next » 

Revision 3536

Added by barteau over 16 years ago

Added a couple of configurable constants for host and context. Added JDoc comments.

View differences:

test/edu/ucsb/nceas/metacat/clientview/ClientViewHelperTest.java
25 25
import org.w3c.dom.Node;
26 26

  
27 27
/**
28
 *
28
 * ClientViewHelper JUnit tests
29 29
 * @author barteau
30 30
 */
31 31
public class ClientViewHelperTest extends TestCase {
......
33 33
    ClientView                  clientViewBean;
34 34
    
35 35
    final static String         PATH_TO_PROPERTIES = "projects/metacat/build/war/WEB-INF/metacat.properties";
36
    final static String         USR = "";
36
    final static String         USR = "barteau";
37 37
    final static String         ORG = "NCEAS";
38
    final static String         PWD = "";
39
    final static String         DOWNLOAD_PACKAGE_DOCID = "";
40
    final static String         DOWNLOAD_DATA_DOCID = "";
38
    final static String         PWD = "geekb8";
39
    final static String         DOWNLOAD_PACKAGE_DOCID = "barteau.179.1";
40
    final static String         DOWNLOAD_DATA_DOCID = "barteau.180.1";
41
    final static String         HOST = "localhost:8084";
42
    final static String         CONTEXT = "/sanparks";
41 43
    
44
    /**
45
     * Constructor
46
     * @param testName String
47
     */
42 48
    public ClientViewHelperTest(String testName) {
43 49
        super(testName);
44 50
    }
......
60 66
        clientViewBean.setOrganization(ORG);
61 67
        clientViewBean.setPassword(PWD);
62 68
        
63
        instance = new ClientViewHelper("localhost:8084", "/sanparks", clientViewBean);
69
        instance = new ClientViewHelper(HOST, CONTEXT, clientViewBean);
64 70
    }
65 71
    
66 72
    protected void tearDown() throws Exception {
......
77 83
        
78 84
        System.out.println("handleClientRequest");
79 85
        
86
        
80 87
        System.out.print("...setLoggedIn");
81 88
        clientViewBean.setAction("Login");
89
        
82 90
        result = instance.handleClientRequest(null);
83 91
        returnResultTxt = (String) result.get("message");
84 92
        assertTrue("Login: Failed to login", returnResultTxt.contains("Authentication successful for user:"));
85 93
        System.out.println(" ...success!");
86 94
        
95
        
87 96
        System.out.print("...download (data file)");
88 97
        clientViewBean.setAction("Download");
89 98
        clientViewBean.setDocId("DOWNLOAD_DATA_DOCID");
......
98 107
        assertTrue("Download: Returned an empty file", ((ByteArrayOutputStream) result.get("outputStream")).size() > 0);
99 108
        System.out.println(" ...success!");
100 109
        
110
        
101 111
        System.out.print("...download (package zip file)");
102 112
        clientViewBean.setDocId("DOWNLOAD_PACKAGE_DOCID");
103 113
        clientViewBean.setMetaFileDocId("DOWNLOAD_PACKAGE_DOCID");
......
111 121
        assertTrue("Download: Returned an empty file", ((ByteArrayOutputStream) result.get("outputStream")).size() > 0);
112 122
        System.out.println(" ...success!");
113 123

  
124
        
114 125
        System.out.print("...logout");
115 126
        clientViewBean.setAction("Logout");
127
        
116 128
        result = instance.handleClientRequest(null);
117 129
        assertNull("Logout: Session ID still exists", clientViewBean.getSessionid());
118 130
        System.out.println(" ...success!");

Also available in: Unified diff