You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "stataru8 (via GitHub)" <gi...@apache.org> on 2024/07/11 18:45:48 UTC

[PR] Add camel-drill integration test [camel-karaf]

stataru8 opened a new pull request, #422:
URL: https://github.com/apache/camel-karaf/pull/422

   Fixes https://github.com/apache/camel-karaf/issues/421: camel-drill integration test


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add camel-drill integration test [camel-karaf]

Posted by "stataru8 (via GitHub)" <gi...@apache.org>.
stataru8 commented on PR #422:
URL: https://github.com/apache/camel-karaf/pull/422#issuecomment-2223686071

   I'm seeing this error in the Karaf container logs:
   ```
   2024-07-11T20:48:08,029 | ERROR | FelixDispatchQueue | Framework                        | 46 - camel-integration-test - 4.6.0.SNAPSHOT | FrameworkEvent ERROR
   org.osgi.framework.ServiceException: Service factory exception: javax/ws/rs/core/Application
   	at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:354) ~[?:?]
   	at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:249) ~[?:?]
   	at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:362) ~[?:?]
   	at org.apache.felix.framework.Felix.getService(Felix.java:3984) ~[?:?]
   	at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:450) ~[?:?]
   	at org.apache.karaf.camel.itests.CamelSuppliedRouteLauncher.serviceChanged(CamelSuppliedRouteLauncher.java:108) ~[?:?]
   	at org.apache.felix.framework.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:990) ~[?:?]
   	at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:838) ~[?:?]
   	at org.apache.felix.framework.EventDispatcher.fireServiceEvent(EventDispatcher.java:545) ~[?:?]
   	at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4863) ~[?:?]
   	at org.apache.felix.framework.Felix.registerService(Felix.java:3834) ~[?:?]
   	at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:328) ~[?:?]
   	at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:302) ~[?:?]
   	at org.apache.aries.spifly.ProviderBundleTrackerCustomizer.addingBundle(ProviderBundleTrackerCustomizer.java:163) ~[?:?]
   	at org.apache.aries.spifly.ProviderBundleTrackerCustomizer.addingBundle(ProviderBundleTrackerCustomizer.java:64) ~[?:?]
   	at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:475) ~[osgi.core-8.0.0.jar:?]
   	at org.osgi.util.tracker.BundleTracker$Tracked.customizerAdding(BundleTracker.java:420) ~[osgi.core-8.0.0.jar:?]
   	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256) ~[osgi.core-8.0.0.jar:?]
   	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:229) ~[osgi.core-8.0.0.jar:?]
   	at org.osgi.util.tracker.BundleTracker$Tracked.bundleChanged(BundleTracker.java:450) ~[osgi.core-8.0.0.jar:?]
   	at org.apache.felix.framework.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:915) ~[?:?]
   	at org.apache.felix.framework.EventDispatcher.fireEventImmediately(EventDispatcher.java:834) ~[?:?]
   	at org.apache.felix.framework.EventDispatcher.fireBundleEvent(EventDispatcher.java:516) ~[?:?]
   	at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4847) ~[?:?]
   	at org.apache.felix.framework.Felix.activateBundle(Felix.java:2420) ~[?:?]
   	at org.apache.felix.framework.Felix.startBundle(Felix.java:2335) ~[?:?]
   	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:1006) ~[?:?]
   	at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:992) ~[?:?]
   	at org.apache.karaf.features.internal.service.BundleInstallSupportImpl.startBundle(BundleInstallSupportImpl.java:165) ~[?:?]
   	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.startBundle(FeaturesServiceImpl.java:1160) ~[?:?]
   	at org.apache.karaf.features.internal.service.Deployer.deploy(Deployer.java:1041) ~[?:?]
   	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.doProvision(FeaturesServiceImpl.java:1069) ~[?:?]
   	at org.apache.karaf.features.internal.service.FeaturesServiceImpl.lambda$doProvisionInThread$13(FeaturesServiceImpl.java:1004) ~[?:?]
   	at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[?:?]
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[?:?]
   	at java.lang.Thread.run(Thread.java:833) [?:?]
   Caused by: java.lang.NoClassDefFoundError: javax/ws/rs/core/Application
   	at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?]
   	at java.lang.Class.privateGetDeclaredConstructors(Class.java:3373) ~[?:?]
   	at java.lang.Class.getConstructor0(Class.java:3578) ~[?:?]
   	at java.lang.Class.getDeclaredConstructor(Class.java:2754) ~[?:?]
   	at org.apache.aries.spifly.ProviderServiceFactory.getService(ProviderServiceFactory.java:35) ~[?:?]
   	at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:349) ~[?:?]
   	... 36 more
   Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.Application not found by wrap_file__C__Users_stataru_.m2_repository_org_apache_drill_exec_drill-jdbc-all_1.21.1_drill-jdbc-all-1.21.1.jar_Bundle-Version_1.21.1_Export-Package_org.apache.drill.jdbc.__version_1.21.1_SPI-Provider__ [159]
   	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1591) ~[?:?]
   	at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79) ~[?:?]
   	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1976) ~[?:?]
   	at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
   	at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?]
   	at java.lang.Class.privateGetDeclaredConstructors(Class.java:3373) ~[?:?]
   	at java.lang.Class.getConstructor0(Class.java:3578) ~[?:?]
   	at java.lang.Class.getDeclaredConstructor(Class.java:2754) ~[?:?]
   	at org.apache.aries.spifly.ProviderServiceFactory.getService(ProviderServiceFactory.java:35) ~[?:?]
   	at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:349) ~[?:?]
   	... 36 more
   2024-07-11T20:48:08,040 | INFO  | features-3-thread-1 | FeaturesServiceImpl              | 19 - org.apache.karaf.features.core - 4.4.6 |   jakarta.xml.ws-api/4.0.2
   2024-07-11T20:48:08,054 | INFO  | features-3-thread-1 | FeaturesServiceImpl              | 19 - org.apache.karaf.features.core - 4.4.6 |   jakarta.annotation-api/2.1.1
   2024-07-11T20:48:08,057 | INFO  | features-3-thread-1 | FeaturesServiceImpl              | 19 - org.apache.karaf.features.core - 4.4.6 | Done.
   2024-07-11T20:48:08,088 | INFO  | RMI TCP Connection(4)-127.0.0.1 | CamelSuppliedRouteLauncher       | 46 - camel-integration-test - 4.6.0.SNAPSHOT | CamelRouteSupplier service registered: {service.id=188, service.bundleid=160, objectClass=[Ljava.lang.String;@650b8394, service.scope=bundle, component.name=karaf-camel-drill-test, osgi.ds.satisfying.condition.target=(osgi.condition.id=true), component.id=3} from the class org.apache.karaf.camel.test.CamelDrillRouteSupplier
   2024-07-11T20:48:08,412 | INFO  | RMI TCP Connection(4)-127.0.0.1 | CamelSuppliedRouteLauncher       | 46 - camel-integration-test - 4.6.0.SNAPSHOT | Route(s) created from CamelRouteSupplier service: org.apache.karaf.camel.test.CamelDrillRouteSupplier
   2024-07-11T20:48:08,653 | INFO  | RMI TCP Connection(4)-127.0.0.1 | DrillProducer                    | 146 - camel-drill - 4.6.0.SNAPSHOT | connection url: jdbc:drill:drillbit=localhost:49958
   2024-07-11T20:48:13,468 | INFO  | RMI TCP Connection(4)-127.0.0.1 | producer-camel-drill-test        | 39 - camel-core-reifier - 4.6.0.SNAPSHOT | Query Result: [{employee_id=1, full_name=Sheri Nowmer, first_name=Sheri, last_name=Nowmer, position_id=1, position_title=President, store_id=0, department_id=1, birth_date=1961-08-26, hire_date=1994-12-01 00:00:00.0, salary=80000.0, supervisor_id=0, education_level=Graduate Degree, marital_status=S, gender=F, management_role=Senior Management, end_date=null}, {employee_id=2, full_name=Derrick Whelply, first_name=Derrick, last_name=Whelply, position_id=2, position_title=VP Country Manager, store
   ```
   
   I assume that this is fine:
   - `org.apache.drill.exec/drill-jdbc-all/1.21.1` is not a regular jar, it contains `javax`, `com.sun`, `google` and `oadd` packages inside. `javax.ws` is intentionally excluded here: https://github.com/apache/drill/blob/drill-1.21.1/exec/jdbc-all/pom.xml#L706.
   - the query executed is successfully


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add camel-drill integration test [camel-karaf]

