1
|
/**
|
2
|
* '$RCSfile$'
|
3
|
* Copyright: 2016 Regents of the University of California and the
|
4
|
* National Center for Ecological Analysis and Synthesis
|
5
|
*
|
6
|
* '$Author: jones $'
|
7
|
* '$Date: 2014-08-07 14:28:35 -0700 (Thu, 07 Aug 2014) $'
|
8
|
* '$Revision: 8834 $'
|
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
|
|
25
|
package edu.ucsb.nceas.metacat.dataone;
|
26
|
|
27
|
import junit.framework.Test;
|
28
|
import junit.framework.TestSuite;
|
29
|
|
30
|
import org.dataone.service.types.v1.ReplicationPolicy;
|
31
|
|
32
|
import edu.ucsb.nceas.MCTestCase;
|
33
|
|
34
|
/**
|
35
|
* A class for testing the generation of SystemMetadata from defaults
|
36
|
*/
|
37
|
public class SystemMetadataFactoryTest extends MCTestCase {
|
38
|
|
39
|
/**
|
40
|
* constructor for the test
|
41
|
*/
|
42
|
public SystemMetadataFactoryTest(String name) {
|
43
|
super(name);
|
44
|
}
|
45
|
|
46
|
/**
|
47
|
* Establish a testing framework by initializing appropriate objects
|
48
|
*/
|
49
|
public void setUp() throws Exception {
|
50
|
|
51
|
}
|
52
|
|
53
|
/**
|
54
|
* Release any objects after tests are complete
|
55
|
*/
|
56
|
public void tearDown() {
|
57
|
|
58
|
}
|
59
|
|
60
|
/**
|
61
|
* Create a suite of tests to be run together
|
62
|
*/
|
63
|
public static Test suite()
|
64
|
{
|
65
|
TestSuite suite = new TestSuite();
|
66
|
suite.addTest(new SystemMetadataFactoryTest("initialize"));
|
67
|
suite.addTest(new SystemMetadataFactoryTest("getDefaultReplicationPolicy"));
|
68
|
return suite;
|
69
|
}
|
70
|
|
71
|
/**
|
72
|
* Run an initial test that always passes to check that the test harness is
|
73
|
* working.
|
74
|
*/
|
75
|
public void initialize()
|
76
|
{
|
77
|
assertTrue(1 == 1);
|
78
|
}
|
79
|
|
80
|
public void getDefaultReplicationPolicy() throws Exception {
|
81
|
ReplicationPolicy rp = SystemMetadataFactory.getDefaultReplicationPolicy();
|
82
|
assertNotNull(rp);
|
83
|
assertTrue(!rp.getReplicationAllowed());
|
84
|
assertTrue(rp.getNumberReplicas() >= 0);
|
85
|
}
|
86
|
}
|