use of ddf.catalog.transformer.xml.XmlMetacardTransformer in project ddf by codice.
the class TestXmlMetacardTransformer method setup.
@Before
public void setup() {
Parser parser = new XmlParser();
MetacardMarshaller metacardMarshaller = new MetacardMarshallerImpl(parser, new PrintWriterProviderImpl());
transformer = new XmlMetacardTransformer(metacardMarshaller);
}
use of ddf.catalog.transformer.xml.XmlMetacardTransformer in project ddf by codice.
the class IntegrationTest method testInputAndOutput.
@Test
public void testInputAndOutput() throws CatalogTransformerException, IOException {
Parser parser = new XmlParser();
InputTransformer inputTransformer = new XmlInputTransformer(parser);
MetacardMarshaller metacardMarshaller = new MetacardMarshallerImpl(parser, new PrintWriterProviderImpl());
MetacardTransformer outputTransformer = new XmlMetacardTransformer(metacardMarshaller);
InputStream input = getClass().getResourceAsStream("/extensibleMetacard.xml");
Metacard metacard = inputTransformer.transform(input);
LOGGER.info("Attributes: ");
for (AttributeDescriptor descriptor : metacard.getMetacardType().getAttributeDescriptors()) {
Attribute attribute = metacard.getAttribute(descriptor.getName());
LOGGER.info("\t" + descriptor.getName() + ": " + ((attribute == null) ? attribute : attribute.getValue()));
}
BinaryContent output = outputTransformer.transform(metacard, mockArguments);
String outputString = new String(output.getByteArray());
// TODO test equivalence with XMLUnit.
LOGGER.info(outputString);
}
Aggregations