Search in sources :

Example 11 with ObjectFactory

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory in project ddf by codice.

the class CswSubscriptionEndpointTest method testCreateOrUpdateSubscriptionPersitanceFalse.

@Test
public void testCreateOrUpdateSubscriptionPersitanceFalse() throws Exception {
    ObjectFactory objectFactory = new ObjectFactory();
    GetRecordsType getRecordsType = createDefaultGetRecordsRequest().get202RecordsType();
    QueryType queryType = new QueryType();
    getRecordsType.setAbstractQuery(objectFactory.createQuery(queryType));
    cswSubscriptionEndpoint.createOrUpdateSubscription(getRecordsType, subscriptionId, false);
    verify(mockContext).registerService(eq(Subscription.class.getName()), any(Subscription.class), any(Dictionary.class));
}
Also used : Dictionary(java.util.Dictionary) ObjectFactory(net.opengis.cat.csw.v_2_0_2.ObjectFactory) GetRecordsType(net.opengis.cat.csw.v_2_0_2.GetRecordsType) Subscription(ddf.catalog.event.Subscription) CswSubscription(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.event.CswSubscription) QueryType(net.opengis.cat.csw.v_2_0_2.QueryType) Test(org.junit.Test)

Example 12 with ObjectFactory

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory in project ddf by codice.

the class CswQueryFactoryTest method setUp.

@org.junit.Before
public void setUp() throws URISyntaxException, SourceUnavailableException, UnsupportedQueryException, FederationException, ParseException, IngestException {
    filterBuilder = new GeotoolsFilterBuilder();
    FilterAdapter filterAdapter = new GeotoolsFilterAdapterImpl();
    metacardTypeList = new ArrayList<>();
    queryFactory = new CswQueryFactory(filterBuilder, filterAdapter, getCswMetacardType(), metacardTypeList);
    AttributeRegistry mockAttributeRegistry = mock(AttributeRegistry.class);
    when(mockAttributeRegistry.lookup(TITLE_TEST_ATTRIBUTE)).thenReturn(Optional.of(mock(AttributeDescriptor.class)));
    queryFactory.setAttributeRegistry(mockAttributeRegistry);
    polygon = new WKTReader().read(POLYGON_STR);
    gmlObjectFactory = new net.opengis.gml.v_3_1_1.ObjectFactory();
    filterObjectFactory = new ObjectFactory();
}
Also used : ObjectFactory(net.opengis.filter.v_1_1_0.ObjectFactory) AttributeRegistry(ddf.catalog.data.AttributeRegistry) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) FilterAdapter(ddf.catalog.filter.FilterAdapter) GeotoolsFilterAdapterImpl(ddf.catalog.filter.proxy.adapter.GeotoolsFilterAdapterImpl) WKTReader(com.vividsolutions.jts.io.WKTReader)

Example 13 with ObjectFactory

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory in project midpoint by Evolveum.

the class Main method createUserQuery2.

private static QueryType createUserQuery2(String username) throws JAXBException {
    QueryType query = new QueryType();
    SearchFilterType filter = new SearchFilterType();
    PropertyComplexValueFilterClauseType fc = new PropertyComplexValueFilterClauseType();
    ItemPathType path = new ItemPathType();
    path.setValue("declare namespace c=\"http://midpoint.evolveum.com/xml/ns/public/common/common-3\"; c:name");
    fc.setPath(path);
    fc.getValue().add(username);
    ObjectFactory factory = new ObjectFactory();
    JAXBElement<PropertyComplexValueFilterClauseType> equal = factory.createEqual(fc);
    JAXBContext jaxbContext = JAXBContext.newInstance("com.evolveum.midpoint.xml.ns._public.common.api_types_3:" + "com.evolveum.midpoint.xml.ns._public.common.common_3:" + "com.evolveum.prism.xml.ns._public.annotation_3:" + "com.evolveum.prism.xml.ns._public.query_3:" + "com.evolveum.prism.xml.ns._public.types_3:");
    Marshaller marshaller = jaxbContext.createMarshaller();
    DOMResult result = new DOMResult();
    marshaller.marshal(equal, result);
    filter.setFilterClause(((Document) result.getNode()).getDocumentElement());
    query.setFilter(filter);
    return query;
}
Also used : Marshaller(javax.xml.bind.Marshaller) SearchFilterType(com.evolveum.prism.xml.ns._public.query_3.SearchFilterType) DOMResult(javax.xml.transform.dom.DOMResult) ObjectFactory(com.evolveum.prism.xml.ns._public.query_3.ObjectFactory) ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) PropertyComplexValueFilterClauseType(com.evolveum.prism.xml.ns._public.query_3.PropertyComplexValueFilterClauseType) JAXBContext(javax.xml.bind.JAXBContext) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType)

