ppalaga commented on a change in pull request #1856:
URL: https://github.com/apache/camel-quarkus/pull/1856#discussion_r498080961



##########
File path: integration-tests/geocoder/src/main/resources/application.properties
##########
@@ -0,0 +1,27 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF 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.
+## ---------------------------------------------------------------------------
+
+
+################################
+#### properties for Google maps services
+# add your API KEY to run the examples
+#google.api.key=YOUR_API_KEY
+
+#The locale English must be available in the machine for native usage with 
Lat/Lng
+quarkus.locales=en-US

Review comment:
       ```suggestion
   ```
   
   I have tested locally and it looks like `quarkus.locales` has no effect. The 
locale set on the machine, e.g. via `export LANG=en_US.UTF-8` seems to be the 
only thing that matters. I think we can remove the above snippet.

##########
File path: 
integration-tests/geocoder/src/test/java/org/apache/camel/quarkus/component/geocoder/it/GeocoderGoogleTest.java
##########
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF 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.apache.camel.quarkus.component.geocoder.it;
+
+import io.quarkus.test.common.http.TestHTTPEndpoint;
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.eclipse.microprofile.config.ConfigProvider;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static 
org.apache.camel.quarkus.component.geocoder.it.GeocoderGoogleResource.GOOGLE_GEOCODER_API_KEY;
+import static org.hamcrest.Matchers.hasKey;
+
+@QuarkusTest
+@TestHTTPEndpoint(GeocoderGoogleResource.class)
+class GeocoderGoogleTest {
+
+    private static boolean enabled;
+
+    @BeforeAll
+    public static void setup() {
+        // enables the integration tests if an API key exists
+        enabled = ConfigProvider.getConfig()
+                .getOptionalValue(GOOGLE_GEOCODER_API_KEY, 
String.class).isPresent();

Review comment:
       You can use `@EnabledIfEnvironmentVariable` for disabling the test like 
we do in 
https://github.com/apache/camel-quarkus/blob/1175fdc6dd5e6ee4a7782afa56b404803ad2e73d/integration-tests/braintree/src/test/java/org/apache/camel/quarkus/component/braintree/it/BraintreeIT.java#L25
   
   If you do that that way, the test app is not started at all and you actually 
do not need to check in the app whether property is set. 
   
   I think in case the GOOGLE_GEOCODER_API_KEY is not provided, the test should 
run against a mock API, something like we do with Telegram and elsewhere. If a 
mock testcontainer is available we should use it. No need to do this now, I'll 
file a followup.

##########
File path: extensions/geocoder/runtime/src/main/doc/configuration.adoc
##########
@@ -0,0 +1,3 @@
+The extension uses Locale.English to do the conversion of Double latitude and 
longitude values, in order to match the format required by the Google Maps API.
+
+An example of setting the Locale en_US for GraalVm: 
https://www.graalvm.org/reference-manual/ruby/UTF8Locale/

Review comment:
       Let's explain this in more detail. How about this?
   
   ```suggestion
   Locales different from the build machine's default locale do not work well 
in native mode due to https://github.com/oracle/graal/issues/1645[this GraalVM 
bug]. The `google-maps-services` library this extension depends on uses 
`Locale.English` to format double latitude and longitude values. As a 
consequence of these two facts, the locale on the building machine must be set 
to some English locale, such as `en_US.UTF-8`, `en_GB.UTF-8` or `en_IE.UTF-8` 
so that the calls to the Google Maps API work properly. On Linux, you need to 
check the value of the `LANG` environment variable, e.g. via `echo $LANG` and 
change the value via `export LANG=en_US.UTF-8` if necessary.
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to