Skip to content

Commit

Permalink
fix: CamelContext.getVersion() always returns an empty string
Browse files Browse the repository at this point in the history
fixes #247
  • Loading branch information
jamesnetherton committed Oct 14, 2019
1 parent 4152d3d commit 7537436
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void process(CombinedIndexBuildItem combinedIndex) {
.map(ai -> ai.target().asMethod())
.forEach(this::addReflectiveMethod);

CamelSupport.resources(applicationArchivesBuildItem, "META-INF/maven/org.apache.camel/camel-core")
CamelSupport.resources(applicationArchivesBuildItem, "META-INF/maven/org.apache.camel/camel-base")
.forEach(this::addResource);
CamelSupport.resources(applicationArchivesBuildItem, CamelSupport.CAMEL_SERVICE_BASE_PATH)
.forEach(this::addCamelService);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*/
package org.apache.camel.quarkus.core;

import java.util.Set;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.json.Json;
Expand Down Expand Up @@ -71,4 +73,12 @@ public boolean lookupContext() {
public boolean lookupMain() {
return registry.findByType(CamelMain.class).size() == 1;
}

@Path("/context/version")
@GET
@Produces(MediaType.TEXT_PLAIN)
public String contextVersion() {
Set<CamelContext> camelContexts = registry.findByType(CamelContext.class);
return camelContexts.isEmpty() ? "" : camelContexts.iterator().next().getVersion();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.junit.jupiter.api.Test;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.core.IsNot.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand All @@ -44,4 +45,9 @@ public void testCamelBeanBuildItem() {
assertTrue(response.jsonPath().getBoolean("show-all"));
assertTrue(response.jsonPath().getBoolean("multi-line"));
}

@Test
public void testCamelContextVersion() {
RestAssured.when().get("/test/context/version").then().body(not(""));
}
}

0 comments on commit 7537436

Please sign in to comment.