use of io.arlas.server.core.model.request.Expression in project ARLAS-server by gisaia.
the class AbstractFilteredTest method testGwithinFilter.
@Test
public void testGwithinFilter() throws Exception {
/**
* west < east bbox
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "-2,-2,2,2")));
handleMatchingGeometryFilter(post(request), 1, everyItem(equalTo("0,0")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 1, everyItem(equalTo("0,0")));
handleMatchingGeometryFilter(header(request.filter), 1, everyItem(equalTo("0,0")));
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "-170,-2,170,2")));
handleMatchingGeometryFilter(post(request), 33, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 33, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(header(request.filter), 33, everyItem(startsWith("0,")));
/**
* west > east bbox
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "2,-2,-2,2")));
handleMatchingGeometryFilter(post(request), 34, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 34, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(header(request.filter), 34, everyItem(startsWith("0,")));
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "170,-2,-170,2")));
handleNotMatchingGwithinFilter(post(request));
handleNotMatchingGwithinFilter(get("f", request.filter.f.get(0).get(0).toString()));
handleNotMatchingGwithinFilter(header(request.filter));
/**
* clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((-2 -2, -2 2, 2 2, 2 -2, -2 -2))")));
handleMatchingGeometryFilter(post(request), 1, everyItem(equalTo("0,0")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 1, everyItem(equalTo("0,0")));
handleMatchingGeometryFilter(header(request.filter), 1, everyItem(equalTo("0,0")));
/**
* clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((-170 -2, -170 2, 170 2, 170 -2, -170 -2))")));
handleMatchingGeometryFilter(post(request), 33, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 33, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(header(request.filter), 33, everyItem(startsWith("0,")));
/**
* counter clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((-170 -2, 170 -2, 170 2, -170 2, -170 -2))")));
handleNotMatchingGwithinFilter(post(request));
handleNotMatchingGwithinFilter(get("f", request.filter.f.get(0).get(0).toString()));
handleNotMatchingGwithinFilter(header(request.filter));
/**
* counter clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((-2 -2, 2 -2, 2 2,-2 2, -2 -2))")));
handleMatchingGeometryFilter(post(request), 34, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 34, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(header(request.filter), 34, everyItem(startsWith("0,")));
/**
* clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((-330 -2, -330 -1, -290 -1, -290 2, -15 2, -15 1, -40 1, -40 -2, -330 -2))")));
handleMatchingGeometryFilter(post(request), 24, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 24, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(header(request.filter), 24, everyItem(startsWith("0,")));
/**
* counter clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((-330 -2, -40 -2, -40 1, -15 1, -15 2, -290 2, -290 -1, -330 -1, -330 -2))")));
handleMatchingGeometryFilter(post(request), 10, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 10, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(header(request.filter), 10, everyItem(startsWith("0,")));
/**
* clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((10 -2, 10 2, 350 2, 350 0, 300 0, 350 -2, 10 -2))")));
handleMatchingGeometryFilter(post(request), 32, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 32, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(header(request.filter), 32, everyItem(startsWith("0,")));
/**
* counter clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((10 -2, 350 -2, 300 0, 350 0, 350 2, 10 2, 10 -2))")));
handleMatchingGeometryFilter(post(request), 1, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 1, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(header(request.filter), 1, everyItem(startsWith("0,")));
/**
* clock-wise WKT with with a point longitude > 180
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((-130 -2, -130 2, 220 2, 220 -2, -130 -2))")));
handleMatchingGeometryFilter(post(request), 33, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 33, everyItem(startsWith("0,")));
handleMatchingGeometryFilter(header(request.filter), 33, everyItem(startsWith("0,")));
/**
* counter clock-wise WKT with a point longitude > 180
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((-130 -2, 220 -2, 220 2, -130 2, -130 -2))")));
handleNotMatchingGwithinFilter(post(request));
handleNotMatchingGwithinFilter(get("f", request.filter.f.get(0).get(0).toString()));
handleNotMatchingGwithinFilter(header(request.filter));
/**
* clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((1 1,1 2,2 2,2 1,1 1))")));
handleNotMatchingGwithinFilter(post(request));
handleNotMatchingGwithinFilter(get("f", request.filter.f.get(0).get(0).toString()));
handleNotMatchingGwithinFilter(header(request.filter));
/**
* west < east bbox along with a clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((1 1,10 -20,-10 -20,-10 20,1 1))")), new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "-2,-2,2,2")));
handleMatchingGeometryFilter(post(request), 1, everyItem(equalTo("0,0")));
handleMatchingGeometryFilter(get(Arrays.asList(new ImmutablePair<>("f", request.filter.f.get(0).get(0).toString()), new ImmutablePair<>("f", request.filter.f.get(1).get(0).toString()))), 1, everyItem(equalTo("0,0")));
handleMatchingGeometryFilter(header(request.filter), 1, everyItem(equalTo("0,0")));
/**
* west < east bbox along with a clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(Arrays.asList(new Expression("geo_params.geometry", OperatorEnum.within, "-2,-2,2,2"), new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((1 1,10 -20,-10 -20,-10 20,1 1))"))));
handleMatchingGeometryFilter(post(request), 2, everyItem(isOneOf("-10,0", "0,0")));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString() + ";" + request.filter.f.get(0).get(1).toString()), 2, everyItem(isOneOf("-10,0", "0,0")));
handleMatchingGeometryFilter(header(request.filter), 2, everyItem(isOneOf("-10,0", "0,0")));
/**
* clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.notwithin, "POLYGON((180 90, 180 -70, 160 -70, 160 -90,-180 -90,-180 90,180 90))")));
handleMatchingGeometryFilter(post(request), 4, hasItems("-70,170", "-80,170", "-70,160", "-80,160"));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 4, hasItems("-70,170", "-80,170", "-70,160", "-80,160"));
handleMatchingGeometryFilter(header(request.filter), 4, hasItems("-70,170", "-80,170", "-70,160", "-80,160"));
/**
* counter clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.notwithin, "POLYGON((-2 -2, 2 -2, 2 2,-2 2, -2 -2))")));
handleMatchingGeometryFilter(post(request), 561, everyItem(notNullValue()));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 561, everyItem(notNullValue()));
handleMatchingGeometryFilter(header(request.filter), 561, everyItem(notNullValue()));
/**
* clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.notwithin, "POLYGON((180 90,180 -90,-180 -90,-180 90,180 90))")));
handleNotMatchingNotGwithinFilter(post(request));
handleNotMatchingNotGwithinFilter(get("f", request.filter.f.get(0).get(0).toString()));
handleNotMatchingNotGwithinFilter(header(request.filter));
/**
* counter clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.notwithin, "POLYGON((160 -2, 160 2, -160 2, -160 -2, 160 -2))")));
handleMatchingGeometryFilter(post(request), 593, everyItem(notNullValue()));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString()), 593, notNullValue());
handleMatchingGeometryFilter(header(request.filter), 593, everyItem(notNullValue()));
/**
* clock-wise WKTs
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.notwithin, "POLYGON((180 90,180 -70,100 -70,100 -80,-180 -80,-180 90,180 90))")), new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.notwithin, "POLYGON((180 90, 180 -70, 160 -70, 160 -90,-180 -90,-180 90,180 90))")));
handleMatchingGeometryFilter(post(request), 4, hasItems("-70,170", "-80,170", "-70,160", "-80,160"));
handleMatchingGeometryFilter(get(Arrays.asList(new ImmutablePair<>("f", request.filter.f.get(0).get(0).toString()), new ImmutablePair<>("f", request.filter.f.get(1).get(0).toString()))), 4, hasItems("-70,170", "-80,170", "-70,160", "-80,160"));
handleMatchingGeometryFilter(header(request.filter), 4, hasItems("-70,170", "-80,170", "-70,160", "-80,160"));
/**
* clock-wise WKTs
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(Arrays.asList(new Expression("geo_params.geometry", OperatorEnum.notwithin, "POLYGON((180 90,180 -68,99 -68,99 -80,-180 -80,-180 90,180 90))"), new Expression("geo_params.geometry", OperatorEnum.notwithin, "POLYGON((180 90, 180 -70, 160 -70, 160 -90,-180 -90,-180 90,180 90))"))));
handleMatchingGeometryFilter(post(request), 43, everyItem(notNullValue()));
handleMatchingGeometryFilter(get("f", request.filter.f.get(0).get(0).toString() + ";" + request.filter.f.get(0).get(1).toString()), 43, everyItem(notNullValue()));
handleMatchingGeometryFilter(header(request.filter), 43, everyItem(notNullValue()));
/**
* west < east bbox along with a clock-wise WKT
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "POLYGON((12 12,12 -12,-12 -12,-12 12,12 12))")), new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.notwithin, "-8,-8,8,8")));
handleMatchingGeometryFilter(post(request), 8, hasItems("10,0", "10,-10", "10,10", "10,10", "10,0", "10,-10", "0,10", "0,-10"));
handleMatchingGeometryFilter(givenFilterableRequestParams().param("f", request.filter.f.get(0).get(0).toString()).param("f", request.filter.f.get(1).get(0).toString()).when().get(getUrlPath("geodata")).then(), 8, hasItems("10,0", "10,-10", "10,10", "10,10", "10,0", "10,-10", "0,10", "0,-10"));
handleMatchingGeometryFilter(header(request.filter), 8, hasItems("10,0", "10,-10", "10,10", "10,10", "10,0", "10,-10", "0,10", "0,-10"));
/**
* west < east bbox
*/
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "-12,-12,12,12")), new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.notwithin, "-11,-11,11,11")));
handleNotMatchingGwithinComboFilter(post(request));
handleNotMatchingGwithinComboFilter(givenFilterableRequestParams().param("f", request.filter.f.get(0).get(0).toString()).param("f", request.filter.f.get(1).get(0).toString()).when().get(getUrlPath("geodata")).then());
handleNotMatchingGwithinComboFilter(header(request.filter));
request.filter.f = null;
}
use of io.arlas.server.core.model.request.Expression in project ARLAS-server by gisaia.
the class AbstractFilteredTest method testCollectionFilter.
@Test
public void testCollectionFilter() throws Exception {
// );
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, DataSetTool.jobs[1])));
RequestSpecification req = givenFilterableRequestBody();
handleNotMatchingRequest(req.body(handlePostRequest(request)).when().post(getUrlPath("geodata_actor")).then());
req = givenFilterableRequestParams();
for (Pair<String, String> extraParam : this.extraParams) {
req = req.param(extraParam.getKey(), extraParam.getValue());
}
handleNotMatchingRequest(req.param("f", request.filter.f.get(0).get(0).toString()).when().get(getUrlPath("geodata_actor")).then());
request.filter = new Filter();
// ("job:eq:" + DataSetTool.jobs[0]);
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, DataSetTool.jobs[0])));
req = givenFilterableRequestBody();
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString()), 59, "Actor");
handleFieldFilter(header(request.filter), 59, "Actor");
handleFieldFilter(req.body(handlePostRequest(request)).when().post(getUrlPath("geodata_actor")).then(), 59, "Actor");
req = givenFilterableRequestParams();
for (Pair<String, String> extraParam : this.extraParams) {
req = req.param(extraParam.getKey(), extraParam.getValue());
}
handleFieldFilter(req.param("f", request.filter.f.get(0).get(0).toString()).when().get(getUrlPath("geodata_actor")).then(), 59, "Actor");
request.filter = new Filter();
}
use of io.arlas.server.core.model.request.Expression in project ARLAS-server by gisaia.
the class AbstractFilteredTest method testFieldFilter.
// ----------------------------------------------------------------
// ----------------------- SUCCESS TESTS --------------------------
// ----------------------------------------------------------------
@Test
public void testFieldFilter() throws Exception {
// ("job:eq:" + DataSetTool.jobs[0]);
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, DataSetTool.jobs[0])));
handleFieldFilter(post(request), 59, "Actor");
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString()), 59, "Actor");
handleFieldFilter(header(request.filter), 59, "Actor");
// "job:eq:" + DataSetTool.jobs[0] + "," + DataSetTool.jobs[1]);
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, DataSetTool.jobs[0] + "," + DataSetTool.jobs[1])));
handleFieldFilter(post(request), 117, "Actor", "Announcers");
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString()), 117, "Actor", "Announcers");
handleFieldFilter(header(request.filter), 117, "Actor", "Announcers");
// "job:like:" + "cto");
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.like, "cto")));
handleFieldFilter(post(request), 59, "Actor");
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString()), 59, "Actor");
handleFieldFilter(header(request.filter), 59, "Actor");
// "job:ne:" + DataSetTool.jobs[0] + "," + DataSetTool.jobs[1]);
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.ne, DataSetTool.jobs[0] + "," + DataSetTool.jobs[1])));
handleFieldFilter(post(request), 478, "Archeologists", "Architect", "Brain Scientist", "Chemist", "Coach", "Coder", "Cost Estimator", "Dancer", "Drafter");
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString()), 478, "Archeologists", "Architect", "Brain Scientist", "Chemist", "Coach", "Coder", "Cost Estimator", "Dancer", "Drafter");
handleFieldFilter(header(request.filter), 478, "Archeologists", "Architect", "Brain Scientist", "Chemist", "Coach", "Coder", "Cost Estimator", "Dancer", "Drafter");
// "job:eq:UnknownJob");
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, "UnknownJob")));
handleUnknownFieldFilter(post(request));
handleUnknownFieldFilter(get("f", request.filter.f.get(0).get(0).toString()));
handleUnknownFieldFilter(header(request.filter));
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, "Actor")), new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, "Announcers")));
handleNotMatchingRequest(post(request));
handleNotMatchingRequest(get(Arrays.asList(new ImmutablePair<>("f", request.filter.f.get(0).get(0).toString()), new ImmutablePair<>("f", request.filter.f.get(1).get(0).toString()))));
handleNotMatchingRequest(header(request.filter));
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, "Actor:Announcers")));
handleNotMatchingRequest(post(request));
handleNotMatchingRequest(get(Arrays.asList(new ImmutablePair<>("f", request.filter.f.get(0).get(0).toString()))));
handleNotMatchingRequest(header(request.filter));
request.filter.f = Arrays.asList(new MultiValueFilter<>(Arrays.asList(new Expression("params.job", OperatorEnum.eq, "Actor"), new Expression("params.job", OperatorEnum.eq, "Announcers"))));
handleFieldFilter(post(request), 117, "Actor", "Announcers");
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString() + ";" + request.filter.f.get(0).get(1).toString()), 117, "Actor", "Announcers");
handleFieldFilter(header(request.filter), 117, "Actor", "Announcers");
// TIMESTAMP LTE, LT, GTE, GT
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.startdate", OperatorEnum.lte, "775000")));
handleFieldFilter(post(request), 3, "Chemist", "Brain Scientist");
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString()), 3, "Chemist", "Brain Scientist");
handleFieldFilter(header(request.filter), 3, "Chemist", "Brain Scientist");
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.startdate", OperatorEnum.lte, "775000||/s")));
handleFieldFilter(post(request), 3, "Chemist", "Brain Scientist");
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString()), 3, "Chemist", "Brain Scientist");
handleFieldFilter(header(request.filter), 3, "Chemist", "Brain Scientist");
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.startdate", OperatorEnum.gt, "1250000")));
handleFieldFilter(post(request), 3, "Chemist", "Brain Scientist");
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString()), 3, "Chemist", "Brain Scientist");
handleFieldFilter(header(request.filter), 3, "Chemist", "Brain Scientist");
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.startdate", OperatorEnum.lte, "now-1M/y")));
handleFieldFilter(post(request), 595);
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString()), 595);
handleFieldFilter(header(request.filter), 595);
request.filter.f = null;
}
use of io.arlas.server.core.model.request.Expression in project ARLAS-server by gisaia.
the class AbstractFilteredTest method testFieldFilterWithCollectionBasedColumnFiltering.
@Test
public void testFieldFilterWithCollectionBasedColumnFiltering() throws Exception {
request.filter.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, DataSetTool.jobs[0])));
handleFieldFilter(post(request, "column-filter", "params.job"), 59, "Actor");
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString(), "column-filter", "params.job"), 59, "Actor");
handleFieldFilter(post(request, "column-filter", COLLECTION_NAME + ":params.job"), 59, "Actor");
handleFieldFilter(get("f", request.filter.f.get(0).get(0).toString(), "column-filter", COLLECTION_NAME + ":params.job"), 59, "Actor");
handleUnavailableColumn(post(request, "column-filter", "fullname,notExisting:params.job"));
handleUnavailableColumn(get("f", request.filter.f.get(0).get(0).toString(), "column-filter", "fullname,notExisting:params.job"));
handleUnavailableCollection(post(request, "column-filter", "notExisting:params.job"));
handleUnavailableCollection(get("f", request.filter.f.get(0).get(0).toString(), "column-filter", "notExisting:params.job"));
request.filter = new Filter();
}
use of io.arlas.server.core.model.request.Expression in project ARLAS-server by gisaia.
the class AbstractFilteredTest method testMixedFilter.
@Test
public void testMixedFilter() throws Exception {
// valid bbox from WFS OGC SPEC = lower longitude , lower latitude , upper longitude , upper latitude
// valid bbox for ARLAS classic bbox = lat top, long left, lat bottom, long right
request.filter.f = // "job:eq:Architect"
Arrays.asList(// "job:eq:Architect"
new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, "Architect")), new MultiValueFilter<>(new Expression("params.startdate", OperatorEnum.range, "[1009799<2000000]")), new MultiValueFilter<>(new Expression("geo_params.centroid", OperatorEnum.within, "-50,-50,50,50")), new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.within, "-30,-30,30,30")), new MultiValueFilter<>(new Expression("geo_params.geometry", OperatorEnum.intersects, "POLYGON((-20 20, 20 20, 20 -20, -20 -20, -20 20))")));
Filter filterHeader = new Filter();
filterHeader.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.startdate", OperatorEnum.range, "[0<1009801]")), new MultiValueFilter<>(new Expression("geo_params.centroid", OperatorEnum.notwithin, "20,-50,60,50")), 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.notintersects, "POLYGON((-30 -10,30 10, 30 -30, -30 -30,-30 -10))")));
handleComplexFilter(givenFilterableRequestParams().header("partition-filter", objectMapper.writeValueAsString(filterHeader)).header("column-filter", "params.job,params.city,params.country").param("f", new Expression("params.job", OperatorEnum.eq, "Architect").toString()).param("f", new Expression("params.startdate", OperatorEnum.range, "[1009799<2000000]").toString()).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()).when().get(getUrlPath("geodata")).then());
handleComplexFilter(post(request, "partition-filter", objectMapper.writeValueAsString(filterHeader), "column-filter", "params.job,params.city,params.country"));
filterHeader.f = Arrays.asList(new MultiValueFilter<>(new Expression("params.job", OperatorEnum.eq, "Actor")));
handleNotMatchingRequest(givenFilterableRequestParams().header("partition-filter", objectMapper.writeValueAsString(filterHeader)).header("column-filter", // an empty column filter is not considered
"").param("f", (new Expression("params.job", OperatorEnum.eq, "Architect")).toString()).when().get(getUrlPath("geodata")).then());
handleNotMatchingRequest(givenFilterableRequestBody().body(request).header("partition-filter", objectMapper.writeValueAsString(filterHeader)).header("column-filter", // an empty column filter is not considered
"").when().post(getUrlPath("geodata")).then());
request.filter = new Filter();
}
Aggregations