10000 Fixes #54, #55, #56 by PhilippSalvisberg · Pull Request #57 · utPLSQL/utPLSQL-SQLDeveloper · GitHub
[go: up one dir, main page]

Skip to content

Fixes #54, #55, #56 #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Nov 25, 2018
2 changes: 1 addition & 1 deletion sqldev/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- The Basics -->
<groupId>org.utplsql</groupId>
<artifactId>org.utplsql.sqldev</artifactId>
<version>0.7.0</version>
<version>0.7.1</version>
<packaging>bundle</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
20 changes: 14 additions & 6 deletions sqldev/src/main/java/org/utplsql/sqldev/dal/UtplsqlDao.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class UtplsqlDao {
val sql = '''
SELECT count(*)
FROM TABLE(ut_runner.get_suites_info(upper(?), upper(?)))
WHERE item_type = 'UT_TEST'
WHERE item_type IN ('UT_TEST', 'UT_SUITE')
AND (item_name = upper(?) or ? IS NULL)
'''
found = jdbcTemplate.queryForObject(sql, Integer, #[owner, objectName, subobjectName, subobjectName])
Expand Down Expand Up @@ -388,6 +388,14 @@ class UtplsqlDao {
SELECT object_owner,
object_name,
path AS suitepath,
count(
CASE
WHEN item_type = 'UT_TEST' THEN
1
ELSE
NULL
END
) over (partition by object_owner, object_name) AS test_count,
item_type,
item_name,
item_description
Expand Down Expand Up @@ -416,7 +424,7 @@ class UtplsqlDao {
'Yes' AS multiselectable,
'Yes' AS relevant
FROM test
WHERE item_type = 'UT_TEST'
WHERE item_type IN ('UT_TEST', 'UT_SUITE')
UNION ALL
SELECT object_owner || '.' || object_name AS parent_id,
object_owner || '.' || object_name || '.' || item_name AS id,
Expand Down Expand Up @@ -451,10 +459,10 @@ class UtplsqlDao {
object_owner || ':' || suitepath AS id,
item_name AS name,
item_description AS description,
CASE item_type
WHEN 'UT_SUITE' THEN
CASE
WHEN item_type = 'UT_SUITE' AND test_count > 0 THEN
'PACKAGE_ICON'
WHEN 'UT_TEST' THEN
WHEN item_type = 'UT_TEST' THEN
'PROCEDURE_ICON'
ELSE
'FOLDER_ICON'
Expand Down Expand Up @@ -492,7 +500,7 @@ class UtplsqlDao {
lower(a.name) AS name,
a.text,
a.subobject_name
FROM table(ut3.ut_annotation_manager.get_annotated_objects(user, 'PACKAGE')) o
FROM table(«utplsqlSchema».ut_annotation_manager.get_annotated_objects(user, 'PACKAGE')) o
CROSS JOIN table(o.annotations) a
WHERE lower(a.name) in ('suite', 'suitepath', 'endcontext', 'test')
OR lower(a.name) = 'context' AND regexp_like(text, '(\w+)(\.\w+)*')
Expand Down
67 changes: 66 additions & 1 deletion sqldev/src/test/java/org/utplsql/sqldev/tests/DalTest.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ class DalTest extends AbstractJdbcTest {
PROCEDURE t3;
END junit_utplsql_test_pkg;
''')
val actualNodes = dao.runnables()
val actualNodes = dao.runnables()
Assert.assertEquals(16, actualNodes.size)
val actual = new HashMap<String, String>
for (node : actualNodes) {
Expand Down Expand Up @@ -472,4 +472,69 @@ class DalTest extends AbstractJdbcTest {

}

@Test
def void issue54FolderIconForSuitesWithoutTests() {
setupAndTeardown
jdbcTemplate.execute('''
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
-- %suite

END junit_utplsql_test_pkg;
''')
val dao = new UtplsqlDao(dataSource.connection)
val actualNodes = dao.runnables()
Assert.assertEquals(4, actualNodes.size)
val pkg = actualNodes.findFirst[it.id == "SCOTT:junit_utplsql_test_pkg"]
Assert.assertEquals("FOLDER_ICON", pkg.iconName)
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
}

@Test
def void issue54PackageIconForSuitesWithTests() {
setupAndTeardown
jdbcTemplate.execute('''
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
-- %suite

-- %test
PROCEDURE t1;

END junit_utplsql_test_pkg;
''')
val dao = new UtplsqlDao(dataSource.connection)
val actualNodes = dao.runnables()
Assert.assertEquals(6, actualNodes.size)
val pkg = actualNodes.findFirst[it.id == "SCOTT:junit_utplsql_test_pkg"]
Assert.assertEquals("PACKAGE_ICON", pkg.iconName)
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
}

@Test
def void issue55SuiteWithoutTests() {
setupAndTeardown
jdbcTemplate.execute('''
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
-- %suite

END junit_utplsql_test_pkg;
''')
val dao = new UtplsqlDao(dataSource.connection)
val actualNodes = dao.runnables()
Assert.assertEquals(4, actualNodes.size)
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
}

@Test
def void issue56SuiteWithoutTests() {
jdbcTemplate.execute('''
CREATE OR REPLACE PACKAGE junit_utplsql_test_pkg IS
-- %suite

END junit_utplsql_test_pkg;
''')
val dao = new UtplsqlDao(dataSource.connection)
Assert.assertTrue(dao.containsUtplsqlTest("scott", "junit_utplsql_test_pkg"))
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
}

}
0