ppalaga commented on a change in pull request #1715: URL: https://github.com/apache/camel-quarkus/pull/1715#discussion_r484758167
########## File path: integration-tests/weather/src/main/java/org/apache/camel/quarkus/component/weather/it/WeatherResource.java ########## @@ -0,0 +1,152 @@ +/* + * 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.weather.it; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.apache.camel.CamelContext; +import org.apache.camel.ConsumerTemplate; +import org.apache.camel.ProducerTemplate; +import org.apache.camel.component.weather.WeatherConstants; +import org.jboss.logging.Logger; + +@Path("/weather") +@ApplicationScoped +public class WeatherResource { + + private static final Logger LOG = Logger.getLogger(WeatherResource.class); + + private static final String COMPONENT_WEATHER = "weather"; + @Inject + CamelContext context; + + @Inject + ProducerTemplate producerTemplate; + + @Inject + ConsumerTemplate consumerTemplate; + + @Path("load/component/weather") + @GET + @Produces(MediaType.TEXT_PLAIN) + public Response loadComponentWeather() throws Exception { + /* This is an autogenerated test */ + if (context.getComponent(COMPONENT_WEATHER) != null) { + return Response.ok().build(); + } + LOG.warnf("Could not load [%s] from the Camel context", COMPONENT_WEATHER); + return Response.status(500, COMPONENT_WEATHER + " could not be loaded from the Camel context").build(); + } + + @Path("location/{location}") + @GET + @Produces(MediaType.TEXT_PLAIN) + public Response getWeatherByLocation(@PathParam("location") String location) { + LOG.infof("Retrieve weather with location : %s", location); + final String response = producerTemplate.requestBodyAndHeader( + "weather:foo?location=random&appid=9162755b2efa555823cfe0451d7fff38&geolocationAccessKey=test&geolocationRequestHostIP=test", Review comment: Hm... what appid is that then? Your personal or perhaps copied from Camel? In any case, I think we should consider putting the appid into the `application.properties` and comment there that it is Camel community's (or whoever else's) testing appid that people should change when copying the code to their apps. ---------------------------------------------------------------- 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