Project

General

Profile

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

    
26
package edu.ucsb.nceas.metacat.dataone.v1;
27

    
28
import java.io.IOException;
29
import java.io.InputStream;
30
import java.io.InputStreamReader;
31
import java.io.Reader;
32
import java.math.BigInteger;
33
import java.util.Date;
34
import java.util.List;
35

    
36
import junit.framework.Test;
37
import junit.framework.TestSuite;
38

    
39
import org.apache.wicket.protocol.http.mock.MockHttpServletRequest;
40
import org.dataone.client.D1Node;
41
import org.dataone.client.NodeLocator;
42
import org.dataone.client.exception.ClientSideException;
43
import org.dataone.service.types.v1.AccessPolicy;
44
import org.dataone.service.types.v1.AccessRule;
45
import org.dataone.service.types.v1.Checksum;
46
import org.dataone.service.types.v1.Identifier;
47
import org.dataone.service.types.v2.Node;
48
import org.dataone.service.types.v2.ObjectFormatList;
49
import org.dataone.service.types.v1.NodeReference;
50
import org.dataone.service.types.v1.NodeType;
51
import org.dataone.service.types.v1.Permission;
52
import org.dataone.service.types.v1.Session;
53
import org.dataone.service.types.v1.Subject;
54
import org.dataone.service.types.v1.SystemMetadata;
55
import org.dataone.service.types.v1.util.ChecksumUtil;
56
import org.dataone.service.util.Constants;
57
import org.dataone.service.util.TypeMarshaller;
58

    
59
import edu.ucsb.nceas.MCTestCase;
60
import edu.ucsb.nceas.metacat.client.Metacat;
61
import edu.ucsb.nceas.metacat.client.MetacatFactory;
62
import edu.ucsb.nceas.metacat.dataone.D1NodeServiceTest;
63

    
64
/**
65
 * A JUnit superclass for testing the dataone Node implementations
66
 */
67
public class D1NodeV1ServiceTest extends D1NodeServiceTest {   
68
    
69
    protected MockHttpServletRequest request;
70

    
71
	/**
72
    * constructor for the test
73
    */
74
    public D1NodeV1ServiceTest(String name) {
75
        super(name);
76
        // set up the fake request (for logging)
77
        request = new MockHttpServletRequest(null, null, null);
78
    }
79
  
80
   
81
    public static Test suite() 
82
    {
83
        TestSuite suite = new TestSuite();
84
        suite.addTest(new D1NodeV1ServiceTest("initialize"));
85
        return suite;
86
    }
87
	
88
    public void initialize() {
89
        assertTrue(true);
90
    }
91
	
92
	/**
93
	 * create system metadata with a specified id
94
	 */
95
	public SystemMetadata createV1SystemMetadata(Identifier id, Subject owner, InputStream object)
96
	  throws Exception
97
	{
98
	    org.dataone.service.types.v2.SystemMetadata v2Sysmeta = super.createSystemMetadata(id, owner, object);
99
	    SystemMetadata sm = TypeMarshaller.convertTypeFromType(v2Sysmeta, SystemMetadata.class);
100
        return sm;
101
	}
102
	
103
 
104
}
(2-2/2)