Skip to content

Commit 58a76c8

Browse files
Merge pull request #90 from PhilippSalvisberg/bugfix/issue89_navigation_failed
Bugfix/issue89 navigation failed
2 parents 340bc82 + 7b595cb commit 58a76c8

File tree

4 files changed

+28
-16
lines changed

4 files changed

+28
-16
lines changed

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>1.1.0</version>
8+
<version>1.1.1-SNAPSHOT</version>
99
<packaging>bundle</packaging>
1010
<properties>
1111
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

sqldev/src/main/java/org/utplsql/sqldev/model/runner/Expectation.xtend

+7-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Expectation extends AbstractModel {
2828
def getFailureText() {
2929
return '''
3030
«message.trim»
31-
«caller.trim»
31+
«caller?.trim»
3232
'''.toString.trim
3333
}
3434

@@ -38,10 +38,12 @@ class Expectation extends AbstractModel {
3838

3939
def getCallerLine() {
4040
var Integer line = null
41-
val p = Pattern.compile("(?i)\"[^\\\"]+\",\\s+line\\s*([0-9]+)")
42-
val m = p.matcher(caller)
43-
if (m.find) {
44-
line = Integer.valueOf(m.group(1))
41+
if (caller !== null) {
42+
val p = Pattern.compile("(?i)\"[^\\\"]+\",\\s+line\\s*([0-9]+)")
43+
val m = p.matcher(caller)
44+
if (m.find) {
45+
line = Integer.valueOf(m.group(1))
46+
}
4547
}
4648
return line
4749
}

sqldev/src/main/java/org/utplsql/sqldev/ui/runner/RunnerPanel.xtend

+16-6
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import org.utplsql.sqldev.dal.UtplsqlDao
6666
import org.utplsql.sqldev.model.LimitedLinkedHashMap
6767
import org.utplsql.sqldev.model.preference.PreferenceModel
6868
import org.utplsql.sqldev.model.runner.Run
69+
import org.utplsql.sqldev.model.runner.Test
6970
import org.utplsql.sqldev.parser.UtplsqlParser
7071
import org.utplsql.sqldev.resources.UtplsqlResources
7172
import org.utplsql.sqldev.runner.UtplsqlRunner
@@ -248,17 +249,21 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
248249
}
249250
sorter.rowFilter = filter
250251
}
252+
253+
private def openTest(Test test) {
254+
val dao = new UtplsqlDao(Connections.instance.getConnection(currentRun.connectionName))
255+
val source = dao.getSource(test.ownerName, "PACKAGE", test.objectName.toUpperCase).trim
256+
val parser = new UtplsqlParser(source)
257+
val line = parser.getLineOf(test.procedureName)
258+
openEditor(test.ownerName, "PACKAGE", test.objectName.toUpperCase, line, 1)
259+
}
251260

252261
private def openSelectedTest() {
253262
val rowIndex = testOverviewTable.selectedRow
254263
if (rowIndex != -1) {
255264
val row = testOverviewTable.convertRowIndexToModel(rowIndex)
256265
val test = testOverviewTableModel.getTest(row)
257-
val dao = new UtplsqlDao(Connections.instance.getConnection(currentRun.connectionName))
258-
val source = dao.getSource(test.ownerName, "PACKAGE", test.objectName.toUpperCase).trim
259-
val parser = new UtplsqlParser(source)
260-
val line = parser.getLineOf(test.procedureName)
261-
openEditor(test.ownerName, "PACKAGE", test.objectName.toUpperCase, line, 1)
266+
openTest(test)
262267
}
263268
}
264269

@@ -268,7 +273,12 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
268273
val row = failuresTable.convertRowIndexToModel(rowIndex)
269274
val expectation = failuresTableModel.getExpectation(row)
270275
val test = testOverviewTableModel.getTest(testOverviewTable.convertRowIndexToModel(testOverviewTable.selectedRow))
271-
openEditor(test.ownerName, "PACKAGE BODY", test.objectName.toUpperCase, expectation.callerLine, 1)
276+
val callerLine = expectation.callerLine
277+
if (callerLine !== null) {
278+
openEditor(test.ownerName, "PACKAGE BODY", test.objectName.toUpperCase, expectation.callerLine, 1)
279+
} else {
280+
openTest(test)
281+
}
272282
}
273283
}
274284

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,11 @@ class DalTest extends AbstractJdbcTest {
399399
Assert.assertEquals("SCOTT:a", actual.get("SCOTT:a.b"))
400400
Assert.assertEquals("SCOTT:a.b", actual.get("SCOTT:a.b.c"))
401401
Assert.assertEquals("SCOTT:a.b.c", actual.get("SCOTT:a.b.c.junit_utplsql_test_pkg"))
402-
Assert.assertEquals("SCOTT:a.b.c.junit_utplsql_test_pkg", actual.get("SCOTT:a.b.c.junit_utplsql_test_pkg.myContext"))
402+
Assert.assertEquals("SCOTT:a.b.c.junit_utplsql_test_pkg.nested_context_#", actual.get("SCOTT:a.b.c.junit_utplsql_test_pkg.nested_context_#1"))
403403
Assert.assertEquals("SCOTT:a.b.c.junit_utplsql_test_pkg", actual.get("SCOTT:a.b.c.junit_utplsql_test_pkg.t0"))
404404
Assert.assertEquals("SCOTT:a.b.c.junit_utplsql_test_pkg", actual.get("SCOTT:a.b.c.junit_utplsql_test_pkg.t3"))
405-
Assert.assertEquals("SCOTT:a.b.c.junit_utplsql_test_pkg.myContext", actual.get("SCOTT:a.b.c.junit_utplsql_test_pkg.myContext.t1"))
406-
Assert.assertEquals("SCOTT:a.b.c.junit_utplsql_test_pkg.myContext", actual.get("SCOTT:a.b.c.junit_utplsql_test_pkg.myContext.t2"))
405+
Assert.assertEquals("SCOTT:a.b.c.junit_utplsql_test_pkg.nested_context_#1", actual.get("SCOTT:a.b.c.junit_utplsql_test_pkg.nested_context_#1.t1"))
406+
Assert.assertEquals("SCOTT:a.b.c.junit_utplsql_test_pkg.nested_context_#1", actual.get("SCOTT:a.b.c.junit_utplsql_test_pkg.nested_context_#1.t2"))
407407
}
408408

409409
@Test
@@ -489,7 +489,7 @@ class DalTest extends AbstractJdbcTest {
489489
val actualEmpty = dao.includes('SCOTT', 'TEST_F1')
490490
Assert.assertEquals(#[], actualEmpty)
491491
val actual = dao.includes('SCOTT', 'junit_utplsql_test_pkg')
492-
Assert.assertEquals(#['SCOTT.JUNIT_UTPLSQL_TEST_PKG','SCOTT.JUNIT_F','UT3_LATEST_RELEASE.UT_EXPECTATION'].sort, actual.sort)
492+
Assert.assertEquals(#['SCOTT.JUNIT_UTPLSQL_TEST_PKG','SCOTT.JUNIT_F','UT3_LATEST_RELEASE.UT_DATA_VALUE','UT3_LATEST_RELEASE.UT_EXPECTATION'].sort, actual.sort)
493493
}
494494

495495
@Test

0 commit comments

Comments
 (0)