use of net.opengis.cat.csw.v_2_0_2.GetRecordByIdResponseType in project ddf by codice.
the class TestGetRecordsResponseConverter method testMarshalRecordCollectionById.
@Ignore
public void testMarshalRecordCollectionById() throws UnsupportedEncodingException, JAXBException {
final int totalResults = 2;
XStream xstream = createXStream(CswConstants.GET_RECORD_BY_ID_RESPONSE);
CswRecordCollection collection = createCswRecordCollection(null, totalResults);
collection.setById(true);
ArgumentCaptor<MarshallingContext> captor = ArgumentCaptor.forClass(MarshallingContext.class);
String xml = xstream.toXML(collection);
// Verify the context arguments were set correctly
verify(mockProvider, times(totalResults)).marshal(any(Object.class), any(HierarchicalStreamWriter.class), captor.capture());
MarshallingContext context = captor.getValue();
assertThat(context, not(nullValue()));
assertThat(context.get(CswConstants.OUTPUT_SCHEMA_PARAMETER), is(CswConstants.CSW_OUTPUT_SCHEMA));
assertThat(context.get(CswConstants.ELEMENT_SET_TYPE), is(nullValue()));
assertThat(context.get(CswConstants.ELEMENT_NAMES), is(nullValue()));
JAXBElement<GetRecordByIdResponseType> jaxb = (JAXBElement<GetRecordByIdResponseType>) getJaxBContext().createUnmarshaller().unmarshal(new ByteArrayInputStream(xml.getBytes("UTF-8")));
GetRecordByIdResponseType response = jaxb.getValue();
// Assert the GetRecordsResponse elements and attributes
assertThat(response, not(nullValue()));
}
Aggregations