Project

General

Profile

1
/*  '$RCSfile$'
2
 *  Copyright: 2010 Regents of the University of California and the
3
 *              National Center for Ecological Analysis and Synthesis
4
 *  Purpose: To test the Access Controls in metacat by JUnit
5
 *
6
 *   '$Author: berkley $'
7
 *     '$Date: 2010-05-03 14:26:08 -0700 (Fri, 14 Aug 2009) $'
8
 * '$Revision: 5027 $'
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 edu.ucsb.nceas.MCTestCase;
28
import junit.framework.Test;
29
import junit.framework.TestSuite;
30

    
31
import org.dataone.service.types.*;
32

    
33
/**
34
 * A JUnit test for testing the dataone MetadataTypeRegister class
35
 */
36
public class MetadataTypeRegisterTest extends MCTestCase 
37
{   
38
    private int createCount = 0;
39
    
40
    /**
41
    * consstructor for the test
42
    */
43
    public MetadataTypeRegisterTest(String name)
44
    {
45
        super(name);
46
    }
47
  
48
    /**
49
     * Establish a testing framework by initializing appropriate objects
50
     */
51
    public void setUp() throws Exception 
52
    {
53
        super.setUp();
54
    }
55

    
56
    /**
57
     * Release any objects after tests are complete
58
     */
59
    public void tearDown() 
60
    {
61
        System.out.println(createCount + " docs created in this test session.");
62
    }
63

    
64
    /**
65
     * Create a suite of tests to be run together
66
     */
67
    public static Test suite() 
68
    {
69
        TestSuite suite = new TestSuite();
70
        suite.addTest(new MetadataTypeRegisterTest("testIsMetadataType"));
71
        return suite;
72
    }
73
    
74
    /**
75
     * MetadataTypeRegister.isMetadataType()
76
     */
77
    public void testIsMetadataType()
78
    {
79
        ObjectFormat of = ObjectFormat.convert("XXXX");
80
        assertFalse(MetadataTypeRegister.isMetadataType(of));
81
        
82
        of = ObjectFormat.convert("eml://ecoinformatics.org/eml-2.0.0");
83
        assertTrue(MetadataTypeRegister.isMetadataType(of));
84
        
85
        of = ObjectFormat.convert("http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2");
86
        assertTrue(MetadataTypeRegister.isMetadataType(of));
87
        
88
        of = ObjectFormat.convert("CF-1.3");
89
        assertTrue(MetadataTypeRegister.isMetadataType(of));
90
        
91
        of = ObjectFormat.convert("http://www.loc.gov/METS/");
92
        assertTrue(MetadataTypeRegister.isMetadataType(of));
93
        
94
        of = ObjectFormat.convert("eml://ecoinformatics.org/eml-3.0.0");
95
        assertFalse(MetadataTypeRegister.isMetadataType(of));
96
    }
97
}
(2-2/3)