mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RecentTests: added date to suite and test infos
This commit is contained in:
@@ -46,13 +46,13 @@ public class RecentTestsData {
|
||||
myRunner = runner;
|
||||
}
|
||||
|
||||
public void addTest(String url, TestStateInfo.Magnitude magnitude) {
|
||||
public void addTest(String url, TestStateInfo.Magnitude magnitude, Date runDate) {
|
||||
if (myRunner.isSuite(url)) {
|
||||
mySuites.put(url, new SuiteInfo(url, magnitude));
|
||||
mySuites.put(url, new SuiteInfo(url, magnitude, runDate));
|
||||
return;
|
||||
}
|
||||
|
||||
TestInfo testInfo = new TestInfo(url, magnitude);
|
||||
TestInfo testInfo = new TestInfo(url, magnitude, runDate);
|
||||
|
||||
SuiteInfo suite = getSuite(url);
|
||||
if (suite != null) {
|
||||
@@ -153,11 +153,25 @@ class SuiteInfo extends TestInfo {
|
||||
private final String mySuiteName;
|
||||
private Set<TestInfo> tests = ContainerUtil.newHashSet();
|
||||
|
||||
public SuiteInfo(String url, TestStateInfo.Magnitude magnitude) {
|
||||
super(url, magnitude);
|
||||
public SuiteInfo(String url, TestStateInfo.Magnitude magnitude, Date runDate) {
|
||||
super(url, magnitude, runDate);
|
||||
mySuiteName = VirtualFileManager.extractPath(url);
|
||||
}
|
||||
|
||||
public Date getMostRecentRunDate() {
|
||||
if (tests.isEmpty()) return getRunDate();
|
||||
|
||||
Date mostRecent = tests.iterator().next().getRunDate();
|
||||
for (TestInfo test : tests) {
|
||||
Date testDate = test.getRunDate();
|
||||
if (testDate.compareTo(mostRecent) > 0) {
|
||||
mostRecent = testDate;
|
||||
}
|
||||
}
|
||||
|
||||
return mostRecent;
|
||||
}
|
||||
|
||||
public String getSuiteName() {
|
||||
return mySuiteName;
|
||||
}
|
||||
@@ -176,12 +190,18 @@ class SuiteInfo extends TestInfo {
|
||||
}
|
||||
|
||||
class TestInfo {
|
||||
private String url;
|
||||
private TestStateInfo.Magnitude magnitude;
|
||||
private final Date runDate;
|
||||
private final String url;
|
||||
private final TestStateInfo.Magnitude magnitude;
|
||||
|
||||
public TestInfo(String url, TestStateInfo.Magnitude magnitude) {
|
||||
public TestInfo(String url, TestStateInfo.Magnitude magnitude, Date runDate) {
|
||||
this.url = url;
|
||||
this.magnitude = magnitude;
|
||||
this.runDate = runDate;
|
||||
}
|
||||
|
||||
public Date getRunDate() {
|
||||
return runDate;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
|
||||
@@ -25,21 +25,11 @@ import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class SelectTestStep extends BaseListPopupStep<String> {
|
||||
private static Comparator<String> TEST_BY_PATH_COMPARATOR = new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
String path1 = VirtualFileManager.extractPath(o1);
|
||||
String path2 = VirtualFileManager.extractPath(o2);
|
||||
return path1.compareTo(path2);
|
||||
}
|
||||
};
|
||||
|
||||
private final Map<String, TestStateStorage.Record> myRecords;
|
||||
private final RecentTestRunner myRunner;
|
||||
|
||||
@@ -55,7 +45,7 @@ public class SelectTestStep extends BaseListPopupStep<String> {
|
||||
for (Map.Entry<String, TestStateStorage.Record> entry : records.entrySet()) {
|
||||
String url = entry.getKey();
|
||||
TestStateStorage.Record record = entry.getValue();
|
||||
data.addTest(url, getMagnitude(record.magnitude));
|
||||
data.addTest(url, getMagnitude(record.magnitude), record.date);
|
||||
}
|
||||
|
||||
return data.calculateTestList();
|
||||
|
||||
Reference in New Issue
Block a user