Project

General

Profile

« Previous | Next » 

Revision 2134

Added by Duane Costa over 20 years ago

JUnit files for tseting Harvester code

View differences:

test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDetailLogTest.java
1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2004 Regents of the University of California and the
4
 *              National Center for Ecological Analysis and Synthesis,
5
 *              and the University of New Mexico
6
 *              
7
 *  Purpose: To test the HarvestDetailLog class by using JUnit
8
 *
9
 *   '$Author$'
10
 *     '$Date$'
11
 * '$Revision$'
12
 *
13
 * This program is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 */
27

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

  
30
import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
31
import junit.framework.Test;
32
import junit.framework.TestCase;
33
import junit.framework.TestSuite;
34

  
35
/**
36
 * Test HarvestDetailLog code using JUnit. Not yet implemented. The test
37
 * contained herein is just a placeholder for the actual tests to be
38
 * added.
39
 *
40
 * @author  costa
41
 */
42
public class HarvestDetailLogTest extends TestCase {
43

  
44
  private Harvester harvester;
45
  
46

  
47
  public HarvestDetailLogTest(String name) {
48
    super(name);
49
  }
50
  
51
  
52
  protected void setUp() {
53
    harvester = new Harvester();
54
  }
55
  
56
  
57
  protected void tearDown() {
58
  }
59

  
60

  
61
  /**
62
   * Dummy test. Will be replaced by the actual Harvester tests when 
63
   * they are implemented.
64
   */
65
  public void testHarvesterObject() {
66
    assertTrue(harvester.equals(harvester));
67
  }
68
  
69
  
70
  /**
71
   * Returns the test suite. The test suite consists of all methods in this
72
   * class whose names start with "test".
73
   * 
74
   * @return  a TestSuite object
75
   */
76
  public static Test suite() {
77
    return new TestSuite(HarvestDetailLogTest.class);
78
  }
79
  
80

  
81
  /**
82
   * The main program. Runs the test suite.
83
   * 
84
   * @param args   command line argument array.
85
   */
86
  public static void main(String args[]) {
87
    junit.textui.TestRunner.run(suite());
88
  }
89

  
90
}
0 91

  
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvesterTest.java
1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2004 Regents of the University of California and the
4
 *              National Center for Ecological Analysis and Synthesis,
5
 *              and the University of New Mexico
6
 *              
7
 *  Purpose: To test the Harvester class by using JUnit
8
 *
9
 *   '$Author$'
10
 *     '$Date$'
11
 * '$Revision$'
12
 *
13
 * This program is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 */
27

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

  
30
import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
31
import java.io.File;
32
import java.io.FileInputStream;
33
import java.io.IOException;
34
import java.util.Properties;
35
import junit.framework.Test;
36
import junit.framework.TestCase;
37
import junit.framework.TestSuite;
38

  
39
/**
40
 * Test Harvester code using JUnit. Not yet implemented. The test
41
 * contained herein is just a placeholder for the actual tests to be
42
 * added.
43
 *
44
 * @author  costa
45
 */
46
public class HarvesterTest extends TestCase {
47

  
48
  private Harvester harvester;
49
  
50

  
51
  public HarvesterTest(String name) {
52
    super(name);
53
  }
54
  
55
  
56
  protected void setUp() {
57
    harvester = new Harvester();
58
  }
59
  
60
  
61
  protected void tearDown() {
62
  }
63
  
64
  
65
  /**
66
   * Tests loading of Harvester properties from a configuration file.
67
   */
68
  public void testLoadProperties() {
69
    File configfile = new File("./lib/harvester", "harvester.properties");
70
    Properties properties = new Properties();
71

  
72
    String[] dir = new java.io.File(".").list(); // Get list of names
73
    java.util.Arrays.sort(dir);             // Sort it (Data Structuring chapter))
74
    for (int i=0; i<dir.length; i++)
75
      System.out.println(dir[i]);     // Print the list
76

  
77
    try {
78
      properties.load(new FileInputStream(configfile));
79
    }
80
    catch (IOException e) {
81
      fail("IOException: " + e.getMessage());
82
    }
83
  }
84
  
85
  
86
  /**
87
   * Returns the test suite. The test suite consists of all methods in this
88
   * class whose names start with "test".
89
   * 
90
   * @return  a TestSuite object
91
   */
92
  public static Test suite() {
93
    return new TestSuite(HarvesterTest.class);
94
  }
95
  
96

  
97
  /**
98
   * The main program. Runs the test suite.
99
   * 
100
   * @param args   command line argument array.
101
   */
102
  public static void main(String args[]) {
103
    junit.textui.TestRunner.run(suite());
104
  }
105

  
106
}
0 107

  
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestDocumentTest.java
1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2004 Regents of the University of California and the
4
 *              National Center for Ecological Analysis and Synthesis,
5
 *              and the University of New Mexico
6
 *              
7
 *  Purpose: To test the HarvestDocument class by using JUnit
8
 *
9
 *   '$Author$'
10
 *     '$Date$'
11
 * '$Revision$'
12
 *
13
 * This program is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 */
27

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

  
30
import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
31
import junit.framework.Test;
32
import junit.framework.TestCase;
33
import junit.framework.TestSuite;
34

  
35
/**
36
 * Test HarvestDocument code using JUnit. Not yet implemented. The test
37
 * contained herein is just a placeholder for the actual tests to be
38
 * added.
39
 *
40
 * @author  costa
41
 */
