Revision 4080
Added by daigle about 16 years ago
MetacatClientTest.java | ||
---|---|---|
39 | 39 |
import java.util.TimeZone; |
40 | 40 |
|
41 | 41 |
import edu.ucsb.nceas.metacat.DocumentImpl; |
42 |
import edu.ucsb.nceas.metacat.MetaCatUtil; |
|
43 | 42 |
import edu.ucsb.nceas.metacat.client.DocumentNotFoundException; |
44 | 43 |
import edu.ucsb.nceas.metacat.client.InsufficientKarmaException; |
45 | 44 |
import edu.ucsb.nceas.metacat.client.Metacat; |
... | ... | |
47 | 46 |
import edu.ucsb.nceas.metacat.client.MetacatException; |
48 | 47 |
import edu.ucsb.nceas.metacat.client.MetacatFactory; |
49 | 48 |
import edu.ucsb.nceas.metacat.client.MetacatInaccessibleException; |
49 |
import edu.ucsb.nceas.metacat.service.PropertyService; |
|
50 |
import edu.ucsb.nceas.metacat.util.MetaCatUtil; |
|
51 |
import edu.ucsb.nceas.metacat.util.SystemUtil; |
|
50 | 52 |
import edu.ucsb.nceas.utilities.IOUtil; |
51 |
import edu.ucsb.nceas.utilities.Options;
|
|
53 |
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
|
|
52 | 54 |
import junit.framework.Test; |
53 | 55 |
import junit.framework.TestCase; |
54 | 56 |
import junit.framework.TestSuite; |
... | ... | |
61 | 63 |
*/ |
62 | 64 |
public class MetacatClientTest extends TestCase |
63 | 65 |
{ |
64 |
/* Initialize Options*/ |
|
65 |
static |
|
66 |
{ |
|
67 |
try |
|
68 |
{ |
|
69 |
Options.initialize(new File("build/tests/metacat.properties")); |
|
70 |
MetaCatUtil.pathsForIndexing |
|
71 |
= MetaCatUtil.getOptionList(MetaCatUtil.getOption("indexPaths")); |
|
72 |
} |
|
73 |
catch(Exception e) |
|
74 |
{ |
|
75 |
System.err.println("Exception in initialize option in MetacatServletNetTest "+e.getMessage()); |
|
76 |
} |
|
77 |
} |
|
78 |
private String metacatUrl = MetaCatUtil.getOption("metacatUrl"); |
|
66 |
|
|
79 | 67 |
private String wrongMetacatUrl= |
80 |
"http://somepalce.somewhere.com/some/servlet/metacat"; |
|
81 |
private String username = MetaCatUtil.getOption("mcuser"); |
|
82 |
private String password = MetaCatUtil.getOption("mcpassword"); |
|
83 |
private String anotheruser = MetaCatUtil.getOption("mcanotheruser"); |
|
84 |
private String anotherpassword = MetaCatUtil.getOption("mcanotherpassword"); |
|
68 |
"http://somepalce.somewhere.com/some/servlet/metacat"; |
|
69 |
|
|
70 |
private static String metacatUrl; |
|
71 |
private static String username; |
|
72 |
private static String password; |
|
73 |
private static String anotheruser; |
|
74 |
private static String anotherpassword; |
|
75 |
static { |
|
76 |
try { |
|
77 |
metacatUrl = SystemUtil.getServletURL(); |
|
78 |
username = PropertyService.getProperty("mcuser"); |
|
79 |
password = PropertyService.getProperty("mcpassword"); |
|
80 |
anotheruser = PropertyService.getProperty("mcanotheruser"); |
|
81 |
anotherpassword = PropertyService.getProperty("mcanotherpassword"); |
|
82 |
} catch (PropertyNotFoundException pnfe) { |
|
83 |
System.err.println("Could not get property in static block: " |
|
84 |
+ pnfe.getMessage()); |
|
85 |
} |
|
86 |
} |
|
85 | 87 |
private String failpass = "uidfnkj43987yfdn"; |
86 | 88 |
private String prefix = "test"; |
87 | 89 |
private String newdocid = null; |
Also available in: Unified diff
Merge 1.9 changes into Head