@@ -0,0 +1,2532 @@
+/*%0A * European Variation Archive (EVA) - Open-access database of all types of genetic%0A * variation data from all species%0A *%0A * Copyright 2016 EMBL - European Bioinformatics Institute%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *   http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage uk.ac.ebi.eva.server.ws;%0A%0Aimport com.jayway.restassured.RestAssured;%0Aimport com.jayway.restassured.path.json.JsonPath;%0Aimport com.jayway.restassured.response.Response;%0Aimport org.junit.BeforeClass;%0Aimport org.junit.Test;%0A%0Aimport java.net.URI;%0Aimport java.net.URISyntaxException;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport static com.jayway.restassured.RestAssured.given;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertTrue;%0A%0Apublic class RegionWSServerTest %7B%0A%0A    @BeforeClass%0A    public static void startJetty() throws Exception %7B%0A        RestAssured.port = 8080;%0A        RestAssured.baseURI = %22http://localhost:8080/eva/webservices/rest%22;%0A    %7D%0A%0A    // 2:48000000-49000000%0A%0A    @Test%0A    public void testGetVariantById() throws URISyntaxException %7B%0A        testGetVariantsByRegionHelper(%2220:60000-62000%22, 40);%0A    %7D%0A%0A    private void testGetVariantsByRegionHelper(String testString, int expectedSize) throws URISyntaxException %7B%0A        Response response = given().param(%22species%22, %22mmusculus_grcm38%22).get(new URI(%22/v1/segments/%22 + testString + %22/variants%22));%0A        response.then().statusCode(200);%0A%0A        List queryResponse = JsonPath.from(response.asString()).getList(%22response%22);%0A%0A        List%3CMap%3E result = JsonPath.from(response.asString()).getJsonObject(%22response%5B0%5D.result%22);%0A%0A        assertEquals(expectedSize, result.size());%0A%0A        for (Map m : result) %7B%0A            String missingField = String.format(%22%25s required field missing%22, m.get(%22name%22));%0A%0A            assertTrue(missingField, m.containsKey(%22id%22));%0A            assertTrue(missingField, m.containsKey(%22chromosome%22));%0A            assertTrue(missingField, m.containsKey(%22start%22));%0A            assertTrue(missingField, m.containsKey(%22end%22));%0A        %7D%0A    %7D%0A%0A%0A%0A%7D%0A

Test for region webservice