use of net.opengis.wfs.v_1_1_0.ObjectFactory in project cxf by apache.
the class AbstractTypeTestClient2 method testStructWithSubstitutionGroupNil.
@Test
public void testStructWithSubstitutionGroupNil() throws Exception {
if (!shouldRunTest("StructWithSubstitutionGroupNil")) {
return;
}
StructWithSubstitutionGroupNil x = new StructWithSubstitutionGroupNil();
ObjectFactory objectFactory = new ObjectFactory();
JAXBElement<? extends SgBaseTypeA> element = objectFactory.createSg04NillableBaseElementA(null);
x.setSg04NillableBaseElementA(element);
StructWithSubstitutionGroupNil yOrig = new StructWithSubstitutionGroupNil();
element = objectFactory.createSg04NillableBaseElementA(null);
yOrig.setSg04NillableBaseElementA(element);
Holder<StructWithSubstitutionGroupNil> y = new Holder<>(yOrig);
Holder<StructWithSubstitutionGroupNil> z = new Holder<>();
StructWithSubstitutionGroupNil ret;
if (testDocLiteral) {
ret = docClient.testStructWithSubstitutionGroupNil(x, y, z);
} else if (testXMLBinding) {
ret = xmlClient.testStructWithSubstitutionGroupNil(x, y, z);
} else {
ret = rpcClient.testStructWithSubstitutionGroupNil(x, y, z);
}
if (!perfTestOnly) {
assertTrue("testStructWithSubstitutionGroupNil(): Incorrect value for inout param", equals(x, y.value));
assertTrue("testStructWithSubstitutionGroupNil(): Incorrect value for out param", equals(yOrig, z.value));
assertTrue("testStructWithSubstitutionGroupNil(): Incorrect return value", equals(x, ret));
}
}
use of net.opengis.wfs.v_1_1_0.ObjectFactory in project ddf by codice.
the class GetRecordsResponseConverterTest method testMarshalRecordCollectionGetFull.
@Ignore
@Test
public void testMarshalRecordCollectionGetFull() throws UnsupportedEncodingException, JAXBException {
final int totalResults = 5;
XStream xstream = createXStream(CswConstants.GET_RECORDS_RESPONSE);
GetRecordsType getRecords = new GetRecordsType();
QueryType query = new QueryType();
ElementSetNameType set = new ElementSetNameType();
set.setValue(ElementSetType.FULL);
query.setElementSetName(set);
ObjectFactory objectFactory = new ObjectFactory();
getRecords.setAbstractQuery(objectFactory.createAbstractQuery(query));
CswRecordCollection collection = createCswRecordCollection(getRecords, totalResults);
collection.setElementSetType(ElementSetType.FULL);
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(ElementSetType.FULL));
JAXBElement<GetRecordsResponseType> jaxb = (JAXBElement<GetRecordsResponseType>) getJaxBContext().createUnmarshaller().unmarshal(new ByteArrayInputStream(xml.getBytes("UTF-8")));
GetRecordsResponseType response = jaxb.getValue();
// Assert the GetRecordsResponse elements and attributes
assertThat(response, not(nullValue()));
SearchResultsType resultsType = response.getSearchResults();
assertThat(resultsType, not(nullValue()));
assertThat(resultsType.getElementSet(), is(ElementSetType.FULL));
assertThat(resultsType.getNumberOfRecordsMatched().intValue(), is(totalResults));
assertThat(resultsType.getNumberOfRecordsReturned().intValue(), is(totalResults));
assertThat(resultsType.getRecordSchema(), is(CswConstants.CSW_OUTPUT_SCHEMA));
}
use of net.opengis.wfs.v_1_1_0.ObjectFactory in project ddf by codice.
the class GetRecordsResponseConverterTest method testMarshalRecordCollectionFullXml.
@Ignore
@Test
public void testMarshalRecordCollectionFullXml() throws UnsupportedEncodingException, JAXBException {
final int totalResults = 5;
TransformerManager mockMetacardManager = mock(TransformerManager.class);
when(mockMetacardManager.getTransformerBySchema(anyString())).thenReturn(new CswRecordConverter(CswRecordConverterTest.getCswMetacardType()));
GetRecordsResponseConverter rrConverter = new GetRecordsResponseConverter(new CswTransformProvider(mockMetacardManager, null));
XStream xstream = createXstream(new StaxDriver(new NoNameCoder()));
xstream.registerConverter(rrConverter);
xstream.alias(CswConstants.CSW_NAMESPACE_PREFIX + CswConstants.NAMESPACE_DELIMITER + CswConstants.GET_RECORDS_RESPONSE, CswRecordCollection.class);
GetRecordsType getRecords = new GetRecordsType();
QueryType query = new QueryType();
ElementSetNameType set = new ElementSetNameType();
set.setValue(ElementSetType.FULL);
query.setElementSetName(set);
ObjectFactory objectFactory = new ObjectFactory();
getRecords.setAbstractQuery(objectFactory.createAbstractQuery(query));
CswRecordCollection collection = createCswRecordCollection(getRecords, totalResults);
collection.setElementSetType(ElementSetType.FULL);
String xml = xstream.toXML(collection);
JAXBElement<GetRecordsResponseType> jaxb = (JAXBElement<GetRecordsResponseType>) getJaxBContext().createUnmarshaller().unmarshal(new ByteArrayInputStream(xml.getBytes("UTF-8")));
GetRecordsResponseType response = jaxb.getValue();
// Assert the GetRecordsResponse elements and attributes
assertThat(response, not(nullValue()));
SearchResultsType resultsType = response.getSearchResults();
assertThat(resultsType, not(nullValue()));
assertThat(resultsType.getElementSet(), is(ElementSetType.FULL));
assertThat(resultsType.getNumberOfRecordsMatched().intValue(), is(totalResults));
assertThat(resultsType.getNumberOfRecordsReturned().intValue(), is(totalResults));
assertThat(resultsType.getRecordSchema(), is(CswConstants.CSW_OUTPUT_SCHEMA));
}
use of net.opengis.wfs.v_1_1_0.ObjectFactory in project ddf by codice.
the class GetRecordsResponseConverterTest method testMarshalRecordCollectionGetSummary.
@Ignore
@Test
public void testMarshalRecordCollectionGetSummary() throws UnsupportedEncodingException, JAXBException {
final int totalResults = 5;
XStream xstream = createXStream(CswConstants.GET_RECORDS_RESPONSE);
GetRecordsType getRecords = new GetRecordsType();
QueryType query = new QueryType();
ElementSetNameType set = new ElementSetNameType();
set.setValue(ElementSetType.SUMMARY);
query.setElementSetName(set);
ObjectFactory objectFactory = new ObjectFactory();
getRecords.setAbstractQuery(objectFactory.createAbstractQuery(query));
CswRecordCollection collection = createCswRecordCollection(getRecords, totalResults);
collection.setElementSetType(ElementSetType.SUMMARY);
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(ElementSetType.SUMMARY));
JAXBElement<GetRecordsResponseType> jaxb = (JAXBElement<GetRecordsResponseType>) getJaxBContext().createUnmarshaller().unmarshal(new ByteArrayInputStream(xml.getBytes("UTF-8")));
GetRecordsResponseType response = jaxb.getValue();
// Assert the GetRecordsResponse elements and attributes
assertThat(response, not(nullValue()));
SearchResultsType resultsType = response.getSearchResults();
assertThat(resultsType, not(nullValue()));
assertThat(resultsType.getElementSet(), is(ElementSetType.SUMMARY));
assertThat(resultsType.getNumberOfRecordsMatched().intValue(), is(totalResults));
assertThat(resultsType.getNumberOfRecordsReturned().intValue(), is(totalResults));
assertThat(resultsType.getRecordSchema(), is(CswConstants.CSW_OUTPUT_SCHEMA));
}
use of net.opengis.wfs.v_1_1_0.ObjectFactory in project ddf by codice.
the class WfsSource method buildSortBy.
private SortByType buildSortBy(QName featureType, SortBy incomingSortBy) {
net.opengis.filter.v_1_1_0.ObjectFactory filterObjectFactory = new net.opengis.filter.v_1_1_0.ObjectFactory();
String propertyName = mapSortByPropertyName(featureType, incomingSortBy.getPropertyName().getPropertyName(), metacardMappers);
if (propertyName != null) {
SortOrder sortOrder = incomingSortBy.getSortOrder();
SortPropertyType sortPropertyType = filterObjectFactory.createSortPropertyType();
PropertyNameType propertyNameType = filterObjectFactory.createPropertyNameType();
List<Serializable> props = Arrays.asList(propertyName);
propertyNameType.setContent(props);
sortPropertyType.setPropertyName(propertyNameType);
if (SortOrder.ASCENDING.equals(sortOrder)) {
sortPropertyType.setSortOrder(SortOrderType.ASC);
} else if (SortOrder.DESCENDING.equals(sortOrder)) {
sortPropertyType.setSortOrder(SortOrderType.DESC);
} else {
LOGGER.debug("Unable to build query. Unknown sort order of [{}].", sortOrder == null ? null : sortOrder.identifier());
return null;
}
SortByType sortByType = filterObjectFactory.createSortByType();
sortByType.getSortProperty().add(sortPropertyType);
return sortByType;
}
return null;
}
Aggregations