Search in sources :

Example 6 with PrintWriterProviderImpl

use of ddf.catalog.transformer.xml.PrintWriterProviderImpl in project ddf by codice.

the class TestXmlResponseQueueTransformer method testMetacardMarshallThrowsXmlPullParserException.

@Test(expected = CatalogTransformerException.class)
public void testMetacardMarshallThrowsXmlPullParserException() throws IOException, CatalogTransformerException, XmlPullParserException, MimeTypeParseException {
    SourceResponse response = givenSourceResponse(new MetacardStub("source1", "id1"));
    PrintWriterProvider pwp = new PrintWriterProviderImpl();
    MetacardMarshaller mockMetacardMarshaller = mock(MetacardMarshaller.class);
    when(mockMetacardMarshaller.marshal(any(Metacard.class), any(Map.class))).thenThrow(new XmlPullParserException(""));
    XmlResponseQueueTransformer xrqt = new XmlResponseQueueTransformer(parser, FJP, pwp, mockMetacardMarshaller, getMimeType());
    xrqt.setThreshold(2);
    BinaryContent bc = xrqt.transform(response, null);
// then exception
}
Also used : Metacard(ddf.catalog.data.Metacard) PrintWriterProvider(ddf.catalog.transformer.api.PrintWriterProvider) SourceResponse(ddf.catalog.operation.SourceResponse) MetacardMarshaller(ddf.catalog.transformer.api.MetacardMarshaller) PrintWriterProviderImpl(ddf.catalog.transformer.xml.PrintWriterProviderImpl) XmlResponseQueueTransformer(ddf.catalog.transformer.xml.XmlResponseQueueTransformer) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) BinaryContent(ddf.catalog.data.BinaryContent) Map(java.util.Map) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

MetacardMarshaller (ddf.catalog.transformer.api.MetacardMarshaller)6 PrintWriterProviderImpl (ddf.catalog.transformer.xml.PrintWriterProviderImpl)6 BinaryContent (ddf.catalog.data.BinaryContent)4 PrintWriterProvider (ddf.catalog.transformer.api.PrintWriterProvider)4 MetacardMarshallerImpl (ddf.catalog.transformer.xml.MetacardMarshallerImpl)4 XmlResponseQueueTransformer (ddf.catalog.transformer.xml.XmlResponseQueueTransformer)4 Test (org.junit.Test)4 SourceResponse (ddf.catalog.operation.SourceResponse)3 XmlParser (org.codice.ddf.parser.xml.XmlParser)3 Metacard (ddf.catalog.data.Metacard)2 XmlMetacardTransformer (ddf.catalog.transformer.xml.XmlMetacardTransformer)2 Parser (org.codice.ddf.parser.Parser)2 Before (org.junit.Before)2 Attribute (ddf.catalog.data.Attribute)1 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)1 InputTransformer (ddf.catalog.transform.InputTransformer)1 MetacardTransformer (ddf.catalog.transform.MetacardTransformer)1 XmlInputTransformer (ddf.catalog.transformer.xml.XmlInputTransformer)1 InputStream (java.io.InputStream)1 HashMap (java.util.HashMap)1