fun readTestData()

in src/main/kotlin/com/jetbrains/plugin/jtreg/configuration/ConfigurationHelper.kt [73:113]


    fun readTestData(element: Element, settings: JTRegService): TestData {
        val data = TestData()
        element.getChild("jtreg")?.let { jtreg ->
            val envVars: MutableMap<String?, String?> = mutableMapOf()
            EnvironmentVariablesComponent.readExternal(jtreg, envVars)
            data.envVars = envVars

            data.testMode = getTestMode(jtreg, settings.testMode)
            data.testCategory = getTestCategory(jtreg)
            data.reportDir = jtreg.getAttributeValue("reportDir") ?: ""
            data.excludeList = jtreg.getAttributeValue("excludeList") ?: ""
            data.concurrency = jtreg.getAttributeValue("concurrency")?.toIntOrNull() ?: settings.concurrency
            data.timeoutFactor = jtreg.getAttributeValue("timeoutFactor")?.toFloatOrNull() ?: settings.timeoutFactor
            data.timeLimit = jtreg.getAttributeValue("timeLimit")?.toIntOrNull() ?: settings.timeLimit
            data.lock = jtreg.getAttributeValue("lockFile") ?: ""
            data.ignoreMode = IgnoreMode.valueOf(jtreg.getAttributeValue("ignoreMode") ?: settings.ignore.toString())
            data.keyword = jtreg.getAttributeValue("keyword") ?: ""

            jtreg.getChild("weston")?.let { weston ->
                data.weston.useWeston = weston.getAttributeValue("useWeston")?.toBoolean() == true
                data.weston.screensCount = weston.getAttributeValue("westonScreens")?.toIntOrNull() ?: settings.westonSettings.screensCount
                data.weston.screenWidth = weston.getAttributeValue("westonScreenWidth")?.toIntOrNull() ?: settings.westonSettings.screenWidth
                data.weston.screenHeight = weston.getAttributeValue("westonScreenHeight")?.toIntOrNull() ?: settings.westonSettings.screenHeight
                data.weston.wakefieldPath = weston.getAttributeValue("wakeFieldPath") ?: settings.westonSettings.wakefieldPath
            }
            jtreg.getChild("testVM")?.let { testVM ->
                data.vmSettings.allowSecurityManager = testVM.getAttributeValue("allowSecurityManager")?.toBoolean() ?: false
                data.vmSettings.javaOptions = testVM.getAttributeValue("testJavaOptions") ?: ""
                val testEnvVars: MutableMap<String?, String?> = mutableMapOf()
                EnvironmentVariablesComponent.readExternal(testVM, testEnvVars)
                data.vmSettings.envVars = testEnvVars
                data.vmSettings.nativeLibPath = testVM.getAttributeValue("nativeTestLibraryPath") ?: ""
            }
            jtreg.getChild("repeat")?.let { repeat ->
                data.repeat.mode = repeat.getAttributeValue("repeatMode") ?: RepeatCount.ONCE
                data.repeat.count = repeat.getAttributeValue("repeatCount")?.toIntOrNull() ?: 1
                data.repeat.maxCount = repeat.getAttributeValue("maxRepeatCount")?.toIntOrNull() ?: 100
            }
        }
        return data
    }