Revision 6942
Added by Chris Jones almost 13 years ago
test/edu/ucsb/nceas/metacat/dataone/MNodeServiceTest.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
|
29 | 29 |
import java.io.ByteArrayInputStream; |
30 |
import java.io.ByteArrayOutputStream; |
|
31 |
import java.io.IOException; |
|
30 | 32 |
import java.io.InputStream; |
31 | 33 |
import java.io.UnsupportedEncodingException; |
32 | 34 |
import java.text.SimpleDateFormat; |
... | ... | |
40 | 42 |
import org.dataone.configuration.Settings; |
41 | 43 |
import org.dataone.service.util.Constants; |
42 | 44 |
import org.dataone.service.util.DateTimeMarshaller; |
45 |
import org.dataone.service.util.TypeMarshaller; |
|
43 | 46 |
import org.dataone.service.exceptions.IdentifierNotUnique; |
44 | 47 |
import org.dataone.service.exceptions.InsufficientResources; |
45 | 48 |
import org.dataone.service.exceptions.InvalidRequest; |
... | ... | |
67 | 70 |
import org.dataone.service.types.v1.Session; |
68 | 71 |
import org.dataone.service.types.v1.Subject; |
69 | 72 |
import org.dataone.service.types.v1.SystemMetadata; |
73 |
import org.jibx.runtime.JiBXException; |
|
70 | 74 |
import org.junit.After; |
71 | 75 |
import org.junit.Before; |
72 | 76 |
|
... | ... | |
670 | 674 |
printTestHeader("testGetCapabilities"); |
671 | 675 |
try { |
672 | 676 |
Node node = MNodeService.getInstance(request).getCapabilities(); |
677 |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
|
678 |
TypeMarshaller.marshalTypeToOutputStream(node, baos); |
|
673 | 679 |
assertNotNull(node); |
674 | 680 |
// TODO: should probably test other parts of the node information |
681 |
|
|
682 |
} catch (JiBXException e) { |
|
683 |
e.printStackTrace(); |
|
684 |
fail("The node instance couldn't be parsed correctly:" + e.getMessage()); |
|
685 |
|
|
686 |
} catch (IOException e) { |
|
687 |
e.printStackTrace(); |
|
688 |
fail("The node instance couldn't be read correctly:" + e.getMessage()); |
|
689 |
|
|
675 | 690 |
} catch (Exception e) { |
676 |
e.printStackTrace(); |
|
677 |
fail("Probably not yet implemented: " + e.getMessage()); |
|
691 |
e.printStackTrace(); |
|
692 |
fail("Probably not yet implemented: " + e.getMessage()); |
|
693 |
|
|
678 | 694 |
} |
679 | 695 |
|
680 | 696 |
} |
Also available in: Unified diff
Update the MNodeServiceTest to test the validity of the node document returned by getCapabilities() by parsing it with the TypeMarshaller.