Skip to content

Commit 3275c1a

Browse files
move bug fix tests to dedicated class
1 parent 4c508cb commit 3275c1a

File tree

2 files changed

+107
-65
lines changed

2 files changed

+107
-65
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
/*
2+
* Copyright 2018 Philipp Salvisberg <philipp.salvisberg@trivadis.com>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.utplsql.sqldev.test.dal
17+
18+
import org.junit.AfterClass
19+
import org.junit.Assert
20+
import org.junit.BeforeClass
21+
import org.junit.Test
22+
import org.springframework.jdbc.BadSqlGrammarException
23+
import org.utplsql.sqldev.dal.UtplsqlDao
24+
import org.utplsql.sqldev.test.AbstractJdbcTest
25+
26+
class DalBugFixTest extends AbstractJdbcTest {
27+
28+
@BeforeClass
29+
@AfterClass
30+
def static void setupAndTeardown() {
31+
try {
32+
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
33+
} catch (BadSqlGrammarException e) {
34+
// ignore
35+
}
36+
}
37+
38+
@Test
39+
// https://github.com/utPLSQL/utPLSQL-SQLDeveloper/issues/54
40+
def void issue54FolderIconForSuitesWithoutTests() {
41+
setupAndTeardown
42+
jdbcTemplate.execute('''
43+
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
44+
-- %suite
45+
46+
END junit_utplsql_test_pkg;
47+
''')
48+
val dao = new UtplsqlDao(dataSource.connection)
49+
val actualNodes = dao.runnables()
50+
Assert.assertEquals(4, actualNodes.size)
51+
val pkg = actualNodes.findFirst[it.id == "SCOTT:junit_utplsql_test_pkg"]
52+
Assert.assertEquals("FOLDER_ICON", pkg.iconName)
53+
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
54+
}
55+
56+
@Test
57+
// https://github.com/utPLSQL/utPLSQL-SQLDeveloper/issues/54
58+
def void issue54PackageIconForSuitesWithTests() {
59+
setupAndTeardown
60+
jdbcTemplate.execute('''
61+
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
62+
-- %suite
63+
64+
-- %test
65+
PROCEDURE t1;
66+
67+
END junit_utplsql_test_pkg;
68+
''')
69+
val dao = new UtplsqlDao(dataSource.connection)
70+
val actualNodes = dao.runnables()
71+
Assert.assertEquals(6, actualNodes.size)
72+
val pkg = actualNodes.findFirst[it.id == "SCOTT:junit_utplsql_test_pkg"]
73+
Assert.assertEquals("PACKAGE_ICON", pkg.iconName)
74+
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
75+
}
76+
77+
@Test
78+
// https://github.com/utPLSQL/utPLSQL-SQLDeveloper/issues/55
79+
def void issue55SuiteWithoutTests() {
80+
setupAndTeardown
81+
jdbcTemplate.execute('''
82+
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
83+
-- %suite
84+
85+
END junit_utplsql_test_pkg;
86+
''')
87+
val dao = new UtplsqlDao(dataSource.connection)
88+
val actualNodes = dao.runnables()
89+
Assert.assertEquals(4, actualNodes.size)
90+
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
91+
}
92+
93+
@Test
94+
// https://github.com/utPLSQL/utPLSQL-SQLDeveloper/issues/56
95+
def void issue56SuiteWithoutTests() {
96+
jdbcTemplate.execute('''
97+
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
98+
-- %suite
99+
100+
END junit_utplsql_test_pkg;
101+
''')
102+
val dao = new UtplsqlDao(dataSource.connection)
103+
Assert.assertTrue(dao.containsUtplsqlTest("scott", "junit_utplsql_test_pkg"))
104+
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
105+
}
106+
107+
}

sqldev/src/test/java/org/utplsql/sqldev/test/dal/DalTest.xtend

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -473,69 +473,4 @@ class DalTest extends AbstractJdbcTest {
473473

474474
}
475475

476-
@Test
477-
def void issue54FolderIconForSuitesWithoutTests() {
478-
setupAndTeardown
479-
jdbcTemplate.execute('''
480-
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
481-
-- %suite
482-
483-
END junit_utplsql_test_pkg;
484-
''')
485-
val dao = new UtplsqlDao(dataSource.connection)
486-
val actualNodes = dao.runnables()
487-
Assert.assertEquals(4, actualNodes.size)
488-
val pkg = actualNodes.findFirst[it.id == "SCOTT:junit_utplsql_test_pkg"]
489-
Assert.assertEquals("FOLDER_ICON", pkg.iconName)
490-
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
491-
}
492-
493-
@Test
494-
def void issue54PackageIconForSuitesWithTests() {
495-
setupAndTeardown
496-
jdbcTemplate.execute('''
497-
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
498-
-- %suite
499-
500-
-- %test
501-
PROCEDURE t1;
502-
503-
END junit_utplsql_test_pkg;
504-
''')
505-
val dao = new UtplsqlDao(dataSource.connection)
506-
val actualNodes = dao.runnables()
507-
Assert.assertEquals(6, actualNodes.size)
508-
val pkg = actualNodes.findFirst[it.id == "SCOTT:junit_utplsql_test_pkg"]
509-
Assert.assertEquals("PACKAGE_ICON", pkg.iconName)
510-
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
511-
}
512-
513-
@Test
514-
def void issue55SuiteWithoutTests() {
515-
setupAndTeardown
516-
jdbcTemplate.execute('''
517-
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
518-
-- %suite
519-
520-
END junit_utplsql_test_pkg;
521-
''')
522-
val dao = new UtplsqlDao(dataSource.connection)
523-
val actualNodes = dao.runnables()
524-
Assert.assertEquals(4, actualNodes.size)
525-
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
526-
}
527-
528-
@Test
529-
def void issue56SuiteWithoutTests() {
530-
jdbcTemplate.execute('''
531-
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
532-
-- %suite
533-
534-
END junit_utplsql_test_pkg;
535-
''')
536-
val dao = new UtplsqlDao(dataSource.connection)
537-
Assert.assertTrue(dao.containsUtplsqlTest("scott", "junit_utplsql_test_pkg"))
538-
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
539-
}
540-
541476
}

0 commit comments

Comments
 (0)