jamesnetherton commented on code in PR #3847:
URL: https://github.com/apache/camel-quarkus/pull/3847#discussion_r916591978


##########
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 {
+        return this.context;
+    }
+
+    @Override
+    public void beforeAll(ExtensionContext context) {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public void beforeEach(ExtensionContext context) throws Exception {
+        //replaced by quarkus callback (beforeEach)
+    }
+
+    @Override
+    public void afterAll(ExtensionContext context) {
+        //in camel-quarkus, junit5 uses different classloader, necessaryu code 
was moved into quarkus's callback

Review Comment:
   Typo `necessaryu` (also repeated in other methods below).



##########
test-framework/junit5/src/main/resources/application.properties:
##########
@@ -0,0 +1,25 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# no console logging
+quarkus.log.console.enable=false

Review Comment:
   Not sure embedding `application.properties` is a good idea.
   
   We're effectively forcing some (potentially undesirable) conventions on user 
applications.



##########
test-framework/junit5/src/main/java/org/apache/camel/quarkus/test/AfterAllCallback.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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 io.quarkus.test.junit.callback.QuarkusTestAfterAllCallback;
+import io.quarkus.test.junit.callback.QuarkusTestContext;
+
+public class AfterAllCallback implements QuarkusTestAfterAllCallback {
+
+    @Override
+    public void afterAll(QuarkusTestContext context) {
+        CamelQuarkusTestSupport testInstance = (CamelQuarkusTestSupport) 
context.getTestInstance();

Review Comment:
   We need to check whether the test instance really is 
`CamelQuarkusTestSupport`. Otherwise it's impossible to write any 
`@QuarkusTest` annotated tests without extending `CamelQuarkusTestSupport`.
   
   The same applies to the other callbacks.



##########
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:
   Question for everyone. Should we make this `final`? If you're free to create 
your own `CamelContext`, then the tests are a bit meaningless on CQ IMO.



##########
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

Review Comment:
   I wonder if we should override `createCamelRegistry` and throw 
`UnsupportedOperationException`?
   
   I think there is the potential to screw things up if we enable the default 
registry to be replaced.



-- 
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]

Reply via email to