Example 14 with ObjectFactory

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory in project ddf by codice.

the class TestCswFilterDelegate method testFeatureIdOr.

@Test
public void testFeatureIdOr() throws JAXBException, SAXException, IOException, XpathException {
    ObjectFactory filterObjectFactory = new ObjectFactory();
    FeatureIdType fidType = new FeatureIdType();
    fidType.setFid("cswRecord.1234");
    List<JAXBElement<? extends AbstractIdType>> fidFilters = new ArrayList<>();
    fidFilters.add(filterObjectFactory.createFeatureId(fidType));
    FilterType idFilter = new FilterType();
    idFilter.setId(fidFilters);
    FeatureIdType fidType2 = new FeatureIdType();
    fidType2.setFid("cswRecord.5678");
    List<JAXBElement<? extends AbstractIdType>> fidFilters2 = new ArrayList<>();
    fidFilters2.add(filterObjectFactory.createFeatureId(fidType2));
    FilterType idFilter2 = new FilterType();
    idFilter2.setId(fidFilters2);
    List<FilterType> filters = new ArrayList<>();
    filters.add(idFilter);
    filters.add(idFilter2);
    FilterType filterType = cswFilterDelegateLatLon.or(filters);
    String xml = getXmlFromMarshaller(filterType);
    assertXpathExists("/ogc:Filter/ogc:FeatureId[@fid='cswRecord.1234']", xml);
    assertXpathExists("/ogc:Filter/ogc:FeatureId[@fid='cswRecord.5678']", xml);
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) ObjectFactory(net.opengis.filter.v_1_1_0.ObjectFactory) ArrayList(java.util.ArrayList) JAXBElement(javax.xml.bind.JAXBElement) AbstractIdType(net.opengis.filter.v_1_1_0.AbstractIdType) FeatureIdType(net.opengis.filter.v_1_1_0.FeatureIdType) Test(org.junit.Test)

Example 15 with ObjectFactory

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory in project ddf by codice.

the class TestCswFilterDelegate method testFeatureIdAndComparisonOpsOr.

@Test(expected = UnsupportedOperationException.class)
public void testFeatureIdAndComparisonOpsOr() throws JAXBException, SAXException, IOException {
    ObjectFactory filterObjectFactory = new ObjectFactory();
    FeatureIdType fidType = new FeatureIdType();
    fidType.setFid("cswRecord.1234");
    List<JAXBElement<? extends AbstractIdType>> fidFilters = new ArrayList<>();
    fidFilters.add(filterObjectFactory.createFeatureId(fidType));
    FilterType idFilter = new FilterType();
    idFilter.setId(fidFilters);
    FilterType propertyIsLikeFilter = cswFilterDelegateLatLon.propertyIsLike(propertyName, likeLiteral, isCaseSensitive);
    List<FilterType> filterList = new ArrayList<>();
    filterList.add(idFilter);
    filterList.add(propertyIsLikeFilter);
    cswFilterDelegateLatLon.or(filterList);
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) ObjectFactory(net.opengis.filter.v_1_1_0.ObjectFactory) ArrayList(java.util.ArrayList) JAXBElement(javax.xml.bind.JAXBElement) AbstractIdType(net.opengis.filter.v_1_1_0.AbstractIdType) FeatureIdType(net.opengis.filter.v_1_1_0.FeatureIdType) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)15 JAXBElement (javax.xml.bind.JAXBElement)13 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)13 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)11 Marshaller (javax.xml.bind.Marshaller)10 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)10 StringWriter (java.io.StringWriter)9 BigInteger (java.math.BigInteger)9 JAXBContext (javax.xml.bind.JAXBContext)9 QName (javax.xml.namespace.QName)9 ObjectFactory (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory)8 ArrayList (java.util.ArrayList)7 Holder (javax.xml.ws.Holder)7 ObjectFactory (org.apache.type_test.types3.ObjectFactory)7 ItemPathType (com.evolveum.prism.xml.ns._public.types_3.ItemPathType)6 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)6 Book (biblemulticonverter.data.Book)5 XStream (com.thoughtworks.xstream.XStream)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5 Ignore (jdk.nashorn.internal.ir.annotations.Ignore)5