Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf26469

Browse files
Merge pull request#130 from utPLSQL/bugfix/issue-126-suite-descriptions-b
Bugfix#126 - Suite descriptions are not aggregated
2 parents6df7d05 +51684d7 commitcf26469

File tree

5 files changed

+117
-8
lines changed

5 files changed

+117
-8
lines changed

‎sqldev/src/main/java/org/utplsql/sqldev/model/XMLTools.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ public Node getElementNode(final Node node, final String tagName) {
130130
NoderesultNode =null;
131131
if (nodeinstanceofElement) {
132132
NodeListlist = ((Element)node).getElementsByTagName(tagName);
133-
if (list !=null &&list.getLength() >0) {
133+
if (list !=null &&list.getLength() >0 &&list.item(0).getParentNode() ==node) {
134134
resultNode =list.item(0);
135135
}
136136
}
137137
returnresultNode;
138138
}
139-
139+
140140
publicDocumentBuildercreateDocumentBuilder() {
141141
DocumentBuilderFactoryfactory =DocumentBuilderFactory.newInstance();
142142
try {

‎sqldev/src/main/java/org/utplsql/sqldev/runner/UtplsqlRunner.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,4 +469,10 @@ public Thread getProducerThread() {
469469
publicThreadgetConsumerThread() {
470470
returnconsumerThread;
471471
}
472+
473+
// for testing purposes only
474+
publicRungetRun() {
475+
returnrun;
476+
}
477+
472478
}

‎sqldev/src/main/java/org/utplsql/sqldev/ui/runner/TestOverviewTreeTableModel.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,6 @@ public Object getValueAt(Object node, int col) {
483483
switch (col) {
484484
case0:
485485
if (showDescription &&itemNode.getDescription() !=null) {
486-
if (itemNode.getUserObject()instanceofSuite) {
487-
if (!itemNode.getName().contains("context_#")) {
488-
// description of suites might be bewildering, hence use it for contexts only
489-
returnitemNode.getName();
490-
}
491-
}
492486
returnitemNode.getDescription();
493487
}else {
494488
returnitemNode.getName();
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/*
2+
* Copyright 2021 Philipp Salvisberg <philipp.salvisberg@trivadis.com>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
packageorg.utplsql.sqldev.test.runner;
17+
18+
importjava.sql.Connection;
19+
importjava.util.Collections;
20+
importjava.util.LinkedHashMap;
21+
22+
importorg.junit.After;
23+
importorg.junit.Assert;
24+
importorg.junit.Before;
25+
importorg.junit.Test;
26+
importorg.springframework.jdbc.datasource.SingleConnectionDataSource;
27+
importorg.utplsql.sqldev.model.DatabaseTools;
28+
importorg.utplsql.sqldev.model.SystemTools;
29+
importorg.utplsql.sqldev.model.runner.ItemNode;
30+
importorg.utplsql.sqldev.runner.UtplsqlRunner;
31+
importorg.utplsql.sqldev.test.AbstractJdbcTest;
32+
33+
publicclassUtplsqlRunnerAggregationTestextendsAbstractJdbcTest {
34+
staticfinalintSHOW_GUI_AFTER_RUN_COMPLETION_IN_SECONDS =0;
35+
36+
@Before
37+
publicvoidsetup() {
38+
// based on https://github.com/utPLSQL/utPLSQL-SQLDeveloper/issues/126
39+
jdbcTemplate.execute(
40+
"create or replace package x is\n"
41+
+"\n"
42+
+" --%suite(suite x)\n"
43+
+" --%suitepath(foo.bar)\n"
44+
+"\n"
45+
+" --%test(feature a)\n"
46+
+" --%disabled\n"
47+
+" procedure test_a;\n"
48+
+"\n"
49+
+" --%test(feature b)\n"
50+
+" --%disabled\n"
51+
+" procedure test_b;\n"
52+
+"\n"
53+
+"end;");
54+
jdbcTemplate.execute(
55+
"create or replace package y is\n"
56+
+"\n"
57+
+" --%suite(suite y)\n"
58+
+" --%suitepath(foo.bar)\n"
59+
+"\n"
60+
+" --%test(feature c)\n"
61+
+" --%disabled\n"
62+
+" procedure test_c;\n"
63+
+"\n"
64+
+" --%test(feature d)\n"
65+
+" --%disabled\n"
66+
+" procedure test_d;\n"
67+
+"\n"
68+
+"end;");
69+
}
70+
71+
@After
72+
publicvoidteardown() {
73+
executeAndIgnore(jdbcTemplate,"DROP PACKAGE x");
74+
executeAndIgnore(jdbcTemplate,"DROP PACKAGE y");
75+
}
76+
77+
privateConnectiongetNewConnection() {
78+
finalSingleConnectionDataSourceds =newSingleConnectionDataSource();
79+
ds.setDriverClassName("oracle.jdbc.OracleDriver");
80+
ds.setUrl(dataSource.getUrl());
81+
ds.setUsername(dataSource.getUsername());
82+
ds.setPassword(dataSource.getPassword());
83+
returnDatabaseTools.getConnection(ds);
84+
}
85+
86+
@Test
87+
publicvoidaggregateDescription() {
88+
UtplsqlRunnerrunner =newUtplsqlRunner(Collections.singletonList(":foo"),getNewConnection(),getNewConnection());
89+
runner.runTestAsync();
90+
SystemTools.waitForThread(runner.getProducerThread(),10000);
91+
SystemTools.waitForThread(runner.getConsumerThread(),10000);
92+
Assert.assertNotNull(runner);
93+
LinkedHashMap<String,ItemNode>nodes =runner.getRun().getItemNodes();
94+
Assert.assertEquals(9,nodes.size());// 8 + 1 for the run node
95+
Assert.assertNotNull(nodes.get(runner.getRun().getReporterId()));
96+
Assert.assertNull(nodes.get("foo").getDescription());
97+
Assert.assertNull(nodes.get("foo.bar").getDescription());
98+
Assert.assertEquals("suite y",nodes.get("foo.bar.y").getDescription());
99+
Assert.assertEquals("suite x",nodes.get("foo.bar.x").getDescription());
100+
Assert.assertEquals("feature c",nodes.get("foo.bar.y.test_c").getDescription());
101+
Assert.assertEquals("feature d",nodes.get("foo.bar.y.test_d").getDescription());
102+
Assert.assertEquals("feature a",nodes.get("foo.bar.x.test_a").getDescription());
103+
Assert.assertEquals("feature b",nodes.get("foo.bar.x.test_b").getDescription());
104+
SystemTools.sleep(SHOW_GUI_AFTER_RUN_COMPLETION_IN_SECONDS *1000);
105+
runner.dispose();
106+
}
107+
108+
}

‎sqldev/src/test/java/org/utplsql/sqldev/test/runner/UtplsqlRunnerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public void setupDefaultPreferences() {
5252
preferences.setShowSuccessfulTests(true);
5353
preferences.setShowWarningIndicator(false);
5454
preferences.setShowInfoIndicator(false);
55+
preferences.setShowTestDescription(true);
5556
}
5657
}
5758

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp