Skip to content

Commit

Permalink
[maven] IDEA-364947 MavenTestCase, MavenTestCaseLegacy
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 0845e674ab4ff2323f66b02a643aaffb39be0dc8
  • Loading branch information
Dmitry Kichinsky authored and intellij-monorepo-bot committed Dec 18, 2024
1 parent cd12727 commit 0fd6650
Show file tree
Hide file tree
Showing 24 changed files with 189 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
*/
package org.jetbrains.idea.maven

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import org.jetbrains.idea.maven.utils.MavenArtifactUtil
import org.jetbrains.idea.maven.utils.MavenPluginInfo
import java.nio.file.Path

class MavenPluginInfoReaderTest : MavenTestCase() {
class MavenPluginInfoReaderTest : MavenTestCaseLegacy() {
override fun runInDispatchThread() = false

private var p: MavenPluginInfo? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
package org.jetbrains.idea.maven.dsl

import com.intellij.buildsystem.model.DeclaredDependency
import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import junit.framework.TestCase
import kotlinx.coroutines.runBlocking
import org.junit.Test

class MavenDependencyModificatorTest : MavenTestCase() {
class MavenDependencyModificatorTest : MavenTestCaseLegacy() {

@Test
fun testShouldReturnDependencyDirectlyDeclared() = runBlocking {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.maven.execution

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import junit.framework.TestCase
import java.io.IOException
import java.nio.file.Path

class MavenExternalParametersVmTest : MavenTestCase() {
class MavenExternalParametersVmTest : MavenTestCaseLegacy() {
@Throws(IOException::class)
fun testGetRunVmOptionsSettingsAndJvm() {
createProjectSubFile(".mvn/jvm.config", "-Xms800m")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
package org.jetbrains.idea.maven.externalSystemIntegration.output.quickfixes

import com.intellij.pom.java.LanguageLevel
import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy

class JpsLanguageLevelQuickFixTest : MavenTestCase() {
class JpsLanguageLevelQuickFixTest : MavenTestCaseLegacy() {
private val jpsLanguageLevelQuickFix = JpsLanguageLevelQuickFix()

fun `test get laguage level 11`() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.maven.importing

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import kotlinx.coroutines.runBlocking
import org.jetbrains.idea.maven.execution.*
import org.junit.Assert
Expand All @@ -12,7 +12,7 @@ import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
import kotlin.String

class ArchetypesTest : MavenTestCase() {
class ArchetypesTest : MavenTestCaseLegacy() {

/**
* very time consumed test (uses the network and -U maven flag)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.maven.importing.workspaceModel

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import junit.framework.TestCase
import kotlinx.coroutines.runBlocking
import org.jetbrains.idea.maven.importing.workspaceModel.ContentRootCollector.collect
Expand All @@ -10,7 +10,7 @@ import org.jetbrains.jps.model.java.JavaSourceRootType
import org.jetbrains.jps.model.module.JpsModuleSourceRootType
import org.junit.Test

class ContentRootCollectorTest : MavenTestCase() {
class ContentRootCollectorTest : MavenTestCaseLegacy() {
@Test
fun `test simple content root`() = runBlocking {
val baseContentRoot = "/home/a/b/c/maven"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.maven.indices

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.platform.ide.progress.runWithModalProgressBlocking
import com.intellij.platform.util.progress.rawProgressReporter
import com.intellij.platform.util.progress.withRawProgressReporter
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import kotlinx.coroutines.runBlocking
import org.jetbrains.idea.maven.MavenCustomRepositoryHelper
import org.jetbrains.idea.maven.model.MavenRepositoryInfo
import org.jetbrains.idea.maven.model.RepositoryKind

class MavenGavIndicesTest : MavenTestCase() {
class MavenGavIndicesTest : MavenTestCaseLegacy() {

fun testUpdateGavIndex() = runBlocking {
val helper = MavenCustomRepositoryHelper(dir, "local1")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.jetbrains.idea.maven.indices

import com.intellij.ide.projectWizard.ProjectWizardTestCase
import com.intellij.ide.util.newProjectWizard.AbstractProjectWizard
import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import com.intellij.openapi.application.EDT
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.LocalFileSystem
Expand Down Expand Up @@ -68,7 +68,7 @@ class MavenMultiProjectImportTest : ProjectWizardTestCase<AbstractProjectWizard?
val projectDir = myDir!!.resolve(dir)
projectDir.toFile().mkdirs()
val pom = projectDir.resolve("pom.xml")
pom.write(MavenTestCase.createPomXml(xml))
pom.write(MavenTestCaseLegacy.createPomXml(xml))
return LocalFileSystem.getInstance().refreshAndFindFileByNioFile(pom)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package org.jetbrains.idea.maven.project

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy

class MavenEmbeddersManagerTest : MavenTestCase() {
class MavenEmbeddersManagerTest : MavenTestCaseLegacy() {
private var myManager: MavenEmbeddersManager? = null

override fun setUp() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.maven.project

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import com.intellij.openapi.command.impl.DummyProject
import com.intellij.ui.TextFieldWithHistory
import com.intellij.util.ReflectionUtil
Expand All @@ -13,7 +13,7 @@ import org.junit.runner.RunWith
import org.junit.runners.JUnit4

@RunWith(JUnit4::class)
class MavenEnvironmentFormTest : MavenTestCase() {
class MavenEnvironmentFormTest : MavenTestCaseLegacy() {
@Test
fun shouldNotShowDuplicatedBundledMavenHome() {
val panel = MavenGeneralPanel()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.maven.project

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.idea.maven.model.MavenExplicitProfiles
import org.jetbrains.idea.maven.model.MavenId
import org.jetbrains.idea.maven.model.MavenModel

abstract class MavenProjectReaderTestCase : MavenTestCase() {
abstract class MavenProjectReaderTestCase : MavenTestCaseLegacy() {
protected suspend fun readProject(file: VirtualFile, vararg profiles: String): MavenModel {
val readResult = readProject(file, NullProjectLocator(), *profiles)
assertProblems(readResult)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.jetbrains.idea.maven.project

import com.intellij.configurationStore.deserializeState
import com.intellij.configurationStore.jdomSerializer
import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import com.intellij.openapi.components.ComponentManager
import com.intellij.openapi.externalSystem.autoimport.AutoImportProjectTrackerSettings
import com.intellij.openapi.externalSystem.autoimport.ExternalSystemProjectTrackerSettings
Expand All @@ -15,7 +15,7 @@ import junit.framework.TestCase
import org.jdom.output.XMLOutputter
import org.jetbrains.idea.maven.utils.MavenSettings

class MavenSettingsTest : MavenTestCase() {
class MavenSettingsTest : MavenTestCaseLegacy() {
fun testCloningGeneralSettingsWithoutListeners() {
val log: Array<String> = arrayOf<String>("")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package org.jetbrains.idea.maven.server

import com.intellij.execution.rmi.RemoteProcessSupport
import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.progress.runBlockingMaybeCancellable
import com.intellij.openapi.util.ThrowableComputable
Expand All @@ -13,12 +13,11 @@ import com.intellij.util.ReflectionUtil
import com.intellij.util.WaitFor
import kotlinx.coroutines.runBlocking
import org.jetbrains.idea.maven.project.MavenWorkspaceSettingsComponent
import org.jetbrains.idea.maven.server.MavenServerConnectorImpl
import java.io.File
import java.util.concurrent.*
import java.util.concurrent.atomic.AtomicReference

class MavenServerManagerTest : MavenTestCase() {
class MavenServerManagerTest : MavenTestCaseLegacy() {
fun testInitializingDoesntTakeReadAction() = runBlocking {
//make sure all components are initialized to prevent deadlocks
ensureConnected(MavenServerManager.getInstance().getConnector(project, projectRoot.path))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.maven.utils

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy

class FileFinderTest : MavenTestCase() {
class FileFinderTest : MavenTestCaseLegacy() {

private val pomContent = """
<project xmlns="http://maven.apache.org/POM/4.0.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.maven.utils

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import junit.framework.TestCase
import kotlinx.coroutines.runBlocking
import org.junit.Test

class MavenArtifactUtilTest : MavenTestCase() {
class MavenArtifactUtilTest : MavenTestCaseLegacy() {
@Test
fun `test get artifact path with illegal newline char in version`() = runBlocking {
val groupId = "groupId"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/
package org.jetbrains.idea.maven.utils

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import kotlinx.coroutines.runBlocking
import java.io.IOException

class MavenJDOMUtilTest : MavenTestCase() {
class MavenJDOMUtilTest : MavenTestCaseLegacy() {
fun testReadingValuesWithComments() = runBlocking {
assertEquals("aaa", readValue("<root><foo>aaa<!--a--></foo></root>", "foo"))
assertEquals("aaa", readValue("""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.maven.utils;

import com.intellij.maven.testFramework.MavenTestCase;
import com.intellij.maven.testFramework.MavenTestCaseLegacy;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.idea.maven.model.MavenId;
import org.jetbrains.idea.maven.server.MavenServerUtil;
Expand All @@ -10,7 +10,7 @@
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;

public class MavenUtilTest extends MavenTestCase {
public class MavenUtilTest extends MavenTestCaseLegacy {

public void testFindExtension() throws IOException {
VirtualFile file = createProjectSubFile(".mvn/extensions.xml", """
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.maven.wizards

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.testFramework.TestActionEvent
Expand All @@ -16,7 +16,7 @@ class MavenAddFileAsMavenProjectActionTest : MavenProjectWizardTestCase() {
fun `test import non-default pom`() = runBlocking {
val pom1: Path = createPom()
val pom2 = pom1.parent.resolve("pom2.xml")
pom2.write(MavenTestCase.createPomXml(
pom2.write(MavenTestCaseLegacy.createPomXml(
"""
<groupId>test</groupId>
<artifactId>project2</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.idea.maven.wizards

import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import com.intellij.maven.testFramework.assertWithinTimeout
import com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsManagerImpl
import com.intellij.openapi.module.ModuleManager
Expand Down Expand Up @@ -59,7 +59,7 @@ class MavenImportWizardTest : MavenProjectWizardTestCase() {
fun testImportProjectWithManyPoms() = runBlocking {
val pom1 = createPom("pom1.xml")
val pom2 = pom1.parent.resolve("pom2.xml")
pom2.write(MavenTestCase.createPomXml(
pom2.write(MavenTestCaseLegacy.createPomXml(
"""
<groupId>test</groupId>
<artifactId>project2</artifactId>
Expand Down Expand Up @@ -87,7 +87,7 @@ class MavenImportWizardTest : MavenProjectWizardTestCase() {
val dir = tempDir.newPath("", true)
val projectName = dir.toFile().getName()
val pom = dir.resolve("pom.xml")
pom.write(MavenTestCase.createPomXml(
pom.write(MavenTestCaseLegacy.createPomXml(
"""
<groupId>test</groupId>
<artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package org.jetbrains.idea.maven.wizards

import com.intellij.ide.projectWizard.ProjectWizardTestCase
import com.intellij.ide.util.newProjectWizard.AbstractProjectWizard
import com.intellij.maven.testFramework.MavenTestCase
import com.intellij.maven.testFramework.MavenTestCaseLegacy
import com.intellij.openapi.application.EDT
import com.intellij.openapi.module.Module
import com.intellij.openapi.projectRoots.impl.JavaAwareProjectJdkTableImpl
Expand Down Expand Up @@ -37,7 +37,7 @@ abstract class MavenProjectWizardTestCase : ProjectWizardTestCase<AbstractProjec
}

protected fun createPom(pomName: String): Path {
return createTempFile(pomName, MavenTestCase.createPomXml(
return createTempFile(pomName, MavenTestCaseLegacy.createPomXml(
"""
<groupId>test</groupId>
<artifactId>project</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import java.util.concurrent.TimeUnit
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicInteger

abstract class MavenImportingTestCase : MavenNioTestCase() {
abstract class MavenImportingTestCase : MavenTestCase() {

private var myProjectsManager: MavenProjectsManager? = null
private var myCodeStyleSettingsTracker: CodeStyleSettingsTracker? = null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicInteger

@Deprecated("Use 'MavenImportingTestCase'")
abstract class MavenImportingTestCaseLegacy : MavenTestCase() {
abstract class MavenImportingTestCaseLegacy : MavenTestCaseLegacy() {
private var myProjectsManager: MavenProjectsManager? = null
private var myCodeStyleSettingsTracker: CodeStyleSettingsTracker? = null
private var myNotificationAware: AutoImportProjectNotificationAware? = null
Expand Down
Loading

0 comments on commit 0fd6650

Please sign in to comment.