Skip to content

Commit b068f2e

Browse files
Merge pull request #100 from utPLSQL/bugfix/issue-99-code-coverage-dialog
Bugfix/issue 99 code coverage dialog
2 parents 2be821b + f6fbba0 commit b068f2e

File tree

4 files changed

+39
-17
lines changed

4 files changed

+39
-17
lines changed

sqldev/src/main/java/org/utplsql/sqldev/dal/UtplsqlDao.xtend

+9-1
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,17 @@ class UtplsqlDao {
121121
if (cachedDbaViewAccessible === null) {
122122
try {
123123
val sql = '''
124-
SELECT 1
124+
SELECT 1 AS dummy
125125
FROM dba_objects
126126
WHERE 1=2
127+
UNION ALL
128+
SELECT 1
129+
FROM dba_synonyms
130+
WHERE 1=2
131+
UNION ALL
132+
SELECT 1
133+
FROM dba_dependencies
134+
WHERE 1=2
127135
'''
128136
jdbcTemplate.execute(sql)
129137
cachedDbaViewAccessible = true

sqldev/src/main/java/org/utplsql/sqldev/menu/UtplsqlController.xtend

+23-9
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,22 @@ class UtplsqlController implements Controller {
5959
public static final IdeAction UTPLSQL_GENERATE_ACTION = IdeAction.get(UtplsqlController.UTPLSQL_GENERATE_CMD_ID)
6060

6161
override handleEvent(IdeAction action, Context context) {
62-
if (action.commandId === UTPLSQL_TEST_CMD_ID) {
63-
runTest(context)
64-
return true
65-
} else if (action.commandId === UTPLSQL_COVERAGE_CMD_ID) {
66-
codeCoverage(context)
67-
return true
68-
} else if (action.commandId === UTPLSQL_GENERATE_CMD_ID) {
69-
generateTest(context)
70-
return true
62+
try {
63+
if (action.commandId === UTPLSQL_TEST_CMD_ID) {
64+
logger.finer("handle utplsql.test")
65+
runTest(context)
66+
return true
67+
} else if (action.commandId === UTPLSQL_COVERAGE_CMD_ID) {
68+
logger.finer("handle utplsql.coverage")
69+
codeCoverage(context)
70+
return true
71+
} else if (action.commandId === UTPLSQL_GENERATE_CMD_ID) {
72+
logger.finer("handle utplsql.generate")
73+
generateTest(context)
74+
return true
75+
}
76+
} catch (Exception e) {
77+
logger.severe("Failed to handle event due to exception " + e?.message)
7178
}
7279
return false
7380
}
@@ -376,14 +383,21 @@ class UtplsqlController implements Controller {
376383
reporter.showParameterWindow
377384
}
378385
} else if (view instanceof DBNavigatorWindow) {
386+
logger.finer("Code coverage from DB navigator")
379387
val url=context.URL
380388
if (url !== null) {
381389
val connectionName = url.connectionName
382390
logger.fine('''connectionName: «connectionName»''')
383391
val pathList=context.pathList.dedupPathList
392+
logger.finer('''pathList: «pathList»''')
384393
val includeObjectList = dependencies(context, connectionName)
394+
logger.finer('''includeObjectList: «includeObjectList»''')
385395
val reporter = new CodeCoverageReporter(pathList, includeObjectList, connectionName)
396+
logger.finer("showing code coverage dialog")
386397
reporter.showParameterWindow
398+
logger.finer("code coverage dialog shown")
399+
} else {
400+
logger.warning('''url is null''')
387401
}
388402
}
389403
}

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class DalTest extends AbstractJdbcTest {
3131
@BeforeClass
3232
@AfterClass
3333
def static void setupAndTeardown() {
34-
sysJdbcTemplate.execute("CREATE OR REPLACE PUBLIC SYNONYM ut FOR ut3_latest_release.ut")
34+
sysJdbcTemplate.execute("CREATE OR REPLACE PUBLIC SYNONYM ut FOR ut3.ut")
3535
try {
3636
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
3737
} catch (BadSqlGrammarException e) {
@@ -83,7 +83,7 @@ class DalTest extends AbstractJdbcTest {
8383
val dao = new UtplsqlDao(dataSource.connection)
8484
Assert.assertEquals(null, dao.utplsqlSchema)
8585
setupAndTeardown
86-
Assert.assertEquals("UT3_LATEST_RELEASE", dao.utplsqlSchema)
86+
Assert.assertEquals("UT3", dao.utplsqlSchema)
8787
}
8888

8989
@Test
@@ -491,7 +491,7 @@ class DalTest extends AbstractJdbcTest {
491491
val actual = dao.includes('SCOTT', 'junit_utplsql_test_pkg')
492492
Assert.assertTrue(actual.findFirst[it == "SCOTT.JUNIT_UTPLSQL_TEST_PKG"] !== null)
493493
Assert.assertTrue(actual.findFirst[it == "SCOTT.JUNIT_F"] !== null)
494-
Assert.assertTrue(actual.findFirst[it == "UT3_LATEST_RELEASE.UT_EXPECTATION"] !== null)
494+
Assert.assertTrue(actual.findFirst[it == "UT3.UT_EXPECTATION"] !== null)
495495
}
496496

497497
@Test

sqldev/src/test/resources/logging.conf

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# logging properties for Oracle SQL Developer and utPLSQL unit test cases
2-
# replace logging.conf in /Applications/SQLDeveloper17.4.0.app/Contents/Resources/sqldeveloper/sqldeveloper/bin
2+
# replace logging.conf in /Applications/SQLDeveloper19.4.0.app/Contents/Resources/sqldeveloper/sqldeveloper/bin
33

44
#handlers for console (messages pane in SQL Developer) and file ($HOME/sqldeveloper.log)
55
#handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
@@ -11,13 +11,13 @@ handlers=java.util.logging.ConsoleHandler
1111
.level=SEVERE
1212

1313
# Loggers
14-
oracle.level=FINE
14+
#oracle.level=FINE
1515
org.utplsql.level=ALL
1616

1717
# --- ConsoleHandler ---
18-
java.util.logging.ConsoleHandler.level=FINE
18+
java.util.logging.ConsoleHandler.level=ALL
1919
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
20-
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %3$s: %5$s%n
20+
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS.%1$tL %4$s %3$s: %5$s%n
2121

2222
# --- FileHandler ---
2323
java.util.logging.FileHandler.level=ALL

0 commit comments

Comments
 (0)