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

Commit32ef3e1

Browse files
Merge pull request#123 from utPLSQL/feature/issue-65-hierarchical-view
#65 - Alternative hierarchical view
2 parents8dfb38f +4d28aa9 commit32ef3e1

File tree

37 files changed

+1960
-322
lines changed

37 files changed

+1960
-322
lines changed

‎images/runner_model.png

64.9 KB
Loading

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

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@
1515
*/
1616
packageorg.utplsql.sqldev.model;
1717

18+
importjava.text.ParseException;
19+
importjava.text.SimpleDateFormat;
1820
importjava.util.Collections;
21+
importjava.util.Date;
1922
importjava.util.List;
2023

24+
importorg.utplsql.sqldev.exception.GenericRuntimeException;
25+
2126
publicclassStringTools {
2227
// do not instantiate this class
2328
privateStringTools() {
@@ -38,11 +43,11 @@ public static String getCSV(List<String> list, String indent) {
3843
sb.append("\n");
3944
returnsb.toString();
4045
}
41-
46+
4247
publicstaticStringgetCSV(List<String>list,intindentSpaces) {
4348
returngetCSV(list,repeat(" ",indentSpaces));
4449
}
45-
50+
4651
publicstaticStringgetSimpleCSV(List<String>list) {
4752
finalStringBuildersb =newStringBuilder();
4853
for (finalStringitem :list) {
@@ -74,4 +79,45 @@ public static String formatDateTime(final String dateTime) {
7479
}
7580
}
7681
}
82+
83+
publicstaticStringmillisToDateTimeString(longmillis) {
84+
finalDatedateTime =newDate(millis);
85+
finalSimpleDateFormatdf =newSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'000'");
86+
returndf.format(dateTime);
87+
}
88+
89+
publicstaticStringgetSysdate() {
90+
returnmillisToDateTimeString(System.currentTimeMillis());
91+
}
92+
93+
publicstaticlongdateTimeStringToMillis(finalStringdateTime) {
94+
// handle milliseconds separately since they get lost (rounded) when converted to date
95+
finalSimpleDateFormatdf =newSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
96+
Datedate;
97+
try {
98+
date =df.parse(dateTime.substring(0,20));
99+
}catch (ParseExceptione) {
100+
thrownewGenericRuntimeException("cannot parse datetime string " +dateTime +".",e);
101+
}
102+
longmillis =Long.parseLong(dateTime.substring(20,23));
103+
returndate.getTime() +millis;
104+
}
105+
106+
publicstaticdoubleelapsedTime(StringstartDateTime,StringendDateTime) {
107+
doublestart = (double)dateTimeStringToMillis(startDateTime);
108+
doubleend = (double)dateTimeStringToMillis(endDateTime);
109+
return (end -start) /1000;
110+
}
111+
112+
publicstaticbooleanisNotBlank(Stringvalue) {
113+
returnvalue !=null && !value.trim().isEmpty();
114+
}
115+
116+
publicstaticStringtrim(Stringvalue) {
117+
if (value ==null) {
118+
returnnull;
119+
}
120+
returnvalue.trim();
121+
}
122+
77123
}

‎sqldev/src/main/java/org/utplsql/sqldev/model/preference/PreferenceModel.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public static PreferenceModel getInstance(final PropertyStorage prefs) {
5353
privatestaticfinalStringKEY_SHOW_DISABLED_TESTS ="showDisabledTests";
5454
privatestaticfinalStringKEY_SHOW_TEST_DESCRIPTION ="showTestDescription";
5555
privatestaticfinalStringKEY_SYNC_DETAIL_TAB ="syncDetailTab";
56+
privatestaticfinalStringKEY_SHOW_SUITES ="showSuites";
5657
privatestaticfinalStringKEY_TEST_PACKAGE_PREFIX ="testPackagePrefix";
5758
privatestaticfinalStringKEY_TEST_PACKAGE_SUFFIX ="testPackageSuffix";
5859
privatestaticfinalStringKEY_TEST_UNIT_PREFIX ="testUnitPrefix";
@@ -88,6 +89,7 @@ public String toString() {
8889
.append(KEY_SHOW_DISABLED_TESTS,isShowDisabledTests())
8990
.append(KEY_SHOW_TEST_DESCRIPTION,isShowTestDescription())
9091
.append(KEY_SYNC_DETAIL_TAB,isSyncDetailTab())
92+
.append(KEY_SHOW_SUITES,isShowSuites())
9193
.append(KEY_TEST_PACKAGE_PREFIX,getTestPackagePrefix())
9294
.append(KEY_TEST_PACKAGE_SUFFIX,getTestPackageSuffix())
9395
.append(KEY_TEST_UNIT_PREFIX,getTestUnitPrefix())
@@ -241,6 +243,14 @@ public void setSyncDetailTab(final boolean syncDetailTab) {
241243
getHashStructure().putBoolean(KEY_SYNC_DETAIL_TAB,syncDetailTab);
242244
}
243245

246+
publicbooleanisShowSuites() {
247+
returngetHashStructure().getBoolean(KEY_SHOW_SUITES,true);
248+
}
249+
250+
publicvoidsetShowSuites(finalbooleanshowSuites) {
251+
getHashStructure().putBoolean(KEY_SHOW_SUITES,showSuites);
252+
}
253+
244254
publicStringgetTestPackagePrefix() {
245255
returngetHashStructure().getString(KEY_TEST_PACKAGE_PREFIX,"test_");
246256
}

‎sqldev/src/main/java/org/utplsql/sqldev/model/runner/Item.java

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@
1515
*/
1616
packageorg.utplsql.sqldev.model.runner;
1717

18+
importjavax.swing.Icon;
19+
1820
importorg.springframework.core.style.ToStringCreator;
1921
importorg.utplsql.sqldev.model.JsonToStringStyler;
22+
importorg.utplsql.sqldev.resources.UtplsqlResources;
2023

2124
publicabstractclassItem {
2225
privateStringid;
26+
privateStringname;
27+
privateStringdescription;
2328
privateStringstartTime;
2429
privateStringendTime;
2530
privateDoubleexecutionTime;
@@ -36,15 +41,75 @@ public Item() {
3641
publicStringtoString() {
3742
returnnewToStringCreator(this,JsonToStringStyler.getInstance())
3843
.append("id",id)
44+
.append("name",name)
45+
.append("description",description)
3946
.append("startTime",startTime)
4047
.append("endTime",endTime)
4148
.append("executionTime",executionTime)
4249
.append("counter",counter)
4350
.append("errorStack",errorStack)
4451
.append("serverOutput",serverOutput)
4552
.append("warnings",warnings)
53+
.append("parentId",getParentId())
54+
.append("statusIcon",getStatusIcon())
55+
.append("warningIcon",getWarningIcon())
56+
.append("infoIcon",getInfoIcon())
4657
.toString();
4758
}
59+
60+
publicStringgetParentId() {
61+
// Works only if id (suitepath) is build based on names delimited with a period
62+
// that's expected for real utPLSQL runs, but may fail for artificial runs.
63+
// Returning null is valid, it means this item has no parent and as a
64+
// consequence it will be shown on the top level in the runner.
65+
// A key is required to identify an item since suites can be delivered
66+
// multiple times, e.g. when running a chosen list of tests. This way
67+
// the tests will shown at the right position in the tree, regardless of the call
68+
// parameters.
69+
if (name !=null &&id !=null &&name.length() <id.length() &&id.endsWith(name)) {
70+
returnid.substring(0,id.length() -name.length() -1);
71+
}
72+
returnnull;
73+
}
74+
75+
publicIcongetStatusIcon() {
76+
Iconicon =null;
77+
if (getStartTime() !=null &&getEndTime() ==null) {
78+
icon =UtplsqlResources.getIcon("PROGRESS_ICON");
79+
}else {
80+
if (getCounter() !=null) {
81+
// Escalation logic as for the color of the progress bar.
82+
// A suite with errors or failed tests cannot be considered successful,
83+
// even if some tests completed successfully.
84+
if (getCounter().getError() >0) {
85+
icon =UtplsqlResources.getIcon("ERROR_ICON");
86+
}elseif (getCounter().getFailure() >0) {
87+
icon =UtplsqlResources.getIcon("FAILURE_ICON");
88+
}elseif (getCounter().getSuccess() >0) {
89+
icon =UtplsqlResources.getIcon("SUCCESS_ICON");
90+
}elseif (getCounter().getDisabled() >0) {
91+
icon =UtplsqlResources.getIcon("DISABLED_ICON");
92+
}
93+
}
94+
}
95+
returnicon;
96+
}
97+
98+
publicIcongetWarningIcon() {
99+
Iconicon =null;
100+
if (getCounter() !=null &&getCounter().getWarning() >0) {
101+
icon =UtplsqlResources.getIcon("WARNING_ICON");
102+
}
103+
returnicon;
104+
}
105+
106+
publicIcongetInfoIcon() {
107+
Iconicon =null;
108+
if (getServerOutput() !=null &&getServerOutput().length() >0) {
109+
icon =UtplsqlResources.getIcon("INFO_ICON");
110+
}
111+
returnicon;
112+
}
48113

49114
publicStringgetId() {
50115
returnid;
@@ -54,6 +119,22 @@ public void setId(final String id) {
54119
this.id =id;
55120
}
56121

122+
publicStringgetName() {
123+
returnname;
124+
}
125+
126+
publicvoidsetName(finalStringname) {
127+
this.name =name;
128+
}
129+
130+
publicStringgetDescription() {
131+
returndescription;
132+
}
133+
134+
publicvoidsetDescription(finalStringdescription) {
135+
this.description =description;
136+
}
137+
57138
publicStringgetStartTime() {
58139
returnstartTime;
59140
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp