Skip to content
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

#65 - Alternative hierarchical view #123

Merged
merged 55 commits into from
Jan 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
9b4ee55
smaller success icon
PhilippSalvisberg Jan 3, 2021
e6b255d
smaller disabled icon
PhilippSalvisberg Jan 3, 2021
cce6e2c
smaller failure icon
PhilippSalvisberg Jan 3, 2021
7144b27
smaller error icon
PhilippSalvisberg Jan 3, 2021
a8a7894
new info icon matching design of success/failure/error/disabled
PhilippSalvisberg Jan 3, 2021
bbd582d
original size of info icon (before scaling down)
PhilippSalvisberg Jan 3, 2021
863d1ef
new warning icon matching design of success/failure/error/disabled
PhilippSalvisberg Jan 3, 2021
370ebcc
original size of warning icon (before scaling down)
PhilippSalvisberg Jan 3, 2021
1d2974d
new status icon matching design of success/failure/error/disabled
PhilippSalvisberg Jan 3, 2021
fce1136
original size of status icon (before scaling down)
PhilippSalvisberg Jan 3, 2021
9ddf38f
add procedure icon representing a test in the tree
PhilippSalvisberg Jan 3, 2021
dac7fc4
add procedure folder icon representing a context in the tree
PhilippSalvisberg Jan 3, 2021
da1a8a8
add package icon representing a suite in the tree
PhilippSalvisberg Jan 3, 2021
ccf076c
add package folder icon representing a suite with multiple packages i…
PhilippSalvisberg Jan 3, 2021
8ec1e38
add showSuites to the preference model (tree-view yes/no)
PhilippSalvisberg Jan 3, 2021
79505df
add showSuites to the preference UI (tree-view checkbox)
PhilippSalvisberg Jan 3, 2021
ad912ba
extend test for preference model (showSuites)
PhilippSalvisberg Jan 3, 2021
a972c50
move common fields and methods from Suite/Test to Item
PhilippSalvisberg Jan 3, 2021
e803e46
add ItemNode class for suites/tests in a tree
PhilippSalvisberg Jan 3, 2021
30a2c24
add items and itemNodes to Run
PhilippSalvisberg Jan 3, 2021
72096ba
add new procedure and package icons to resource bundle
PhilippSalvisberg Jan 3, 2021
3c95d41
change label of test tab to Test/Suite in resource bundle
PhilippSalvisberg Jan 3, 2021
50275bc
add label and button tooltip for show suites in resource bundle
PhilippSalvisberg Jan 3, 2021
3faa839
fix wrong Run initialization in test setup
PhilippSalvisberg Jan 3, 2021
c1d5f30
add runTestHidingSuccesfulRuns test (tree-view is the new default)
PhilippSalvisberg Jan 3, 2021
70da38a
add getSysdate() to StringTools (from UtplsqlRunner)
PhilippSalvisberg Jan 3, 2021
0b8b729
remove blank lines
PhilippSalvisberg Jan 3, 2021
1749af8
add dateTimeStringToMillis to StringTools
PhilippSalvisberg Jan 3, 2021
a87d314
add elapsedTime to StringTools
PhilippSalvisberg Jan 3, 2021
235eb0b
add isNotBlank to StringTools
PhilippSalvisberg Jan 3, 2021
fe53809
add trim (with null handling) to StringTools
PhilippSalvisberg Jan 3, 2021
4a1802e
add tests for millisToDateTimeString to StringToolsTest
PhilippSalvisberg Jan 3, 2021
3daf6af
add tests for dateTimeStringToMillis to StringToolsTest
PhilippSalvisberg Jan 3, 2021
17de78d
add test for elapsedTime to StringToolsTest
PhilippSalvisberg Jan 3, 2021
39a707b
amend expected output based on new Run model in JsonToStringStylerTest
PhilippSalvisberg Jan 3, 2021
e24528a
add TestOverviewTreeTableModel class
PhilippSalvisberg Jan 3, 2021
535ea91
return String instead of CharSequence for getTestIdColumnName()
PhilippSalvisberg Jan 3, 2021
6911f8b
new column order: status, description, indicators, execution time
PhilippSalvisberg Jan 3, 2021
ad5110c
use StringTools.getSysdate()
PhilippSalvisberg Jan 3, 2021
d299c87
add imports for Supplier, ItemNode, Suite and reorder
PhilippSalvisberg Jan 3, 2021
7899067
add private logFalseCondition method used in assert statements
PhilippSalvisberg Jan 3, 2021
51691aa
process pre-suite event
PhilippSalvisberg Jan 3, 2021
d84dc2c
pass item when updating runner panel
PhilippSalvisberg Jan 3, 2021
7a4fda9
add aggregation logic for suites in PostSuiteEvent
PhilippSalvisberg Jan 3, 2021
c847c87
assert test != null for PreTestEvent
PhilippSalvisberg Jan 3, 2021
accc46c
assert test != null for PostTestEvent
PhilippSalvisberg Jan 3, 2021
79dfab7
hyperlinks in warnings require mouse click to activate
PhilippSalvisberg Jan 3, 2021
77ba5a9
hyperlinks in info (server output) require mouse click to activate
PhilippSalvisberg Jan 3, 2021
e9a4d09
add alternative tree-table-view based on #65 to the RunnerPanel
PhilippSalvisberg Jan 3, 2021
ce56ec3
ensure that the test runs in all environments
PhilippSalvisberg Jan 3, 2021
5d6d6bc
add ItemNode.createNonOverlappingSet
PhilippSalvisberg Jan 3, 2021
c77e254
add test cases for add ItemNode.createNonOverlappingSet
PhilippSalvisberg Jan 3, 2021
0970cd4
use ItemNode.createNonOverlappingSet to optimize paths before calling…
PhilippSalvisberg Jan 3, 2021
71fbc5f
use interfaces to enable ModelGoon to draw correct class diagram
PhilippSalvisberg Jan 3, 2021
4d28aa9
updated RunnerModel class diagram
PhilippSalvisberg Jan 3, 2021
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
Binary file modified images/runner_model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 48 additions & 2 deletions sqldev/src/main/java/org/utplsql/sqldev/model/StringTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@
*/
package org.utplsql.sqldev.model;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import org.utplsql.sqldev.exception.GenericRuntimeException;

