ppalaga commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r938639850
##########
poms/bom/pom.xml:
##########
@@ -1849,6 +1849,11 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-directvm</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
Review Comment:
I see that this is a transitive of camel-test-junit5, but I still wonder
whether it is really needed on Camel Quarkus?
IIRC, we agreed recently not to port camel-directvm to CQ. But when it soaks
to end user tests in this way, it might awake a false impression that it is
supported on CQ. Would it perhaps be possible to exclude camel-directvm from
camel-test-junit5? I would not mind filing a follow up for this if nobody knows
the answer from top of her head.
##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-test-framework</artifactId>
+ <version>2.12.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+ <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
Review Comment:
Is slf4j-api really needed? I have not found any use of it.
##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-test-framework</artifactId>
+ <version>2.12.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+ <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ </dependency>
Review Comment:
Why not `<scope>test</scope>`?
##########
test-framework/junit5-extension-tests/src/test/java/org/apachencamel/quarkus/test/extensions/HelloET.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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.apachencamel.quarkus.test.extensions;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.apache.camel.quarkus.test.CamelQuarkusTestSupport;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+
+@QuarkusTest
+public class HelloET extends CamelQuarkusTestSupport {
+
+ @Test
+ public void hello1Test() throws Exception {
+ Files.createDirectories(testDirectory());
+ Path testFile = testFile("hello.txt");
+ Files.write(testFile, "Hello ".getBytes());
Review Comment:
```suggestion
Files.write(testFile, "Hello ".getBytes(StandardEncodings.UTF_8));
```
##########
test-framework/junit5/pom.xml:
##########
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-test-framework</artifactId>
+ <version>2.12.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-junit5</artifactId>
+ <name>Camel Quarkus :: Test Framework :: Junit5</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
Review Comment:
Could we perhaps use the same logging facade as quarkus-junit5? I guess it
is jboss logging.
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
Review Comment:
Please add some class level JavaDoc: what is this class for? What are the
differences and gotchas against CamelTestSupport?
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ public final void afterTestExecution(ExtensionContext context) throws
Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ protected void stopCamelContext() throws Exception {
+ //context is started and stopped via quarkus lifecycle
Review Comment:
JavaDoc
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ public final void afterTestExecution(ExtensionContext context) throws
Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ protected void stopCamelContext() throws Exception {
+ //context is started and stopped via quarkus lifecycle
+ }
+
+ @Override
+ protected void doQuarkusCheck() {
+ //can run on Quarkus
+ }
+
+ void internalBeforeAll(ExtensionContext context) {
+ super.beforeAll(context);
+ }
+
+ void internalBeforeEach(ExtensionContext context) throws Exception {
+ super.beforeEach(context);
+ }
+
+ @Override
+ public boolean isUseRouteBuilder() {
Review Comment:
JavaDoc
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ public final void afterTestExecution(ExtensionContext context) throws
Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ protected void stopCamelContext() throws Exception {
+ //context is started and stopped via quarkus lifecycle
+ }
+
+ @Override
+ protected void doQuarkusCheck() {
+ //can run on Quarkus
+ }
+
+ void internalBeforeAll(ExtensionContext context) {
+ super.beforeAll(context);
+ }
+
+ void internalBeforeEach(ExtensionContext context) throws Exception {
+ super.beforeEach(context);
+ }
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ if (context.getRoutes().isEmpty()) {
+ wasUsedRouteBuilder = super.isUseRouteBuilder();
+ return wasUsedRouteBuilder;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected void doSetUp() throws Exception {
+ context.getManagementStrategy();
+ if (!initialized) {
+ super.doSetUp();
+ initialized = true;
+ }
+ }
+
+ @Override
+ protected void doPreSetup() throws Exception {
+ if (isUseAdviceWith() || isUseDebugger()) {
+ ((FastCamelContext) context).suspend();
+ }
+ super.doPreSetup();
+ }
+
+ @Override
+ protected void doPostSetup() throws Exception {
+ if (isUseAdviceWith() || isUseDebugger()) {
+ ((FastCamelContext) context).resume();
+ if (isUseDebugger()) {
+ ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+ List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+ //addition causes removal -> it starts routes, which were
added during setUp, when context was suspended
+ mcc.addRouteDefinitions(rdfs);
+ }
+ }
+ super.doPostSetup();
+ }
+
+ RoutesBuilder getRouteBuilder() throws Exception {
+ return createRouteBuilder();
+ }
Review Comment:
Is this method really needed?
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ public final void afterTestExecution(ExtensionContext context) throws
Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ protected void stopCamelContext() throws Exception {
+ //context is started and stopped via quarkus lifecycle
+ }
+
+ @Override
+ protected void doQuarkusCheck() {
+ //can run on Quarkus
+ }
+
+ void internalBeforeAll(ExtensionContext context) {
+ super.beforeAll(context);
+ }
+
+ void internalBeforeEach(ExtensionContext context) throws Exception {
+ super.beforeEach(context);
+ }
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ if (context.getRoutes().isEmpty()) {
+ wasUsedRouteBuilder = super.isUseRouteBuilder();
+ return wasUsedRouteBuilder;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected void doSetUp() throws Exception {
+ context.getManagementStrategy();
+ if (!initialized) {
+ super.doSetUp();
+ initialized = true;
+ }
+ }
+
+ @Override
+ protected void doPreSetup() throws Exception {
+ if (isUseAdviceWith() || isUseDebugger()) {
+ ((FastCamelContext) context).suspend();
+ }
+ super.doPreSetup();
+ }
+
+ @Override
+ protected void doPostSetup() throws Exception {
+ if (isUseAdviceWith() || isUseDebugger()) {
+ ((FastCamelContext) context).resume();
+ if (isUseDebugger()) {
+ ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+ List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+ //addition causes removal -> it starts routes, which were
added during setUp, when context was suspended
+ mcc.addRouteDefinitions(rdfs);
+ }
+ }
+ super.doPostSetup();
+ }
+
+ RoutesBuilder getRouteBuilder() throws Exception {
+ return createRouteBuilder();
+ }
+
+ @Override
+ protected void doStopCamelContext(CamelContext context, Service
camelContextService) {
+ //don't stop
+ }
+
+ @Override
+ protected void startCamelContext() {
+ //context has already started
+ }
Review Comment:
JavaDoc? Should be final?
##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-test-framework</artifactId>
+ <version>2.12.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+ <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
Review Comment:
Why not `<scope>test</scope>`?
##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-test-framework</artifactId>
+ <version>2.12.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+ <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5-internal</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-rest-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
Review Comment:
This is a transitive of camel-quarkus-junit5. Can we perhaps remove it?
##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-test-framework</artifactId>
+ <version>2.12.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+ <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5-internal</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
Review Comment:
Why not `<scope>test</scope>`?
##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-test-framework</artifactId>
+ <version>2.12.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+ <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ </dependency>
Review Comment:
This seems to be a transitive of other deps here. Could we perhaps remove it?
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
Review Comment:
Why is this not a proper method level JavaDoc `Does nothing. All necessary
tasks are performed in <className>.beforeEach()` ? End users might be
interested in this info.
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ public final void afterTestExecution(ExtensionContext context) throws
Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ protected void stopCamelContext() throws Exception {
+ //context is started and stopped via quarkus lifecycle
+ }
+
+ @Override
+ protected void doQuarkusCheck() {
+ //can run on Quarkus
+ }
+
+ void internalBeforeAll(ExtensionContext context) {
+ super.beforeAll(context);
+ }
+
+ void internalBeforeEach(ExtensionContext context) throws Exception {
+ super.beforeEach(context);
+ }
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ if (context.getRoutes().isEmpty()) {
+ wasUsedRouteBuilder = super.isUseRouteBuilder();
+ return wasUsedRouteBuilder;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected void doSetUp() throws Exception {
+ context.getManagementStrategy();
+ if (!initialized) {
+ super.doSetUp();
+ initialized = true;
+ }
+ }
+
+ @Override
+ protected void doPreSetup() throws Exception {
+ if (isUseAdviceWith() || isUseDebugger()) {
+ ((FastCamelContext) context).suspend();
+ }
+ super.doPreSetup();
+ }
+
+ @Override
+ protected void doPostSetup() throws Exception {
+ if (isUseAdviceWith() || isUseDebugger()) {
+ ((FastCamelContext) context).resume();
+ if (isUseDebugger()) {
+ ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+ List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+ //addition causes removal -> it starts routes, which were
added during setUp, when context was suspended
+ mcc.addRouteDefinitions(rdfs);
+ }
+ }
+ super.doPostSetup();
+ }
+
+ RoutesBuilder getRouteBuilder() throws Exception {
+ return createRouteBuilder();
+ }
+
+ @Override
+ protected void doStopCamelContext(CamelContext context, Service
camelContextService) {
+ //don't stop
+ }
Review Comment:
JavaDoc? Shouldn't be final?
##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-test-framework</artifactId>
+ <version>2.12.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+ <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5-internal</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-rest-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-junit5</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-file</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-direct</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
Review Comment:
If all deps here are moved to `<scope>test</scope>`, we could perhaps move
all the stuff from here to `camel-quarkus-junit5` and perhaps also eliminate
camel-quarkus-test-framework? Less modules would be better, I think.
Hm... now seeing that there are other tests in camel-quarkus-junit5. But
still, maybe the deps here and there are similar enough?
##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-test-framework</artifactId>
+ <version>2.12.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
+ <name>Camel Quarkus :: Test Framework :: Junit5 :: Extension Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-engine</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5-internal</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-rest-client</artifactId>
+ </dependency>
Review Comment:
Are we using this somewhere?
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
Review Comment:
Please transform this to a method level JavaDoc.
##########
test-framework/junit5-extension-tests/pom.xml:
##########
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-test-framework</artifactId>
+ <version>2.12.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-junit5-extension-tests</artifactId>
Review Comment:
It looks like this module is not executed anywhere on GH actions?
We need to add something like
```
- name: cd test-framework/junit5-extension-tests && mvn test
run: |
cd test-framework/junit5-extension-tests
../mvnw ${MAVEN_ARGS} ${BRANCH_OPTIONS} \
-Dformatter.skip -Dimpsort.skip -Denforcer.skip
-Dcamel-quarkus.update-extension-doc-page.skip \
test
```
before this line
https://github.com/apache/camel-quarkus/blob/main/.github/workflows/ci-build.yaml#L240
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
Review Comment:
JavaDoc
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ public final void afterTestExecution(ExtensionContext context) throws
Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
Review Comment:
JavaDoc
##########
test-framework/junit5/pom.xml:
##########
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-test-framework</artifactId>
+ <version>2.12.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>camel-quarkus-junit5</artifactId>
+ <name>Camel Quarkus :: Test Framework :: Junit5</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit5</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
Review Comment:
Uh, oh, does this really have to be a runtime dep? I'd be fine with having
it with `<scope>test</scope>` for our own testing, but I do not think we should
pass it to end users. They should choose their own assertion lib.
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
Review Comment:
JavaDoc
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ public final void afterTestExecution(ExtensionContext context) throws
Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ protected void stopCamelContext() throws Exception {
+ //context is started and stopped via quarkus lifecycle
+ }
+
+ @Override
+ protected void doQuarkusCheck() {
+ //can run on Quarkus
+ }
+
+ void internalBeforeAll(ExtensionContext context) {
+ super.beforeAll(context);
+ }
+
+ void internalBeforeEach(ExtensionContext context) throws Exception {
+ super.beforeEach(context);
+ }
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ if (context.getRoutes().isEmpty()) {
+ wasUsedRouteBuilder = super.isUseRouteBuilder();
+ return wasUsedRouteBuilder;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected void doSetUp() throws Exception {
Review Comment:
JavaDoc
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ public final void afterTestExecution(ExtensionContext context) throws
Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ protected void stopCamelContext() throws Exception {
+ //context is started and stopped via quarkus lifecycle
+ }
+
+ @Override
+ protected void doQuarkusCheck() {
+ //can run on Quarkus
+ }
+
+ void internalBeforeAll(ExtensionContext context) {
+ super.beforeAll(context);
+ }
+
+ void internalBeforeEach(ExtensionContext context) throws Exception {
+ super.beforeEach(context);
+ }
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ if (context.getRoutes().isEmpty()) {
+ wasUsedRouteBuilder = super.isUseRouteBuilder();
+ return wasUsedRouteBuilder;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected void doSetUp() throws Exception {
+ context.getManagementStrategy();
+ if (!initialized) {
+ super.doSetUp();
+ initialized = true;
+ }
+ }
+
+ @Override
+ protected void doPreSetup() throws Exception {
Review Comment:
JavaDoc
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ public final void afterTestExecution(ExtensionContext context) throws
Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ protected void stopCamelContext() throws Exception {
+ //context is started and stopped via quarkus lifecycle
+ }
+
+ @Override
+ protected void doQuarkusCheck() {
+ //can run on Quarkus
Review Comment:
JavaDoc: should user's override this? At which time is it called? Any
example of an intended use?
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
Review Comment:
I think this one should be final with JavaDoc:
```
This method is not called on Camel Quarkus because the `CamelRegistry` is
created and owned by Quarkus CDI container. If you need to customize the
registry upon creation, you may want to override {@link #createCamelContext()}
in the following way:
@Override
protected CamelContext createCamelContext() throws Exception {
CamelContext ctx = super.createCamelContext();
Registry registry = ctx.getRegistry();
// do something with the registry...
return ctx;
}
```
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ public final void afterTestExecution(ExtensionContext context) throws
Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ protected void stopCamelContext() throws Exception {
+ //context is started and stopped via quarkus lifecycle
+ }
+
+ @Override
+ protected void doQuarkusCheck() {
+ //can run on Quarkus
+ }
+
+ void internalBeforeAll(ExtensionContext context) {
+ super.beforeAll(context);
+ }
+
+ void internalBeforeEach(ExtensionContext context) throws Exception {
+ super.beforeEach(context);
+ }
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ if (context.getRoutes().isEmpty()) {
+ wasUsedRouteBuilder = super.isUseRouteBuilder();
+ return wasUsedRouteBuilder;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected void doSetUp() throws Exception {
+ context.getManagementStrategy();
+ if (!initialized) {
+ super.doSetUp();
+ initialized = true;
+ }
+ }
+
+ @Override
+ protected void doPreSetup() throws Exception {
+ if (isUseAdviceWith() || isUseDebugger()) {
+ ((FastCamelContext) context).suspend();
+ }
+ super.doPreSetup();
+ }
+
+ @Override
+ protected void doPostSetup() throws Exception {
Review Comment:
JavaDoc
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,147 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ @Inject
+ protected CamelContext context;
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
Review Comment:
Good point!
Unluckily, it looks like CamelTestSupport does not offer any dedicated way
to customize the context instance upon creation.
So we are rather forced to keep the method non-final so that end users can
customize the context as they need.
At the same time, I'd vote for the following:
* Add a piece of JavaDoc to the method saying something like
```
Feel free to override this method for the sake of customizing the instance
returned by this implementation. Do not create your own CamelContext instance,
because there needs to exist just a single instance owned by Quarkus CDI
container. There are checks in place that will make your tests fail if you do
otherwise.
```
* Add some checks asserting that `CamelTestSupport.context ==
CamelQuarkusTestSupport.context`. E.g. in
* override of `context()` method
* override of `bindToRegistry()`
* override of `postProcessTest()`
##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/CamelQuarkusTestSupport.java:
##########
@@ -0,0 +1,177 @@
+/*
+ * 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.test;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+import io.quarkus.test.junit.QuarkusTestProfile;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
+import org.apache.camel.CamelContext;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.Service;
+import org.apache.camel.model.ModelCamelContext;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.quarkus.core.FastCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+public class CamelQuarkusTestSupport extends CamelTestSupport
+ implements QuarkusTestProfile {
+
+ private boolean initialized;
+
+ //Flag, whether routes was created by test's route builder and therefore
should be stopped smd removed based on lifecycle
+ private boolean wasUsedRouteBuilder;
+
+ @Inject
+ protected CamelContext context;
+
+ //------------------------ quarkus callbacks ---------------
+ protected void doAfterAll(QuarkusTestContext context) throws Exception {
+ }
+
+ protected void doAfterEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ protected void doAfterConstruct() throws Exception {
+ }
+
+ protected void doBeforeEach(QuarkusTestMethodContext context) throws
Exception {
+ }
+
+ @Override
+ protected CamelContext createCamelContext() throws Exception {
+ return this.context;
+ }
+
+ @Override
+ protected Registry createCamelRegistry() {
+ throw new UnsupportedOperationException("won't be executed.");
+ }
+
+ @Override
+ public final void beforeAll(ExtensionContext context) {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void beforeEach(ExtensionContext context) throws Exception {
+ //replaced by quarkus callback (beforeEach)
+ }
+
+ @Override
+ public final void afterAll(ExtensionContext context) {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ try {
+ doPostTearDown();
+ cleanupResources();
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Override
+ public final void afterEach(ExtensionContext context) throws Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ public final void afterTestExecution(ExtensionContext context) throws
Exception {
+ //in camel-quarkus, junit5 uses different classloader, necessary code
was moved into quarkus's callback
+ }
+
+ @Override
+ protected void stopCamelContext() throws Exception {
+ //context is started and stopped via quarkus lifecycle
+ }
+
+ @Override
+ protected void doQuarkusCheck() {
+ //can run on Quarkus
+ }
+
+ void internalBeforeAll(ExtensionContext context) {
+ super.beforeAll(context);
+ }
+
+ void internalBeforeEach(ExtensionContext context) throws Exception {
+ super.beforeEach(context);
+ }
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ if (context.getRoutes().isEmpty()) {
+ wasUsedRouteBuilder = super.isUseRouteBuilder();
+ return wasUsedRouteBuilder;
+ }
+
+ return false;
+ }
+
+ @Override
+ protected void doSetUp() throws Exception {
+ context.getManagementStrategy();
+ if (!initialized) {
+ super.doSetUp();
+ initialized = true;
+ }
+ }
+
+ @Override
+ protected void doPreSetup() throws Exception {
+ if (isUseAdviceWith() || isUseDebugger()) {
+ ((FastCamelContext) context).suspend();
+ }
+ super.doPreSetup();
+ }
+
+ @Override
+ protected void doPostSetup() throws Exception {
+ if (isUseAdviceWith() || isUseDebugger()) {
+ ((FastCamelContext) context).resume();
+ if (isUseDebugger()) {
+ ModelCamelContext mcc = context.adapt(ModelCamelContext.class);
+ List<RouteDefinition> rdfs = mcc.getRouteDefinitions();
+ //addition causes removal -> it starts routes, which were
added during setUp, when context was suspended
+ mcc.addRouteDefinitions(rdfs);
+ }
+ }
+ super.doPostSetup();
+ }
+
+ RoutesBuilder getRouteBuilder() throws Exception {
+ return createRouteBuilder();
+ }
+
+ @Override
+ protected void doStopCamelContext(CamelContext context, Service
camelContextService) {
+ //don't stop
+ }
+
+ @Override
+ protected void startCamelContext() {
+ //context has already started
+ }
+
+ boolean isWasUsedRouteBuilder() {
+ return wasUsedRouteBuilder;
+ }
Review Comment:
Is this method needed?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]