-
Notifications
You must be signed in to change notification settings - Fork 411
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bugfix#1181-address_data_alignment_issue_i…
…n_hgv_storage
- Loading branch information
Showing
331 changed files
with
13,103 additions
and
897 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...uteservice-api-tests/src/test/java/org/heigit/ors/services/common/EndPointAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Licensed to GIScience Research Group, Heidelberg University (GIScience) | ||
* | ||
* http://www.giscience.uni-hd.de | ||
* http://www.heigit.org | ||
* | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. The GIScience licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.heigit.ors.services.common; | ||
|
||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.Target; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.ElementType; | ||
|
||
@Retention(RetentionPolicy.RUNTIME) | ||
@Target(ElementType.TYPE) | ||
|
||
public @interface EndPointAnnotation { | ||
public String name(); | ||
} |
79 changes: 79 additions & 0 deletions
79
openrouteservice-api-tests/src/test/java/org/heigit/ors/services/common/ServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Licensed to GIScience Research Group, Heidelberg University (GIScience) | ||
* | ||
* http://www.giscience.uni-hd.de | ||
* http://www.heigit.org | ||
* | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. The GIScience licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.heigit.ors.services.common; | ||
|
||
import io.restassured.RestAssured; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.junit.BeforeClass; | ||
|
||
public abstract class ServiceTest { | ||
private final Map<String, Object> dictUrlParams; | ||
private String endPointName; | ||
|
||
public ServiceTest() { | ||
dictUrlParams = new HashMap<String, Object>(); | ||
|
||
Annotation[] annotations = getClass().getAnnotations(); | ||
for(Annotation annotation : annotations){ | ||
if(annotation instanceof EndPointAnnotation){ | ||
EndPointAnnotation epa = (EndPointAnnotation) annotation; | ||
endPointName = epa.name(); | ||
} | ||
} | ||
} | ||
|
||
protected Object getParameter(String paramName) { | ||
return dictUrlParams.get(paramName); | ||
} | ||
|
||
protected void addParameter(String paramName, Object paramValue) { | ||
dictUrlParams.put(paramName, paramValue); | ||
} | ||
|
||
protected String getEndPointName() { | ||
return endPointName; | ||
} | ||
|
||
@BeforeClass | ||
public static void setup() { | ||
String port = System.getProperty("server.port"); | ||
RestAssured.port = (port == null) ? 8082 : Integer.valueOf(port); | ||
|
||
String baseHost = System.getProperty("server.host"); | ||
if (baseHost == null) | ||
baseHost = "http://localhost"; | ||
|
||
RestAssured.baseURI = baseHost; | ||
|
||
if (RestAssured.get("/status").statusCode() != 200) { | ||
String basePath = System.getProperty("server.base"); | ||
if (basePath == null) { | ||
basePath = "/ors/"; | ||
} | ||
RestAssured.basePath = basePath; | ||
} | ||
|
||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
openrouteservice-api-tests/src/test/java/org/heigit/ors/services/common/Utils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Licensed to GIScience Research Group, Heidelberg University (GIScience) | ||
* | ||
* http://www.giscience.uni-hd.de | ||
* http://www.heigit.org | ||
* | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. The GIScience licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.heigit.ors.services.common; | ||
|
||
import java.io.InputStream; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.nio.file.Paths; | ||
|
||
import javax.xml.parsers.DocumentBuilderFactory; | ||
import javax.xml.xpath.XPathConstants; | ||
import javax.xml.xpath.XPathFactory; | ||
|
||
import org.w3c.dom.Document; | ||
|
||
public class Utils { | ||
|
||
public synchronized static final String getORSVersion() { | ||
|
||
String version = null; | ||
|
||
try { | ||
String curDir = System.getProperty("user.dir"); | ||
Path pomFile = Paths.get(Paths.get(curDir).getParent().toString(), "openrouteservice").resolve("pom.xml"); | ||
|
||
try (InputStream is = Files.newInputStream(pomFile)) | ||
{ | ||
Document doc = DocumentBuilderFactory.newInstance() | ||
.newDocumentBuilder().parse(is); | ||
doc.getDocumentElement().normalize(); | ||
version = (String) XPathFactory.newInstance().newXPath().compile("/project/version").evaluate(doc, XPathConstants.STRING); | ||
if (version != null) { | ||
version = version.trim(); | ||
} | ||
} | ||
} catch (Exception e) { | ||
} | ||
|
||
return version; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
...outeservice-api-tests/src/test/java/org/heigit/ors/services/helper/HealthServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Licensed to GIScience Research Group, Heidelberg University (GIScience) | ||
* | ||
* http://www.giscience.uni-hd.de | ||
* http://www.heigit.org | ||
* | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. The GIScience licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.heigit.ors.services.helper; | ||
|
||
import static io.restassured.RestAssured.*; | ||
|
||
import org.junit.Test; | ||
|
||
import org.heigit.ors.services.common.EndPointAnnotation; | ||
import org.heigit.ors.services.common.ServiceTest; | ||
|
||
@EndPointAnnotation(name="health") | ||
public class HealthServiceTest extends ServiceTest { | ||
|
||
public HealthServiceTest() { | ||
} | ||
|
||
@Test | ||
public void pingTest() { | ||
|
||
given() | ||
.when() | ||
.get(getEndPointName()) | ||
.then() | ||
.statusCode(200); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...outeservice-api-tests/src/test/java/org/heigit/ors/services/helper/StatusServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Licensed to GIScience Research Group, Heidelberg University (GIScience) | ||
* | ||
* http://www.giscience.uni-hd.de | ||
* http://www.heigit.org | ||
* | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. The GIScience licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.heigit.ors.services.helper; | ||
|
||
import static io.restassured.RestAssured.*; | ||
import static org.hamcrest.Matchers.is; | ||
|
||
import org.junit.Test; | ||
|
||
import org.heigit.ors.services.common.EndPointAnnotation; | ||
import org.heigit.ors.services.common.ServiceTest; | ||
|
||
@EndPointAnnotation(name="status") | ||
public class StatusServiceTest extends ServiceTest { | ||
|
||
public StatusServiceTest() { | ||
} | ||
|
||
@Test | ||
public void pingTest() { | ||
|
||
given() | ||
.when() | ||
.get(getEndPointName()) | ||
.then() | ||
.body("any { it.key == 'profiles' }", is(true)) | ||
.statusCode(200); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
...vice-api-tests/src/test/java/org/heigit/ors/services/isochrones/IsochronesErrorCodes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* | ||
* * Licensed to GIScience Research Group, Heidelberg University (GIScience) | ||
* * | ||
* * http://www.giscience.uni-hd.de | ||
* * http://www.heigit.org | ||
* * | ||
* * under one or more contributor license agreements. See the NOTICE file | ||
* * distributed with this work for additional information regarding copyright | ||
* * ownership. The GIScience licenses this file to you under the Apache License, | ||
* * Version 2.0 (the "License"); you may not use this file except in compliance | ||
* * with the License. You may obtain a copy of the License at | ||
* * | ||
* * http://www.apache.org/licenses/LICENSE-2.0 | ||
* * | ||
* * Unless required by applicable law or agreed to in writing, software | ||
* * distributed under the License is distributed on an "AS IS" BASIS, | ||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* * See the License for the specific language governing permissions and | ||
* * limitations under the License. | ||
* | ||
*/ | ||
package org.heigit.ors.services.isochrones; | ||
|
||
/** | ||
* This Class handles the error Codes as described in the error_codes.md | ||
* | ||
* @author OpenRouteServiceTeam | ||
* @author Julian Psotta, julian@openrouteservice.org | ||
*/ | ||
public class IsochronesErrorCodes { | ||
public static int INVALID_JSON_FORMAT = 3000; | ||
public static int MISSING_PARAMETER = 3001; | ||
public static int INVALID_PARAMETER_FORMAT = 3002; | ||
public static int INVALID_PARAMETER_VALUE = 3003; | ||
public static int PARAMETER_VALUE_EXCEEDS_MAXIMUM = 3004; | ||
public static int FEATURE_NOT_SUPPORTED = 3005; | ||
public static int EXPORT_HANDLER_ERROR = 3006; | ||
public static int UNSUPPORTED_EXPORT_FORMAT = 3007; | ||
public static int EMPTY_ELEMENT = 3008; | ||
public static int UNKNOWN = 3099; | ||
} |
39 changes: 39 additions & 0 deletions
39
...api-tests/src/test/java/org/heigit/ors/services/mapmatching/ParametersValidationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Licensed to GIScience Research Group, Heidelberg University (GIScience) | ||
* | ||
* http://www.giscience.uni-hd.de | ||
* http://www.heigit.org | ||
* | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. The GIScience licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.heigit.ors.services.mapmatching; | ||
|
||
import static io.restassured.RestAssured.*; | ||
import static org.hamcrest.Matchers.*; | ||
|
||
import org.junit.Test; | ||
import org.json.JSONObject; | ||
|
||
import org.heigit.ors.services.common.EndPointAnnotation; | ||
import org.heigit.ors.services.common.ServiceTest; | ||
|
||
@EndPointAnnotation(name = "matching") | ||
public class ParametersValidationTest extends ServiceTest { | ||
|
||
public ParametersValidationTest() { | ||
|
||
|
||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ce-api-tests/src/test/java/org/heigit/ors/services/mapmatching/ResultsValidationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Licensed to GIScience Research Group, Heidelberg University (GIScience) | ||
* | ||
* http://www.giscience.uni-hd.de | ||
* http://www.heigit.org | ||
* | ||
* under one or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information regarding copyright | ||
* ownership. The GIScience licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.heigit.ors.services.mapmatching; | ||
|
||
import org.heigit.ors.services.common.EndPointAnnotation; | ||
import org.heigit.ors.services.common.ServiceTest; | ||
|
||
@EndPointAnnotation(name="matching") | ||
public class ResultsValidationTest extends ServiceTest { | ||
public ResultsValidationTest() { | ||
} | ||
} |
Oops, something went wrong.