Skip to content

Improve performance of "Run test" from oddgen's Generator window #52

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 2 commits into from
Nov 17, 2018
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
2 changes: 1 addition & 1 deletion sqldev/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- The Basics -->
<groupId>org.utplsql</groupId>
<artifactId>org.utplsql.sqldev</artifactId>
<version>0.6.5-SNAPSHOT</version>
<version>0.7.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
28 changes: 18 additions & 10 deletions sqldev/src/main/java/org/utplsql/sqldev/oddgen/RunGenerator.xtend
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class RunGenerator implements OddgenGenerator2 {
public static var RESET_PACKAGE = UtplsqlResources.getString("PREF_RESET_PACKAGE_LABEL")
public static var CLEAR_SCREEN = UtplsqlResources.getString("PREF_CLEAR_SCREEN_LABEL")
public static var INDENT_SPACES = UtplsqlResources.getString("PREF_INDENT_SPACES_LABEL")

// oddgen node cache
var List<Node> runnables = null;

override isSupported(Connection conn) {
var ret = false
Expand Down Expand Up @@ -75,17 +78,22 @@ class RunGenerator implements OddgenGenerator2 {
}

override getNodes(Connection conn, String parentNodeId) {
val preferences = PreferenceModel.getInstance(Preferences.preferences)
val params = new LinkedHashMap<String, String>()
params.put(RESET_PACKAGE, if (preferences.resetPackage) {YES} else {NO})
params.put(CLEAR_SCREEN, if (preferences.clearScreen) {YES} else {NO})
params.put(INDENT_SPACES, String.valueOf(preferences.indentSpaces))
val UtplsqlDao dao = new UtplsqlDao(conn)
val nodes = dao.runnables
for (node : nodes) {
node.params = params
// oddgen asks for children for each parent node, regardless of load strategy (eager/lazy)
// oddgen does not know about the load strategy, hence caching is the responsibility of the generator
if (runnables === null) {
val preferences = PreferenceModel.getInstance(Preferences.preferences)
val params = new LinkedHashMap<String, String>()
params.put(RESET_PACKAGE, if (preferences.resetPackage) {YES} else {NO})
params.put(CLEAR_SCREEN, if (preferences.clearScreen) {YES} else {NO})
params.put(INDENT_SPACES, String.valueOf(preferences.indentSpaces))
val UtplsqlDao dao = new UtplsqlDao(conn)
// load node tree eagerly (all nodes in one go)
runnables = dao.runnables
for (node : runnables) {
node.params = params
}
}
return nodes
return runnables
}

override getLov(Connection conn, LinkedHashMap<String, String> params, List<Node> nodes) {
Expand Down