Skip to content

Bugfix/issue 99 code coverage dialog #100

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 6 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion sqldev/src/main/java/org/utplsql/sqldev/dal/UtplsqlDao.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,17 @@ class UtplsqlDao {
if (cachedDbaViewAccessible === null) {
try {
val sql = '''
SELECT 1
SELECT 1 AS dummy
FROM dba_objects
WHERE 1=2
UNION ALL
SELECT 1
FROM dba_synonyms
WHERE 1=2
UNION ALL
SELECT 1
FROM dba_dependencies
WHERE 1=2
'''
jdbcTemplate.execute(sql)
cachedDbaViewAccessible = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,22 @@ class UtplsqlController implements Controller {
public static final IdeAction UTPLSQL_GENERATE_ACTION = IdeAction.get(UtplsqlController.UTPLSQL_GENERATE_CMD_ID)

override handleEvent(IdeAction action, Context context) {
if (action.commandId === UTPLSQL_TEST_CMD_ID) {
runTest(context)
return true
} else if (action.commandId === UTPLSQL_COVERAGE_CMD_ID) {
codeCoverage(context)
return true
} else if (action.commandId === UTPLSQL_GENERATE_CMD_ID) {
generateTest(context)
return true
try {
if (action.commandId === UTPLSQL_TEST_CMD_ID) {
logger.finer("handle utplsql.test")
runTest(context)
return true
} else if (action.commandId === UTPLSQL_COVERAGE_CMD_ID) {
logger.finer("handle utplsql.coverage")
codeCoverage(context)
return true
} else if (action.commandId === UTPLSQL_GENERATE_CMD_ID) {
logger.finer("handle utplsql.generate")
generateTest(context)
return true
}
} catch (Exception e) {
logger.severe("Failed to handle event due to exception " + e?.message)
}
return false
}
Expand Down Expand Up @@ -376,14 +383,21 @@ class UtplsqlController implements Controller {
reporter.showParameterWindow
}
} else if (view instanceof DBNavigatorWindow) {
logger.finer("Code coverage from DB navigator")
val url=context.URL
if (url !== null) {
val connectionName = url.connectionName
logger.fine('''connectionName: «connectionName»''')
val pathList=context.pathList.dedupPathList
logger.finer('''pathList: «pathList»''')
val includeObjectList = dependencies(context, connectionName)
logger.finer('''includeObjectList: «includeObjectList»''')
val reporter = new CodeCoverageReporter(pathList, includeObjectList, connectionName)
logger.finer("showing code coverage dialog")
reporter.showParameterWindow
logger.finer("code coverage dialog shown")
} else {
logger.warning('''url is null''')
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class DalTest extends AbstractJdbcTest {
@BeforeClass
@AfterClass
def static void setupAndTeardown() {
sysJdbcTemplate.execute("CREATE OR REPLACE PUBLIC SYNONYM ut FOR ut3_latest_release.ut")
sysJdbcTemplate.execute("CREATE OR REPLACE PUBLIC SYNONYM ut FOR ut3.ut")
try {
jdbcTemplate.execute("DROP PACKAGE junit_utplsql_test_pkg")
} catch (BadSqlGrammarException e) {
Expand Down Expand Up @@ -83,7 +83,7 @@ class DalTest extends AbstractJdbcTest {
val dao = new UtplsqlDao(dataSource.connection)
Assert.assertEquals(null, dao.utplsqlSchema)
setupAndTeardown
Assert.assertEquals("UT3_LATEST_RELEASE", dao.utplsqlSchema)
Assert.assertEquals("UT3", dao.utplsqlSchema)
}

@Test
Expand Down Expand Up @@ -491,7 +491,7 @@ class DalTest extends AbstractJdbcTest {
val actual = dao.includes('SCOTT', 'junit_utplsql_test_pkg')
Assert.assertTrue(actual.findFirst[it == "SCOTT.JUNIT_UTPLSQL_TEST_PKG"] !== null)
Assert.assertTrue(actual.findFirst[it == "SCOTT.JUNIT_F"] !== null)
Assert.assertTrue(actual.findFirst[it == "UT3_LATEST_RELEASE.UT_EXPECTATION"] !== null)
Assert.assertTrue(actual.findFirst[it == "UT3.UT_EXPECTATION"] !== null)
}

@Test
Expand Down
8 changes: 4 additions & 4 deletions sqldev/src/test/resources/logging.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# logging properties for Oracle SQL Developer and utPLSQL unit test cases
# replace logging.conf in /Applications/SQLDeveloper17.4.0.app/Contents/Resources/sqldeveloper/sqldeveloper/bin
# replace logging.conf in /Applications/SQLDeveloper19.4.0.app/Contents/Resources/sqldeveloper/sqldeveloper/bin

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

# Loggers
oracle.level=FINE
#oracle.level=FINE
org.utplsql.level=ALL

# --- ConsoleHandler ---
java.util.logging.ConsoleHandler.level=FINE
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %3$s: %5$s%n
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

# --- FileHandler ---
java.util.logging.FileHandler.level=ALL
Expand Down