Project

General

Profile

« Previous | Next » 

Revision 3566

Added by Jing Tao about 17 years ago

Add code to initialize Options. Otherwise will get null exception.

View differences:

test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDetailLogTest.java
27 27

  
28 28
package edu.ucsb.nceas.metacattest.harvesterClient;
29 29

  
30
import edu.ucsb.nceas.metacat.MetaCatUtil;
30 31
import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
31 32
import edu.ucsb.nceas.metacat.harvesterClient.HarvestDetailLog;
32 33
import edu.ucsb.nceas.metacat.harvesterClient.HarvestDocument;
33 34
import edu.ucsb.nceas.metacat.harvesterClient.HarvestSiteSchedule;
35
import edu.ucsb.nceas.utilities.Options;
36

  
34 37
import java.io.File;
35 38
import java.sql.Connection;
36 39
import junit.framework.Test;
......
48 51
  private HarvestDetailLog harvestDetailLog;
49 52
  private HarvestDocument harvestDocument;
50 53
  private HarvestSiteSchedule harvestSiteSchedule;
51
  
54
  /* Initialize Options*/
55
  static
56
  {
57
	  try
58
	  {
59
		  Options.initialize(new File("build/tests/metacat.properties"));
60
		  MetaCatUtil.pathsForIndexing 
61
		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
62
	  }
63
	  catch(Exception e)
64
	  {
65
		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
66
	  }
67
  }
52 68

  
53 69
  /**
54 70
   * Constructor for this test.
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvesterTest.java
27 27

  
28 28
package edu.ucsb.nceas.metacattest.harvesterClient;
29 29

  
30
import edu.ucsb.nceas.metacat.MetaCatUtil;
30 31
import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
31 32
import edu.ucsb.nceas.utilities.Options;
32 33
import java.io.File;
......
44 45
public class HarvesterTest extends TestCase {
45 46

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

  
49 63
  /**
50 64
   * Constructor for this test.
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDocumentTest.java
27 27

  
28 28
package edu.ucsb.nceas.metacattest.harvesterClient;
29 29

  
30
import edu.ucsb.nceas.metacat.MetaCatUtil;
30 31
import edu.ucsb.nceas.metacat.harvesterClient.HarvestDocument;
31 32
import edu.ucsb.nceas.metacat.harvesterClient.HarvestSiteSchedule;
32 33
import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
34
import edu.ucsb.nceas.utilities.Options;
35

  
33 36
import java.io.File;
34 37
import java.io.StringReader;
35 38
import java.util.Date;
......
47 50
  private Harvester harvester;
48 51
  private HarvestDocument harvestDocument;
49 52
  private HarvestSiteSchedule harvestSiteSchedule;
50
  
53
  /* Initialize Options*/
54
  static
55
  {
56
	  try
57
	  {
58
		  Options.initialize(new File("build/tests/metacat.properties"));
59
		  MetaCatUtil.pathsForIndexing 
60
		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
61
	  }
62
	  catch(Exception e)
63
	  {
64
		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
65
	  }
66
  }
51 67

  
52 68
  /**
53 69
   * Constructor for this test.
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestLogTest.java
27 27

  
28 28
package edu.ucsb.nceas.metacattest.harvesterClient;
29 29

  
30
import edu.ucsb.nceas.metacat.MetaCatUtil;
30 31
import edu.ucsb.nceas.metacat.harvesterClient.HarvestSiteSchedule;
31 32
import java.io.File;
32 33
import java.sql.Connection;
......
38 39
import edu.ucsb.nceas.metacat.harvesterClient.HarvestDetailLog;
39 40
import edu.ucsb.nceas.metacat.harvesterClient.HarvestDocument;
40 41
import edu.ucsb.nceas.metacat.harvesterClient.HarvestLog;
42
import edu.ucsb.nceas.utilities.Options;
41 43
import junit.framework.Test;
42 44
import junit.framework.TestCase;
43 45
import junit.framework.TestSuite;
......
55 57
  private HarvestLog harvestLogDeep;
56 58
  private HarvestDocument harvestDocument;
57 59
  private HarvestSiteSchedule harvestSiteSchedule;
58
  
60
  /* Initialize Options*/
61
  static
62
  {
63
	  try
64
	  {
65
		  Options.initialize(new File("build/tests/metacat.properties"));
66
		  MetaCatUtil.pathsForIndexing 
67
		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
68
	  }
69
	  catch(Exception e)
70
	  {
71
		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
72
	  }
73
  }
59 74

  
60 75
  /**
61 76
   * Constructor for this test.
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestSiteScheduleTest.java
27 27

  
28 28
package edu.ucsb.nceas.metacattest.harvesterClient;
29 29

  
30
import edu.ucsb.nceas.metacat.MetaCatUtil;
30 31
import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
31 32
import edu.ucsb.nceas.metacat.harvesterClient.HarvestSiteSchedule;
33
import edu.ucsb.nceas.utilities.Options;
34

  
32 35
import java.io.File;
33 36
import java.util.Date;
34 37
import javax.xml.parsers.ParserConfigurationException;
......
46 49
  private Harvester harvester;
47 50
  private HarvestSiteSchedule harvestSiteScheduleFuture; // future date next har
48 51
  private HarvestSiteSchedule harvestSiteSchedulePast; // past date next harvest
49
  
52
  /* Initialize Options*/
53
  static
54
  {
55
	  try
56
	  {
57
		  Options.initialize(new File("build/tests/metacat.properties"));
58
		  MetaCatUtil.pathsForIndexing 
59
		         = MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths"));
60
	  }
61
	  catch(Exception e)
62
	  {
63
		  System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage());
64
	  }
65
  }
50 66

  
51 67
  /**
52 68
   * Constructor for this test.

Also available in: Unified diff