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.util;
26

    
27
import java.util.*;
28
import java.io.*;
29

    
30
import java.security.MessageDigest;
31

    
32
import edu.ucsb.nceas.MCTestCase;
33
import edu.ucsb.nceas.metacat.IdentifierManager;
34
import edu.ucsb.nceas.metacat.client.MetacatAuthException;
35
import edu.ucsb.nceas.metacat.client.MetacatException;
36
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException;
37
import edu.ucsb.nceas.metacat.util.MetacatPopulator;
38
import edu.ucsb.nceas.metacat.dataone.CrudService;
39
import junit.framework.Test;
40
import junit.framework.TestSuite;
41

    
42
import org.dataone.service.exceptions.InvalidRequest;
43
import org.dataone.service.exceptions.InvalidToken;
44
import org.dataone.service.exceptions.NotAuthorized;
45
import org.dataone.service.exceptions.NotImplemented;
46
import org.dataone.service.exceptions.ServiceFailure;
47
import org.dataone.service.types.*;
48

    
49
import edu.ucsb.nceas.metacat.properties.PropertyService;
50
import edu.ucsb.nceas.metacat.client.rest.MetacatRestClient;
51

    
52
import edu.ucsb.nceas.metacat.service.SessionService;
53
import edu.ucsb.nceas.metacat.util.SessionData;
54

    
55
/**
56
 * A JUnit test for testing the dataone MetacatPopulator class
57
 */
58
public class MetacatPopulatorTest extends MCTestCase 
59
{   
60
    /**
61
    * consstructor for the test
62
    */
63
    public MetacatPopulatorTest(String name)
64
    {
65
        super(name);
66
    }
67
  
68
    /**
69
     * Establish a testing framework by initializing appropriate objects
70
     */
71
    public void setUp() throws Exception 
72
    {
73
        super.setUp();
74
    }
75

    
76
    /**
77
     * Release any objects after tests are complete
78
     */
79
    public void tearDown() 
80
    {
81
    }
82

    
83
    /**
84
     * Create a suite of tests to be run together
85
     */
86
    public static Test suite() 
87
    {
88
        TestSuite suite = new TestSuite();
89
        suite.addTest(new MetacatPopulatorTest("initialize"));
90
        suite.addTest(new MetacatPopulatorTest("testPopulate"));
91
        
92
        return suite;
93
    }
94
    
95
    public void testPopulate()
96
    {
97
        try
98
        {
99
            //ids to upload to knb-mn:
100
            //connolly.301, kgordon.17.27
101
            MetacatPopulator mp = new MetacatPopulator(
102
                    "http://knb.ecoinformatics.org/knb", 
103
                    /*"http://localhost:8080/knb"*/
104
                    "http://knb-mn.ecoinformatics.org/knb", 
105
                    /*"msucci"*/"connolly.301", "uid=kepler,o=unaffiliated,dc=ecoinformatics,dc=org", "kepler");
106
            mp.populate();
107
        }
108
        catch(Exception e)
109
        {
110
            e.printStackTrace();
111
            fail("Error: " + e.getMessage());
112
        }
113
    }
114
    
115
    /**
116
     * init
117
     */
118
    public void initialize()
119
    {
120
        assertTrue(1==1);
121
    }
122
}
    (1-1/1)