You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ji...@apache.org on 2023/10/27 14:25:09 UTC

(camel-quarkus) branch camel-main updated: Quick fix because CAMEL-20051

This is an automated email from the ASF dual-hosted git repository.

jiriondrusek pushed a commit to branch camel-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/camel-main by this push:
     new 30264395c5 Quick fix because CAMEL-20051
30264395c5 is described below

commit 30264395c5cf5291e0cca7a95999c743825ff34b
Author: JiriOndrusek <on...@gmail.com>
AuthorDate: Fri Oct 27 16:24:36 2023 +0200

    Quick fix because CAMEL-20051
---
 .../core/converter/it/ConverterProfile1IT.java     | 23 +++++++++
 .../core/converter/it/ConverterProfile1Test.java   | 33 +++++++++++++
 .../core/converter/it/ConverterProfile2IT.java     | 23 +++++++++
 .../core/converter/it/ConverterProfile2Test.java   | 33 +++++++++++++
 .../quarkus/core/converter/it/ConverterTest.java   | 44 +----------------
 .../core/converter/it/ConverterTestBase.java       | 56 ++++++++++++++++++++++
 6 files changed, 169 insertions(+), 43 deletions(-)

diff --git a/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile1IT.java b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile1IT.java
new file mode 100644
index 0000000000..410ffd6f7f
--- /dev/null
+++ b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile1IT.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.core.converter.it;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+public class ConverterProfile1IT extends ConverterProfile1Test {
+}
diff --git a/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile1Test.java b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile1Test.java
new file mode 100644
index 0000000000..2916ada3bf
--- /dev/null
+++ b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile1Test.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.core.converter.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.TestProfile;
+import org.junit.jupiter.api.Test;
+
+// See https://github.com/apache/camel-quarkus/issues/5467
+@QuarkusTest
+@TestProfile(ConverterProfile1Test.class)
+public class ConverterProfile1Test extends ConverterTestBase implements QuarkusTestProfile {
+
+    @Test
+    void testFallback() {
+        testConverter("/converter/fallback", "a:b", "test_a", "b");
+    }
+}
diff --git a/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile2IT.java b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile2IT.java
new file mode 100644
index 0000000000..34cad1cf64
--- /dev/null
+++ b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile2IT.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.core.converter.it;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+public class ConverterProfile2IT extends ConverterProfile2Test {
+}
diff --git a/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile2Test.java b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile2Test.java
new file mode 100644
index 0000000000..8aaa5edd66
--- /dev/null
+++ b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterProfile2Test.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.core.converter.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.TestProfile;
+import org.junit.jupiter.api.Test;
+
+// See https://github.com/apache/camel-quarkus/issues/5467
+@QuarkusTest
+@TestProfile(ConverterProfile2Test.class)
+public class ConverterProfile2Test extends ConverterTestBase implements QuarkusTestProfile {
+
+    @Test
+    void testExchangeConverter() {
+        testConverter("/converter/fallback", "c:d", "test_c", "d");
+    }
+}
diff --git a/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterTest.java b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterTest.java
index 7a77063504..3b79b05bf5 100644
--- a/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterTest.java
+++ b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterTest.java
@@ -18,15 +18,12 @@ package org.apache.camel.quarkus.core.converter.it;
 
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
-import io.restassured.http.ContentType;
-import io.restassured.response.ValidatableResponse;
-import jakarta.ws.rs.core.MediaType;
 import org.junit.jupiter.api.Test;
 
 import static org.hamcrest.Matchers.*;
 
 @QuarkusTest
-public class ConverterTest {
+public class ConverterTest extends ConverterTestBase {
 
     @Test
     void testConverterFromRegistry() {
@@ -85,16 +82,6 @@ public class ConverterTest {
         testConverter("/converter/myLoaderPair", "a:b", "loader_a", "b");
     }
 
-    @Test
-    void testFallback() {
-        testConverter("/converter/fallback", "a:b", "test_a", "b");
-    }
-
-    @Test
-    void testExchangeConverter() {
-        testConverter("/converter/fallback", "c:d", "test_c", "d");
-    }
-
     @Test
     void testConverterGetStatistics() {
         enableStatistics(true);
@@ -106,33 +93,4 @@ public class ConverterTest {
 
         enableStatistics(false);
     }
-
-    private void enableStatistics(boolean b) {
-        RestAssured.given()
-                .contentType(ContentType.TEXT).body(b)
-                .post("/converter/setStatisticsEnabled")
-                .then()
-                .statusCode(204);
-    }
-
-    private void testConverterReturningNull(String url, String body) {
-        testConverter(url, body, 204, null, null);
-    }
-
-    private void testConverter(String url, String body, String expectedKey, String expectedValue) {
-        testConverter(url, body, 200, expectedKey, expectedValue);
-    }
-
-    private void testConverter(String url, String body, int expectedResultCode, String expectedKey, String expectedValue) {
-        ValidatableResponse response = RestAssured.given()
-                .contentType(ContentType.TEXT).body(body)
-                .accept(MediaType.APPLICATION_JSON)
-                .post(url)
-                .then()
-                .statusCode(expectedResultCode);
-
-        if (expectedKey != null) {
-            response.body("key", is(expectedKey), "val", is(expectedValue));
-        }
-    }
 }
diff --git a/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterTestBase.java b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterTestBase.java
new file mode 100644
index 0000000000..e3e18cfb41
--- /dev/null
+++ b/integration-test-groups/foundation/type-converter/src/test/java/org/apache/camel/quarkus/core/converter/it/ConverterTestBase.java
@@ -0,0 +1,56 @@
+/*
+ * 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.core.converter.it;
+
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import io.restassured.response.ValidatableResponse;
+import jakarta.ws.rs.core.MediaType;
+
+import static org.hamcrest.Matchers.is;
+
+public abstract class ConverterTestBase {
+
+    void enableStatistics(boolean b) {
+        RestAssured.given()
+                .contentType(ContentType.TEXT).body(b)
+                .post("/converter/setStatisticsEnabled")
+                .then()
+                .statusCode(204);
+    }
+
+    void testConverterReturningNull(String url, String body) {
+        testConverter(url, body, 204, null, null);
+    }
+
+    void testConverter(String url, String body, String expectedKey, String expectedValue) {
+        testConverter(url, body, 200, expectedKey, expectedValue);
+    }
+
+    void testConverter(String url, String body, int expectedResultCode, String expectedKey, String expectedValue) {
+        ValidatableResponse response = RestAssured.given()
+                .contentType(ContentType.TEXT).body(body)
+                .accept(MediaType.APPLICATION_JSON)
+                .post(url)
+                .then()
+                .statusCode(expectedResultCode);
+
+        if (expectedKey != null) {
+            response.body("key", is(expectedKey), "val", is(expectedValue));
+        }
+    }
+}