This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push: new 1978f7b173 Remove integration-tests/jdbc module 1978f7b173 is described below commit 1978f7b173e264770992eed52b85e081e0d6cc43 Author: James Netherton <jamesnether...@gmail.com> AuthorDate: Tue Aug 15 09:30:42 2023 +0100 Remove integration-tests/jdbc module Fixes #5164 --- integration-tests/jdbc/.gitignore | 1 - integration-tests/jdbc/README.adoc | 26 --- integration-tests/jdbc/pom.xml | 219 ------------------ .../quarkus/component/jdbc/CamelResource.java | 246 --------------------- .../camel/quarkus/component/jdbc/JdbcRoutes.java | 76 ------- .../camel/quarkus/component/jdbc/model/Camel.java | 42 ---- .../jdbc/src/main/resources/application.properties | 24 -- .../jdbc/src/main/resources/sql/db2.sql | 20 -- .../jdbc/src/main/resources/sql/derby.sql | 20 -- .../jdbc/src/main/resources/sql/droptables.sql | 20 -- .../jdbc/src/main/resources/sql/h2.sql | 20 -- .../jdbc/src/main/resources/sql/inserts.sql | 22 -- .../jdbc/src/main/resources/sql/mariadb.sql | 20 -- .../jdbc/src/main/resources/sql/mssql.sql | 20 -- .../jdbc/src/main/resources/sql/mysql.sql | 20 -- .../jdbc/src/main/resources/sql/oracle.sql | 20 -- .../jdbc/src/main/resources/sql/postgresql.sql | 20 -- .../camel/quarkus/component/jdbc/CamelJdbcIT.java | 24 -- .../quarkus/component/jdbc/CamelJdbcTest.java | 170 -------------- integration-tests/pom.xml | 1 - tooling/scripts/test-categories.yaml | 1 - 21 files changed, 1032 deletions(-) diff --git a/integration-tests/jdbc/.gitignore b/integration-tests/jdbc/.gitignore deleted file mode 100644 index 837c2eb1d6..0000000000 --- a/integration-tests/jdbc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -ObjectStore \ No newline at end of file diff --git a/integration-tests/jdbc/README.adoc b/integration-tests/jdbc/README.adoc deleted file mode 100644 index 76b30862b5..0000000000 --- a/integration-tests/jdbc/README.adoc +++ /dev/null @@ -1,26 +0,0 @@ -== JDBC integration tests - -=== Default database type - -When the tests are executed without any special configuration, dev-service `H2` database is used (more details will follow). - -=== Dev-service databases - -As is described in the https://quarkus.io/guides/datasource#dev-services[documentation], several database types could be started in dev-service mode. -Running the tests against a database in dev-service mode could be achieved by addition of build property `cq.jdbcKind`. Example of usage: - -`mvn clean test -f integration-tests/jdbc/ -Dcq.jdbcKind=postgresql` - -Following databases could be started in the dev-service mode: - -- Postgresql (container) - add `-Dcq.jdbcKind=postgresql` -- MySQL (container) - add `-Dcq.jdbcKind=mysql` -- MariaDB (container) - add `-Dcq.jdbcKind=mariadb` -- H2 (in-process) used by default -- Apache Derby (in-process) - add `-Dcq.jdbcKind=derby` -- DB2 (container) (requires license acceptance) - add `-Dcq.jdbcKind=db2` -- MSSQL (container) (requires license acceptance) - add `-Dcq.jdbcKind=mssql` -- Oracle (container) - add `-Dcq.jdbcKind=oracle` - -For more information about dev-service mode, see https://quarkus.io/guides/datasource#dev-services[documentation]. - diff --git a/integration-tests/jdbc/pom.xml b/integration-tests/jdbc/pom.xml deleted file mode 100644 index e6352b9c22..0000000000 --- a/integration-tests/jdbc/pom.xml +++ /dev/null @@ -1,219 +0,0 @@ -<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-build-parent-it</artifactId> - <version>3.0.0-SNAPSHOT</version> - <relativePath>../../poms/build-parent-it/pom.xml</relativePath> - </parent> - - <artifactId>camel-quarkus-integration-test-jdbc</artifactId> - <name>Camel Quarkus :: Integration Tests :: JDBC</name> - <description>Integration tests for Camel JDBC extension</description> - - <properties> - <cq.jdbcKind>h2</cq.jdbcKind> - </properties> - - <dependencies> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-jdbc</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-log</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-timer</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bean</artifactId> - </dependency> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-resteasy</artifactId> - </dependency> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-jdbc-${cq.jdbcKind}</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-direct</artifactId> - </dependency> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-resteasy-jsonb</artifactId> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-mock</artifactId> - </dependency> - - <!-- test dependencies --> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-junit5</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>io.rest-assured</groupId> - <artifactId>rest-assured</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.awaitility</groupId> - <artifactId>awaitility</artifactId> - <scope>test</scope> - </dependency> - </dependencies> - - - <profiles> - <profile> - <id>native</id> - <activation> - <property> - <name>native</name> - </property> - </activation> - <properties> - <quarkus.package.type>native</quarkus.package.type> - </properties> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-failsafe-plugin</artifactId> - <executions> - <execution> - <goals> - <goal>integration-test</goal> - <goal>verify</goal> - </goals> - </execution> - </executions> - <configuration> - <systemPropertyVariables> - <quarkus.test.arg-line>-Dcq.jdbcKind=${cq.jdbcKind}</quarkus.test.arg-line> - </systemPropertyVariables> - </configuration> - </plugin> - </plugins> - </build> - </profile> - <profile> - <id>virtualDependencies</id> - <activation> - <property> - <name>!noVirtualDependencies</name> - </property> - </activation> - <dependencies> - <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory --> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-direct-deployment</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-jdbc-deployment</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-log-deployment</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-mock-deployment</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-timer-deployment</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-bean-deployment</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> - </dependencies> - </profile> - </profiles> - -</project> diff --git a/integration-tests/jdbc/src/main/java/org/apache/camel/quarkus/component/jdbc/CamelResource.java b/integration-tests/jdbc/src/main/java/org/apache/camel/quarkus/component/jdbc/CamelResource.java deleted file mode 100644 index 04a8205c45..0000000000 --- a/integration-tests/jdbc/src/main/java/org/apache/camel/quarkus/component/jdbc/CamelResource.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.quarkus.component.jdbc; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import io.agroal.api.AgroalDataSource; -import io.quarkus.agroal.DataSource; -import jakarta.annotation.PostConstruct; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.POST; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import org.apache.camel.CamelContext; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.quarkus.component.jdbc.model.Camel; -import org.eclipse.microprofile.config.inject.ConfigProperty; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@Path("/test") -@ApplicationScoped -public class CamelResource { - private static final Logger LOGGER = LoggerFactory.getLogger(CamelResource.class); - @Inject - @DataSource("cameldb") - AgroalDataSource dataSource; - - @Inject - ProducerTemplate template; - - @Inject - CamelContext context; - - @ConfigProperty(name = "quarkus.datasource.cameldb.db-kind") - String dbKind; - - @PostConstruct - void postConstruct() throws Exception { - Connection conn = dataSource.getConnection(); - runScripts(conn, "droptables.sql"); - runScripts(conn, dbKind + ".sql"); - runScripts(conn, "inserts.sql"); - - context.getRouteController().startRoute("jdbc-poll"); - } - - @Path("/species/{id}") - @GET - @Produces(MediaType.TEXT_PLAIN) - public String getSpeciesById(@PathParam("id") String id) throws Exception { - return template.requestBody("jdbc:cameldb", "select species from camels where id = " + id, String.class); - } - - @SuppressWarnings("unchecked") - @Path("/species/{id}/list") - @GET - @Produces(MediaType.TEXT_PLAIN) - public String getSpeciesByIdWithSelectList(@PathParam("id") String id) throws Exception { - List<LinkedHashMap<String, Object>> result = template - .requestBody("jdbc:cameldb?outputType=SelectList", "select * from camels where id = " + id, List.class); - - if (result.isEmpty()) { - throw new IllegalStateException("Expected at least 1 camel result but none were found"); - } - - LinkedHashMap<String, Object> data = result.get(0); - return data.get(getSpeciesRowName()) + " " + data.get(getIdRowName()); - } - - @SuppressWarnings("unchecked") - @Path("/species/{id}/type") - @GET - @Produces(MediaType.TEXT_PLAIN) - public String getSpeciesByIdWithDefinedType(@PathParam("id") String id) throws Exception { - List<Camel> results = template.requestBody("jdbc:cameldb?outputClass=" + Camel.class.getName(), - "select * from camels where id = " + id, List.class); - - if (results.isEmpty()) { - throw new IllegalStateException("Expected at least 1 camel result but none were found"); - } - - Camel camel = results.get(0); - return camel.getSpecies() + " " + camel.getId(); - } - - @Path("/execute") - @POST - @Consumes(MediaType.TEXT_PLAIN) - @Produces(MediaType.TEXT_PLAIN) - public String executeStatement(String statement) throws Exception { - return template.requestBody("jdbc:cameldb", statement, String.class); - } - - @Path("/generated-keys/rows") - @GET - @Produces(MediaType.APPLICATION_JSON) - public List generatedKeysRows() throws Exception { - return template.requestBodyAndHeader("direct://get-generated-keys", - "insert into camelsGenerated (species) values ('Camelus testus')", - "CamelRetrieveGeneratedKeys", "true", ArrayList.class); - } - - @Path("/headers/insert") - @GET - @Produces(MediaType.APPLICATION_JSON) - public String headersFromInsertOrUpdate() throws Exception { - return template.requestBodyAndHeader("direct://get-headers", - "insert into camelsGenerated (species) values ('Camelus testus')", - "CamelRetrieveGeneratedKeys", "true", String.class); - } - - @Path("/headers/select") - @GET - @Produces(MediaType.APPLICATION_JSON) - public String headersFromSelect() throws Exception { - return template.requestBody("direct://get-headers", "select * from camelsGenerated", String.class); - } - - @Path("/named-parameters/headers-as-parameters") - @GET - @Produces(MediaType.APPLICATION_JSON) - public String headersAsParameters() throws Exception { - int id = 3; - return template.requestBodyAndHeader("direct://headers-as-parameters", - "select * from camels where id < :?idmax order by id", - "idmax", id, String.class); - } - - @Path("/named-parameters/headers-as-parameters-map") - @GET - @Produces(MediaType.APPLICATION_JSON) - public String headersAsParametersMap() throws Exception { - Map<String, Object> headersMap = Map.of("idmax", 3, "specs", "Camelus bactrianus"); - return template.requestBodyAndHeader("direct://headers-as-parameters", - "select * from camels where id < :?idmax and species = :?specs order by id", - "CamelJdbcParameters", headersMap, String.class); - } - - @Path("/interval-polling") - @GET - @Produces(MediaType.APPLICATION_JSON) - public void intervalPolling(String selectResult) throws Exception { - MockEndpoint mockEndpoint = context.getEndpoint("mock:interval-polling", MockEndpoint.class); - mockEndpoint.expectedBodiesReceived(selectResult); - - mockEndpoint.assertIsSatisfied(); - } - - @Path("/move-between-datasources") - @POST - @Produces(MediaType.APPLICATION_JSON) - public String moveBetweenDatasources() throws Exception { - return template.requestBody("direct://move-between-datasources", null, String.class); - } - - private void runScripts(Connection conn, String fileName) throws SQLException, IOException { - try (Statement statement = conn.createStatement()) { - try (InputStream is = Thread.currentThread().getContextClassLoader() - .getResourceAsStream("sql/" + fileName); - InputStreamReader isr = new InputStreamReader(is); - BufferedReader reader = new BufferedReader(isr)) { - - //execute each line from the sql script as separate statement - reader.lines().filter(s -> s != null && !"".equals(s) && !s.startsWith("--")).forEach(s -> { - try { - statement.execute(s); - } catch (SQLException e) { - if (!s.toUpperCase().startsWith("DROP")) { - throw new RuntimeException(e); - } else { - LOGGER.debug(String.format("Command '%s' failed.", s)); //use debug logging - } - } - }); - } - } - - } - - @Path("/get-id-key") - @GET - @Produces(MediaType.TEXT_PLAIN) - public String getIdKey() { - switch (dbKind) { - case "postgresql": - return "id"; - case "oracle": - return "ROWID"; - case "mssql": - return "GENERATED_KEYS"; - case "mariadb": - return "insert_id"; - case "mysql": - return "GENERATED_KEY"; - default: - return "ID"; - } - } - - private String getIdRowName() { - if (dbKind.equals("h2") || dbKind.equals("oracle") || dbKind.equals("db2")) { - return "ID"; - } else { - return "id"; - } - } - - private String getSpeciesRowName() { - if (dbKind.equals("h2") || dbKind.equals("oracle") || dbKind.equals("db2")) { - return "SPECIES"; - } else { - return "species"; - } - } -} diff --git a/integration-tests/jdbc/src/main/java/org/apache/camel/quarkus/component/jdbc/JdbcRoutes.java b/integration-tests/jdbc/src/main/java/org/apache/camel/quarkus/component/jdbc/JdbcRoutes.java deleted file mode 100644 index 7b5f977cea..0000000000 --- a/integration-tests/jdbc/src/main/java/org/apache/camel/quarkus/component/jdbc/JdbcRoutes.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.quarkus.component.jdbc; - -import jakarta.enterprise.context.ApplicationScoped; -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.builder.RouteBuilder; -import org.eclipse.microprofile.config.inject.ConfigProperty; - -@ApplicationScoped -public class JdbcRoutes extends RouteBuilder { - - @ConfigProperty(name = "quarkus.datasource.cameldb.db-kind") - String dbKind; - - @Override - public void configure() { - from("direct://get-generated-keys") - .to("jdbc:cameldb") - .process(new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - System.out.println(exchange.getIn().getHeaders()); - Object in = exchange.getIn().getHeader("CamelGeneratedKeysRows"); - exchange.getIn().setBody(in); - } - }); - - from("direct://get-headers") - .to("jdbc:cameldb") - .process(new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - Object in = exchange.getIn().getHeaders(); - exchange.getIn().setBody(in); - } - }); - - from("direct://headers-as-parameters") - .to("jdbc:cameldb?useHeadersAsParameters=true"); - - from("timer://interval-polling?delay=2000&repeatCount=1").routeId("jdbc-poll").autoStartup(false) - .setBody(constant("select * from camelsGenerated order by id desc")) - .to("jdbc:cameldb") - .to("mock:interval-polling"); - - String species; - if (dbKind.equals("postgresql") || dbKind.equals("mysql") || dbKind.equals("mariadb") || dbKind.equals("mssql")) { - species = "species"; - } else { - species = "SPECIES"; - } - - from("direct://move-between-datasources") - .setBody(constant("select * from camels")) - .to("jdbc:cameldb") - .split(body()) - .setBody(simple("insert into camelsProcessed (species) values('${body[" + species + "]}')")) - .to("jdbc:cameldb"); - } -} diff --git a/integration-tests/jdbc/src/main/java/org/apache/camel/quarkus/component/jdbc/model/Camel.java b/integration-tests/jdbc/src/main/java/org/apache/camel/quarkus/component/jdbc/model/Camel.java deleted file mode 100644 index 5b1715ffd3..0000000000 --- a/integration-tests/jdbc/src/main/java/org/apache/camel/quarkus/component/jdbc/model/Camel.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.quarkus.component.jdbc.model; - -import io.quarkus.runtime.annotations.RegisterForReflection; - -@RegisterForReflection -public class Camel { - - private int id; - private String species; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getSpecies() { - return species; - } - - public void setSpecies(String species) { - this.species = species; - } -} diff --git a/integration-tests/jdbc/src/main/resources/application.properties b/integration-tests/jdbc/src/main/resources/application.properties deleted file mode 100644 index 3fae84e7b2..0000000000 --- a/integration-tests/jdbc/src/main/resources/application.properties +++ /dev/null @@ -1,24 +0,0 @@ -## --------------------------------------------------------------------------- -## 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. -## --------------------------------------------------------------------------- - -# -# Quarkus :: DS -# -quarkus.datasource.cameldb.db-kind=${cq.jdbcKind:h2} -quarkus.datasource.cameldb.jdbc.max-size=8 - -quarkus.native.resources.includes=sql/${cq.jdbcKind:h2}.sql,sql/inserts.sql,sql/droptables.sql \ No newline at end of file diff --git a/integration-tests/jdbc/src/main/resources/sql/db2.sql b/integration-tests/jdbc/src/main/resources/sql/db2.sql deleted file mode 100644 index 48e78bc85f..0000000000 --- a/integration-tests/jdbc/src/main/resources/sql/db2.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- 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. --- - -CREATE TABLE camels (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, species VARCHAR(50) NOT NULL,PRIMARY KEY (id)) -CREATE TABLE camelsGenerated (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, species VARCHAR(50) NOT NULL,PRIMARY KEY (id)) -CREATE TABLE camelsProcessed (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, species VARCHAR(50) NOT NULL,PRIMARY KEY (id)) \ No newline at end of file diff --git a/integration-tests/jdbc/src/main/resources/sql/derby.sql b/integration-tests/jdbc/src/main/resources/sql/derby.sql deleted file mode 100644 index 1f5485efe6..0000000000 --- a/integration-tests/jdbc/src/main/resources/sql/derby.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- 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. --- - -CREATE TABLE camels (id INT NOT NULL GENERATED ALWAYS AS IDENTITY,species VARCHAR(50) NOT NULL) -CREATE TABLE camelsGenerated (id INT NOT NULL GENERATED ALWAYS AS IDENTITY,species VARCHAR(50) NOT NULL) -CREATE TABLE camelsProcessed (id INT NOT NULL GENERATED ALWAYS AS IDENTITY,species VARCHAR(50) NOT NULL) \ No newline at end of file diff --git a/integration-tests/jdbc/src/main/resources/sql/droptables.sql b/integration-tests/jdbc/src/main/resources/sql/droptables.sql deleted file mode 100644 index 7a77034cc8..0000000000 --- a/integration-tests/jdbc/src/main/resources/sql/droptables.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- 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. --- - -drop table camels -drop table camelsGenerated -drop table camelsProcessed \ No newline at end of file diff --git a/integration-tests/jdbc/src/main/resources/sql/h2.sql b/integration-tests/jdbc/src/main/resources/sql/h2.sql deleted file mode 100644 index e54ab07edd..0000000000 --- a/integration-tests/jdbc/src/main/resources/sql/h2.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- 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. --- - -create table camels (id int auto_increment primary key, species varchar(50)) -create table camelsGenerated (id int auto_increment primary key, species varchar(50)) -create table camelsProcessed (id int auto_increment primary key , species varchar(50)) \ No newline at end of file diff --git a/integration-tests/jdbc/src/main/resources/sql/inserts.sql b/integration-tests/jdbc/src/main/resources/sql/inserts.sql deleted file mode 100644 index fce3a151ca..0000000000 --- a/integration-tests/jdbc/src/main/resources/sql/inserts.sql +++ /dev/null @@ -1,22 +0,0 @@ --- --- 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. --- - -insert into camelsGenerated (species) values ('Camelus status') -insert into camelsGenerated (species) values ('Camelus linus') -insert into camels (species) values ('Camelus dromedarius') -insert into camels (species) values ('Camelus bactrianus') -insert into camels (species) values ('Camelus ferus') \ No newline at end of file diff --git a/integration-tests/jdbc/src/main/resources/sql/mariadb.sql b/integration-tests/jdbc/src/main/resources/sql/mariadb.sql deleted file mode 100644 index e54ab07edd..0000000000 --- a/integration-tests/jdbc/src/main/resources/sql/mariadb.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- 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. --- - -create table camels (id int auto_increment primary key, species varchar(50)) -create table camelsGenerated (id int auto_increment primary key, species varchar(50)) -create table camelsProcessed (id int auto_increment primary key , species varchar(50)) \ No newline at end of file diff --git a/integration-tests/jdbc/src/main/resources/sql/mssql.sql b/integration-tests/jdbc/src/main/resources/sql/mssql.sql deleted file mode 100644 index c603f48434..0000000000 --- a/integration-tests/jdbc/src/main/resources/sql/mssql.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- 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. --- - -create table camels (id int IDENTITY(1,1) PRIMARY KEY, species varchar(255)) -create table camelsGenerated (id int IDENTITY(1,1) PRIMARY KEY, species varchar(255)) -create table camelsProcessed (id int IDENTITY(1,1) PRIMARY KEY, species varchar(255)) \ No newline at end of file diff --git a/integration-tests/jdbc/src/main/resources/sql/mysql.sql b/integration-tests/jdbc/src/main/resources/sql/mysql.sql deleted file mode 100644 index e54ab07edd..0000000000 --- a/integration-tests/jdbc/src/main/resources/sql/mysql.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- 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. --- - -create table camels (id int auto_increment primary key, species varchar(50)) -create table camelsGenerated (id int auto_increment primary key, species varchar(50)) -create table camelsProcessed (id int auto_increment primary key , species varchar(50)) \ No newline at end of file diff --git a/integration-tests/jdbc/src/main/resources/sql/oracle.sql b/integration-tests/jdbc/src/main/resources/sql/oracle.sql deleted file mode 100644 index a127ab480b..0000000000 --- a/integration-tests/jdbc/src/main/resources/sql/oracle.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- 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. --- - -CREATE TABLE camels(id NUMBER GENERATED by default on null as IDENTITY, species VARCHAR2(50) NOT NULL, PRIMARY KEY(id)) -CREATE TABLE camelsGenerated(id NUMBER GENERATED by default on null as IDENTITY, species VARCHAR2(50) NOT NULL, PRIMARY KEY(id)) -CREATE TABLE camelsProcessed(id NUMBER GENERATED by default on null as IDENTITY, species VARCHAR2(50) NOT NULL, PRIMARY KEY(id)) diff --git a/integration-tests/jdbc/src/main/resources/sql/postgresql.sql b/integration-tests/jdbc/src/main/resources/sql/postgresql.sql deleted file mode 100644 index b31dc12ef6..0000000000 --- a/integration-tests/jdbc/src/main/resources/sql/postgresql.sql +++ /dev/null @@ -1,20 +0,0 @@ --- --- 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. --- - -CREATE TABLE camels (id serial PRIMARY KEY, species VARCHAR ( 50 ) NOT NULL) -CREATE TABLE camelsGenerated (id serial PRIMARY KEY, species VARCHAR ( 50 ) NOT NULL) -CREATE TABLE camelsProcessed (id serial PRIMARY KEY, species VARCHAR ( 50 ) NOT NULL) \ No newline at end of file diff --git a/integration-tests/jdbc/src/test/java/org/apache/camel/quarkus/component/jdbc/CamelJdbcIT.java b/integration-tests/jdbc/src/test/java/org/apache/camel/quarkus/component/jdbc/CamelJdbcIT.java deleted file mode 100644 index a4764a169c..0000000000 --- a/integration-tests/jdbc/src/test/java/org/apache/camel/quarkus/component/jdbc/CamelJdbcIT.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.quarkus.component.jdbc; - -import io.quarkus.test.junit.QuarkusIntegrationTest; - -@QuarkusIntegrationTest -public class CamelJdbcIT extends CamelJdbcTest { - -} diff --git a/integration-tests/jdbc/src/test/java/org/apache/camel/quarkus/component/jdbc/CamelJdbcTest.java b/integration-tests/jdbc/src/test/java/org/apache/camel/quarkus/component/jdbc/CamelJdbcTest.java deleted file mode 100644 index 9c8dce2d81..0000000000 --- a/integration-tests/jdbc/src/test/java/org/apache/camel/quarkus/component/jdbc/CamelJdbcTest.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.quarkus.component.jdbc; - -import java.util.List; - -import io.quarkus.test.junit.QuarkusTest; -import io.restassured.RestAssured; -import io.restassured.http.ContentType; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledIfSystemProperty; - -import static org.hamcrest.Matchers.containsStringIgnoringCase; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.equalToIgnoringCase; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -@QuarkusTest -@DisabledIfSystemProperty(named = "cq.jdbcKind", matches = "derby") -//https://github.com/quarkusio/quarkus/issues/23083 -public class CamelJdbcTest { - @Test - void testGetSpeciesById() { - RestAssured.when().get("/test/species/1").then().body(equalToIgnoringCase("[{SPECIES=Camelus dromedarius}]")); - RestAssured.when().get("/test/species/2").then().body(equalToIgnoringCase("[{SPECIES=Camelus bactrianus}]")); - RestAssured.when().get("/test/species/3").then().body(equalToIgnoringCase("[{SPECIES=Camelus ferus}]")); - } - - @Test - void testGetSpeciesByIdWithResultList() { - RestAssured.when().get("/test/species/1/list").then().body(is("Camelus dromedarius 1")); - } - - @Test - void testGetSpeciesByIdWithDefinedType() { - RestAssured.when().get("/test/species/1/type").then().body(equalToIgnoringCase("Camelus dromedarius 1")); - } - - @Test - void testExecuteStatement() { - RestAssured.given() - .contentType(ContentType.TEXT).body("select id from camels order by id desc") - .post("/test/execute") - .then().body(equalToIgnoringCase("[{ID=3}, {ID=2}, {ID=1}]")); - } - - @Test - void testCamelRetrieveGeneratedKeysHeader() { - String idKey = RestAssured.when() - .get("/test/get-id-key") - .then() - .extract() - .body().asString(); - - List generatedIDs = RestAssured.given() - .get("test/generated-keys/rows") - .then().extract().body() - .jsonPath().getList(idKey); - - assertFalse(generatedIDs.isEmpty()); - assertNotNull(generatedIDs.get(0)); - - } - - @Test - void testHeadersFromInsertOrUpdateQuery() { - RestAssured.given() - .get("test/headers/insert") - .then() - .body(containsStringIgnoringCase("CamelGeneratedKeysRowCount=1")) - .and() - .body(containsStringIgnoringCase("CamelJdbcUpdateCount=1")) - .and() - .body(containsStringIgnoringCase("CamelRetrieveGeneratedKeys=true")) - .and() - .body(not(containsStringIgnoringCase("CamelJdbcRowCount"))) - .and() - .body(not(containsStringIgnoringCase("CamelJdbcColumnNames"))) - .and() - .body(not(containsStringIgnoringCase("CamelJdbcParameters"))) - .and() - .body(not(containsStringIgnoringCase("CamelGeneratedColumns"))); - } - - @Test - void testHeadersFromSelectQuery() { - RestAssured.given() - .get("test/headers/select") - .then() - .body(not(containsStringIgnoringCase("CamelGeneratedKeysRowCount"))) - .and() - .body(not(containsStringIgnoringCase("CamelJdbcUpdateCount"))) - .and() - .body(not(containsStringIgnoringCase("CamelRetrieveGeneratedKeys"))) - .and() - .body(not(containsStringIgnoringCase("CamelJdbcParameters"))) - .and() - .body(not(containsStringIgnoringCase("CamelGeneratedColumns"))) - .and() - .body(containsStringIgnoringCase("CamelJdbcRowCount")) - .and() - .body(containsStringIgnoringCase("CamelJdbcColumnNames=[ID, SPECIES]")); - } - - @Test - void testNamedParameters() { - RestAssured.given() - .get("test/named-parameters/headers-as-parameters") - .then() - .body(containsStringIgnoringCase("{ID=1, SPECIES=Camelus dromedarius}")) - .and() - .body(containsStringIgnoringCase("{ID=2, SPECIES=Camelus bactrianus}")); - } - - @Test - void testCamelJdbcParametersHeader() { - RestAssured.given() - .get("test/named-parameters/headers-as-parameters-map") - .then() - .body(containsStringIgnoringCase("{ID=2, SPECIES=Camelus bactrianus}")); - } - - @Test - void testTimeIntervalDatabasePolling() { - String selectResult = RestAssured.given() - .contentType(ContentType.TEXT).body("select * from camelsGenerated order by id desc") - .post("/test/execute") - .then().extract().body().asString(); - - RestAssured.given() - .body(selectResult) - .get("/test/interval-polling") - .then() - .statusCode(204); - } - - @Test - void testMoveDataBetweenDatasources() { - String camelsDbResult = RestAssured.given() - .contentType(ContentType.TEXT).body("select * from camels order by id desc") - .post("/test/execute") - .then().extract().body().asString(); - - RestAssured.given() - .post("test/move-between-datasources"); - - RestAssured.given() - .contentType(ContentType.TEXT).body("select * from camelsProcessed order by id desc") - .post("/test/execute") - .then() - .body(equalTo(camelsDbResult)); - } -} diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 32a56e40f8..fe4aeeb3dd 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -119,7 +119,6 @@ <module>java-joor-dsl</module> <module>jaxb</module> <module>jcache</module> - <module>jdbc</module> <module>jdbc-grouped</module> <module>jfr</module> <module>jira</module> diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml index 743475f64c..4f255251f6 100644 --- a/tooling/scripts/test-categories.yaml +++ b/tooling/scripts/test-categories.yaml @@ -69,7 +69,6 @@ group-04: - cassandraql - couchdb - influxdb - - jdbc - jms-qpid-amqp-client - jpa - kudu