mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[maven] test code cleanup
GitOrigin-RevId: c60f1ee534ba8b75722974130798550b18d95c11
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ab9da69a5d
commit
c7816b45a4
+108
-126
@@ -12,137 +12,123 @@ class MavenSetupProjectTest : MavenSetupProjectTestCase() {
|
||||
|
||||
@Test
|
||||
fun `test settings are not reset`() = runBlocking {
|
||||
runBlocking {
|
||||
val projectInfo = generateProject("A")
|
||||
val linkedProjectInfo = generateProject("L")
|
||||
val projectInfo = generateProject("A")
|
||||
val linkedProjectInfo = generateProject("L")
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync {
|
||||
assertProjectState(it, projectInfo)
|
||||
getGeneralSettings(it).isWorkOffline = true
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync {
|
||||
assertProjectState(it, projectInfo)
|
||||
getGeneralSettings(it).isWorkOffline = true
|
||||
waitForImport {
|
||||
attachProjectAsync(it, linkedProjectInfo.projectFile)
|
||||
}
|
||||
assertProjectState(it, projectInfo, linkedProjectInfo)
|
||||
assertTrue(getGeneralSettings(it).isWorkOffline)
|
||||
attachProjectAsync(it, linkedProjectInfo.projectFile)
|
||||
}
|
||||
assertProjectState(it, projectInfo, linkedProjectInfo)
|
||||
assertTrue(getGeneralSettings(it).isWorkOffline)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test project open`() = runBlocking {
|
||||
runBlocking {
|
||||
val projectInfo = generateProject("A")
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync {
|
||||
assertProjectState(it, projectInfo)
|
||||
val projectInfo = generateProject("A")
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync {
|
||||
assertProjectState(it, projectInfo)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test project import`() = runBlocking {
|
||||
runBlocking {
|
||||
val projectInfo = generateProject("A")
|
||||
waitForImport {
|
||||
importProjectActionAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync {
|
||||
assertProjectState(it, projectInfo)
|
||||
val projectInfo = generateProject("A")
|
||||
waitForImport {
|
||||
importProjectActionAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync {
|
||||
assertProjectState(it, projectInfo)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test project attach`() = runBlocking {
|
||||
runBlocking {
|
||||
val projectInfo = generateProject("A")
|
||||
openPlatformProjectAsync(projectInfo.projectFile.parent)
|
||||
.useProjectAsync {
|
||||
waitForImport {
|
||||
attachProjectAsync(it, projectInfo.projectFile)
|
||||
}
|
||||
assertProjectState(it, projectInfo)
|
||||
val projectInfo = generateProject("A")
|
||||
openPlatformProjectAsync(projectInfo.projectFile.parent)
|
||||
.useProjectAsync {
|
||||
waitForImport {
|
||||
attachProjectAsync(it, projectInfo.projectFile)
|
||||
}
|
||||
}
|
||||
assertProjectState(it, projectInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test project import from script`() = runBlocking {
|
||||
runBlocking {
|
||||
val projectInfo = generateProject("A")
|
||||
openPlatformProjectAsync(projectInfo.projectFile.parent)
|
||||
.useProjectAsync {
|
||||
waitForImport {
|
||||
attachProjectFromScriptAsync(it, projectInfo.projectFile)
|
||||
}
|
||||
assertProjectState(it, projectInfo)
|
||||
val projectInfo = generateProject("A")
|
||||
openPlatformProjectAsync(projectInfo.projectFile.parent)
|
||||
.useProjectAsync {
|
||||
waitForImport {
|
||||
attachProjectFromScriptAsync(it, projectInfo.projectFile)
|
||||
}
|
||||
}
|
||||
assertProjectState(it, projectInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test module attach`() = runBlocking {
|
||||
runBlocking {
|
||||
val projectInfo = generateProject("A")
|
||||
val linkedProjectInfo = generateProject("L")
|
||||
val projectInfo = generateProject("A")
|
||||
val linkedProjectInfo = generateProject("L")
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync {
|
||||
assertProjectState(it, projectInfo)
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync {
|
||||
assertProjectState(it, projectInfo)
|
||||
waitForImport {
|
||||
attachProjectAsync(it, linkedProjectInfo.projectFile)
|
||||
}
|
||||
assertProjectState(it, projectInfo, linkedProjectInfo)
|
||||
attachProjectAsync(it, linkedProjectInfo.projectFile)
|
||||
}
|
||||
assertProjectState(it, projectInfo, linkedProjectInfo)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test project re-open`() = runBlocking {
|
||||
runBlocking {
|
||||
val projectInfo = generateProject("A")
|
||||
val linkedProjectInfo = generateProject("L")
|
||||
val projectInfo = generateProject("A")
|
||||
val linkedProjectInfo = generateProject("L")
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync(save = true) {
|
||||
assertProjectState(it, projectInfo)
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync(save = true) {
|
||||
assertProjectState(it, projectInfo)
|
||||
waitForImport {
|
||||
attachProjectAsync(it, linkedProjectInfo.projectFile)
|
||||
}
|
||||
attachProjectAsync(it, linkedProjectInfo.projectFile)
|
||||
}
|
||||
assertProjectState(it, projectInfo, linkedProjectInfo)
|
||||
}
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
.useProjectAsync {
|
||||
assertProjectState(it, projectInfo, linkedProjectInfo)
|
||||
}
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
.useProjectAsync {
|
||||
assertProjectState(it, projectInfo, linkedProjectInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test project re-open with same module name in different cases`() = runBlocking {
|
||||
val projectPom = createModulePom("project-name", """
|
||||
<groupId>test</groupId>
|
||||
<artifactId>project</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1</version>
|
||||
<modules>
|
||||
<module>dir1/m</module>
|
||||
<module>dir2/M</module>
|
||||
</modules>
|
||||
""".trimIndent())
|
||||
<groupId>test</groupId>
|
||||
<artifactId>project</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1</version>
|
||||
<modules>
|
||||
<module>dir1/m</module>
|
||||
<module>dir2/M</module>
|
||||
</modules>
|
||||
""".trimIndent())
|
||||
createModulePom("project-name/dir1/m", """
|
||||
<groupId>test</groupId>
|
||||
<artifactId>m</artifactId>
|
||||
<version>1</version>
|
||||
""".trimIndent())
|
||||
<groupId>test</groupId>
|
||||
<artifactId>m</artifactId>
|
||||
<version>1</version>
|
||||
""".trimIndent())
|
||||
createModulePom("project-name/dir2/M", """
|
||||
<groupId>test</groupId>
|
||||
<artifactId>M</artifactId>
|
||||
<version>1</version>
|
||||
""".trimIndent())
|
||||
<groupId>test</groupId>
|
||||
<artifactId>M</artifactId>
|
||||
<version>1</version>
|
||||
""".trimIndent())
|
||||
|
||||
runBlocking {
|
||||
val projectInfo = ProjectInfo(projectPom, "project", "m (1)", "M (2)")
|
||||
@@ -160,58 +146,54 @@ class MavenSetupProjectTest : MavenSetupProjectTestCase() {
|
||||
|
||||
@Test
|
||||
fun `test project re-import deprecation`() = runBlocking {
|
||||
runBlocking {
|
||||
val projectInfo = generateProject("A")
|
||||
val linkedProjectInfo = generateProject("L")
|
||||
val projectInfo = generateProject("A")
|
||||
val linkedProjectInfo = generateProject("L")
|
||||
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync(save = true) {
|
||||
assertProjectState(it, projectInfo)
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync(save = true) {
|
||||
assertProjectState(it, projectInfo)
|
||||
waitForImport {
|
||||
attachProjectAsync(it, linkedProjectInfo.projectFile)
|
||||
}
|
||||
attachProjectAsync(it, linkedProjectInfo.projectFile)
|
||||
}
|
||||
assertProjectState(it, projectInfo, linkedProjectInfo)
|
||||
}
|
||||
importProjectActionAsync(projectInfo.projectFile)
|
||||
.useProjectAsync {
|
||||
assertProjectState(it, projectInfo, linkedProjectInfo)
|
||||
}
|
||||
importProjectActionAsync(projectInfo.projectFile)
|
||||
.useProjectAsync {
|
||||
assertProjectState(it, projectInfo, linkedProjectInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `test workspace import forcibly enabled once per project`() = runBlocking {
|
||||
runBlocking {
|
||||
val projectInfo = generateProject("A")
|
||||
val projectInfo = generateProject("A")
|
||||
|
||||
MavenProjectLegacyImporter.setAnswerToDeleteObsoleteModulesQuestion(true)
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync(true) {
|
||||
// initial state: workspace import is disabled, has not been forced yet
|
||||
val mavenProjectsManager = MavenProjectsManager.getInstance(it)
|
||||
mavenProjectsManager.state!!.workspaceImportForciblyTurnedOn = false
|
||||
mavenProjectsManager.importingSettings.isWorkspaceImportEnabled = false
|
||||
}
|
||||
MavenProjectLegacyImporter.setAnswerToDeleteObsoleteModulesQuestion(true)
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync(true) {
|
||||
// initial state: workspace import is disabled, has not been forced yet
|
||||
val mavenProjectsManager = MavenProjectsManager.getInstance(it)
|
||||
mavenProjectsManager.state!!.workspaceImportForciblyTurnedOn = false
|
||||
mavenProjectsManager.importingSettings.isWorkspaceImportEnabled = false
|
||||
}
|
||||
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync(true) {
|
||||
// check that workspace import has been forced
|
||||
val mavenProjectsManager = MavenProjectsManager.getInstance(it)
|
||||
assertTrue(mavenProjectsManager.importingSettings.isWorkspaceImportEnabled)
|
||||
// user still chooses legacy import
|
||||
mavenProjectsManager.importingSettings.isWorkspaceImportEnabled = false
|
||||
}
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync(true) {
|
||||
// check that workspace import has been forced
|
||||
val mavenProjectsManager = MavenProjectsManager.getInstance(it)
|
||||
assertTrue(mavenProjectsManager.importingSettings.isWorkspaceImportEnabled)
|
||||
// user still chooses legacy import
|
||||
mavenProjectsManager.importingSettings.isWorkspaceImportEnabled = false
|
||||
}
|
||||
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync(true) {
|
||||
// check that workspace import has not been forced twice
|
||||
val mavenProjectsManager = MavenProjectsManager.getInstance(it)
|
||||
assertFalse(mavenProjectsManager.importingSettings.isWorkspaceImportEnabled)
|
||||
}
|
||||
waitForImport {
|
||||
openProjectAsync(projectInfo.projectFile)
|
||||
}.useProjectAsync(true) {
|
||||
// check that workspace import has not been forced twice
|
||||
val mavenProjectsManager = MavenProjectsManager.getInstance(it)
|
||||
assertFalse(mavenProjectsManager.importingSettings.isWorkspaceImportEnabled)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user