use of com.thoughtworks.xstream.converters.MarshallingContext in project ddf by codice.
the class TestCswRecordConverter method testMarshalRecordWithNamespaces.
@Test
public void testMarshalRecordWithNamespaces() throws IOException, JAXBException, SAXException, XpathException {
Metacard metacard = getTestMetacard();
StringWriter stringWriter = new StringWriter();
PrettyPrintWriter writer = new PrettyPrintWriter(stringWriter);
MarshallingContext context = new TreeMarshaller(writer, null, null);
context.put(CswConstants.WRITE_NAMESPACES, true);
converter.marshal(metacard, writer, context);
String xml = stringWriter.toString();
XMLUnit.setIgnoreWhitespace(true);
assertXMLEqual(getControlRecord(), xml);
}
use of com.thoughtworks.xstream.converters.MarshallingContext in project ddf by codice.
the class TestCswRecordConverter method testMarshalRecord.
@Test
public void testMarshalRecord() throws IOException, JAXBException, SAXException, XpathException {
Metacard metacard = getTestMetacard();
StringWriter stringWriter = new StringWriter();
PrettyPrintWriter writer = new PrettyPrintWriter(stringWriter);
MarshallingContext context = new TreeMarshaller(writer, null, null);
converter.marshal(metacard, writer, context);
String xml = stringWriter.toString();
assertThat(xml, containsString(CswConstants.CSW_RECORD));
assertRecordXml(xml, metacard, FULL);
}
use of com.thoughtworks.xstream.converters.MarshallingContext in project ddf by codice.
the class TestCswRecordConverter method testMarshalSummaryRecord.
@Test
public void testMarshalSummaryRecord() throws IOException, JAXBException, SAXException, XpathException {
Metacard metacard = getTestMetacard();
StringWriter stringWriter = new StringWriter();
PrettyPrintWriter writer = new PrettyPrintWriter(stringWriter);
MarshallingContext context = new TreeMarshaller(writer, null, null);
context.put(CswConstants.ELEMENT_SET_TYPE, ElementSetType.SUMMARY);
converter.marshal(metacard, writer, context);
String xml = stringWriter.toString();
assertThat(xml, containsString(CswConstants.CSW_SUMMARY_RECORD));
assertRecordXml(xml, metacard, SUMMARY);
}
Aggregations