Skip to content

Commit

Permalink
Merge branch 'master' into bugfix#1181-address_data_alignment_issue_i…
Browse files Browse the repository at this point in the history
…n_hgv_storage
  • Loading branch information
takb authored Jun 14, 2022
2 parents d2a095a + d8b1d5d commit fb9852d
Show file tree
Hide file tree
Showing 331 changed files with 13,103 additions and 897 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ RELEASING:
- `ors_app_config` system property ([#1017](https://github.com/GIScience/openrouteservice/issues/1017))
- `app.config` ors configuration file name ([#1017](https://github.com/GIScience/openrouteservice/issues/1017))
- `ORS_APP_CONF` environment variable ([#1017](https://github.com/GIScience/openrouteservice/issues/1017))
### Removed
- old v1 API code and related classes
### Fixed
- Errors in travel speed explanation
- Failing assertion with CALT routing ([#1047](https://github.com/GIScience/openrouteservice/issues/1047))
Expand Down
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();
}
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;
}

}
}
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;
}
}
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);
}
}
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);
}
}
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;
}
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() {


}
}
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() {
}
}
Loading

0 comments on commit fb9852d

Please sign in to comment.