Skip to content

Commit 2bfd53e

Browse files
authored
Enable vector test to run only in AzureDB (#2749)
* Enable vector test in AzureDB * jdk8 failure : for testing * Added custom annotation to run tests on AzureDB * Added vectorTest tag along with AzureDB tag
1 parent 1c66508 commit 2bfd53e

File tree

6 files changed

+50
-0
lines changed

6 files changed

+50
-0
lines changed

src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyCSVTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import com.microsoft.sqlserver.jdbc.TestUtils;
4545
import com.microsoft.sqlserver.testframework.AbstractSQLGenerator;
4646
import com.microsoft.sqlserver.testframework.AbstractTest;
47+
import com.microsoft.sqlserver.testframework.AzureDB;
4748
import com.microsoft.sqlserver.testframework.Constants;
4849
import com.microsoft.sqlserver.testframework.DBConnection;
4950
import com.microsoft.sqlserver.testframework.DBResultSet;
@@ -609,6 +610,7 @@ public void testBulkCopyWithComputedColumnNotAsLastColumn() throws SQLException
609610
* BulkCopyCSVTestInputWithVector.csv file
610611
*/
611612
@Test
613+
@AzureDB
612614
@Tag(Constants.vectorTest)
613615
public void testBulkCopyVectorFromCSV() throws SQLException {
614616
String dstTable = AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("dstTableBulkCopyVectorCsv"));
@@ -686,6 +688,7 @@ public void testBulkCopyVectorFromCSV() throws SQLException {
686688
* BulkCopyCSVTestInputWithMultipleVectorColumn.csv file
687689
*/
688690
@Test
691+
@AzureDB
689692
@Tag(Constants.vectorTest)
690693
public void testBulkCopyVectorFromCSVWithMultipleColumns() throws SQLException {
691694
String dstTable = AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("dstTableVectorCsvMulti"));
@@ -753,6 +756,7 @@ public void testBulkCopyVectorFromCSVWithMultipleColumns() throws SQLException {
753756
* BulkCopyCSVTestWithMultipleVectorColumnWithPipeDelimiter.csv file
754757
*/
755758
@Test
759+
@AzureDB
756760
@Tag(Constants.vectorTest)
757761
public void testBulkCopyVectorFromCSVWithMultipleColumnsWithPipeDelimiter() throws SQLException {
758762
String dstTable = AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("dstTableBulkCopyVectorCsvMultiPipe"));
@@ -820,6 +824,7 @@ public void testBulkCopyVectorFromCSVWithMultipleColumnsWithPipeDelimiter() thro
820824
* metadata.
821825
*/
822826
@Test
827+
@AzureDB
823828
@Tag(Constants.vectorTest)
824829
public void testBulkCopyVectorFromCSVWithIncorrectDimension() throws SQLException {
825830
String dstTable = AbstractSQLGenerator.escapeIdentifier(RandomUtil.getIdentifier("dstTableBulkCopyVectorCsvBadDim"));

src/test/java/com/microsoft/sqlserver/jdbc/bulkCopy/BulkCopyISQLServerBulkRecordTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import com.microsoft.sqlserver.jdbc.TestUtils;
4343
import com.microsoft.sqlserver.testframework.AbstractSQLGenerator;
4444
import com.microsoft.sqlserver.testframework.AbstractTest;
45+
import com.microsoft.sqlserver.testframework.AzureDB;
4546
import com.microsoft.sqlserver.testframework.Constants;
4647
import com.microsoft.sqlserver.testframework.DBConnection;
4748
import com.microsoft.sqlserver.testframework.DBStatement;
@@ -161,6 +162,7 @@ public void testBulkCopyDateTimePrecision() throws SQLException {
161162
* Test bulk copy with a single Vector row.
162163
*/
163164
@Test
165+
@AzureDB
164166
@Tag(Constants.vectorTest)
165167
public void testBulkCopyVector() throws SQLException {
166168
String dstTable = TestUtils
@@ -586,6 +588,7 @@ public void testBulkCopyWithCountVerification() throws SQLException {
586588
* to destination table with VECTOR column.
587589
*/
588590
@Test
591+
@AzureDB
589592
@Tag(Constants.vectorTest)
590593
public void testBulkCopyTableToTableJsonToVector() throws Exception {
591594
String srcTable = TestUtils.escapeSingleQuotes(AbstractSQLGenerator.escapeIdentifier("testSrcJsonTable"));
@@ -661,6 +664,7 @@ private static Object[] parseJsonArrayToFloatArray(String json) {
661664
* Test bulk copy with null Vector data.
662665
*/
663666
@Test
667+
@AzureDB
664668
@Tag(Constants.vectorTest)
665669
public void testBulkCopyVectorNull() throws SQLException {
666670
String dstTable = TestUtils
@@ -706,6 +710,7 @@ public void testBulkCopyVectorNull() throws SQLException {
706710
* incompatible with vector".
707711
*/
708712
@Test
713+
@AzureDB
709714
@Tag(Constants.vectorTest)
710715
public void testBulkCopyVectorUsingBulkCopySourceAsVarBinary() {
711716
String varbinaryTable = TestUtils
@@ -767,6 +772,7 @@ public void testBulkCopyVectorUsingBulkCopySourceAsVarBinary() {
767772
* incompatible with varbinary(max)".
768773
*/
769774
@Test
775+
@AzureDB
770776
@Tag(Constants.vectorTest)
771777
public void testBulkCopyVectorUsingBulkCopyDestinationAsVarBinary() {
772778
String vectorTable = TestUtils.escapeSingleQuotes(AbstractSQLGenerator.escapeIdentifier("testVectorTable"));
@@ -834,6 +840,7 @@ public void testBulkCopyVectorUsingBulkCopyDestinationAsVarBinary() {
834840
* The operation should succeed, and the data should be validated.
835841
*/
836842
@Test
843+
@AzureDB
837844
@Tag(Constants.vectorTest)
838845
public void testBulkCopyVectorUsingBulkCopySourceAsVarchar() {
839846
String varcharTable = TestUtils.escapeSingleQuotes(AbstractSQLGenerator.escapeIdentifier("testVarcharTable"));
@@ -901,6 +908,7 @@ public void testBulkCopyVectorUsingBulkCopySourceAsVarchar() {
901908
* The operation should succeed, and the data should be validated.
902909
*/
903910
@Test
911+
@AzureDB
904912
@Tag(Constants.vectorTest)
905913
public void testBulkCopyVectorUsingBulkCopyDestinationAsVarchar() {
906914
String vectorTable = TestUtils.escapeSingleQuotes(AbstractSQLGenerator.escapeIdentifier("testVectorTable"));
@@ -971,6 +979,7 @@ public void testBulkCopyVectorUsingBulkCopyDestinationAsVarchar() {
971979
* The operation should fail with an error: "The vector dimensions 3 and 4 do not match."
972980
*/
973981
@Test
982+
@AzureDB
974983
@Tag(Constants.vectorTest)
975984
public void testBulkCopyVectorWithMismatchedDimensions() {
976985
String srcTable = TestUtils.escapeSingleQuotes(AbstractSQLGenerator.escapeIdentifier("testSrcTable"));
@@ -1029,6 +1038,7 @@ public void testBulkCopyVectorWithMismatchedDimensions() {
10291038
* Test bulk copy with a large number of records to check performance.
10301039
*/
10311040
@Test
1041+
@AzureDB
10321042
@Tag(Constants.vectorTest)
10331043
public void testBulkCopyPerformance() throws SQLException {
10341044
String tableName = AbstractSQLGenerator.escapeIdentifier("srcTable");

src/test/java/com/microsoft/sqlserver/jdbc/databasemetadata/DatabaseMetaDataTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
import com.microsoft.sqlserver.jdbc.TestUtils;
5757
import com.microsoft.sqlserver.testframework.AbstractSQLGenerator;
5858
import com.microsoft.sqlserver.testframework.AbstractTest;
59+
import com.microsoft.sqlserver.testframework.AzureDB;
5960
import com.microsoft.sqlserver.testframework.Constants;
6061

6162

@@ -1091,6 +1092,7 @@ public void testGetSchemasWithAndWithoutCatalog() throws SQLException {
10911092
* @throws SQLException
10921093
*/
10931094
@Test
1095+
@AzureDB
10941096
@Tag(Constants.vectorTest)
10951097
public void testVectorMetaData() throws SQLException {
10961098
String vectorTableName = RandomUtil.getIdentifier("vectorTable");

src/test/java/com/microsoft/sqlserver/jdbc/datatypes/VectorTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,15 @@
3939
import com.microsoft.sqlserver.jdbc.TestUtils;
4040
import com.microsoft.sqlserver.testframework.AbstractSQLGenerator;
4141
import com.microsoft.sqlserver.testframework.AbstractTest;
42+
import com.microsoft.sqlserver.testframework.AzureDB;
4243
import com.microsoft.sqlserver.testframework.Constants;
4344

4445
import microsoft.sql.Vector;
4546
import microsoft.sql.Vector.VectorDimensionType;
4647

4748
@RunWith(JUnitPlatform.class)
4849
@DisplayName("Test Vector Data Type")
50+
@AzureDB
4951
@Tag(Constants.vectorTest)
5052
public class VectorTest extends AbstractTest {
5153

src/test/java/com/microsoft/sqlserver/jdbc/preparedStatement/BatchExecutionWithBulkCopyTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import com.microsoft.sqlserver.jdbc.TestUtils;
5555
import com.microsoft.sqlserver.testframework.AbstractSQLGenerator;
5656
import com.microsoft.sqlserver.testframework.AbstractTest;
57+
import com.microsoft.sqlserver.testframework.AzureDB;
5758
import com.microsoft.sqlserver.testframework.Constants;
5859
import com.microsoft.sqlserver.testframework.PrepUtil;
5960

@@ -1266,6 +1267,7 @@ public void testBulkInsertWithNullDataForAllTemporalTypesAndMoney() throws Excep
12661267
* Test inserting vector data using prepared statement with bulk copy enabled.
12671268
*/
12681269
@Test
1270+
@AzureDB
12691271
@Tag(Constants.vectorTest)
12701272
public void testInsertVectorWithBulkCopy() throws Exception {
12711273
String tableName = RandomUtil.getIdentifier("BulkCopyVectorTest");
@@ -1304,6 +1306,7 @@ public void testInsertVectorWithBulkCopy() throws Exception {
13041306
* Test inserting null vector data using prepared statement with bulk copy enabled.
13051307
*/
13061308
@Test
1309+
@AzureDB
13071310
@Tag(Constants.vectorTest)
13081311
public void testInsertNullVectorWithBulkCopy() throws Exception {
13091312
String tableName = RandomUtil.getIdentifier("BulkCopyVectorTest");
@@ -1343,6 +1346,7 @@ public void testInsertNullVectorWithBulkCopy() throws Exception {
13431346
* Test inserting vector data using prepared statement with bulk copy enabled for performance.
13441347
*/
13451348
@Test
1349+
@AzureDB
13461350
@Tag(Constants.vectorTest)
13471351
public void testInsertWithBulkCopyPerformance() throws SQLException {
13481352
String tableName = AbstractSQLGenerator.escapeIdentifier("BulkCopyVectorPerformanceTest");
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made
3+
* available under the terms of the MIT License. See the LICENSE file in the project root for more information.
4+
*/
5+
6+
package com.microsoft.sqlserver.testframework;
7+
8+
import java.lang.annotation.ElementType;
9+
import java.lang.annotation.Retention;
10+
import java.lang.annotation.RetentionPolicy;
11+
import java.lang.annotation.Target;
12+
13+
import org.junit.jupiter.api.Tag;
14+
15+
/*
16+
* Custom annotation to run tests only on Azure DBs
17+
*/
18+
@Target({ElementType.METHOD, ElementType.TYPE})
19+
@Retention(RetentionPolicy.RUNTIME)
20+
@Tag(Constants.xSQLv11)
21+
@Tag(Constants.xSQLv12)
22+
@Tag(Constants.xSQLv14)
23+
@Tag(Constants.xSQLv15)
24+
@Tag(Constants.xSQLv16)
25+
@Tag(Constants.xAzureSQLDW)
26+
@Tag(Constants.xAzureSQLMI)
27+
public @interface AzureDB {}

0 commit comments

Comments
 (0)