Project

General

Profile

« Previous | Next » 

Revision 4080

Added by daigle almost 16 years ago

Merge 1.9 changes into Head

View differences:

AccessControlTest.java
34 34
import java.util.TimeZone;
35 35
import java.util.Vector;
36 36

  
37
import edu.ucsb.nceas.metacat.MetaCatUtil;
38 37
import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
39 38
import edu.ucsb.nceas.metacat.client.Metacat;
40 39
import edu.ucsb.nceas.metacat.client.MetacatAuthException;
41 40
import edu.ucsb.nceas.metacat.client.MetacatException;
42 41
import edu.ucsb.nceas.metacat.client.MetacatFactory;
43 42
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
43
import edu.ucsb.nceas.metacat.service.PropertyService;
44
import edu.ucsb.nceas.metacat.util.SystemUtil;
44 45
import edu.ucsb.nceas.utilities.IOUtil;
45
import edu.ucsb.nceas.utilities.Options;
46
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
46 47
import junit.framework.Test;
47 48
import junit.framework.TestCase;
48 49
import junit.framework.TestSuite;
......
51 52
/**
52 53
 * A JUnit test for testing Access Control in Metacat
53 54
 */
54
public class AccessControlTest extends TestCase {
55
	 /* Initialize Options*/
56
    static
57
    {
58
  	  try
59
  	  {
60
  		  Options.initialize(new File("build/tests/metacat.properties"));
61
  		  MetaCatUtil.pathsForIndexing 
62
  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
63
  	  }
64
  	  catch(Exception e)
65
  	  {
66
  		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
67
  	  }
68
    }
55
public class AccessControlTest
56
    extends TestCase {
69 57

  
70
    private String metacatUrl = MetaCatUtil.getOption("metacatUrl");
71
    private String username = MetaCatUtil.getOption("mcuser");
72
    private String password = MetaCatUtil.getOption("mcpassword");
73
    private String anotheruser = MetaCatUtil.getOption("mcanotheruser");
74
    private String anotherpassword = MetaCatUtil.getOption("mcanotherpassword");
58
    private static String metacatUrl;
59
    private static String username;
60
	private static String password;
61
	private static String anotheruser;
62
	private static String anotherpassword;
63
	static {
64
		try {
65
		    metacatUrl = SystemUtil.getServletURL();
66
			username = PropertyService.getProperty("mcuser");
67
			password = PropertyService.getProperty("mcpassword");
68
			anotheruser = PropertyService.getProperty("mcanotheruser");
69
			anotherpassword = PropertyService.getProperty("mcanotherpassword");
70
		} catch (PropertyNotFoundException pnfe) {
71
			System.err.println("Could not get property in static block: " 
72
					+ pnfe.getMessage());
73
		}
74
	}
75

  
75 76
    private String prefix = "test";
76 77
    private String newdocid = null;
77 78
    private String testdocument = "";

Also available in: Unified diff