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

    
56
import edu.ucsb.nceas.MCTestCase;
57
import edu.ucsb.nceas.metacat.client.Metacat;
58
import edu.ucsb.nceas.metacat.client.MetacatFactory;
59
import edu.ucsb.nceas.metacat.dataone.D1NodeServiceTest;
60

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

    
68
	/**
69
    * constructor for the test
70
    */
71
    public D1NodeV1ServiceTest(String name) {
72
        super(name);
73
        // set up the fake request (for logging)
74
        request = new MockHttpServletRequest(null, null, null);
75
    }
76
  
77
   
78
	
79
	
80
	/**
81
	 * create system metadata with a specified id
82
	 */
83
	public SystemMetadata createV1SystemMetadata(Identifier id, Subject owner, InputStream object)
84
	  throws Exception
85
	{
86
	    org.dataone.service.types.v2.SystemMetadata v2Sysmeta = super.createSystemMetadata(id, owner, object);
87
	    SystemMetadata sm = TypeMarshaller.convertTypeFromType(v2Sysmeta, SystemMetadata.class);
88
        return sm;
89
	}
90
	
91
 
92
}
(2-2/2)