@Test public void testGetSystemMessage() throws ParameterValueException { System.setProperty("ors_app_config", "target/test-classes/app.config.test"); RoutingRequest v1RouteRequest = new RoutingRequest(); Assert.assertEquals("This message would be sent with every request on API v1 from January 2020 until June 2050", SystemMessage.getSystemMessage(v1RouteRequest)); RouteRequest routeRequest = new RouteRequest(new Double[][] {new Double[] {1.0,1.0}, new Double[] {2.0,2.0}}); routeRequest.setProfile(APIEnums.Profile.CYCLING_REGULAR); routeRequest.setRoutePreference(APIEnums.RoutePreference.FASTEST); Assert.assertEquals("This message would be sent with every routing bike fastest request", SystemMessage.getSystemMessage(routeRequest)); IsochronesRequest isochronesRequest = new IsochronesRequest(); Assert.assertEquals("This message would be sent with every request for geojson response", SystemMessage.getSystemMessage(isochronesRequest)); MatrixRequest matrixRequest = new MatrixRequest(new ArrayList<>()); Assert.assertEquals("This message would be sent with every request", SystemMessage.getSystemMessage(matrixRequest)); Assert.assertEquals("This message would be sent with every request", SystemMessage.getSystemMessage(null)); Assert.assertEquals("This message would be sent with every request", SystemMessage.getSystemMessage("not a valid request parameter object")); }
public static String getSystemMessage(Object requestObj) { if (messages == null) { loadMessages(); } if (messages.isEmpty()) { return ""; } if (requestObj == null) { requestObj = ""; } RequestParams params = new RequestParams(); if (requestObj.getClass() == RoutingRequest.class) { extractParams((RoutingRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.matrix.MatrixRequest.class) { extractParams((org.heigit.ors.matrix.MatrixRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.isochrones.IsochroneRequest.class) { extractParams((org.heigit.ors.isochrones.IsochroneRequest)requestObj, params); } else if (requestObj.getClass() == RouteRequest.class) { extractParams((RouteRequest)requestObj, params); } else if (requestObj.getClass() == MatrixRequest.class) { extractParams((MatrixRequest)requestObj, params); } else if (requestObj.getClass() == IsochronesRequest.class) { extractParams((IsochronesRequest)requestObj, params); } return selectMessage(params); }
SystemMessage { public static String getSystemMessage(Object requestObj) { if (messages == null) { loadMessages(); } if (messages.isEmpty()) { return ""; } if (requestObj == null) { requestObj = ""; } RequestParams params = new RequestParams(); if (requestObj.getClass() == RoutingRequest.class) { extractParams((RoutingRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.matrix.MatrixRequest.class) { extractParams((org.heigit.ors.matrix.MatrixRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.isochrones.IsochroneRequest.class) { extractParams((org.heigit.ors.isochrones.IsochroneRequest)requestObj, params); } else if (requestObj.getClass() == RouteRequest.class) { extractParams((RouteRequest)requestObj, params); } else if (requestObj.getClass() == MatrixRequest.class) { extractParams((MatrixRequest)requestObj, params); } else if (requestObj.getClass() == IsochronesRequest.class) { extractParams((IsochronesRequest)requestObj, params); } return selectMessage(params); } }
SystemMessage { public static String getSystemMessage(Object requestObj) { if (messages == null) { loadMessages(); } if (messages.isEmpty()) { return ""; } if (requestObj == null) { requestObj = ""; } RequestParams params = new RequestParams(); if (requestObj.getClass() == RoutingRequest.class) { extractParams((RoutingRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.matrix.MatrixRequest.class) { extractParams((org.heigit.ors.matrix.MatrixRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.isochrones.IsochroneRequest.class) { extractParams((org.heigit.ors.isochrones.IsochroneRequest)requestObj, params); } else if (requestObj.getClass() == RouteRequest.class) { extractParams((RouteRequest)requestObj, params); } else if (requestObj.getClass() == MatrixRequest.class) { extractParams((MatrixRequest)requestObj, params); } else if (requestObj.getClass() == IsochronesRequest.class) { extractParams((IsochronesRequest)requestObj, params); } return selectMessage(params); } private  SystemMessage(); }
SystemMessage { public static String getSystemMessage(Object requestObj) { if (messages == null) { loadMessages(); } if (messages.isEmpty()) { return ""; } if (requestObj == null) { requestObj = ""; } RequestParams params = new RequestParams(); if (requestObj.getClass() == RoutingRequest.class) { extractParams((RoutingRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.matrix.MatrixRequest.class) { extractParams((org.heigit.ors.matrix.MatrixRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.isochrones.IsochroneRequest.class) { extractParams((org.heigit.ors.isochrones.IsochroneRequest)requestObj, params); } else if (requestObj.getClass() == RouteRequest.class) { extractParams((RouteRequest)requestObj, params); } else if (requestObj.getClass() == MatrixRequest.class) { extractParams((MatrixRequest)requestObj, params); } else if (requestObj.getClass() == IsochronesRequest.class) { extractParams((IsochronesRequest)requestObj, params); } return selectMessage(params); } private  SystemMessage(); static String getSystemMessage(Object requestObj); }
SystemMessage { public static String getSystemMessage(Object requestObj) { if (messages == null) { loadMessages(); } if (messages.isEmpty()) { return ""; } if (requestObj == null) { requestObj = ""; } RequestParams params = new RequestParams(); if (requestObj.getClass() == RoutingRequest.class) { extractParams((RoutingRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.matrix.MatrixRequest.class) { extractParams((org.heigit.ors.matrix.MatrixRequest)requestObj, params); } else if (requestObj.getClass() == org.heigit.ors.isochrones.IsochroneRequest.class) { extractParams((org.heigit.ors.isochrones.IsochroneRequest)requestObj, params); } else if (requestObj.getClass() == RouteRequest.class) { extractParams((RouteRequest)requestObj, params); } else if (requestObj.getClass() == MatrixRequest.class) { extractParams((MatrixRequest)requestObj, params); } else if (requestObj.getClass() == IsochronesRequest.class) { extractParams((IsochronesRequest)requestObj, params); } return selectMessage(params); } private  SystemMessage(); static String getSystemMessage(Object requestObj);  }