Project

General

Profile

« Previous | Next » 

Revision 4127

Added by daigle about 16 years ago

Replace Options class with PropertyService and create PropertyService using log directory name instead of servlet context

View differences:

test/edu/ucsb/nceas/metacattest/AuthLdapTest.java
27 27
import java.io.File;
28 28

  
29 29
import edu.ucsb.nceas.metacat.AuthLdap;
30
import edu.ucsb.nceas.metacat.service.PropertyService;
30 31
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
31
import edu.ucsb.nceas.utilities.Options;
32 32
import junit.framework.Test;
33 33
import junit.framework.TestCase;
34 34
import junit.framework.TestSuite;
......
45 45
	
46 46
	
47 47
	private MetaCatUtil util;
48
    /* Initialize Options*/
48
    /* Initialize properties*/
49 49
    static
50 50
    {
51 51
  	  try
52 52
  	  {
53
  		  Options.initialize(new File("build/tests/metacat.properties"));
53
  		PropertyService.getInstance("build/tests");
54 54
  	  }
55 55
  	  catch(Exception e)
56 56
  	  {
test/edu/ucsb/nceas/metacattest/SitemapTest.java
32 32

  
33 33
import edu.ucsb.nceas.metacat.DBConnectionPool;
34 34
import edu.ucsb.nceas.metacat.Sitemap;
35
import edu.ucsb.nceas.metacat.util.SystemUtil;
36
import edu.ucsb.nceas.utilities.Options;
37
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
35
import edu.ucsb.nceas.metacat.service.PropertyService;
36
import edu.ucsb.nceas.metacat.service.ServiceException;
38 37

  
39 38
import junit.framework.TestCase;
40 39

  
......
44 43
 * @author Matt Jones
45 44
 */
46 45
public class SitemapTest extends TestCase {
47
	
48
	private static String propertyFileName;
49
	static {
50
		try {
51
			propertyFileName = SystemUtil.getContextDir() + "/WEB-INF/metacat.properties";
52
			// "/usr/share/tomcat5.5/webapps/knb/WEB-INF/metacat.properties";
53
		} catch (PropertyNotFoundException pnfe) {
54 46

  
55
		}
56
	}
57

  
58 47
    private String directoryName = "/tmp/sitemaps";
59 48

  
60 49
    /**
......
63 52
    protected void setUp() throws Exception {
64 53
        super.setUp();
65 54
        try {
66
            File propertyFile = new File(propertyFileName);
67
            Options options = Options.initialize(propertyFile);
55
  		  	PropertyService.getInstance("build/tests");
68 56
            DBConnectionPool pool = DBConnectionPool.getInstance();
69
        } catch (FileNotFoundException e) {
70
            fail(e.getMessage());
71
        } catch (IOException e) {
72
            fail(e.getMessage());
57
        } catch (ServiceException se) {
58
            fail(se.getMessage());
73 59
        }
74 60
    }
75 61

  
test/edu/ucsb/nceas/metacattest/QuerySpecificationTest.java
27 27
import java.io.FileNotFoundException;
28 28
import java.io.FileReader;
29 29
import java.io.IOException;
30
import java.util.Hashtable;
31 30

  
32 31
import junit.framework.Test;
33 32
import junit.framework.TestCase;
......
36 35
import edu.ucsb.nceas.metacat.QuerySpecification;
37 36
import edu.ucsb.nceas.metacat.service.PropertyService;
38 37
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
39
import edu.ucsb.nceas.utilities.Options;
40 38
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
41 39

  
42 40
/**
......
91 89
                                    "OR  (xml_index.nodeid=xml_nodes.nodeid AND ( xml_index.path IN ( '/eml/@packageId', '/eml/dataset/access/@authSystem' , '/eml/dataset/access/@order' ) AND xml_nodes.nodetype = 'ATTRIBUTE'))) "+
92 90
                                    "AND xml_nodes.docid in ('obfs.45337', 'obfs.45338', 'obfs.45346')";
93 91
    
94
    /* Initialize Options*/
92
    /* Initialize properties*/
95 93
    static
96 94
    {
97 95
  	  try
98 96
  	  {
99
  		  Options.initialize(new File("build/tests/metacat.properties"));
97
		  PropertyService.getInstance("build/tests");
100 98
  		  MetaCatUtil.pathsForIndexing 
101 99
  		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
102 100
  	  }
......
123 121
    {
124 122
        super.setUp();
125 123
        try {
126
            File propertyFile = new File("./lib/metacat.properties");
127
            Options options = Options.initialize(propertyFile);
124
  		  	PropertyService.getInstance("build/tests");
128 125
            String xmlfile = "./test/query.xml";
129 126
            xml = new FileReader(new File(xmlfile));
130 127
        } catch (FileNotFoundException e) {
131 128
            fail(e.getMessage());
132
        } catch (IOException e) {
133
            fail(e.getMessage());
134
        }
129
        } 
135 130
    }
136 131

  
137 132
    /**
test/edu/ucsb/nceas/metacattest/SubTreeTest.java
29 29
import edu.ucsb.nceas.metacat.*;
30 30
import edu.ucsb.nceas.metacat.service.PropertyService;
31 31
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
32
import edu.ucsb.nceas.utilities.Options;
33
//import edu.ucsb.nceas.morpho.framework.*;
34 32
import junit.framework.Test;
35 33
import junit.framework.TestCase;
36 34
import junit.framework.TestResult;
......
38 36
import org.apache.commons.logging.Log;
39 37
import org.apache.commons.logging.LogFactory;
40 38

  
41
import java.io.*;
42
import java.net.*;
43 39
import java.util.*;
44 40

  
45 41

  
......
50 46
{
51 47
  private SubTree tree = null;
52 48
  private static final Log log = LogFactory.getLog("edu.ucsb.nceas.metacattest.ReplicationServerListTest");
53
  /* Initialize Options*/
49
  /* Initialize properties*/
54 50
  static
55 51
  {
56 52
	  try
57 53
	  {
58
		  Options.initialize(new File("build/tests/metacat.properties"));
54
		  PropertyService.getInstance("build/tests");
59 55
		  MetaCatUtil.pathsForIndexing 
60 56
		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
61 57
	  }
test/edu/ucsb/nceas/metacattest/QueryResultBuilderTest.java
23 23
 */
24 24
package edu.ucsb.nceas.metacattest;
25 25

  
26
import java.io.File;
27
import java.io.FileNotFoundException;
28
import java.io.IOException;
29 26
import java.sql.PreparedStatement;
30 27
import java.sql.ResultSet;
31 28
import java.util.Enumeration;
32 29
import java.util.Hashtable;
33
import java.util.Iterator;
34 30

  
35 31
import edu.ucsb.nceas.metacat.DBConnection;
36 32
import edu.ucsb.nceas.metacat.DBConnectionPool;
37
import edu.ucsb.nceas.metacat.Version;
38 33
import edu.ucsb.nceas.metacat.service.PropertyService;
39
import edu.ucsb.nceas.utilities.Options;
40 34

  
41 35
import junit.framework.Test;
42 36
import junit.framework.TestCase;
......
62 56
	  {
63 57
		  try
64 58
		  {
65
			  Options.initialize(new File("build/tests/metacat.properties"));
59
			  PropertyService.getInstance("build/tests");
66 60
		  }
67 61
		  catch(Exception e)
68 62
		  {
test/edu/ucsb/nceas/metacattest/UploadIPCCDataTest.java
32 32
import edu.ucsb.nceas.metacat.service.PropertyService;
33 33
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
34 34
import edu.ucsb.nceas.utilities.IOUtil;
35
import edu.ucsb.nceas.utilities.Options;
36 35
import edu.ucsb.nceas.utilities.XMLUtilities;
37 36
//import edu.ucsb.nceas.morpho.framework.*;
38 37
import junit.framework.Test;
......
77 76
{
78 77
  
79 78
	 
80
	  /* Initialize Options*/
79
	  /* Initialize properties*/
81 80
	  static
82 81
	  {
83 82
		  try
84 83
		  {
85
			  Options.initialize(new File("build/tests/metacat.properties"));
84
			  PropertyService.getInstance("build/tests");
86 85
			  MetaCatUtil.pathsForIndexing 
87 86
			         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
88 87
		  }
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDetailLogTest.java
33 33
import edu.ucsb.nceas.metacat.harvesterClient.HarvestSiteSchedule;
34 34
import edu.ucsb.nceas.metacat.service.PropertyService;
35 35
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
36
import edu.ucsb.nceas.utilities.Options;
37 36

  
38
import java.io.File;
39 37
import java.sql.Connection;
40 38
import junit.framework.Test;
41 39
import junit.framework.TestCase;
......
52 50
  private HarvestDetailLog harvestDetailLog;
53 51
  private HarvestDocument harvestDocument;
54 52
  private HarvestSiteSchedule harvestSiteSchedule;
55
  /* Initialize Options*/
53
  /* Initialize Properties*/
56 54
  static
57 55
  {
58 56
	  try
59 57
	  {
60
		  Options.initialize(new File("build/tests/metacat.properties"));
58
		  PropertyService.getInstance("build/tests");
61 59
		  MetaCatUtil.pathsForIndexing 
62 60
		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
63 61
	  }
......
105 103
    int updateFrequency = 1;
106 104
  
107 105
    harvester = new Harvester();
108
    Harvester.loadOptions(test);
106
    Harvester.loadProperties(test);
109 107
    conn = harvester.getConnection();  // initializes the database connection
110 108
    harvester.initLogIDs();
111 109
    harvestLogID = harvester.getHarvestLogID();
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvesterTest.java
30 30
import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
31 31
import edu.ucsb.nceas.metacat.service.PropertyService;
32 32
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
33
import edu.ucsb.nceas.utilities.Options;
34
import java.io.File;
35
import java.io.FileInputStream;
36
import java.io.IOException;
33
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
37 34
import junit.framework.Test;
38 35
import junit.framework.TestCase;
39 36
import junit.framework.TestSuite;
......
46 43
public class HarvesterTest extends TestCase {
47 44

  
48 45
  private Harvester harvester;
49
  /* Initialize Options*/
50
  static
51
  {
52
	  try
53
	  {
54
		  Options.initialize(new File("build/tests/metacat.properties"));
55
		  MetaCatUtil.pathsForIndexing 
56
		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
57
	  }
58
	  catch(Exception e)
59
	  {
60
		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
61
	  }
62
  }
46
	/* Initialize Properties */
47
	static {
48
		try {
49
			PropertyService.getInstance("build/tests");
50
			MetaCatUtil.pathsForIndexing = MetaCatUtil.getOptionList(
51
					PropertyService.getProperty("indexPaths"));
52
		} catch (Exception e) {
53
			System.err.println("Exception in initialize option in MetacatServletNetTest "
54
					+ e.getMessage());
55
		}
56
	}
63 57

  
64 58
  /**
65
   * Constructor for this test.
66
   * 
67
   * @param name     name of the test case
68
   */
59
	 * Constructor for this test.
60
	 * 
61
	 * @param name
62
	 *            name of the test case
63
	 */
69 64
  public HarvesterTest(String name) {
70 65
    super(name);
71 66
  }
......
109 104
  }
110 105
  
111 106
  
112
  /**
113
   * Tests loading of Harvester properties from a configuration file.
114
   */
115
  public void testLoadOptions() {
116
    Options options;
117
    String ctm;
118
    boolean test = true;
119
    
120
    Harvester.loadOptions(test);
121
    options = Harvester.options;
122
    ctm = options.getOption("connectToMetacat");
123
    assertTrue(ctm.equals("true") || ctm.equals("false"));
124
  }
107
    /**
108
	 * Tests loading of Harvester properties from a configuration file.
109
	 */
110
	public void testLoadProperties() {
111
		String ctm = null;
112
		boolean test = true;
113

  
114
		Harvester.loadProperties(test);
115
		try {
116
			ctm = PropertyService.getProperty("connectToMetacat");
117
		} catch (PropertyNotFoundException pnfe) {
118
			fail("Could not get connectToMetacat property: "+ pnfe.getMessage());
119
		}
120
		assertTrue(ctm.equals("true") || ctm.equals("false"));
121
	}
125 122
  
126 123
  
127 124
  /**
128
   * Prints the files in the current working directory. This may be useful
129
   * for determining which directory all other tests are running in.
130
   */
125
	 * Prints the files in the current working directory. This may be useful for
126
	 * determining which directory all other tests are running in.
127
	 */
131 128
  public void testWorkingDirectory() {
132 129
    String[] dir = new java.io.File(".").list(); // Get files in current dir
133 130

  
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDocumentTest.java
32 32
import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
33 33
import edu.ucsb.nceas.metacat.service.PropertyService;
34 34
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
35
import edu.ucsb.nceas.utilities.Options;
36 35

  
37 36
import java.io.File;
38 37
import java.io.StringReader;
......
51 50
  private Harvester harvester;
52 51
  private HarvestDocument harvestDocument;
53 52
  private HarvestSiteSchedule harvestSiteSchedule;
54
  /* Initialize Options*/
53
  /* Initialize Properties*/
55 54
  static
56 55
  {
57 56
	  try
58 57
	  {
59
		  Options.initialize(new File("build/tests/metacat.properties"));
58
		  PropertyService.getInstance("build/tests");
60 59
		  MetaCatUtil.pathsForIndexing 
61 60
		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
62 61
	  }
......
107 106
    int updateFrequency = 1;
108 107

  
109 108
    harvester = new Harvester();
110
    Harvester.loadOptions(test);
109
    Harvester.loadProperties(test);
111 110
    harvester.getConnection();  // initializes the database connection
112 111
    harvester.initLogIDs();
113 112
    harvester.setHarvestStartTime(new Date());
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestLogTest.java
40 40
import edu.ucsb.nceas.metacat.harvesterClient.HarvestLog;
41 41
import edu.ucsb.nceas.metacat.service.PropertyService;
42 42
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
43
import edu.ucsb.nceas.utilities.Options;
44 43
import junit.framework.Test;
45 44
import junit.framework.TestCase;
46 45
import junit.framework.TestSuite;
......
58 57
  private HarvestLog harvestLogDeep;
59 58
  private HarvestDocument harvestDocument;
60 59
  private HarvestSiteSchedule harvestSiteSchedule;
61
  /* Initialize Options*/
60
  /* Initialize Properties*/
62 61
  static
63 62
  {
64 63
	  try
65 64
	  {
66
		  Options.initialize(new File("build/tests/metacat.properties"));
65
		  PropertyService.getInstance("build/tests");
67 66
		  MetaCatUtil.pathsForIndexing 
68 67
		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
69 68
	  }
......
117 116
    int updateFrequency = 1;
118 117

  
119 118
    harvester = new Harvester();
120
    Harvester.loadOptions(test);
119
    Harvester.loadProperties(test);
121 120
    conn = harvester.getConnection();  // initializes the database connection
122 121
    harvester.initLogIDs();
123 122
    harvestLogID = harvester.getHarvestLogID();
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestSiteScheduleTest.java
31 31
import edu.ucsb.nceas.metacat.harvesterClient.HarvestSiteSchedule;
32 32
import edu.ucsb.nceas.metacat.service.PropertyService;
33 33
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
34
import edu.ucsb.nceas.utilities.Options;
35 34

  
36 35
import java.io.File;
37 36
import java.util.Date;
......
50 49
  private Harvester harvester;
51 50
  private HarvestSiteSchedule harvestSiteScheduleFuture; // future date next har
52 51
  private HarvestSiteSchedule harvestSiteSchedulePast; // past date next harvest
53
  /* Initialize Options*/
52
  /* Initialize Properties*/
54 53
  static
55 54
  {
56 55
	  try
57 56
	  {
58
		  Options.initialize(new File("build/tests/metacat.properties"));
57
		  PropertyService.getInstance("build/tests");
59 58
		  MetaCatUtil.pathsForIndexing 
60 59
		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
61 60
	  }
......
98 97
    int updateFrequency = 1;
99 98

  
100 99
    harvester = new Harvester();
101
    Harvester.loadOptions(test);
100
    Harvester.loadProperties(test);
102 101
    harvester.getConnection();  // initializes the database connection
103 102
    harvester.initLogIDs();
104 103
    harvester.setHarvestStartTime(new Date());
test/edu/ucsb/nceas/metacattest/QueryGroupTest.java
23 23
 */
24 24
package edu.ucsb.nceas.metacattest;
25 25

  
26
import java.io.File;
27
import java.io.FileNotFoundException;
28
import java.io.FileReader;
29
import java.io.IOException;
30
import java.util.Hashtable;
31

  
32 26
import junit.framework.Test;
33 27
import junit.framework.TestCase;
34 28
import junit.framework.TestSuite;
......
37 31
import edu.ucsb.nceas.metacat.QueryTerm;
38 32
import edu.ucsb.nceas.metacat.service.PropertyService;
39 33
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
40
import edu.ucsb.nceas.utilities.Options;
41 34

  
42 35
/**
43 36
 * @author jones
......
47 40
public class QueryGroupTest extends TestCase
48 41
{
49 42
	private QueryGroup group = null;
50
	 /* Initialize Options*/
43
	 /* Initialize properties*/
51 44
    static
52 45
    {
53 46
  	  try
54 47
  	  {
55
  		  Options.initialize(new File("build/tests/metacat.properties"));
48
		  PropertyService.getInstance("build/tests");
56 49
  		  MetaCatUtil.pathsForIndexing 
57 50
  		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
58 51
  	  }
test/edu/ucsb/nceas/metacattest/EventLogTest.java
23 23
 */
24 24
package edu.ucsb.nceas.metacattest;
25 25

  
26
import java.io.File;
27
import java.io.FileNotFoundException;
28
import java.io.IOException;
29 26
import java.sql.Timestamp;
30 27
import java.text.ParseException;
31 28
import java.text.SimpleDateFormat;
32 29

  
33 30
import edu.ucsb.nceas.metacat.DBConnectionPool;
34 31
import edu.ucsb.nceas.metacat.EventLog;
32
import edu.ucsb.nceas.metacat.service.PropertyService;
33
import edu.ucsb.nceas.metacat.service.ServiceException;
35 34
import edu.ucsb.nceas.metacat.util.SystemUtil;
36
import edu.ucsb.nceas.utilities.Options;
37 35

  
38 36
import junit.framework.TestCase;
39 37

  
......
44 42
 */
45 43
public class EventLogTest extends TestCase
46 44
{
47
    private String propertyFileName = null;
48 45

  
49 46
    protected void setUp() throws Exception
50 47
    {
51
    	propertyFileName = SystemUtil.getContextDir() + "/WEB-INF/metacat.properties";
52 48
    	
53 49
        super.setUp();
54 50
        try {
55
            File propertyFile = new File(propertyFileName);
56
            Options options = Options.initialize(propertyFile);
51
			PropertyService.getInstance("build/tests");
57 52
            DBConnectionPool pool = DBConnectionPool.getInstance();
58
        } catch (FileNotFoundException e) {
59
            fail(e.getMessage());
60
        } catch (IOException e) {
61
            fail(e.getMessage());
62
        }
53
        } catch (ServiceException se) {
54
            fail(se.getMessage());
55
        } 
63 56
    }
64 57

  
65 58
    /**
test/edu/ucsb/nceas/metacattest/VersionTest.java
23 23
 */
24 24
package edu.ucsb.nceas.metacattest;
25 25

  
26
import java.io.File;
27
import java.io.FileNotFoundException;
28
import java.io.IOException;
29

  
30 26
import edu.ucsb.nceas.metacat.MetaCatVersion;
31 27
import edu.ucsb.nceas.metacat.service.PropertyService;
32
import edu.ucsb.nceas.utilities.Options;
28
import edu.ucsb.nceas.metacat.service.ServiceException;
33 29
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
34 30

  
35 31
import junit.framework.TestCase;
......
49 45
    {
50 46
        super.setUp();
51 47
        try {
52
            File propertyFile = new File("./lib/metacat.properties");
53
            Options options = Options.initialize(propertyFile);
54
        } catch (FileNotFoundException e) {
55
            fail(e.getMessage());
56
        } catch (IOException e) {
57
            fail(e.getMessage());
58
        }
48
  		  	PropertyService.getInstance("build/tests");
49
        } catch (ServiceException se) {
50
            fail(se.getMessage());
51
        } 
59 52
    }
60 53
    
61 54
    /**
test/edu/ucsb/nceas/metacattest/BuildIndexTest.java
24 24

  
25 25
package edu.ucsb.nceas.metacattest;
26 26

  
27
import java.io.File;
28
import java.io.FileNotFoundException;
29 27
import java.io.FileReader;
30 28
import java.io.IOException;
31 29
import java.io.Reader;
......
45 43
import edu.ucsb.nceas.metacat.client.MetacatFactory;
46 44
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
47 45
import edu.ucsb.nceas.metacat.service.PropertyService;
46
import edu.ucsb.nceas.metacat.service.ServiceException;
48 47
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
49
import edu.ucsb.nceas.metacat.util.SystemUtil;
50 48
import edu.ucsb.nceas.utilities.IOUtil;
51
import edu.ucsb.nceas.utilities.Options;
52 49
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
53 50
import junit.framework.Test;
54 51
import junit.framework.TestCase;
......
60 57
public class BuildIndexTest extends TestCase
61 58
{
62 59
    private static String metacatUrl;
63
    private static String propertyFileName;
64 60
    private static String username;
65 61
	private static String password;
66
	private static String anotheruser;
67
	private static String anotherpassword;
68 62
	static {
69 63
		try {
70
		    metacatUrl = SystemUtil.getServletURL();
71
		    propertyFileName = SystemUtil.getContextDir()
72
			+ "/WEB-INF/metacat.properties";
73
			username = PropertyService.getProperty("mcuser");
74
			password = PropertyService.getProperty("mcpassword");
64
			PropertyService.getInstance("build/tests");
65
		    metacatUrl = PropertyService.getProperty("test.metacat.url");
66
			username = PropertyService.getProperty("test.mcuser");
67
			password = PropertyService.getProperty("test.mcpassword");
75 68
		} catch (PropertyNotFoundException pnfe) {
76 69
			System.err.println("Could not get property in static block: " 
77 70
					+ pnfe.getMessage());
71
		} catch (ServiceException se) {
72
			System.err.println("Could not get PropertyService instance in static block: " 
73
					+ se.getMessage());
78 74
		}
79 75
	}
80 76

  
......
83 79
	private String testfile = "test/eml-sample.xml";
84 80
	private String testdocument = "";
85 81
	private Metacat m;
86
    /* Initialize Options */
82
    /* Initialize properties */
87 83
    static
88 84
    {
89 85
  	  try
90 86
  	  {
91
  		  Options.initialize(new File("build/tests/metacat.properties"));
87
  		  PropertyService.getInstance("build/tests");
92 88
  		  MetaCatUtil.pathsForIndexing 
93 89
  		         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
94 90
  	  }
......
115 111
    public void setUp()
116 112
    {
117 113
        try {
118
            File propertyFile = new File(propertyFileName);
119
            Options options = Options.initialize(propertyFile);
120
            metacatUrl = SystemUtil.getServletURL();
121
        } catch (FileNotFoundException e) {
122
            fail(e.getMessage());
123
        } catch (IOException e) {
124
            fail(e.getMessage());
114
        	PropertyService.getInstance("build/tests");
115
            metacatUrl = PropertyService.getProperty("test.metacat.url");
116
        } catch (ServiceException se) {
117
            fail(se.getMessage());
125 118
        } catch (PropertyNotFoundException pnfe) {
126 119
        	fail (pnfe.getMessage());
127 120
        }
test/edu/ucsb/nceas/metacattest/ReplicationServerListTest.java
29 29
import edu.ucsb.nceas.metacat.*;
30 30
import edu.ucsb.nceas.metacat.service.PropertyService;
31 31
import edu.ucsb.nceas.metacat.util.MetaCatUtil;
32
import edu.ucsb.nceas.utilities.Options;
33 32
//import edu.ucsb.nceas.morpho.framework.*;
34 33
import junit.framework.Test;
35 34
import junit.framework.TestCase;
......
49 48
public class ReplicationServerListTest extends TestCase
50 49
{
51 50
    private static String metacatReplicationURL;
52
	 /* Initialize Options*/
51
	 /* Initialize properties*/
53 52
	  static
54 53
	  {
55 54
		  try
56 55
		  {
57 56
			 metacatReplicationURL=
58 57
                     PropertyService.getProperty("junitreplicationurl");
59
			  Options.initialize(new File("build/tests/metacat.properties"));
58
			  PropertyService.getInstance("build/tests");
60 59
			  MetaCatUtil.pathsForIndexing 
61 60
			         = MetaCatUtil.getOptionList(PropertyService.getProperty("indexPaths"));
62 61
		  }

Also available in: Unified diff