Project

General

Profile

« Previous | Next » 

Revision 4080

Added by daigle about 16 years ago

Merge 1.9 changes into Head

View differences:

BuildIndexTest.java
37 37
import java.util.TimeZone;
38 38

  
39 39
import edu.ucsb.nceas.metacat.DocumentImpl;
40
import edu.ucsb.nceas.metacat.MetaCatUtil;
41 40
import edu.ucsb.nceas.metacat.McdbException;
42 41
import edu.ucsb.nceas.metacat.client.InsufficientKarmaException;
43 42
import edu.ucsb.nceas.metacat.client.Metacat;
......
45 44
import edu.ucsb.nceas.metacat.client.MetacatException;
46 45
import edu.ucsb.nceas.metacat.client.MetacatFactory;
47 46
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
47
import edu.ucsb.nceas.metacat.service.PropertyService;
48
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
49
import edu.ucsb.nceas.metacat.util.SystemUtil;
48 50
import edu.ucsb.nceas.utilities.IOUtil;
49 51
import edu.ucsb.nceas.utilities.Options;
52
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
50 53
import junit.framework.Test;
51 54
import junit.framework.TestCase;
52 55
import junit.framework.TestSuite;
......
56 59
 */
57 60
public class BuildIndexTest extends TestCase
58 61
{
59
	 /* Initialize Options*/
62
    private static String metacatUrl;
63
    private static String propertyFileName;
64
    private static String username;
65
	private static String password;
66
	private static String anotheruser;
67
	private static String anotherpassword;
68
	static {
69
		try {
70
		    metacatUrl = SystemUtil.getServletURL();
71
		    propertyFileName = SystemUtil.getContextDir()
72
			+ "/WEB-INF/metacat.properties";
73
			username = PropertyService.getProperty("mcuser");
74
			password = PropertyService.getProperty("mcpassword");
75
		} catch (PropertyNotFoundException pnfe) {
76
			System.err.println("Could not get property in static block: " 
77
					+ pnfe.getMessage());
78
		}
79
	}
80

  
81
	private String prefix = "test";
82
	private String newdocid = null;
83
	private String testfile = "test/eml-sample.xml";
84
	private String testdocument = "";
85
	private Metacat m;
86
    /* Initialize Options */
60 87
    static
61 88
    {
62 89
  	  try
63 90
  	  {
64 91
  		  Options.initialize(new File("build/tests/metacat.properties"));
65 92
  		  MetaCatUtil.pathsForIndexing 
66
  		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
93
  		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
67 94
  	  }
68 95
  	  catch(Exception e)
69 96
  	  {
70 97
  		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
71 98
  	  }
72 99
    }
73
    
74
    private String metacatUrl = MetaCatUtil.getOption("metacatUrl");;
75
    private String propertyFileName = 
76
    	MetaCatUtil.getOption("installDir") + "/WEB-INF/metacat.properties";
77
    private String username = MetaCatUtil.getOption("mcuser");
78
    private String password = MetaCatUtil.getOption("mcpassword");
79
    private String prefix = "test";
80
    private String newdocid = null;
81
    private String testfile = "test/eml-sample.xml";
82
    private String testdocument = "";
83
    private Metacat m;
84
    private MetaCatUtil util;
85
   
86 100

  
87 101
    /**
88 102
     * Constructor to build the test
......
103 117
        try {
104 118
            File propertyFile = new File(propertyFileName);
105 119
            Options options = Options.initialize(propertyFile);
106
            util = new MetaCatUtil();
107
            metacatUrl = MetaCatUtil.getOption("junittesturl");
120
            metacatUrl = SystemUtil.getServletURL();
108 121
        } catch (FileNotFoundException e) {
109 122
            fail(e.getMessage());
110 123
        } catch (IOException e) {
111 124
            fail(e.getMessage());
125
        } catch (PropertyNotFoundException pnfe) {
126
        	fail (pnfe.getMessage());
112 127
        }
113 128

  
114 129
        try {

Also available in: Unified diff