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
+ }
0 commit comments