mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
minor, rename
This commit is contained in:
@@ -23,8 +23,8 @@ import java.util.*
|
||||
|
||||
class RecentTestsData {
|
||||
|
||||
private val suitePacks = hashMapOf<String, SuitePackInfo>()
|
||||
private var testsWithoutSuites: MutableList<TestInfo> = ContainerUtil.newArrayList<TestInfo>()
|
||||
private val runConfigurationSuites = hashMapOf<String, RunConfigurationEntry>()
|
||||
private var testsWithoutSuites: MutableList<SingleTestEntry> = ContainerUtil.newArrayList<SingleTestEntry>()
|
||||
|
||||
fun addSuite(url: String,
|
||||
magnitude: TestStateInfo.Magnitude,
|
||||
@@ -32,15 +32,16 @@ class RecentTestsData {
|
||||
runConfiguration: RunnerAndConfigurationSettings)
|
||||
{
|
||||
|
||||
val suiteInfo = SuiteInfo(url, magnitude, runDate, runConfiguration)
|
||||
val suiteInfo = SuiteEntry(url, magnitude, runDate, runConfiguration)
|
||||
|
||||
val suitePack = suitePacks[runConfiguration.uniqueID]
|
||||
val configurationId = runConfiguration.uniqueID
|
||||
val suitePack = runConfigurationSuites[configurationId]
|
||||
if (suitePack != null) {
|
||||
suitePack.addSuite(suiteInfo)
|
||||
return
|
||||
}
|
||||
|
||||
suitePacks[runConfiguration.uniqueID] = SuitePackInfo(runConfiguration, suiteInfo)
|
||||
runConfigurationSuites[configurationId] = RunConfigurationEntry(runConfiguration, suiteInfo)
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +50,7 @@ class RecentTestsData {
|
||||
runDate: Date,
|
||||
runConfiguration: RunnerAndConfigurationSettings) {
|
||||
|
||||
val testInfo = TestInfo(url, magnitude, runDate, runConfiguration)
|
||||
val testInfo = SingleTestEntry(url, magnitude, runDate, runConfiguration)
|
||||
|
||||
val suite = findSuite(url, runConfiguration)
|
||||
if (suite != null) {
|
||||
@@ -60,8 +61,8 @@ class RecentTestsData {
|
||||
testsWithoutSuites.add(testInfo)
|
||||
}
|
||||
|
||||
private fun findSuite(url: String, runConfiguration: RunnerAndConfigurationSettings): SuiteInfo? {
|
||||
val pack: SuitePackInfo = suitePacks[runConfiguration.uniqueID] ?: return null
|
||||
private fun findSuite(url: String, runConfiguration: RunnerAndConfigurationSettings): SuiteEntry? {
|
||||
val pack: RunConfigurationEntry = runConfigurationSuites[runConfiguration.uniqueID] ?: return null
|
||||
val testName = VirtualFileManager.extractPath(url)
|
||||
|
||||
pack.suites.forEach {
|
||||
@@ -79,13 +80,13 @@ class RecentTestsData {
|
||||
findSuite(url, it.runConfiguration)?.addTest(it)
|
||||
}
|
||||
|
||||
val packsByDate = suitePacks.values.sortedByDescending { it.runDate }
|
||||
val packsByDate = runConfigurationSuites.values.sortedByDescending { it.runDate }
|
||||
return packsByDate.fold(listOf(), { list, pack -> list + pack.entriesToShow() })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun SuitePackInfo.entriesToShow(): List<RecentTestsPopupEntry> {
|
||||
fun RunConfigurationEntry.entriesToShow(): List<RecentTestsPopupEntry> {
|
||||
if (suites.size == 1) {
|
||||
return suites[0].entriesToShow()
|
||||
}
|
||||
@@ -97,7 +98,7 @@ fun SuitePackInfo.entriesToShow(): List<RecentTestsPopupEntry> {
|
||||
return failedSuites + this
|
||||
}
|
||||
|
||||
fun SuiteInfo.entriesToShow(): List<RecentTestsPopupEntry> {
|
||||
fun SuiteEntry.entriesToShow(): List<RecentTestsPopupEntry> {
|
||||
val failed = failedTests
|
||||
if (failed.size > 0) {
|
||||
return failed.sortedByDescending { it.runDate } + this
|
||||
|
||||
+12
-12
@@ -35,10 +35,10 @@ interface RecentTestsPopupEntry {
|
||||
open fun navigatableElement(locator: TestLocator): PsiElement? = null
|
||||
}
|
||||
|
||||
open class TestInfo(val url: String,
|
||||
override val magnitude: TestStateInfo.Magnitude,
|
||||
override val runDate: Date,
|
||||
val runConfiguration: RunnerAndConfigurationSettings) : RecentTestsPopupEntry
|
||||
open class SingleTestEntry(val url: String,
|
||||
override val magnitude: TestStateInfo.Magnitude,
|
||||
override val runDate: Date,
|
||||
val runConfiguration: RunnerAndConfigurationSettings) : RecentTestsPopupEntry
|
||||
{
|
||||
|
||||
override val presentation = VirtualFileManager.extractPath(url)
|
||||
@@ -52,36 +52,36 @@ open class TestInfo(val url: String,
|
||||
|
||||
}
|
||||
|
||||
class SuiteInfo(url: String, magnitude: TestStateInfo.Magnitude, runDate: Date, runConfiguration: RunnerAndConfigurationSettings)
|
||||
: TestInfo(url, magnitude, runDate, runConfiguration)
|
||||
class SuiteEntry(url: String, magnitude: TestStateInfo.Magnitude, runDate: Date, runConfiguration: RunnerAndConfigurationSettings)
|
||||
: SingleTestEntry(url, magnitude, runDate, runConfiguration)
|
||||
{
|
||||
|
||||
private val tests = hashSetOf<TestInfo>()
|
||||
private val tests = hashSetOf<SingleTestEntry>()
|
||||
|
||||
override val testsUrls: List<String>
|
||||
get() = tests.fold(listOf<String>(), { acc, testEntry -> acc + testEntry.testsUrls })
|
||||
|
||||
val suiteName = VirtualFileManager.extractPath(url)
|
||||
|
||||
val failedTests: List<TestInfo>
|
||||
val failedTests: List<SingleTestEntry>
|
||||
get() = tests.filter { it.magnitude == FAILED_INDEX || it.magnitude == ERROR_INDEX }
|
||||
|
||||
fun addTest(info: TestInfo) = tests.add(info)
|
||||
fun addTest(info: SingleTestEntry) = tests.add(info)
|
||||
|
||||
override val presentation = suiteName
|
||||
|
||||
}
|
||||
|
||||
|
||||
class SuitePackInfo(val runSettings: RunnerAndConfigurationSettings, initial: SuiteInfo) : RecentTestsPopupEntry {
|
||||
class RunConfigurationEntry(val runSettings: RunnerAndConfigurationSettings, initial: SuiteEntry) : RecentTestsPopupEntry {
|
||||
|
||||
val suites = ContainerUtil.newArrayList<SuiteInfo>()
|
||||
val suites = ContainerUtil.newArrayList<SuiteEntry>()
|
||||
|
||||
init {
|
||||
addSuite(initial)
|
||||
}
|
||||
|
||||
fun addSuite(s: SuiteInfo) = suites.add(s)
|
||||
fun addSuite(s: SuiteEntry) = suites.add(s)
|
||||
|
||||
override val runDate = suites.map { it.runDate }.min()!!
|
||||
|
||||
Reference in New Issue
Block a user