parent
5912d6f52a
commit
71d83388d4
|
|
@ -86,10 +86,7 @@ public class ScriptUtilsUnitTests {
|
|||
statements.get(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* See <a href="https://jira.spring.io/browse/SPR-13218">SPR-13218</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // SPR-13218
|
||||
public void splitScriptWithSingleQuotesNestedInsideDoubleQuotes() throws Exception {
|
||||
String statement1 = "select '1' as \"Dogbert's owner's\" from dual";
|
||||
String statement2 = "select '2' as \"Dilbert's\" from dual";
|
||||
|
|
@ -102,10 +99,7 @@ public class ScriptUtilsUnitTests {
|
|||
assertEquals("statement 2 not split correctly", statement2, statements.get(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* See <a href="https://jira.spring.io/browse/SPR-11560">SPR-11560</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // SPR-11560
|
||||
public void readAndSplitScriptWithMultipleNewlinesAsSeparator() throws Exception {
|
||||
String script = readScript("db-test-data-multi-newline.sql");
|
||||
List<String> statements = new ArrayList<>();
|
||||
|
|
@ -138,10 +132,7 @@ public class ScriptUtilsUnitTests {
|
|||
assertEquals("statement 4 not split correctly", statement4, statements.get(3));
|
||||
}
|
||||
|
||||
/**
|
||||
* See <a href="https://jira.spring.io/browse/SPR-10330">SPR-10330</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // SPR-10330
|
||||
public void readAndSplitScriptContainingCommentsWithLeadingTabs() throws Exception {
|
||||
String script = readScript("test-data-with-comments-and-leading-tabs.sql");
|
||||
List<String> statements = new ArrayList<>();
|
||||
|
|
@ -157,10 +148,7 @@ public class ScriptUtilsUnitTests {
|
|||
assertEquals("statement 3 not split correctly", statement3, statements.get(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* See <a href="https://jira.spring.io/browse/SPR-9531">SPR-9531</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // SPR-9531
|
||||
public void readAndSplitScriptContainingMuliLineComments() throws Exception {
|
||||
String script = readScript("test-data-with-multi-line-comments.sql");
|
||||
List<String> statements = new ArrayList<>();
|
||||
|
|
@ -176,10 +164,12 @@ public class ScriptUtilsUnitTests {
|
|||
|
||||
@Test
|
||||
public void containsDelimiters() {
|
||||
assertTrue("test with ';' is wrong", !containsSqlScriptDelimiters("select 1\n select ';'", ";"));
|
||||
assertTrue("test with delimiter ; is wrong", containsSqlScriptDelimiters("select 1; select 2", ";"));
|
||||
assertTrue("test with '\\n' is wrong", !containsSqlScriptDelimiters("select 1; select '\\n\n';", "\n"));
|
||||
assertTrue("test with delimiter \\n is wrong", containsSqlScriptDelimiters("select 1\n select 2", "\n"));
|
||||
assertFalse(containsSqlScriptDelimiters("select 1\n select ';'", ";"));
|
||||
assertTrue(containsSqlScriptDelimiters("select 1; select 2", ";"));
|
||||
assertFalse(containsSqlScriptDelimiters("select 1; select '\\n\n';", "\n"));
|
||||
assertTrue(containsSqlScriptDelimiters("select 1\n select 2", "\n"));
|
||||
assertFalse(containsSqlScriptDelimiters("select 1\n select 2", "\n\n"));
|
||||
assertTrue(containsSqlScriptDelimiters("select 1\n\n select 2", "\n\n"));
|
||||
}
|
||||
|
||||
private String readScript(String path) throws Exception {
|
||||
|
|
|
|||
Loading…
Reference in New Issue