Skip to content

Commit

Permalink
Add another test; see if I can still push to GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffery-Wasty committed Sep 28, 2024
1 parent 08d6cc4 commit 2220ba9
Showing 1 changed file with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

package com.microsoft.sqlserver.jdbc.configurableretry;

import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.io.File;
import java.io.FileWriter;
import java.sql.CallableStatement;
Expand All @@ -30,6 +27,8 @@
import com.microsoft.sqlserver.testframework.AbstractSQLGenerator;
import com.microsoft.sqlserver.testframework.AbstractTest;

import static org.junit.jupiter.api.Assertions.*;


/**
* Test connection and statement retry for configurable retry logic.
Expand Down Expand Up @@ -66,6 +65,31 @@ public void testRetryExecConnectionStringOption() throws Exception {
String test = conn.getRetryExec();
assertTrue(test.isEmpty());
conn.setRetryExec("{2714:3,2*2:CREATE;2715:1,3}");
test = conn.getRetryExec();
assertFalse(test.isEmpty());
try {
PreparedStatement ps = conn.prepareStatement("create table " + CRLTestTable + " (c1 int null);");
createTable(s);
ps.execute();
Assertions.fail(TestResource.getResource("R_expectedFailPassed"));
} catch (SQLServerException e) {
assertTrue(e.getMessage().startsWith("There is already an object"),
TestResource.getResource("R_unexpectedExceptionContent") + ": " + e.getMessage());
} finally {
dropTable(s);
}
}
}

@Test
public void testRetryConnConnectionStringOption() throws Exception {
try (SQLServerConnection conn = (SQLServerConnection) DriverManager.getConnection(connectionString);
Statement s = conn.createStatement()) {
String test = conn.getRetryConn();
assertTrue(test.isEmpty());
conn.setRetryConn("{4060}");
test = conn.getRetryConn();
assertFalse(test.isEmpty());
try {
PreparedStatement ps = conn.prepareStatement("create table " + CRLTestTable + " (c1 int null);");
createTable(s);
Expand Down

0 comments on commit 2220ba9

Please sign in to comment.