Search in sources :

Example 1 with MultiValueFilter

use of io.arlas.server.core.model.request.MultiValueFilter 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;
}
Also used : Expression(io.arlas.server.core.model.request.Expression) MultiValueFilter(io.arlas.server.core.model.request.MultiValueFilter) Test(org.junit.Test)

Example 2 with MultiValueFilter

use of io.arlas.server.core.model.request.MultiValueFilter 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();
}
Also used : Expression(io.arlas.server.core.model.request.Expression) Filter(io.arlas.server.core.model.request.Filter) MultiValueFilter(io.arlas.server.core.model.request.MultiValueFilter) MultiValueFilter(io.arlas.server.core.model.request.MultiValueFilter) RequestSpecification(io.restassured.specification.RequestSpecification) Test(org.junit.Test)

Example 3 with MultiValueFilter

use of io.arlas.server.core.model.request.MultiValueFilter 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;
}
Also used : Expression(io.arlas.server.core.model.request.Expression) MultiValueFilter(io.arlas.server.core.model.request.MultiValueFilter) Test(org.junit.Test)

Example 4 with MultiValueFilter

use of io.arlas.server.core.model.request.MultiValueFilter 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();
}
Also used : Expression(io.arlas.server.core.model.request.Expression) Filter(io.arlas.server.core.model.request.Filter) MultiValueFilter(io.arlas.server.core.model.request.MultiValueFilter) MultiValueFilter(io.arlas.server.core.model.request.MultiValueFilter) Test(org.junit.Test)

Example 5 with MultiValueFilter

use of io.arlas.server.core.model.request.MultiValueFilter in project ARLAS-server by gisaia.

the class AbstractFilteredTest method testQueryFilterWithCollectionBasedColumnFiltering.

@Test
public void testQueryFilterWithCollectionBasedColumnFiltering() throws Exception {
    request.filter = new Filter();
    request.filter.q = Arrays.asList(new MultiValueFilter<>("fullname:My name is"));
    handleMatchingQueryFilter(post(request, "column-filter", "fullname*"), 595);
    handleMatchingQueryFilter(get("q", request.filter.q.get(0).get(0), "column-filter", "fullname*"), 595);
    handleMatchingQueryFilter(post(request, "column-filter", COLLECTION_NAME + ":fullname*"), 595);
    handleMatchingQueryFilter(get("q", request.filter.q.get(0).get(0), "column-filter", COLLECTION_NAME + ":fullname*"), 595);
    handleUnavailableColumn(post(request, "column-filter", "params,notExisting:fullname*"));
    handleUnavailableColumn(get("q", request.filter.q.get(0).get(0), "column-filter", "params,notExisting:fullname*"));
    handleUnavailableCollection(post(request, "column-filter", "notExisting:fullname*"));
    handleUnavailableCollection(get("q", request.filter.q.get(0).get(0), "column-filter", "notExisting:fullname*"));
}
Also used : Filter(io.arlas.server.core.model.request.Filter) MultiValueFilter(io.arlas.server.core.model.request.MultiValueFilter) MultiValueFilter(io.arlas.server.core.model.request.MultiValueFilter) Test(org.junit.Test)

Aggregations

MultiValueFilter (io.arlas.server.core.model.request.MultiValueFilter)19 Expression (io.arlas.server.core.model.request.Expression)17 Test (org.junit.Test)17 Filter (io.arlas.server.core.model.request.Filter)11 ArlasException (io.arlas.server.core.exceptions.ArlasException)2 CollectionReferenceParameters (io.arlas.server.core.model.CollectionReferenceParameters)2 DublinCoreElementName (io.arlas.server.core.model.DublinCoreElementName)2 Inspire (io.arlas.server.core.model.Inspire)2 IOException (java.io.IOException)2 UnknownHostException (java.net.UnknownHostException)2 RequestSpecification (io.restassured.specification.RequestSpecification)1