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/10/01 08:48:20 UTC

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

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