Project

General

Profile

« Previous | Next » 

Revision 6156

Added by Jing Tao over 13 years ago

Get username and password from a property file.

View differences:

test/edu/ucsb/nceas/metacattest/AuthLdapTest.java
26 26
package edu.ucsb.nceas.metacattest;
27 27

  
28 28
import edu.ucsb.nceas.MCTestCase;
29
import edu.ucsb.nceas.metacat.properties.PropertyService;
30

  
29 31
import edu.ucsb.nceas.metacat.AuthLdap;
30 32
import junit.framework.Test;
31 33
import junit.framework.TestSuite;
......
36 38
 */
37 39
public class AuthLdapTest extends MCTestCase
38 40
{
39
	// Constants
40
	private static final String USER = "uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org";
41
	private static final String PASS   = "kepler";
42 41
	
43 42
	/**
44 43
     * Constructor to build the test
......
68 67
     */
69 68
    public void initialize()
70 69
    {
71
        assertTrue(true);
70
    	//System.out.println("here");
71
        assertTrue(1 == 1);
72 72
    }
73 73
    
74 74
    public void getPrincipals()
75 75
    {
76 76
    	try
77 77
    	{
78
    	    String lterUser = PropertyService.getProperty("test.lterUser");
78 79
        	//System.out.println("before initilizing authldap object");
79 80
        	AuthLdap ldap = new AuthLdap();
80 81
        	//System.out.println("after initilizing authldap object");
81 82
    		
82 83
    		//System.out.println("before calling the getPrincipals method");
83
    	    String response = ldap.getPrincipals(USER, PASS);
84
    	    String response = ldap.getPrincipals(username, password);
84 85
    	    //System.out.println("after calling the getPrincipals method \n"+response);
85 86
    	    if ( response != null)
86 87
    	    {
87
    	       assertTrue("Couldn't find user from NCEAS",response.indexOf("uid=test,o=NCEAS") != -1);
88
    	       assertTrue("Couldn't find user from LTER",response.indexOf("uid=tmonkey,o=LTER") != -1);
88
    	       assertTrue("Couldn't find user "+anotheruser,response.indexOf(anotheruser) != -1);
89
    	       assertTrue("Couldn't find user "+lterUser,response.indexOf(lterUser) != -1);
89 90
    	    }
90 91
    	    else
91 92
    	    {

Also available in: Unified diff