Skip to content

Commit

Permalink
Fix #129 Properies evaluation broken after the introduction of Proper…
Browse files Browse the repository at this point in the history
…tyBindingSupport
  • Loading branch information
ppalaga authored and lburgazzoli committed Aug 13, 2019
1 parent dce74db commit be79b58
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import io.quarkus.deployment.builditem.substrate.SubstrateResourceBundleBuildItem;
import io.quarkus.jaxb.deployment.JaxbEnabledBuildItem;
import io.quarkus.jaxb.deployment.JaxbFileRootBuildItem;

import org.apache.camel.Component;
import org.apache.camel.Consumer;
import org.apache.camel.Converter;
import org.apache.camel.Endpoint;
Expand All @@ -67,7 +69,8 @@ class CamelProcessor {
Producer.class,
TypeConverter.class,
ExchangeFormatter.class,
ScheduledPollConsumerScheduler.class);
ScheduledPollConsumerScheduler.class,
Component.class);

private static final List<Class<? extends Annotation>> CAMEL_REFLECTIVE_ANNOTATIONS = Arrays.asList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ protected <T> T resolve(Class<T> clazz, String type, String name, CamelContext c
this,
result,
new HashMap<>((Map) props),
CamelRuntime.PFX_CAMEL + type + "." + name);
CamelRuntime.PFX_CAMEL + type + "." + name + ".");
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import javax.ws.rs.core.MediaType;

import org.apache.camel.Route;
import org.apache.camel.component.timer.TimerComponent;
import org.apache.camel.quarkus.core.runtime.CamelRuntime;

@Path("/")
Expand All @@ -51,4 +52,11 @@ public String getProperty(@PathParam("name") String name) throws Exception {

return runtime.getContext().resolvePropertyPlaceholders(prefix + name + suffix);
}

@Path("/timer/resolve-property-placeholders")
@GET
@Produces(MediaType.TEXT_PLAIN)
public boolean timerResolvePropertyPlaceholders() throws Exception {
return runtime.getContext().getComponent("timer", TimerComponent.class).isResolvePropertyPlaceholders();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ quarkus.camel.defer-init-phase=true
#
camel.context.name=quarkus-camel-example

# Timer
camel.component.timer.resolve-property-placeholders = false
#
# Integration
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@
*/
package org.apache.camel.quarkus.core;

import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import org.junit.jupiter.api.Test;

import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;

import org.junit.jupiter.api.Test;

import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;

@QuarkusTest
public class CamelTest {

@Test
public void testRoutes() {
RestAssured.when().get("/test/routes").then().body(containsString("timer"));
Expand All @@ -34,4 +36,11 @@ public void testRoutes() {
public void testProperties() {
RestAssured.when().get("/test/property/camel.context.name").then().body(is("quarkus-camel-example"));
}

@Test
public void timerPropertyPropagated() {
RestAssured.when().get("/test/property/camel.component.timer.resolve-property-placeholders").then().body(is("false"));
RestAssured.when().get("/test/timer/resolve-property-placeholders").then().body(is("false"));
}

}

0 comments on commit be79b58

Please sign in to comment.