You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2023/06/23 13:37:56 UTC
[camel] 15/18: CAMEL-19461 - Make Cassandra tests aware of license headers in .cql files
This is an automated email from the ASF dual-hosted git repository.
ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 7a82031306d540630b96b9ee52da63487bd78ac4
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Thu Jun 22 22:31:34 2023 +0200
CAMEL-19461 - Make Cassandra tests aware of license headers in .cql
files
---
.../camel/component/cassandra/integration/BaseCassandra.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/integration/BaseCassandra.java b/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/integration/BaseCassandra.java
index ec8f76b9e4c..7132a731f8d 100644
--- a/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/integration/BaseCassandra.java
+++ b/components/camel-cassandraql/src/test/java/org/apache/camel/component/cassandra/integration/BaseCassandra.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.cassandra.integration;
import java.io.IOException;
import java.net.InetSocketAddress;
+import java.nio.file.Paths;
import java.time.Duration;
import com.datastax.oss.driver.api.core.CqlSession;
@@ -31,11 +32,11 @@ import org.apache.camel.test.infra.core.DefaultCamelContextExtension;
import org.apache.camel.test.infra.core.annotations.RouteFixture;
import org.apache.camel.test.infra.core.api.CamelTestSupportHelper;
import org.apache.camel.test.infra.core.api.ConfigurableRoute;
+import org.apache.camel.util.IOHelper;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.extension.RegisterExtension;
-import org.testcontainers.shaded.org.apache.commons.io.IOUtils;
public abstract class BaseCassandra implements ConfigurableRoute, CamelTestSupportHelper {
@@ -68,10 +69,10 @@ public abstract class BaseCassandra implements ConfigurableRoute, CamelTestSuppo
}
public void executeScript(String pathToScript) throws IOException {
- String s = IOUtils.toString(getClass().getResourceAsStream("/" + pathToScript), "UTF-8");
+ String s = IOHelper.stripLineComments(Paths.get("src/test/resources/" + pathToScript), "--", true);
String[] statements = s.split(";");
for (int i = 0; i < statements.length; i++) {
- if (!statements[i].isEmpty()) {
+ if (!statements[i].isBlank()) {
executeCql(statements[i]);
}
}