This is an automated email from the ASF dual-hosted git repository.
absurdfarce pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/cassandra-java-driver.git
The following commit(s) were added to refs/heads/3.x by this push:
new 4914cf785 CASSJAVA-57 Filter comment lines out when reading in
comparison files
4914cf785 is described below
commit 4914cf785b2724c595724bd6796265976f348307
Author: absurdfarce <[email protected]>
AuthorDate: Tue Nov 12 00:18:37 2024 -0600
CASSJAVA-57 Filter comment lines out when reading in comparison files
patch by Bret McGuire; reviewed by Bret McGuire for CASSJAVA-57
---
.../datastax/driver/core/ExportAsStringTest.java | 23 +++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git
a/driver-core/src/test/java/com/datastax/driver/core/ExportAsStringTest.java
b/driver-core/src/test/java/com/datastax/driver/core/ExportAsStringTest.java
index 40ae98d00..934bfba79 100644
--- a/driver-core/src/test/java/com/datastax/driver/core/ExportAsStringTest.java
+++ b/driver-core/src/test/java/com/datastax/driver/core/ExportAsStringTest.java
@@ -23,12 +23,12 @@ import static org.assertj.core.api.Assertions.fail;
import com.datastax.driver.core.schemabuilder.SchemaBuilder;
import com.datastax.driver.core.utils.CassandraVersion;
import com.google.common.collect.ImmutableMap;
-import com.google.common.io.ByteStreams;
import com.google.common.io.Closer;
-import java.io.ByteArrayOutputStream;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
-import java.io.PrintStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -248,10 +248,19 @@ public class ExportAsStringTest extends CCMTestsSupport {
+ ")")
.isNotNull();
closer.register(is);
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- PrintStream ps = new PrintStream(baos);
- ByteStreams.copy(is, ps);
- return baos.toString().trim();
+
+ BufferedReader in = new BufferedReader(new InputStreamReader(is));
+ StringWriter out = new StringWriter();
+
+ String line;
+ while ((line = in.readLine()) != null) {
+
+ String trimmedLine = line.trim();
+ if (trimmedLine.startsWith("/*") || trimmedLine.startsWith("*"))
continue;
+ out.write(line);
+ out.write(System.getProperty("line.separator"));
+ }
+ return out.toString().trim();
} catch (IOException e) {
logger.warn("Failure to read {}", resourceName, e);
fail("Unable to read " + resourceName + " is it defined?");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]