Revision 9144
Added by Jing Tao over 9 years ago
test/edu/ucsb/nceas/metacat/dataone/v1/CNodeV1ServiceTest.java | ||
---|---|---|
97 | 97 |
suite.addTest(new CNodeV1ServiceTest("testGetFormat")); |
98 | 98 |
suite.addTest(new CNodeV1ServiceTest("testGetLogRecords"));*/ |
99 | 99 |
suite.addTest(new CNodeV1ServiceTest("testGetSystemMetadata")); |
100 |
suite.addTest(new CNodeV1ServiceTest("testGetFormat")); |
|
100 | 101 |
/*suite.addTest(new CNodeV1ServiceTest("testIsAuthorized")); |
101 | 102 |
suite.addTest(new CNodeV1ServiceTest("testListFormats")); |
102 | 103 |
suite.addTest(new CNodeV1ServiceTest("testListNodes")); |
... | ... | |
110 | 111 |
suite.addTest(new CNodeV1ServiceTest("testSetOwner")); |
111 | 112 |
suite.addTest(new CNodeV1ServiceTest("readDeletedObject")); |
112 | 113 |
suite.addTest(new CNodeV1ServiceTest("testGetSID"));*/ |
113 |
|
|
114 | 114 |
return suite; |
115 | 115 |
} |
116 | 116 |
|
... | ... | |
143 | 143 |
} |
144 | 144 |
} |
145 | 145 |
|
146 |
|
|
146 |
public void testGetFormat() { |
|
147 |
// make sure we are set up |
|
148 |
setUpFormats(); |
|
149 |
|
|
150 |
String knownFormat = "text/plain"; |
|
151 |
ObjectFormatIdentifier fmtid = new ObjectFormatIdentifier(); |
|
152 |
fmtid.setValue(knownFormat); |
|
153 |
try { |
|
154 |
|
|
155 |
ObjectFormat format = CNodeService.getInstance(request).getFormat(fmtid); |
|
156 |
assertTrue( format instanceof org.dataone.service.types.v1.ObjectFormat); |
|
157 |
assertFalse( format instanceof org.dataone.service.types.v2.ObjectFormat); |
|
158 |
System.out.println("=== the class name is "+format.getClass().getName()); |
|
159 |
String result = format.getFormatId().getValue(); |
|
160 |
System.out.println("Expected result: " + knownFormat); |
|
161 |
System.out.println("Found result: " + result); |
|
162 |
assertTrue(result.equals(knownFormat)); |
|
163 |
|
|
164 |
} catch (Exception npe) { |
|
165 |
fail("Can't get the returned format : " + npe.getMessage()); |
|
166 |
|
|
167 |
} |
|
168 |
} |
|
147 | 169 |
|
148 | 170 |
|
149 | 171 |
|
Also available in: Unified diff
Add a test method to test v1.getFormat.