Skip to content

Commit 260f55a

Browse files
Merge pull request #57 from PhilippSalvisberg/develop
Fixes #54, #55, #56
2 parents 05d4a72 + bde7eac commit 260f55a

File tree

3 files changed

+81
-8
lines changed

3 files changed

+81
-8
lines changed

Diff for: sqldev/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<!-- The Basics -->
66
<groupId>org.utplsql</groupId>
77
<artifactId>org.utplsql.sqldev</artifactId>
8-
<version>0.7.0</version>
8+
<version>0.7.1</version>
99
<packaging>bundle</packaging>
1010
<properties>
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

Diff for: sqldev/src/main/java/org/utplsql/sqldev/dal/UtplsqlDao.xtend

+14-6
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class UtplsqlDao {
179179
val sql = '''
180180
SELECT count(*)
181181
FROM TABLE(ut_runner.get_suites_info(upper(?), upper(?)))
182-
WHERE item_type = 'UT_TEST'
182+
WHERE item_type IN ('UT_TEST', 'UT_SUITE')
183183
AND (item_name = upper(?) or ? IS NULL)
184184
'''
185185
found = jdbcTemplate.queryForObject(sql, Integer, #[owner, objectName, subobjectName, subobjectName])
@@ -388,6 +388,14 @@ class UtplsqlDao {
388388
SELECT object_owner,
389389
object_name,
390390
path AS suitepath,
391+
count(
392+
CASE
393+
WHEN item_type = 'UT_TEST' THEN
394+
1
395+
ELSE
396+
NULL
397+
END
398+
) over (partition by object_owner, object_name) AS test_count,
391399
item_type,
392400
item_name,
393401
item_description
@@ -416,7 +424,7 @@ class UtplsqlDao {
416424
'Yes' AS multiselectable,
417425
'Yes' AS relevant
418426
FROM test
419-
WHERE item_type = 'UT_TEST'
427+
WHERE item_type IN ('UT_TEST', 'UT_SUITE')
420428
UNION ALL
421429
SELECT object_owner || '.' || object_name AS parent_id,
422430
object_owner || '.' || object_name || '.' || item_name AS id,
@@ -451,10 +459,10 @@ class UtplsqlDao {
451459
object_owner || ':' || suitepath AS id,
452460
item_name AS name,
453461
item_description AS description,
454-
CASE item_type
455-
WHEN 'UT_SUITE' THEN
462+
CASE
463+
WHEN item_type = 'UT_SUITE' AND test_count > 0 THEN
456464
'PACKAGE_ICON'
457-
WHEN 'UT_TEST' THEN
465+
WHEN item_type = 'UT_TEST' THEN
458466
'PROCEDURE_ICON'
459467
ELSE
460468
'FOLDER_ICON'
@@ -492,7 +500,7 @@ class UtplsqlDao {
492500
lower(a.name) AS name,
493501
a.text,
494502
a.subobject_name
495-
FROM table(ut3.ut_annotation_manager.get_annotated_objects(user, 'PACKAGE')) o
503+
FROM table(«utplsqlSchema».ut_annotation_manager.get_annotated_objects(user, 'PACKAGE')) o
496504
CROSS JOIN table(o.annotations) a
497505
WHERE lower(a.name) in ('suite', 'suitepath', 'endcontext', 'test')
498506
OR lower(a.name) = 'context' AND regexp_like(text, '(\w+)(\.\w+)*')

Diff for: sqldev/src/test/java/org/utplsql/sqldev/tests/DalTest.xtend

+66-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class DalTest extends AbstractJdbcTest {
328328
PROCEDURE t3;
329329
END junit_utplsql_test_pkg;
330330
''')
331-
val actualNodes = dao.runnables()
331+
val actualNodes = dao.runnables()
332332
Assert.assertEquals(16, actualNodes.size)
333333
val actual = new HashMap<String, String>
334334
for (node : actualNodes) {
@@ -472,4 +472,69 @@ class DalTest extends AbstractJdbcTest {
472472

473473
}
474474

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

0 commit comments

Comments
 (0)