use of io.arlas.server.core.model.request.MultiValueFilter in project ARLAS-server by gisaia.
the class AbstractFilteredTest method testQueryFilterWithUnavailableColumns.
@Test
public void testQueryFilterWithUnavailableColumns() throws Exception {
request.filter = new Filter();
request.filter.q = Arrays.asList(new MultiValueFilter<>("My name is"));
handleUnavailableColumn(post(request, "column-filter", "params.city"));
handleUnavailableColumn(get("q", request.filter.q.get(0).get(0), "column-filter", "params.city"));
request.filter.q = Arrays.asList(new MultiValueFilter<>("*ullnam*:My name is"));
handleUnavailableColumn(post(request, "column-filter", "fullname"));
handleUnavailableColumn(get("q", request.filter.q.get(0).get(0), "column-filter", "fullname"));
request.filter.q = Arrays.asList(new MultiValueFilter<>("fullname:My name:is"));
handleUnavailableColumn(post(request, "column-filter", "params.city"));
handleUnavailableColumn(get("q", request.filter.q.get(0).get(0), "column-filter", "params.city"));
// used to return 200 in previous implementation, this is anti-regression
request.filter.q = Arrays.asList(new MultiValueFilter<>("fullname:My name:is"));
handleUnavailableColumn(post(request, "column-filter", "fullname.anything"));
handleUnavailableColumn(get("q", request.filter.q.get(0).get(0), "column-filter", "fullname.anything"));
request.filter = new Filter();
}
use of io.arlas.server.core.model.request.MultiValueFilter in project ARLAS-server by gisaia.
the class AbstractFilteredTest method testComplexFilter.
@Test
public void testComplexFilter() throws Exception {
request.filter.f = // "job:eq:Architect"
Arrays.asList(// "job:eq:Architect"
new MultiValueFilter<>(new Expression("params.job", OperatorEnum.like, "Architect")), new MultiValueFilter<>(new Expression("params.startdate", OperatorEnum.range, "[1009799<1009801]")));
handleFieldFilter(post(request), 2, "Architect");
handleFieldFilter(givenFilterableRequestParams().param("f", request.filter.f.get(0).get(0).toString()).param("f", "params.startdate:range:[1009799<1009801]").when().get(getUrlPath("geodata")).then(), 2, "Architect");
handleFieldFilter(header(request.filter), 2, "Architect");
//
request.filter.f = // "job:eq:Architect"
Arrays.asList(// "job:eq:Architect"
new MultiValueFilter<>(new Expression("params.job", OperatorEnum.like, "Architect")), new MultiValueFilter<>(new Expression("params.startdate", OperatorEnum.range, "[1970/01/01 00:16:49:799<1970/01/01 00:16:49:801]")));
request.filter.dateformat = "yyyy/MM/dd HH:mm:ss:SSS";
handleFieldFilter(post(request), 2, "Architect");
handleFieldFilter(givenFilterableRequestParams().param("f", request.filter.f.get(0).get(0).toString()).param("f", "params.startdate:range:[1970/01/01 00:16:49:799<1970/01/01 00:16:49:801]").param("dateformat", request.filter.dateformat).when().get(getUrlPath("geodata")).then(), 2, "Architect");
handleFieldFilter(header(request.filter), 2, "Architect");
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.startdate", OperatorEnum.lte, "01-01-1970 00:12:55")));
request.filter.dateformat = "dd-MM-yyyy HH:mm:ss";
handleFieldFilter(post(request), 3, "Chemist", "Brain Scientist");
handleFieldFilter(givenFilterableRequestParams().param("f", request.filter.f.get(0).get(0).toString()).param("dateformat", request.filter.dateformat).when().get(getUrlPath("geodata")).then(), 3, "Chemist", "Brain Scientist");
handleFieldFilter(header(request.filter), 3, "Chemist", "Brain Scientist");
// DATEFORMAT : check that date operations (||/s) works when specifying dates with custom format
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.startdate", OperatorEnum.lte, "01-01-1970 00:12:55||/s")));
request.filter.dateformat = "dd-MM-yyyy HH:mm:ss";
handleFieldFilter(post(request), 3, "Chemist", "Brain Scientist");
handleFieldFilter(givenFilterableRequestParams().param("f", request.filter.f.get(0).get(0).toString()).param("dateformat", request.filter.dateformat).when().get(getUrlPath("geodata")).then(), 3, "Chemist", "Brain Scientist");
handleFieldFilter(header(request.filter), 3, "Chemist", "Brain Scientist");
// DATEFORMAT : check that dateformat works when we specify an alias ($timestamp) in range operation
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("$timestamp", OperatorEnum.range, "[01-01-1970 00:00:00<01-01-1970 00:12:55||-3s/s[")));
request.filter.dateformat = "dd-MM-yyyy HH:mm:ss";
handleMatchingTimestampRangeFilter(post(request), 0, 772000, 2);
handleMatchingTimestampRangeFilter(givenFilterableRequestParams().param("f", request.filter.f.get(0).get(0).toString()).param("dateformat", request.filter.dateformat).when().get(getUrlPath("geodata")).then(), 0, 772000, 2);
handleMatchingTimestampRangeFilter(header(request.filter), 0, 772000, 2);
request.filter.dateformat = null;
request.filter.f = // "job:eq:Architect"
Arrays.asList(// "job:eq:Architect"
new MultiValueFilter<>(new Expression("params.job", OperatorEnum.like, "Architect")), new MultiValueFilter<>(new Expression("params.startdate", OperatorEnum.range, "[1009799<1009801]")), new MultiValueFilter<>(new Expression("geo_params.centroid", OperatorEnum.within, "-50,-50,50,50")), new MultiValueFilter<>(new Expression("geo_params.centroid", OperatorEnum.notwithin, "20,-50,60,50")), new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((30 30,30 -30,-30 -30,-30 30,30 30))")), new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.notwithin, "POLYGON((-50 50,-20 50, -20 -50, -50 -50,-50 50))")), new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.intersects, "POLYGON((-20 20, 20 20, 20 -20, -20 -20, -20 20))")), new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.notintersects, "POLYGON((-30 -10,30 10, 30 -30, -30 -30,-30 -10))")));
handleComplexFilter(post(request));
handleComplexFilter(givenFilterableRequestParams().param("f", request.filter.f.get(0).get(0).toString()).param("f", "params.startdate:range:[1009799<1009801]").param("f", request.filter.f.get(2).get(0).toString()).param("f", request.filter.f.get(3).get(0).toString()).param("f", request.filter.f.get(4).get(0).toString()).param("f", request.filter.f.get(5).get(0).toString()).param("f", request.filter.f.get(6).get(0).toString()).param("f", request.filter.f.get(7).get(0).toString()).when().get(getUrlPath("geodata")).then());
handleComplexFilter(header(request.filter));
request.filter = new Filter();
}
use of io.arlas.server.core.model.request.MultiValueFilter in project ARLAS-server by gisaia.
the class CollectionTool method load.
public void load(long sleepAfter) throws ArlasException {
try {
DataSetTool.loadDataSet();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
throw e;
}
CollectionReferenceParameters params = new CollectionReferenceParameters();
params.indexName = DataSetTool.DATASET_INDEX_NAME;
params.idPath = DataSetTool.DATASET_ID_PATH;
params.geometryPath = DataSetTool.WKT_GEOMETRIES ? DataSetTool.DATASET_WKT_GEOMETRY_PATH : DataSetTool.DATASET_GEOMETRY_PATH;
params.centroidPath = DataSetTool.DATASET_CENTROID_PATH;
params.h3Path = DataSetTool.DATASET_H3_PATH;
params.timestampPath = DataSetTool.DATASET_TIMESTAMP_PATH;
params.excludeFields = DataSetTool.DATASET_EXCLUDE_FIELDS;
params.excludeWfsFields = DataSetTool.DATASET_EXCLUDE_WFS_FIELDS;
params.rasterTileURL = DataSetTool.DATASET_TILE_URL;
params.rasterTileWidth = 256;
params.rasterTileHeight = 256;
params.inspire = new Inspire();
params.inspire.lineage = DataSetTool.DATASET_INSPIRE_LINEAGE;
params.inspire.topicCategories = Arrays.asList(DataSetTool.DATASET_INSPIRE_TOPIC_CATEGORY);
params.dublinCoreElementName = new DublinCoreElementName();
params.dublinCoreElementName.title = DataSetTool.DATASET_DUBLIN_CORE_TITLE;
params.dublinCoreElementName.description = DataSetTool.DATASET_DUBLIN_CORE_DESCRIPTION;
params.dublinCoreElementName.language = DataSetTool.DATASET_DUBLIN_CORE_LANGUAGE;
// PUT new collection
given().contentType("application/json").body(params).when().put(getUrlPath()).then().statusCode(200);
Filter filter = new Filter();
filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, DataSetTool.jobs[0])));
params.filter = filter;
given().contentType("application/json").body(params).when().put(arlasPath + "collections/" + COLLECTION_NAME_ACTOR).then().statusCode(200);
try {
Thread.sleep(sleepAfter);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
use of io.arlas.server.core.model.request.MultiValueFilter in project ARLAS-server by gisaia.
the class CollectionInjector method load.
public void load(long sleepAfter) throws ArlasException {
try {
getDataInjector(POSTGIS_SINK).loadDataSet();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
throw e;
}
CollectionReferenceParameters params = new CollectionReferenceParameters();
params.indexName = AbstractDataInjector.DATA_SINK_NAME;
params.idPath = AbstractDataInjector.DATASET_ID_PATH;
params.geometryPath = AbstractDataInjector.WKT_GEOMETRIES ? AbstractDataInjector.DATASET_WKT_GEOMETRY_PATH : AbstractDataInjector.DATASET_GEOMETRY_PATH;
params.centroidPath = AbstractDataInjector.DATASET_CENTROID_PATH;
params.timestampPath = AbstractDataInjector.DATASET_TIMESTAMP_PATH;
params.excludeFields = AbstractDataInjector.DATASET_EXCLUDE_FIELDS;
params.excludeWfsFields = AbstractDataInjector.DATASET_EXCLUDE_WFS_FIELDS;
params.rasterTileURL = AbstractDataInjector.DATASET_TILE_URL;
params.rasterTileWidth = 256;
params.rasterTileHeight = 256;
params.inspire = new Inspire();
params.inspire.lineage = AbstractDataInjector.DATASET_INSPIRE_LINEAGE;
params.inspire.topicCategories = Arrays.asList(AbstractDataInjector.DATASET_INSPIRE_TOPIC_CATEGORY);
params.dublinCoreElementName = new DublinCoreElementName();
params.dublinCoreElementName.title = AbstractDataInjector.DATASET_DUBLIN_CORE_TITLE;
params.dublinCoreElementName.description = AbstractDataInjector.DATASET_DUBLIN_CORE_DESCRIPTION;
params.dublinCoreElementName.language = AbstractDataInjector.DATASET_DUBLIN_CORE_LANGUAGE;
// PUT new collection
given().contentType("application/json").body(params).when().put(getUrlPath()).then().statusCode(200);
Filter filter = new Filter();
filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, AbstractDataInjector.jobs[0])));
params.filter = filter;
given().contentType("application/json").body(params).when().put(arlasPath + "collections/" + COLLECTION_NAME_ACTOR).then().statusCode(200);
try {
Thread.sleep(sleepAfter);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Aggregations