public class StringTools {
// do not instantiate this class
private StringTools() {
Expand All @@ -38,11 +43,11 @@ public static String getCSV(List<String> list, String indent) {
sb.append("\n");
return sb.toString();
}

public static String getCSV(List<String> list, int indentSpaces) {
return getCSV(list, repeat(" ", indentSpaces));
}

public static String getSimpleCSV(List<String> list) {
final StringBuilder sb = new StringBuilder();
for (final String item : list) {
Expand Down Expand Up @@ -74,4 +79,45 @@ public static String formatDateTime(final String dateTime) {
}
}
}

public static String millisToDateTimeString(long millis) {
final Date dateTime = new Date(millis);
final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'000'");
return df.format(dateTime);
}

public static String getSysdate() {
return millisToDateTimeString(System.currentTimeMillis());
}

public static long dateTimeStringToMillis(final String dateTime) {
// handle milliseconds separately since they get lost (rounded) when converted to date
final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date date;
try {
date = df.parse(dateTime.substring(0, 20));
} catch (ParseException e) {
throw new GenericRuntimeException("cannot parse datetime string " + dateTime + ".", e);
}
long millis = Long.parseLong(dateTime.substring(20, 23));
return date.getTime() + millis;
}

public static double elapsedTime(String startDateTime, String endDateTime) {
double start = (double) dateTimeStringToMillis(startDateTime);
double end = (double) dateTimeStringToMillis(endDateTime);
return (end - start) / 1000;
}

public static boolean isNotBlank(String value) {
return value != null && !value.trim().isEmpty();
}

public static String trim(String value) {
if (value == null) {
return null;
}
return value.trim();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public static PreferenceModel getInstance(final PropertyStorage prefs) {
private static final String KEY_SHOW_DISABLED_TESTS = "showDisabledTests";
private static final String KEY_SHOW_TEST_DESCRIPTION = "showTestDescription";
private static final String KEY_SYNC_DETAIL_TAB = "syncDetailTab";
private static final String KEY_SHOW_SUITES = "showSuites";
private static final String KEY_TEST_PACKAGE_PREFIX = "testPackagePrefix";
private static final String KEY_TEST_PACKAGE_SUFFIX = "testPackageSuffix";
private static final String KEY_TEST_UNIT_PREFIX = "testUnitPrefix";
Expand Down Expand Up @@ -88,6 +89,7 @@ public String toString() {
.append(KEY_SHOW_DISABLED_TESTS, isShowDisabledTests())
.append(KEY_SHOW_TEST_DESCRIPTION, isShowTestDescription())
.append(KEY_SYNC_DETAIL_TAB, isSyncDetailTab())
.append(KEY_SHOW_SUITES, isShowSuites())
.append(KEY_TEST_PACKAGE_PREFIX, getTestPackagePrefix())
.append(KEY_TEST_PACKAGE_SUFFIX, getTestPackageSuffix())
.append(KEY_TEST_UNIT_PREFIX, getTestUnitPrefix())
Expand Down Expand Up @@ -241,6 +243,14 @@ public void setSyncDetailTab(final boolean syncDetailTab) {
getHashStructure().putBoolean(KEY_SYNC_DETAIL_TAB, syncDetailTab);
}

public boolean isShowSuites() {
return getHashStructure().getBoolean(KEY_SHOW_SUITES, true);
}

public void setShowSuites(final boolean showSuites) {
getHashStructure().putBoolean(KEY_SHOW_SUITES, showSuites);
}

public String getTestPackagePrefix() {
return getHashStructure().getString(KEY_TEST_PACKAGE_PREFIX, "test_");
}
Expand Down
81 changes: 81 additions & 0 deletions sqldev/src/main/java/org/utplsql/sqldev/model/runner/Item.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@
*/
package org.utplsql.sqldev.model.runner;

import javax.swing.Icon;

import org.springframework.core.style.ToStringCreator;
import org.utplsql.sqldev.model.JsonToStringStyler;
import org.utplsql.sqldev.resources.UtplsqlResources;

public abstract class Item {
private String id;
private String name;
private String description;
private String startTime;
private String endTime;
private Double executionTime;
Expand All @@ -36,15 +41,75 @@ public Item() {
public String toString() {
return new ToStringCreator(this, JsonToStringStyler.getInstance())
.append("id", id)
.append("name", name)
.append("description", description)
.append("startTime", startTime)
.append("endTime", endTime)
.append("executionTime", executionTime)
.append("counter", counter)
.append("errorStack", errorStack)
.append("serverOutput", serverOutput)
.append("warnings", warnings)
.append("parentId", getParentId())
.append("statusIcon", getStatusIcon())
.append("warningIcon", getWarningIcon())
.append("infoIcon", getInfoIcon())
.toString();
}

public String getParentId() {
// Works only if id (suitepath) is build based on names delimited with a period
// that's expected for real utPLSQL runs, but may fail for artificial runs.
// Returning null is valid, it means this item has no parent and as a
// consequence it will be shown on the top level in the runner.
// A key is required to identify an item since suites can be delivered
// multiple times, e.g. when running a chosen list of tests. This way
// the tests will shown at the right position in the tree, regardless of the call
// parameters.
if (name != null && id != null && name.length() < id.length() && id.endsWith(name)) {
return id.substring(0, id.length() - name.length() - 1);
}
return null;
}

public Icon getStatusIcon() {
Icon icon = null;
if (getStartTime() != null && getEndTime() == null) {
icon = UtplsqlResources.getIcon("PROGRESS_ICON");
} else {
if (getCounter() != null) {
// Escalation logic as for the color of the progress bar.
// A suite with errors or failed tests cannot be considered successful,
// even if some tests completed successfully.
if (getCounter().getError() > 0) {
icon = UtplsqlResources.getIcon("ERROR_ICON");
} else if (getCounter().getFailure() > 0) {
icon = UtplsqlResources.getIcon("FAILURE_ICON");
} else if (getCounter().getSuccess() > 0) {
icon = UtplsqlResources.getIcon("SUCCESS_ICON");
} else if (getCounter().getDisabled() > 0) {
icon = UtplsqlResources.getIcon("DISABLED_ICON");
}
}
}
return icon;
}

public Icon getWarningIcon() {
Icon icon = null;
if (getCounter() != null && getCounter().getWarning() > 0) {
icon = UtplsqlResources.getIcon("WARNING_ICON");
}
return icon;
}

public Icon getInfoIcon() {
Icon icon = null;
if (getServerOutput() != null && getServerOutput().length() > 0) {
icon = UtplsqlResources.getIcon("INFO_ICON");
}
return icon;
}

public String getId() {
return id;
Expand All @@ -54,6 +119,22 @@ public void setId(final String id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(final String name) {
this.name = name;
}

public String getDescription() {
return description;
}

public void setDescription(final String description) {
this.description = description;
}

public String getStartTime() {
return startTime;
}
Expand Down
Loading