Skip to content

Commit

Permalink
Fixed missing registry values in native mode apache#867
Browse files Browse the repository at this point in the history
  • Loading branch information
aldettinger committed Mar 11, 2020
1 parent 16cf8e5 commit b38edaa
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,9 @@ void process(
// Register routes as reflection aware as camel-main main use reflection
// to bind beans to the registry
//
camelRoutesBuilders.forEach(dotName -> {
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, dotName.toString()));
camelRoutesBuilders.forEach(camelRoutesBuilderClassBuildItem -> {
reflectiveClass.produce(
new ReflectiveClassBuildItem(true, true, camelRoutesBuilderClassBuildItem.getDotName().toString()));
});

reflectiveClass.produce(new ReflectiveClassBuildItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@
*/
package org.apache.camel.quarkus.core;

import org.apache.camel.BindToRegistry;
import org.apache.camel.builder.RouteBuilder;

public class CamelRoute extends RouteBuilder {

@BindToRegistry
private String stringFromRegistry = "String From Registry";

@Override
public void configure() {
from("timer:keep-alive")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,4 +228,12 @@ public JsonObject describeRegistryComponent(@PathParam("name") String name) {

return builder.build();
}

@Path("/registry/string/{name}")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getStringValueFromRegistry(@PathParam("name") String name) {
final DefaultRegistry registry = context.getRegistry(DefaultRegistry.class);
return registry.getFallbackRegistry().lookupByNameAndType(name, String.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,4 +172,14 @@ public void testCustomComponent() {
"registry", is("repository"),
"registry-type", is("org.apache.camel.quarkus.core.RuntimeBeanRepository"));
}

@Test
public void testGetStringFromRegistry() {
RestAssured.given()
.accept(MediaType.TEXT_PLAIN)
.get("/test/registry/string/stringFromRegistry")
.then()
.statusCode(200)
.body(is("String From Registry"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
*/
package org.apache.camel.quarkus.component.mustache.it;

import io.quarkus.runtime.annotations.RegisterForReflection;
import org.apache.camel.BindToRegistry;
import org.apache.camel.builder.RouteBuilder;

@RegisterForReflection(fields = true, methods = false)
public class MustacheRoute extends RouteBuilder {

@BindToRegistry
Expand Down

0 comments on commit b38edaa

Please sign in to comment.