You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/09/30 16:00:38 UTC

[GitHub] [camel-quarkus] zbendhiba opened a new pull request #1856: Geocoder native support fixes #1645

zbendhiba opened a new pull request #1856:
URL: https://github.com/apache/camel-quarkus/pull/1856


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #1856: Geocoder native support fixes #1645

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #1856:
URL: https://github.com/apache/camel-quarkus/pull/1856#discussion_r498087327



##########
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();
+    }
+
+    @Test
+    public void loadCurrentLocation() {
+        // disable test if no API KEY
+        if (enabled) {

Review comment:
       thanks!! I'll add that annotation then !!




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #1856: Geocoder native support fixes #1645

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #1856:
URL: https://github.com/apache/camel-quarkus/pull/1856#discussion_r498105508



##########
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:
       OK




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on pull request #1856: Geocoder native support fixes #1645

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #1856:
URL: https://github.com/apache/camel-quarkus/pull/1856#issuecomment-701578491


   I have restarted the CI.
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #1856: Geocoder native support fixes #1645

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #1856:
URL: https://github.com/apache/camel-quarkus/pull/1856#discussion_r498107783



##########
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:
       LGTM!




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on a change in pull request #1856: Geocoder native support fixes #1645

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga merged pull request #1856: Geocoder native support fixes #1645

Posted by GitBox <gi...@apache.org>.
ppalaga merged pull request #1856:
URL: https://github.com/apache/camel-quarkus/pull/1856


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on pull request #1856: Geocoder native support fixes #1645

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #1856:
URL: https://github.com/apache/camel-quarkus/pull/1856#issuecomment-702225602


   The foundation test group failure is unrelated.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] zbendhiba commented on pull request #1856: Geocoder native support fixes #1645

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on pull request #1856:
URL: https://github.com/apache/camel-quarkus/pull/1856#issuecomment-702257493


   Thanks @ppalaga 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga commented on pull request #1856: Geocoder native support fixes #1645

Posted by GitBox <gi...@apache.org>.
ppalaga commented on pull request #1856:
URL: https://github.com/apache/camel-quarkus/pull/1856#issuecomment-702002407


   Here is the follow up: https://github.com/apache/camel-quarkus/issues/1860
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [camel-quarkus] jamesnetherton commented on a change in pull request #1856: Geocoder native support fixes #1645

Posted by GitBox <gi...@apache.org>.
jamesnetherton commented on a change in pull request #1856:
URL: https://github.com/apache/camel-quarkus/pull/1856#discussion_r498082787



##########
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();
+    }
+
+    @Test
+    public void loadCurrentLocation() {
+        // disable test if no API KEY
+        if (enabled) {

Review comment:
       I think it'd be better to follow the pattern we use in other tests, where annotations determine whether the test should run. For example, see the Braintree test:
   
   https://github.com/apache/camel-quarkus/blob/master/integration-tests/braintree/src/test/java/org/apache/camel/quarkus/component/braintree/it/BraintreeTest.java#L29-L31
   
   https://github.com/apache/camel-quarkus/blob/master/integration-tests/braintree/src/test/java/org/apache/camel/quarkus/component/braintree/it/BraintreeIT.java#L23-L25
   
   Can you also add a README to the itest module directory that explains which environment variable(s) need to be set and how to obtain API keys etc. E.g like this:
   
   https://github.com/apache/camel-quarkus/blob/master/integration-tests/braintree/README.adoc




----------------------------------------------------------------
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:
users@infra.apache.org