Skip to content

Commit

Permalink
Update DatabaseMetadataTest.java - testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ananya2 authored Dec 13, 2024
1 parent fd74d8e commit 38d1350
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
import java.sql.SQLException;
import java.sql.Statement;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import com.microsoft.sqlserver.testframework.AbstractTest;
import com.microsoft.sqlserver.testframework.AbstractSQLGenerator;
Expand Down Expand Up @@ -38,7 +36,7 @@ public void testGetIndexInfo() throws SQLException, SQLServerException {
col3Name + " INT)";
stmt.executeUpdate(createTableSQL);

String createClusteredIndexSQL = "CREATE CLUSTERED INDEX IDX_Clustered ON " + tableName + "(" + col1Name + ")";
String createClusteredIndexSQL = "CREATE CLUSTERED INDEX IDX_Clustered ON " + tableName + "(" + col1Name + ")";
stmt.executeUpdate(createClusteredIndexSQL);

String createNonClusteredIndexSQL = "CREATE NONCLUSTERED INDEX IDX_NonClustered ON " + tableName + "(" + col2Name + ")";
Expand All @@ -56,10 +54,11 @@ public void testGetIndexInfo() throws SQLException, SQLServerException {
boolean hasClusteredIndex = false;
boolean hasNonClusteredIndex = false;
boolean hasColumnstoreIndex = false;

System.out.println("Testing getIndexInfo " + rs);
while (rs.next()) {
String indexType = rs.getString("IndexType");
String indexName = rs.getString("IndexName");
System.out.println(indexType + " " + indexName);

if (indexType.contains("COLUMNSTORE")) {
hasColumnstoreIndex = true;
Expand All @@ -73,8 +72,6 @@ public void testGetIndexInfo() throws SQLException, SQLServerException {
assertTrue(hasClusteredIndex, "CLUSTERED index found.");
assertTrue(hasNonClusteredIndex, "NONCLUSTERED index found.");
assertTrue(hasColumnstoreIndex, "COLUMNSTORE index found.");
} catch (SQLException e) {
fail("Exception occurred while testing getIndexInfo: " + e.getMessage());
}
}
}

0 comments on commit 38d1350

Please sign in to comment.