Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfcfab5

Browse files
add unit test execution from various nodes in the connections navigator tree
1 parent 85b1ce6 commit bfcfab5

File tree

5 files changed

+131
-17
lines changed

5 files changed

+131
-17
lines changed

sqldev/src/main/java/org/utplsql/sqldev/UtplsqlWorksheet.xtend

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2018 Philipp Salvisberg <[email protected]>
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+
*/
116
package org.utplsql.sqldev
217

318
import java.util.logging.Logger

sqldev/src/main/java/org/utplsql/sqldev/navigator/menu/RunFromConnection.xtend

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright 2018 Philipp Salvisberg <[email protected]>
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+
package org.utplsql.sqldev.navigator.menu
17+
18+
import java.net.URL
19+
import java.util.logging.Logger
20+
import java.util.regex.Pattern
21+
import oracle.dbtools.raptor.dialogs.actions.AbstractMenuAction
22+
import oracle.dbtools.raptor.navigator.impl.ChildObjectElement
23+
import org.utplsql.sqldev.UtplsqlWorksheet
24+
25+
class UtplsqlNavigatorAction extends AbstractMenuAction {
26+
private static final Logger logger = Logger.getLogger(UtplsqlNavigatorAction.name);
27+
28+
private def getSchema(URL url) {
29+
val p = Pattern.compile("(//)([^/]+)")
30+
val m = p.matcher(url.toString)
31+
if (m.find) {
32+
return m.group(2)
33+
} else {
34+
return ""
35+
}
36+
}
37+
38+
private def getMemberObject(URL url) {
39+
val p = Pattern.compile("(/)([^/]+)(#MEMBER)")
40+
val m = p.matcher(url.toString)
41+
if (m.find) {
42+
return m.group(2)
43+
} else {
44+
return ""
45+
}
46+
}
47+
48+
private def getPath() {
49+
var String path
50+
if (DBObject.objectType == "MEMBER") {
51+
val element = DBObject.element as ChildObjectElement
52+
path = '''«element.URL.schema».«element.URL.memberObject».«DBObject.childName»'''
53+
} else if (DBObject.objectType == "CONNECTION" || DBObject.objectName === null) {
54+
path = DBObject.schemaName
55+
} else {
56+
path = '''«DBObject.schemaName».«DBObject.objectName»'''
57+
}
58+
return path
59+
}
60+
61+
override launch() {
62+
logger.finer('''Run utPLSQL from a navigator node.''')
63+
val utPlsqlWorksheet = new UtplsqlWorksheet(path, DBObject.connectionName)
64+
utPlsqlWorksheet.runTestAsync
65+
}
66+
}

sqldev/src/main/resources/org/utplsql/sqldev/actions/navigator_actions.xml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,28 @@
44
http://xmlns.oracle.com/sqldeveloper/3_1/dialogs.xsd"
55
xmlns="http://xmlns.oracle.com/sqldeveloper/3_1/dialogs">
66

7-
<item connType="Oracle" type="CONNECTION" className="org.utplsql.sqldev.navigator.menu.RunFromConnection">
7+
<item connType="Oracle" type="CONNECTION" className="org.utplsql.sqldev.navigator.menu.UtplsqlNavigatorAction">
8+
<title>Run utPLSQL test</title>
9+
</item>
10+
<item connType="Oracle" type="PACKAGE_FOLDER" className="org.utplsql.sqldev.navigator.menu.UtplsqlNavigatorAction">
11+
<title>Run utPLSQL test</title>
12+
</item>
13+
<item connType="Oracle" type="PACKAGE" className="org.utplsql.sqldev.navigator.menu.UtplsqlNavigatorAction">
14+
<title>Run utPLSQL test</title>
15+
</item>
16+
<item connType="Oracle" type="PACKAGE BODY" className="org.utplsql.sqldev.navigator.menu.UtplsqlNavigatorAction">
17+
<title>Run utPLSQL test</title>
18+
</item>
19+
<item connType="Oracle" type="TYPE_FOLDER" className="org.utplsql.sqldev.navigator.menu.UtplsqlNavigatorAction">
20+
<title>Run utPLSQL test</title>
21+
</item>
22+
<item connType="Oracle" type="TYPE" className="org.utplsql.sqldev.navigator.menu.UtplsqlNavigatorAction">
23+
<title>Run utPLSQL test</title>
24+
</item>
25+
<item connType="Oracle" type="TYPE BODY" className="org.utplsql.sqldev.navigator.menu.UtplsqlNavigatorAction">
26+
<title>Run utPLSQL test</title>
27+
</item>
28+
<item connType="Oracle" type="MEMBER" className="org.utplsql.sqldev.navigator.menu.UtplsqlNavigatorAction">
829
<title>Run utPLSQL test</title>
9-
<iconName/>
1030
</item>
1131
</items>

sqldev/src/main/resources/org/utplsql/sqldev/actions/navigator_actions_de.xliff

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,34 @@
66
<source>Run utPLSQL test</source>
77
<target>utPLSQL Test ausführen</target>
88
</trans-unit>
9+
<trans-unit id="items_item_title_2">
10+
<source>Run utPLSQL test</source>
11+
<target>utPLSQL Test ausführen</target>
12+
</trans-unit>
13+
<trans-unit id="items_item_title_3">
14+
<source>Run utPLSQL test</source>
15+
<target>utPLSQL Test ausführen</target>
16+
</trans-unit>
17+
<trans-unit id="items_item_title_4">
18+
<source>Run utPLSQL test</source>
19+
<target>utPLSQL Test ausführen</target>
20+
</trans-unit>
21+
<trans-unit id="items_item_title_5">
22+
<source>Run utPLSQL test</source>
23+
<target>utPLSQL Test ausführen</target>
24+
</trans-unit>
25+
<trans-unit id="items_item_title_6">
26+
<source>Run utPLSQL test</source>
27+
<target>utPLSQL Test ausführen</target>
28+
</trans-unit>
29+
<trans-unit id="items_item_title_7">
30+
<source>Run utPLSQL test</source>
31+
<target>utPLSQL Test ausführen</target>
32+
</trans-unit>
33+
<trans-unit id="items_item_title_8">
34+
<source>Run utPLSQL test</source>
35+
<target>utPLSQL Test ausführen</target>
36+
</trans-unit>
937
</body>
1038
</file>
1139
</xliff>

0 commit comments

Comments
 (0)