42
public class HarvestDocumentTest extends TestCase {
43

  
44
  private Harvester harvester;
45
  
46

  
47
  public HarvestDocumentTest(String name) {
48
    super(name);
49
  }
50
  
51
  
52
  protected void setUp() {
53
    harvester = new Harvester();
54
  }
55
  
56
  
57
  protected void tearDown() {
58
  }
59

  
60

  
61
  /**
62
   * Dummy test. Will be replaced by the actual HarvestDocument tests when 
63
   * they are implemented.
64
   */
65
  public void testHarvesterObject() {
66
    assertTrue(harvester.equals(harvester));
67
  }
68
  
69
  
70
  /**
71
   * Returns the test suite. The test suite consists of all methods in this
72
   * class whose names start with "test".
73
   * 
74
   * @return  a TestSuite object
75
   */
76
  public static Test suite() {
77
    return new TestSuite(HarvestDocumentTest.class);
78
  }
79
  
80

  
81
  /**
82
   * The main program. Runs the test suite.
83
   * 
84
   * @param args   command line argument array.
85
   */
86
  public static void main(String args[]) {
87
    junit.textui.TestRunner.run(suite());
88
  }
89

  
90
}
0 91

  
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestLogTest.java
1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2004 Regents of the University of California and the
4
 *              National Center for Ecological Analysis and Synthesis,
5
 *              and the University of New Mexico
6
 *              
7
 *  Purpose: To test the HarvestLog class by using JUnit
8
 *
9
 *   '$Author$'
10
 *     '$Date$'
11
 * '$Revision$'
12
 *
13
 * This program is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 */
27

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

  
30
import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
31
import junit.framework.Test;
32
import junit.framework.TestCase;
33
import junit.framework.TestSuite;
34

  
35
/**
36
 * Test HarvestLog code using JUnit. Not yet implemented. The test
37
 * contained herein is just a placeholder for the actual tests to be
38
 * added.
39
 *
40
 * @author  costa
41
 */
42
public class HarvestLogTest extends TestCase {
43

  
44
  private Harvester harvester;
45
  
46

  
47
  public HarvestLogTest(String name) {
48
    super(name);
49
  }
50
  
51
  
52
  protected void setUp() {
53
    harvester = new Harvester();
54
  }
55
  
56
  
57
  protected void tearDown() {
58
  }
59

  
60

  
61
  /**
62
   * Dummy test. Will be replaced by the actual Harvester tests when 
63
   * they are implemented.
64
   */
65
  public void testHarvesterObject() {
66
    assertTrue(harvester.equals(harvester));
67
  }
68
  
69
  
70
  /**
71
   * Returns the test suite. The test suite consists of all methods in this
72
   * class whose names start with "test".
73
   * 
74
   * @return  a TestSuite object
75
   */
76
  public static Test suite() {
77
    return new TestSuite(HarvestLogTest.class);
78
  }
79
  
80

  
81
  /**
82
   * The main program. Runs the test suite.
83
   * 
84
   * @param args   command line argument array.
85
   */
86
  public static void main(String args[]) {
87
    junit.textui.TestRunner.run(suite());
88
  }
89

  
90
}
0 91

  
test/edu/ucsb/nceas/metacattest/harvesterClient/HarvestSiteScheduleTest.java
1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2004 Regents of the University of California and the
4
 *              National Center for Ecological Analysis and Synthesis,
5
 *              and the University of New Mexico
6
 *              
7
 *  Purpose: To test the HarvestSiteSchedule class by using JUnit
8
 *
9
 *   '$Author$'
10
 *     '$Date$'
11
 * '$Revision$'
12
 *
13
 * This program is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 */
27

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

  
30
import edu.ucsb.nceas.metacat.harvesterClient.Harvester;
31
import junit.framework.Test;
32
import junit.framework.TestCase;
33
import junit.framework.TestSuite;
34

  
35
/**
36
 * Test HarvestSiteSchedule code using JUnit. Not yet implemented. The test
37
 * contained herein is just a placeholder for the actual tests to be
38
 * added.
39
 *
40
 * @author  costa
41
 */
42
public class HarvestSiteScheduleTest extends TestCase {
43

  
44
  private Harvester harvester;
45
  
46

  
47
  public HarvestSiteScheduleTest(String name) {
48
    super(name);
49
  }
50
  
51
  
52
  protected void setUp() {
53
    harvester = new Harvester();
54
  }
55
  
56
  
57
  protected void tearDown() {
58
  }
59

  
60

  
61
  /**
62
   * Dummy test. Will be replaced by the actual Harvester tests when 
63
   * they are implemented.
64
   */
65
  public void testHarvesterObject() {
66
    assertTrue(harvester.equals(harvester));
67
  }
68
  
69
  
70
  /**
71
   * Returns the test suite. The test suite consists of all methods in this
72
   * class whose names start with "test".
73
   * 
74
   * @return  a TestSuite object
75
   */
76
  public static Test suite() {
77
    return new TestSuite(HarvestSiteScheduleTest.class);
78
  }
79
  
80

  
81
  /**
82
   * The main program. Runs the test suite.
83
   * 
84
   * @param args   command line argument array.
85
   */
86
  public static void main(String args[]) {
87
    junit.textui.TestRunner.run(suite());
88
  }
89

  
90
}
0 91

  

Also available in: Unified diff