@@ -35,6 +35,31 @@ class DalTest extends AbstractJdbcTest {
35
35
} catch (BadSqlGrammarException e) {
36
36
// ignore
37
37
}
38
+ try {
39
+ jdbcTemplate. execute(" DROP PACKAGE junit_no_test_pkg" )
40
+ } catch (BadSqlGrammarException e) {
41
+ // ignore
42
+ }
43
+ try {
44
+ jdbcTemplate. execute(" DROP TYPE junit_tab1_ot" )
45
+ } catch (BadSqlGrammarException e) {
46
+ // ignore
47
+ }
48
+ try {
49
+ jdbcTemplate. execute(" DROP TYPE junit_tab2_ot" )
50
+ } catch (BadSqlGrammarException e) {
51
+ // ignore
52
+ }
53
+ try {
54
+ jdbcTemplate. execute(" DROP FUNCTION junit_f" )
55
+ } catch (BadSqlGrammarException e) {
56
+ // ignore
57
+ }
58
+ try {
59
+ jdbcTemplate. execute(" DROP PROCEDURE junit_p" )
60
+ } catch (BadSqlGrammarException e) {
61
+ // ignore
62
+ }
38
63
}
39
64
40
65
@Test
@@ -63,7 +88,6 @@ class DalTest extends AbstractJdbcTest {
63
88
@Test
64
89
def void containsUtplsqlTest () {
65
90
val dao = new UtplsqlDao (dataSource. connection)
66
- Assert . assertFalse(dao. containsUtplsqlTest(" scott" ))
67
91
jdbcTemplate. execute(' ' '
68
92
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
69
93
-- %suite
@@ -104,7 +128,6 @@ class DalTest extends AbstractJdbcTest {
104
128
@Test
105
129
def void annotations () {
106
130
val dao = new UtplsqlDao (dataSource. connection)
107
- Assert . assertEquals(new ArrayList<Annotation > , dao. annotations(" scott" , " junit_utplsql_test_pkg" ))
108
131
jdbcTemplate. execute(' ' '
109
132
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
110
133
-- %suite
@@ -143,4 +166,82 @@ class DalTest extends AbstractJdbcTest {
143
166
Assert . assertEquals(expected. toString, effective. toString)
144
167
jdbcTemplate. execute(" DROP PACKAGE junit_utplsql_test_pkg" )
145
168
}
169
+
170
+ @Test
171
+ def void testablesPackages () {
172
+ val dao = new UtplsqlDao (dataSource. connection)
173
+ jdbcTemplate. execute(' ' '
174
+ CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
175
+ -- %suite
176
+
177
+ -- %test
178
+ PROCEDURE t1;
179
+
180
+ -- %Test
181
+ PROCEDURE t2;
182
+
183
+ PROCEDURE t3;
184
+ END junit_utplsql_test_pkg;
185
+ ' ' ' )
186
+ jdbcTemplate. execute(' ' '
187
+ CREATE OR REPLACE PACKAGE junit_no_test_pkg IS
188
+ PROCEDURE p1;
189
+
190
+ PROCEDURE p2;
191
+ END junit_no_test_pkg;
192
+ ' ' ' )
193
+ val effective = dao. testables(' PACKAGE' )
194
+ Assert . assertEquals(1 , effective. size)
195
+ Assert . assertEquals(" PACKAGE.JUNIT_NO_TEST_PKG" , effective. get(0 ). id)
196
+ }
197
+
198
+ @Test
199
+ def void testablesTypes () {
200
+ val dao = new UtplsqlDao (dataSource. connection)
201
+ jdbcTemplate. execute(' ' '
202
+ CREATE OR REPLACE TYPE junit_tab1_ot IS object (a integer, b integer);
203
+ ' ' ' )
204
+ jdbcTemplate. execute(' ' '
205
+ CREATE OR REPLACE TYPE junit_tab2_ot IS object (
206
+ a integer,
207
+ b integer,
208
+ member procedure c(
209
+ self in out nocopy junit_tab2_ot,
210
+ p integer
211
+ )
212
+ );
213
+ ' ' ' )
214
+ val effective = dao. testables(' TYPE' )
215
+ Assert . assertEquals(1 , effective. size)
216
+ Assert . assertEquals(" TYPE.JUNIT_TAB2_OT" , effective. get(0 ). id)
217
+ }
218
+
219
+ @Test
220
+ def void testablesFunctions () {
221
+ val dao = new UtplsqlDao (dataSource. connection)
222
+ jdbcTemplate. execute(' ' '
223
+ CREATE OR REPLACE FUNCTION junit_f RETURN INTEGER IS
224
+ BEGIN
225
+ RETURN 1;
226
+ END;
227
+ ' ' ' )
228
+ val effective = dao. testables(' FUNCTION' )
229
+ Assert . assertEquals(1 , effective. size)
230
+ Assert . assertEquals(" FUNCTION.JUNIT_F" , effective. get(0 ). id)
231
+ }
232
+
233
+ @Test
234
+ def void testablesProcedures () {
235
+ val dao = new UtplsqlDao (dataSource. connection)
236
+ jdbcTemplate. execute(' ' '
237
+ CREATE OR REPLACE PROCEDURE junit_p RETURN INTEGER IS
238
+ BEGIN
239
+ NULL;
240
+ END;
241
+ ' ' ' )
242
+ val effective = dao. testables(' PROCEDURE' )
243
+ Assert . assertEquals(1 , effective. size)
244
+ Assert . assertEquals(" PROCEDURE.JUNIT_P" , effective. get(0 ). id)
245
+ }
246
+
146
247
}
0 commit comments