Skip to content

Commit bffc06f

Browse files
committed
Fix Tests
1 parent 34f87b5 commit bffc06f

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

src/test/java/org/apache/beam/sdk/io/astra/AbstractAstraTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected static byte[] getSecureBundle(String dbname, String keyspace) {
9595
* Cassandra cluster
9696
*/
9797
protected static CqlSession getCqlSession(String dbName, String keyspace) {
98-
if (cqlSession == null) {
98+
if (cqlSession == null || cqlSession.isClosed()) {
9999
cqlSession = CqlSession.builder()
100100
.withCloudSecureConnectBundle(getSecureConnectBundlePath(dbName, keyspace))
101101
.withAuthCredentials("token", getToken())
@@ -159,7 +159,8 @@ protected static AstraDevopsApiClient getApiDevopsClient() {
159159
* @return
160160
* database client
161161
*/
162-
protected static DatabaseClient createDbAndProvideClient(String dbName, String keyspace, boolean vector) throws InterruptedException {
162+
protected static DatabaseClient createDbAndProvideClient(String dbName, String keyspace, boolean vector)
163+
throws InterruptedException {
163164
if (dbClient == null) {
164165
if (!getDatabasesClient().findByName(dbName).findAny().isPresent()) {
165166
LOGGER.info("Create DB {} as not existing ", dbName);

src/test/java/org/apache/beam/sdk/io/astra/AstraDbIOVectorTest.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ public class AstraDbIOVectorTest extends AbstractAstraTest implements Serializab
4343

4444
@BeforeClass
4545
public static void beforeClass() throws InterruptedException {
46-
//createDbAndProvideClient(DB_VECTOR_NAME, DB_KEYSPACE_NAME, true);
46+
createDbAndProvideClient(DB_VECTOR_NAME, DB_KEYSPACE_NAME, true);
4747
cqlSession = getCqlSession(DB_VECTOR_NAME, DB_KEYSPACE_NAME);
48-
//createSchema();
49-
//insertData();
48+
createSchema();
49+
insertData();
5050
}
5151

5252
@Test
@@ -152,11 +152,7 @@ public void processElement(ProcessContext c) {
152152
Arrays.asList(vector).stream().map(f -> df.format(f))
153153
.collect(Collectors.toList()).toString();
154154
System.out.println("Decoded Vector: " + result);
155-
156-
c.output(c.element().toString());
157-
//CqlVectorCodec codec = new CqlVectorCodec<Float>();
158-
159-
155+
c.output(c.element().toString());
160156
}
161157
}
162158

0 commit comments

Comments
 (0)