Posted by "stataru8 (via GitHub)" <gi...@apache.org>.
stataru8 commented on code in PR #422:
URL: https://github.com/apache/camel-karaf/pull/422#discussion_r1674520742


##########
tests/features/camel-drill/src/test/java/org/apache/karaf/camel/itest/CamelDrillITest.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * Licensed 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.karaf.camel.itest;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteITest;
+import org.apache.karaf.camel.itests.CamelKarafTestHint;
+import org.apache.karaf.camel.itests.GenericContainerResource;
+import org.apache.karaf.camel.itests.PaxExamWithExternalResource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.wait.strategy.Wait;
+
+@CamelKarafTestHint(externalResourceProvider = CamelDrillITest.ExternalResourceProviders.class)
+@RunWith(PaxExamWithExternalResource.class)
+@ExamReactorStrategy(PerClass.class)
+public class CamelDrillITest extends AbstractCamelSingleFeatureResultMockBasedRouteITest {
+
+    private static final int ORIGINAL_JDBC_PORT = 31010;
+
+    @Override
+    public void configureMock(MockEndpoint mock) {
+        mock.expectedBodiesReceived("OK");
+    }
+
+    @Test
+    public void testResultMock() throws Exception {
+        assertMockEndpointsSatisfied();
+    }
+
+    public static final class ExternalResourceProviders {
+        public static GenericContainerResource<DrillContainer> createDrillStorageBlobContainer() {
+
+            DrillContainer drillContainer = new DrillContainer("apache/drill:1.21.1");
+            return new GenericContainerResource<>(drillContainer, resource -> {
+                resource.setProperty("drill.host", drillContainer.getHost());
+                resource.setProperty("drill.port", Integer.toString(drillContainer.getMappedPort(ORIGINAL_JDBC_PORT)));
+            });
+        }
+    }
+
+    public static class DrillContainer extends GenericContainer<DrillContainer> {
+
+        public DrillContainer(final String containerName) {
+            super(containerName);
+
+            withExposedPorts(ORIGINAL_JDBC_PORT)
+                .waitingFor(Wait.forListeningPort())
+                // prevent the container from stopping prematurely in non interactive sessions
+                .withCreateContainerCmdModifier(cmd -> cmd.withTty(true));

Review Comment:
   This is a known issue with the docker image: https://github.com/apache/drill/issues/ 2829



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add camel-drill integration test [camel-karaf]

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo merged PR #422:
URL: https://github.com/apache/camel-karaf/pull/422


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Add camel-drill integration test [camel-karaf]

Posted by "essobedo (via GitHub)" <gi...@apache.org>.
essobedo commented on code in PR #422:
URL: https://github.com/apache/camel-karaf/pull/422#discussion_r1676200543


##########
tests/features/camel-drill/src/test/java/org/apache/karaf/camel/itest/CamelDrillITest.java:
##########
@@ -0,0 +1,67 @@
+/*
+ * Licensed 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.karaf.camel.itest;
+
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.karaf.camel.itests.AbstractCamelSingleFeatureResultMockBasedRouteITest;
+import org.apache.karaf.camel.itests.CamelKarafTestHint;
+import org.apache.karaf.camel.itests.GenericContainerResource;
+import org.apache.karaf.camel.itests.PaxExamWithExternalResource;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.containers.wait.strategy.Wait;
+
+@CamelKarafTestHint(externalResourceProvider = CamelDrillITest.ExternalResourceProviders.class)
+@RunWith(PaxExamWithExternalResource.class)
+@ExamReactorStrategy(PerClass.class)
+public class CamelDrillITest extends AbstractCamelSingleFeatureResultMockBasedRouteITest {
+
+    private static final int ORIGINAL_JDBC_PORT = 31010;
+
+    @Override
+    public void configureMock(MockEndpoint mock) {
+        mock.expectedBodiesReceived("OK");
+    }
+
+    @Test
+    public void testResultMock() throws Exception {
+        assertMockEndpointsSatisfied();
+    }
+
+    public static final class ExternalResourceProviders {
+        public static GenericContainerResource<DrillContainer> createDrillStorageBlobContainer() {
+
+            DrillContainer drillContainer = new DrillContainer("apache/drill:1.21.1");
+            return new GenericContainerResource<>(drillContainer, resource -> {
+                resource.setProperty("drill.host", drillContainer.getHost());
+                resource.setProperty("drill.port", Integer.toString(drillContainer.getMappedPort(ORIGINAL_JDBC_PORT)));
+            });
+        }
+    }
+
+    public static class DrillContainer extends GenericContainer<DrillContainer> {
+
+        public DrillContainer(final String containerName) {
+            super(containerName);
+
+            withExposedPorts(ORIGINAL_JDBC_PORT)
+                .waitingFor(Wait.forListeningPort())
+                // prevent the container from stopping prematurely in non interactive sessions

Review Comment:
   ```suggestion
                   // prevent the container from stopping prematurely in non interactive sessions
                   // see https://github.com/apache/drill/issues/2829 for more details
   ```



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org