You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2021/04/29 12:08:00 UTC
[camel-quarkus] branch main updated: Test class component,
test bean language #2361
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new cc32c2f Test class component, test bean language #2361
cc32c2f is described below
commit cc32c2fdf2a3bbab2cf4ac3e3f798124b542a31d
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Apr 28 20:34:39 2021 +0200
Test class component, test bean language #2361
---
integration-tests/bean/pom.xml | 9 +++
.../component/bean/method/BeanMethodResource.java | 62 ++++++++++++++++++
.../component/bean/method/BeanMethodRoute.java | 59 +++++++++++++++++
.../component/bean/method/NonRegisteredBean.java | 33 ++++++++++
.../quarkus/component/bean/method/Producers.java | 40 ++++++++++++
.../component/bean/method/RegisteredBean.java | 40 ++++++++++++
.../quarkus/component/bean/model/Employee.java | 64 +++++++++++++++++++
.../quarkus/component/class_/ClassResource.java | 52 +++++++++++++++
.../quarkus/component/class_/EmployeeService.java | 38 +++++++++++
.../camel/quarkus/component/bean/BeanMethodIT.java | 23 +++++++
.../quarkus/component/bean/BeanMethodTest.java | 74 ++++++++++++++++++++++
.../camel/quarkus/component/bean/ClassIT.java | 23 +++++++
.../camel/quarkus/component/bean/ClassTest.java | 50 +++++++++++++++
13 files changed, 567 insertions(+)
diff --git a/integration-tests/bean/pom.xml b/integration-tests/bean/pom.xml
index ef6155c..9f6215c 100644
--- a/integration-tests/bean/pom.xml
+++ b/integration-tests/bean/pom.xml
@@ -47,6 +47,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy-jackson</artifactId>
+ </dependency>
<!-- test dependencies -->
<dependency>
@@ -64,6 +68,11 @@
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ <scope>test</scope>
+ </dependency>
<!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
<dependency>
diff --git a/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/BeanMethodResource.java b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/BeanMethodResource.java
new file mode 100644
index 0000000..3bf0589
--- /dev/null
+++ b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/BeanMethodResource.java
@@ -0,0 +1,62 @@
+/*
+ * 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.bean.method;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+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.ProducerTemplate;
+import org.apache.camel.quarkus.component.bean.model.Employee;
+
+@Path("/bean-method")
+public class BeanMethodResource {
+
+ @Inject
+ ProducerTemplate template;
+
+ @Inject
+ @Named("collected-names")
+ Map<String, List<String>> collectedNames;
+
+ @Path("/employee/{route}")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ public Response employee(Employee employee, @PathParam("route") String route) {
+ template.sendBody("direct:" + route, employee);
+ return Response.created(URI.create("https://camel.apache.org")).build();
+ }
+
+ @Path("/collectedNames/{key}")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public List<String> collectedNames(@PathParam("key") String key) {
+ return collectedNames.get(key);
+ }
+
+}
diff --git a/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/BeanMethodRoute.java b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/BeanMethodRoute.java
new file mode 100644
index 0000000..a7332e6
--- /dev/null
+++ b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/BeanMethodRoute.java
@@ -0,0 +1,59 @@
+/*
+ * 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.bean.method;
+
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * A {@link RouteBuilder} instantiated by Camel (not by Arc).
+ */
+@ApplicationScoped
+public class BeanMethodRoute extends RouteBuilder {
+
+ @Inject
+ @Named("collected-names")
+ Map<String, List<String>> collectedNames;
+
+ private final NonRegisteredBean beanInstance = new NonRegisteredBean();
+
+ @Override
+ public void configure() {
+ from("direct:beanFromRegistryByName")
+ .filter().method("RegisteredBean", "isSenior")
+ .transform(method("RegisteredBean", "toFirstName"))
+ .process(e -> collectedNames.get("beanFromRegistryByName").add(e.getMessage().getBody(String.class)));
+
+ from("direct:beanByClassName")
+ .filter().method(NonRegisteredBean.class, "isJunior")
+ .transform(method(NonRegisteredBean.class, "toLastName"))
+ .process(e -> collectedNames.get("beanByClassName").add(e.getMessage().getBody(String.class)));
+
+ from("direct:beanInstance")
+ .filter().method(beanInstance, "isJunior")
+ .transform(method(beanInstance, "toLastName"))
+ .process(e -> collectedNames.get("beanInstance").add(e.getMessage().getBody(String.class)));
+
+ }
+
+}
diff --git a/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/NonRegisteredBean.java b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/NonRegisteredBean.java
new file mode 100644
index 0000000..4405ab9
--- /dev/null
+++ b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/NonRegisteredBean.java
@@ -0,0 +1,33 @@
+/*
+ * 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.bean.method;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+import org.apache.camel.quarkus.component.bean.model.Employee;
+
+@RegisterForReflection
+public class NonRegisteredBean {
+
+ public boolean isJunior(Employee employee) {
+ return "junior".equals(employee.getSeniority());
+ }
+
+ public String toLastName(Employee employee) {
+ return employee.getLastName();
+ }
+
+}
diff --git a/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/Producers.java b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/Producers.java
new file mode 100644
index 0000000..888785c
--- /dev/null
+++ b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/Producers.java
@@ -0,0 +1,40 @@
+/*
+ * 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.bean.method;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class Producers {
+
+ @Produces
+ @ApplicationScoped
+ @Named("collected-names")
+ public Map<String, List<String>> collectedNames() {
+ Map<String, List<String>> result = new HashMap<>();
+ result.put("beanFromRegistryByName", new CopyOnWriteArrayList<>());
+ result.put("beanByClassName", new CopyOnWriteArrayList<>());
+ result.put("beanInstance", new CopyOnWriteArrayList<>());
+ return result;
+ }
+}
diff --git a/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/RegisteredBean.java b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/RegisteredBean.java
new file mode 100644
index 0000000..4b6983a
--- /dev/null
+++ b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/method/RegisteredBean.java
@@ -0,0 +1,40 @@
+/*
+ * 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.bean.method;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+
+import io.quarkus.arc.Unremovable;
+import io.quarkus.runtime.annotations.RegisterForReflection;
+import org.apache.camel.quarkus.component.bean.model.Employee;
+
+@ApplicationScoped
+@Named("RegisteredBean")
+@Unremovable
+@RegisterForReflection
+public class RegisteredBean {
+
+ public boolean isSenior(Employee employee) {
+ return "senior".equals(employee.getSeniority());
+ }
+
+ public String toFirstName(Employee employee) {
+ return employee.getFirstName();
+ }
+
+}
diff --git a/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/model/Employee.java b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/model/Employee.java
new file mode 100644
index 0000000..e944689
--- /dev/null
+++ b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/bean/model/Employee.java
@@ -0,0 +1,64 @@
+/*
+ * 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.bean.model;
+
+public class Employee {
+
+ private String firstName;
+ private String lastName;
+ private String seniority;
+
+ public Employee() {
+
+ }
+
+ public Employee(String firstName, String lastName, String seniority) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.seniority = seniority;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public String getSeniority() {
+ return seniority;
+ }
+
+ public void setSeniority(String seniority) {
+ this.seniority = seniority;
+ }
+
+ @Override
+ public String toString() {
+ return "Employee [firstName=" + firstName + ", lastName=" + lastName + ", seniority=" + seniority + "]";
+ }
+
+}
diff --git a/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/class_/ClassResource.java b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/class_/ClassResource.java
new file mode 100644
index 0000000..ceb43fd
--- /dev/null
+++ b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/class_/ClassResource.java
@@ -0,0 +1,52 @@
+/*
+ * 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.class_;
+
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.core.MediaType;
+
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.quarkus.component.bean.model.Employee;
+
+@Path("/class")
+public class ClassResource {
+
+ @Inject
+ ProducerTemplate template;
+
+ @Path("/firstName")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ public String firstName(Employee employee) {
+ return template.requestBody("class:org.apache.camel.quarkus.component.class_.EmployeeService?method=toFirstName",
+ employee, String.class);
+ }
+
+ @Path("/greet/{greeting}")
+ @POST
+ @Consumes(MediaType.APPLICATION_JSON)
+ public String greet(Employee employee, @PathParam("greeting") String greeting) {
+ return template.requestBody(
+ "class:org.apache.camel.quarkus.component.class_.EmployeeService?bean.greeting=" + greeting + "&method=greet",
+ employee, String.class);
+ }
+
+}
diff --git a/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/class_/EmployeeService.java b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/class_/EmployeeService.java
new file mode 100644
index 0000000..cd2a0fa
--- /dev/null
+++ b/integration-tests/bean/src/main/java/org/apache/camel/quarkus/component/class_/EmployeeService.java
@@ -0,0 +1,38 @@
+/*
+ * 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.class_;
+
+import io.quarkus.runtime.annotations.RegisterForReflection;
+import org.apache.camel.quarkus.component.bean.model.Employee;
+
+@RegisterForReflection
+public class EmployeeService {
+
+ private String greeting;
+
+ public String toFirstName(Employee employee) {
+ return employee.getFirstName();
+ }
+
+ public void setGreeting(String greeting) {
+ this.greeting = greeting;
+ }
+
+ public String greet(Employee employee) {
+ return greeting + " " + employee.getFirstName();
+ }
+}
diff --git a/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/BeanMethodIT.java b/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/BeanMethodIT.java
new file mode 100644
index 0000000..13e8262
--- /dev/null
+++ b/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/BeanMethodIT.java
@@ -0,0 +1,23 @@
+/*
+ * 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.bean;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class BeanMethodIT extends BeanMethodTest {
+}
diff --git a/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/BeanMethodTest.java b/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/BeanMethodTest.java
new file mode 100644
index 0000000..fa84ed6
--- /dev/null
+++ b/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/BeanMethodTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.bean;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.apache.camel.quarkus.component.bean.model.Employee;
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.Test;
+
+@QuarkusTest
+public class BeanMethodTest {
+
+ private static final List<Employee> EMPLOYEES = Arrays.asList(
+ new Employee("Michael", "Singer", "junior"),
+ new Employee("Joe", "Doe", "junior"),
+ new Employee("Susanne", "First", "senior"),
+ new Employee("Max", "Mustermann", "senior"));
+
+ static void assertFilterAndExpression(String route, String... expectedNames) {
+ for (Employee employee : EMPLOYEES) {
+ RestAssured.given()
+ .contentType(ContentType.JSON)
+ .body(employee)
+ .post("/bean-method/employee/" + route)
+ .then()
+ .statusCode(201);
+ }
+
+ Awaitility.await().pollInterval(50, TimeUnit.MILLISECONDS).atMost(30, TimeUnit.SECONDS)
+ .<String[]> until(
+ () -> RestAssured.given()
+ .get("/bean-method/collectedNames/" + route)
+ .then()
+ .statusCode(200)
+ .extract().body().as(String[].class),
+ names -> Arrays.equals(names, expectedNames));
+ }
+
+ @Test
+ public void beanFromRegistryByName() {
+ assertFilterAndExpression("beanFromRegistryByName", "Susanne", "Max");
+ }
+
+ @Test
+ public void beanByClassName() {
+ assertFilterAndExpression("beanByClassName", "Singer", "Doe");
+ }
+
+ @Test
+ public void beanInstance() {
+ assertFilterAndExpression("beanInstance", "Singer", "Doe");
+ }
+
+}
diff --git a/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/ClassIT.java b/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/ClassIT.java
new file mode 100644
index 0000000..421ddd5
--- /dev/null
+++ b/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/ClassIT.java
@@ -0,0 +1,23 @@
+/*
+ * 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.bean;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+public class ClassIT extends ClassTest {
+}
diff --git a/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/ClassTest.java b/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/ClassTest.java
new file mode 100644
index 0000000..586cdca
--- /dev/null
+++ b/integration-tests/bean/src/test/java/org/apache/camel/quarkus/component/bean/ClassTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.bean;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.apache.camel.quarkus.component.bean.model.Employee;
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.Test;
+
+@QuarkusTest
+public class ClassTest {
+ @Test
+ public void classMethod() {
+ RestAssured.given()
+ .contentType(ContentType.JSON)
+ .body(new Employee("Joe", "Doe", "junior"))
+ .post("/class/firstName")
+ .then()
+ .statusCode(200)
+ .body(Matchers.is("Joe"));
+ }
+
+ @Test
+ public void classSetInstanceField() {
+ RestAssured.given()
+ .contentType(ContentType.JSON)
+ .body(new Employee("Joe", "Doe", "junior"))
+ .post("/class/greet/Hello")
+ .then()
+ .statusCode(200)
+ .body(Matchers.is("Hello Joe"));
+ }
+
+}