use of com.thoughtworks.xstream.io.xml.Xpp3Driver in project ddf by codice.
the class TransactionMessageBodyReader method readFrom.
@Override
public CswTransactionRequest readFrom(Class<CswTransactionRequest> aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> multivaluedMap, InputStream inputStream) throws IOException, WebApplicationException {
XStream xStream = new XStream(new Xpp3Driver());
TransactionRequestConverter transactionRequestConverter = new TransactionRequestConverter(cswRecordConverter, registry);
transactionRequestConverter.setCswRecordConverter(new CswRecordConverter(metacardType));
xStream.registerConverter(transactionRequestConverter);
xStream.alias("csw:" + CswConstants.TRANSACTION, CswTransactionRequest.class);
xStream.alias(CswConstants.TRANSACTION, CswTransactionRequest.class);
return (CswTransactionRequest) xStream.fromXML(inputStream);
}
use of com.thoughtworks.xstream.io.xml.Xpp3Driver in project ddf by codice.
the class TestTransactionRequestConverter method setup.
@Before
public void setup() {
cswRecordConverter = mock(Converter.class);
when(cswRecordConverter.canConvert(any())).thenReturn(true);
new CoreAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
new ContactAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
new LocationAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
new MediaAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
new TopicAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
new AssociationsAttributes().getAttributeDescriptors().stream().forEach(d -> mockRegistry.register(d));
xStream = new XStream(new Xpp3Driver());
xStream.registerConverter(new TransactionRequestConverter(cswRecordConverter, mockRegistry));
xStream.alias(CswConstants.CSW_TRANSACTION, CswTransactionRequest.class);
}
Aggregations