1
|
/**
|
2
|
* '$RCSfile$'
|
3
|
* Copyright: 2004 Regents of the University of California and the
|
4
|
* National Center for Ecological Analysis and Synthesis
|
5
|
*
|
6
|
* '$Author: daigle $'
|
7
|
* '$Date: 2008-07-15 10:16:18 -0700 (Tue, 15 Jul 2008) $'
|
8
|
* '$Revision: 4127 $'
|
9
|
*
|
10
|
* This program is free software; you can redistribute it and/or modify
|
11
|
* it under the terms of the GNU General Public License as published by
|
12
|
* the Free Software Foundation; either version 2 of the License, or
|
13
|
* (at your option) any later version.
|
14
|
*
|
15
|
* This program is distributed in the hope that it will be useful,
|
16
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
* GNU General Public License for more details.
|
19
|
*
|
20
|
* You should have received a copy of the GNU General Public License
|
21
|
* along with this program; if not, write to the Free Software
|
22
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
*/
|
24
|
package edu.ucsb.nceas.metacattest;
|
25
|
|
26
|
import edu.ucsb.nceas.metacat.MetaCatVersion;
|
27
|
import edu.ucsb.nceas.metacat.service.PropertyService;
|
28
|
import edu.ucsb.nceas.metacat.service.ServiceException;
|
29
|
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
|
30
|
|
31
|
import junit.framework.TestCase;
|
32
|
|
33
|
|
34
|
/**
|
35
|
* @author jones
|
36
|
*
|
37
|
* Test class for the Version class.
|
38
|
*/
|
39
|
public class VersionTest extends TestCase
|
40
|
{
|
41
|
/*
|
42
|
* @see TestCase#setUp()
|
43
|
*/
|
44
|
protected void setUp() throws Exception
|
45
|
{
|
46
|
super.setUp();
|
47
|
try {
|
48
|
PropertyService.getInstance("build/tests");
|
49
|
} catch (ServiceException se) {
|
50
|
fail(se.getMessage());
|
51
|
}
|
52
|
}
|
53
|
|
54
|
/**
|
55
|
* Test the "getVersion" method by printing its output.
|
56
|
*/
|
57
|
public void testGetVersion()
|
58
|
{
|
59
|
try {
|
60
|
assertTrue(PropertyService.getProperty("application.metacatVersion").equals(MetaCatVersion.getVersionID()));
|
61
|
System.out.println(MetaCatVersion.getVersionID());
|
62
|
} catch (PropertyNotFoundException pnfe) {
|
63
|
fail ("Could not get metacat version property; " + pnfe.getMessage());
|
64
|
}
|
65
|
|
66
|
}
|
67
|
|
68
|
/**
|
69
|
* Test the "printVersionAsXml" method by printing its output.
|
70
|
*/
|
71
|
public void testPrintVersionAsXml()
|
72
|
{
|
73
|
try {
|
74
|
System.out.println(MetaCatVersion.getVersionAsXml());
|
75
|
assertTrue(MetaCatVersion.getVersionAsXml().indexOf(
|
76
|
PropertyService.getProperty("application.metacatVersion")) != -1);
|
77
|
} catch (PropertyNotFoundException pnfe) {
|
78
|
fail ("Could not get metacat version property; " + pnfe.getMessage());
|
79
|
}
|
80
|
}
|
81
|
|
82
|
}
|