Search in sources :

Example 1 with QueryFilterTransformerProvider

use of ddf.catalog.transform.QueryFilterTransformerProvider in project ddf by codice.

the class CswQueryFactoryTest method setUp.

@org.junit.Before
public void setUp() throws URISyntaxException, SourceUnavailableException, UnsupportedQueryException, FederationException, ParseException, IngestException {
    FilterBuilder filterBuilder = new GeotoolsFilterBuilder();
    FilterAdapter filterAdapter = new GeotoolsFilterAdapterImpl();
    CswRecordMap cswRecordMap = new MetacardCswRecordMap();
    queryFactory = new CswQueryFactory(cswRecordMap, filterBuilder, filterAdapter, new PermissionsImpl());
    AttributeRegistryImpl attributeRegistry = new AttributeRegistryImpl();
    attributeRegistry.registerMetacardType(getCswMetacardType());
    queryFactory.setAttributeRegistry(attributeRegistry);
    polygon = new WKTReader().read(POLYGON_STR);
    gmlObjectFactory = new net.opengis.gml.v_3_1_1.ObjectFactory();
    filterObjectFactory = new ObjectFactory();
    queryFilterTransformerProvider = mock(QueryFilterTransformerProvider.class);
    QueryFilterTransformer cswQueryFilter = new CswQueryFilterTransformer(new MetacardCswRecordMap(), attributeRegistry);
    when(queryFilterTransformerProvider.getTransformer(new QName(CswConstants.CSW_OUTPUT_SCHEMA, "Record"))).thenReturn(Optional.of(cswQueryFilter));
    when(queryFilterTransformerProvider.getTransformer(anyString())).thenReturn(Optional.of(cswQueryFilter));
    queryFactory.setQueryFilterTransformerProvider(queryFilterTransformerProvider);
}
Also used : AttributeRegistryImpl(ddf.catalog.data.impl.AttributeRegistryImpl) QueryFilterTransformerProvider(ddf.catalog.transform.QueryFilterTransformerProvider) QName(javax.xml.namespace.QName) FilterAdapter(ddf.catalog.filter.FilterAdapter) CswQueryFilterTransformer(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.transformer.CswQueryFilterTransformer) CswRecordMap(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.transformer.CswRecordMap) MetacardCswRecordMap(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.mappings.MetacardCswRecordMap) WKTReader(org.locationtech.jts.io.WKTReader) ObjectFactory(net.opengis.filter.v_1_1_0.ObjectFactory) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) FilterBuilder(ddf.catalog.filter.FilterBuilder) PermissionsImpl(ddf.security.permission.impl.PermissionsImpl) GeotoolsFilterBuilder(ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder) GeotoolsFilterAdapterImpl(ddf.catalog.filter.proxy.adapter.GeotoolsFilterAdapterImpl) MetacardCswRecordMap(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.mappings.MetacardCswRecordMap) QueryFilterTransformer(ddf.catalog.transform.QueryFilterTransformer) CswQueryFilterTransformer(org.codice.ddf.spatial.ogc.csw.catalog.endpoint.transformer.CswQueryFilterTransformer)

Example 2 with QueryFilterTransformerProvider

use of ddf.catalog.transform.QueryFilterTransformerProvider in project ddf by codice.

the class ValidatorTest method setUp.

@Before
public void setUp() throws Exception {
    QName[] qname = { new QName(CswConstants.CSW_OUTPUT_SCHEMA, CswConstants.CSW_RECORD_LOCAL_NAME) };
    qNameList = Arrays.asList(qname);
    transformerManager = mock(TransformerManager.class);
    validator = new Validator();
    QueryFilterTransformerProvider transformerProvider = mock(QueryFilterTransformerProvider.class);
    QueryFilterTransformer transformer = mock(QueryFilterTransformer.class);
    when(transformerProvider.getTransformer(any(QName.class))).thenReturn(Optional.empty());
    when(transformerProvider.getTransformer(qname[0])).thenReturn(Optional.of(transformer));
    validator.setQueryFilterTransformerProvider(transformerProvider);
}
Also used : TransformerManager(org.codice.ddf.spatial.ogc.csw.catalog.common.transformer.TransformerManager) QName(javax.xml.namespace.QName) QueryFilterTransformerProvider(ddf.catalog.transform.QueryFilterTransformerProvider) QueryFilterTransformer(ddf.catalog.transform.QueryFilterTransformer) Before(org.junit.Before)

Aggregations

QueryFilterTransformer (ddf.catalog.transform.QueryFilterTransformer)2 QueryFilterTransformerProvider (ddf.catalog.transform.QueryFilterTransformerProvider)2 QName (javax.xml.namespace.QName)2 AttributeRegistryImpl (ddf.catalog.data.impl.AttributeRegistryImpl)1 FilterAdapter (ddf.catalog.filter.FilterAdapter)1 FilterBuilder (ddf.catalog.filter.FilterBuilder)1 GeotoolsFilterAdapterImpl (ddf.catalog.filter.proxy.adapter.GeotoolsFilterAdapterImpl)1 GeotoolsFilterBuilder (ddf.catalog.filter.proxy.builder.GeotoolsFilterBuilder)1 PermissionsImpl (ddf.security.permission.impl.PermissionsImpl)1 ObjectFactory (net.opengis.filter.v_1_1_0.ObjectFactory)1 TransformerManager (org.codice.ddf.spatial.ogc.csw.catalog.common.transformer.TransformerManager)1 MetacardCswRecordMap (org.codice.ddf.spatial.ogc.csw.catalog.endpoint.mappings.MetacardCswRecordMap)1 CswQueryFilterTransformer (org.codice.ddf.spatial.ogc.csw.catalog.endpoint.transformer.CswQueryFilterTransformer)1 CswRecordMap (org.codice.ddf.spatial.ogc.csw.catalog.endpoint.transformer.CswRecordMap)1 Before (org.junit.Before)1 WKTReader (org.locationtech.jts.io.WKTReader)1