Skip to content

Commit d8d163a

Browse files
convert Test to Java
1 parent 8afb3ed commit d8d163a

1 file changed

Lines changed: 157 additions & 57 deletions

File tree

  • sqldev/src/main/java/org/utplsql/sqldev/model/runner

sqldev/src/main/java/org/utplsql/sqldev/model/runner/Test.java

Lines changed: 157 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -13,60 +13,160 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.utplsql.sqldev.model.runner
17-
18-
import java.util.List
19-
import javax.swing.Icon
20-
import org.eclipse.xtend.lib.annotations.Accessors
21-
import org.utplsql.sqldev.resources.UtplsqlResources
22-
23-
@Accessors
24-
class Test extends Item {
25-
String executableType
26-
String ownerName
27-
String objectName
28-
String procedureName
29-
Boolean disabled
30-
String name
31-
String description
32-
Integer testNumber
33-
List<Expectation> failedExpectations
34-
35-
def getStatusIcon() {
36-
var Icon icon = null
37-
if (startTime !== null && endTime === null ) {
38-
icon = UtplsqlResources.getIcon("PROGRESS_ICON")
39-
} else {
40-
if (counter !== null) {
41-
if (counter.success > 0) {
42-
icon = UtplsqlResources.getIcon("SUCCESS_ICON")
43-
} else if (counter.error > 0) {
44-
icon = UtplsqlResources.getIcon("ERROR_ICON")
45-
} else if (counter.failure > 0) {
46-
icon = UtplsqlResources.getIcon("FAILURE_ICON")
47-
} else if (counter.disabled > 0) {
48-
icon = UtplsqlResources.getIcon("DISABLED_ICON")
49-
}
50-
}
51-
}
52-
return icon
53-
}
54-
55-
def getWarningIcon() {
56-
var Icon icon = null
57-
if (counter !== null) {
58-
if (counter.warning > 0) {
59-
icon = UtplsqlResources.getIcon("WARNING_ICON")
60-
}
61-
}
62-
return icon
63-
}
64-
65-
def getInfoIcon() {
66-
var Icon icon = null
67-
if (serverOutput !== null && serverOutput.length > 0) {
68-
icon = UtplsqlResources.getIcon("INFO_ICON")
69-
}
70-
return icon
71-
}
72-
}
16+
package org.utplsql.sqldev.model.runner;
17+
18+
import java.util.List;
19+
20+
import javax.swing.Icon;
21+
22+
import org.springframework.core.style.ToStringCreator;
23+
import org.utplsql.sqldev.model.UtplsqlToStringStyler;
24+
import org.utplsql.sqldev.resources.UtplsqlResources;
25+
26+
public class Test extends Item {
27+
private String executableType;
28+
private String ownerName;
29+
private String objectName;
30+
private String procedureName;
31+
private Boolean disabled;
32+
private String name;
33+
private String description;
34+
private Integer testNumber;
35+
private List<Expectation> failedExpectations;
36+
37+
@Override
38+
public String toString() {
39+
return new ToStringCreator(this, UtplsqlToStringStyler.INSTANCE)
40+
// ancestor
41+
.append("id", getId())
42+
.append("startTime", getStartTime())
43+
.append("endTime", getEndTime())
44+
.append("executionTime", getExecutionTime())
45+
.append("counter", getCounter())
46+
.append("errorStack", getErrorStack())
47+
.append("serverOutput", getServerOutput())
48+
.append("warnings", getWarnings())
49+
// local
50+
.append("executableType", executableType)
51+
.append("ownerName", ownerName)
52+
.append("objectName", objectName)
53+
.append("procedureName", procedureName)
54+
.append("disabled", disabled)
55+
.append("name", name)
56+
.append("description", description)
57+
.append("testNumber", testNumber)
58+
.append("failedExpectations", failedExpectations)
59+
.append("statusIcon", getStatusIcon())
60+
.append("warningIcon", getWarningIcon())
61+
.append("infoIcon", getInfoIcon())
62+
.toString();
63+
}
64+
65+
public Icon getStatusIcon() {
66+
Icon icon = null;
67+
if (getStartTime() != null && getEndTime() == null) {
68+
icon = UtplsqlResources.getIcon("PROGRESS_ICON");
69+
} else {
70+
if (getCounter() != null) {
71+
if (getCounter().getSuccess() > 0) {
72+
icon = UtplsqlResources.getIcon("SUCCESS_ICON");
73+
} else if (getCounter().getError() > 0) {
74+
icon = UtplsqlResources.getIcon("ERROR_ICON");
75+
} else if (getCounter().getFailure() > 0) {
76+
icon = UtplsqlResources.getIcon("FAILURE_ICON");
77+
} else if (getCounter().getDisabled() > 0) {
78+
icon = UtplsqlResources.getIcon("DISABLED_ICON");
79+
}
80+
}
81+
}
82+
return icon;
83+
}
84+
85+
public Icon getWarningIcon() {
86+
Icon icon = null;
87+
if (getCounter() != null && getCounter().getWarning() > 0) {
88+
icon = UtplsqlResources.getIcon("WARNING_ICON");
89+
}
90+
return icon;
91+
}
92+
93+
public Icon getInfoIcon() {
94+
Icon icon = null;
95+
if (getServerOutput() != null && getServerOutput().length() > 0) {
96+
icon = UtplsqlResources.getIcon("INFO_ICON");
97+
}
98+
return icon;
99+
}
100+
101+
public String getExecutableType() {
102+
return executableType;
103+
}
104+
105+
public void setExecutableType(final String executableType) {
106+
this.executableType = executableType;
107+
}
108+
109+
public String getOwnerName() {
110+
return ownerName;
111+
}
112+
113+
public void setOwnerName(final String ownerName) {
114+
this.ownerName = ownerName;
115+
}
116+
117+
public String getObjectName() {
118+
return objectName;
119+
}
120+
121+
public void setObjectName(final String objectName) {
122+
this.objectName = objectName;
123+
}
124+
125+
public String getProcedureName() {
126+
return procedureName;
127+
}
128+
129+
public void setProcedureName(final String procedureName) {
130+
this.procedureName = procedureName;
131+
}
132+
133+
public Boolean getDisabled() {
134+
return disabled;
135+
}
136+
137+
public void setDisabled(final Boolean disabled) {
138+
this.disabled = disabled;
139+
}
140+
141+
public String getName() {
142+
return name;
143+
}
144+
145+
public void setName(final String name) {
146+
this.name = name;
147+
}
148+
149+
public String getDescription() {
150+
return description;
151+
}
152+
153+
public void setDescription(final String description) {
154+
this.description = description;
155+
}
156+
157+
public Integer getTestNumber() {
158+
return testNumber;
159+
}
160+
161+
public void setTestNumber(final Integer testNumber) {
162+
this.testNumber = testNumber;
163+
}
164+
165+
public List<Expectation> getFailedExpectations() {
166+
return failedExpectations;
167+
}
168+
169+
public void setFailedExpectations(final List<Expectation> failedExpectations) {
170+
this.failedExpectations = failedExpectations;
171+
}
172+
}

0 commit comments

Comments
 (0)