Skip to content

Commit

Permalink
Use Quarkus Derby DevServices for SQL integration test
Browse files Browse the repository at this point in the history
Fixes #5633
  • Loading branch information
jamesnetherton committed Jan 4, 2024
1 parent 2055a79 commit 61232e9
Show file tree
Hide file tree
Showing 13 changed files with 6 additions and 208 deletions.
1 change: 0 additions & 1 deletion integration-tests-support/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
<module>kafka</module>
<module>mongodb</module>
<module>process-executor-support</module>
<module>sql-derby-support</module>
<module>test-support</module>
<module>mock-backend</module>
<module>wiremock</module>
Expand Down
3 changes: 0 additions & 3 deletions integration-tests-support/sql-derby-support/README.adoc

This file was deleted.

42 changes: 0 additions & 42 deletions integration-tests-support/sql-derby-support/pom.xml

This file was deleted.

1 change: 1 addition & 0 deletions integration-tests/sql/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
derby.log
24 changes: 0 additions & 24 deletions integration-tests/sql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@
<artifactId>awaitility</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-integration-tests-support-sql-derby</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
Expand Down Expand Up @@ -195,25 +190,6 @@
<value>derby</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeArtifactIds>camel-quarkus-integration-tests-support-sql-derby</includeArtifactIds>
<outputDirectory>target/test-classes/derby/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ public class SqlDbInitializer {
String dbKind;

public void initDb() throws SQLException, IOException {

runScripts("initDb.sql");

if (SqlHelper.useDocker()) {
//docker execution may require more sql scripts
runScripts("initDb_docker.sql");
}
}

private void runScripts(String fileName) throws SQLException, IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package test;
package org.apache.camel.quarkus.component.sql.it.storedproc.derby;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class AddNumsProcedure {

public static void testProc(int a, int b) throws SQLException {
String sql = "insert into ADD_NUMS_RESULTS (id, value) VALUES (1, " + (a + b) + ")";

public class NumberAddStoredProcedure {
public static void addNumbers(int a, int b) throws SQLException {
String sql = "INSERT INTO ADD_NUMS_RESULTS (id, value) VALUES (1, " + (a + b) + ")";
try (Connection con = DriverManager.getConnection("jdbc:default:connection");
PreparedStatement ps = con.prepareStatement(sql)) {
ps.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ CREATE TABLE aggregation_completed (id VARCHAR(255) NOT NULL, exchange BLOB NOT
DROP TABLE ADD_NUMS_RESULTS
CREATE TABLE ADD_NUMS_RESULTS (id INT PRIMARY KEY, value INT NOT NULL)

CREATE PROCEDURE ADD_NUMS(IN a INTEGER, IN b INTEGER) PARAMETER STYLE JAVA LANGUAGE JAVA EXTERNAL NAME 'test.AddNumsProcedure.testProc'
CREATE PROCEDURE ADD_NUMS(IN a INTEGER, IN b INTEGER) PARAMETER STYLE JAVA LANGUAGE JAVA EXTERNAL NAME 'org.apache.camel.quarkus.component.sql.it.storedproc.derby.NumberAddStoredProcedure.addNumbers'

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.Map;
import java.util.concurrent.TimeUnit;

import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
import io.restassured.http.ContentType;
Expand All @@ -33,12 +32,10 @@
import org.hamcrest.text.IsEqualIgnoringCase;
import org.junit.jupiter.api.Test;

import static io.restassured.RestAssured.given;
import static org.awaitility.Awaitility.await;
import static org.hamcrest.Matchers.*;

@QuarkusTest
@QuarkusTestResource(DerbyTestResource.class)
class SqlTest {

@Test
Expand Down
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@
<consul.container.image>docker.io/hashicorp/consul:1.16</consul.container.image>
<couchbase.container.image>docker.io/couchbase/server:7.2.0</couchbase.container.image>
<couchdb.container.image>docker.io/couchdb:2.3.1</couchdb.container.image>
<derby.container.image>docker.io/az82/docker-derby:10.16</derby.container.image>
<eclipse-mosquitto.container.image>docker.io/eclipse-mosquitto:1.6.15</eclipse-mosquitto.container.image>
<eclipse-temurin.container.image>eclipse-temurin:17-ubi9-minimal</eclipse-temurin.container.image>
<elasticsearch.container.image>docker.io/elasticsearch:8.8.1</elasticsearch.container.image>
Expand Down
5 changes: 0 additions & 5 deletions poms/bom-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,6 @@
<artifactId>camel-quarkus-integration-tests-support-mongodb</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-integration-tests-support-sql-derby</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-integration-wiremock-support</artifactId>
Expand Down

0 comments on commit 61232e9

Please sign in to comment.