diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/GradleOutdatedLibraryVersionTest.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/GradleOutdatedLibraryVersionTest.groovy deleted file mode 100644 index 55daa27c1757..000000000000 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/GradleOutdatedLibraryVersionTest.groovy +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jetbrains.plugins.gradle.sync - -import com.intellij.openapi.externalSystem.settings.ExternalSystemTextAttributes -import org.jetbrains.plugins.gradle.testutil.AbstractGradleTest -import org.junit.Test - -/** - * @author Denis Zhdanov - * @since 1/22/13 3:04 PM - */ -class GradleOutdatedLibraryVersionTest extends AbstractGradleTest { - - // TODO den remove - @Test - void "dummy"() { - } - -// @Test -// void "changed library version change construction and representation"() { -// def gradleProject = { -// project { -// module('module1') { -// dependencies { -// library('lib-2', bin: ['jar1-2', 'jar2-2']) } } -// module('module2') { -// dependencies { -// library('lib-2', bin: ['jar1-2', 'jar2-2']) } } } } -// -// init( -// gradle: gradleProject, -// -// intellij: { -// project { -// module('module1') { -// dependencies { -// library('lib-1', bin: ['jar1-1', 'jar2-1']) } } -// module('module2') { -// dependencies { -// library('lib-1', bin: ['jar1-1', 'jar2-1']) } } } -// } -// ) -// -// checkChanges { -// libraryVersion ( -// name: 'lib', -// gradleVersion: '2', -// gradleLibraryId: findLibraryId('lib-2', true), -// ideVersion: '1', -// ideLibraryId: findLibraryId('lib-1', false) -// ) -// } -// -// checkTree { -// project { -// module1 { -// dependencies { -// 'lib (1 -> 2)' ('outdated') } } -// module2 { -// dependencies { -// 'lib (1 -> 2)' ('outdated') } } } } -// -// // Emulate 'sync library' and check how obsolete change is processed. -// setState(intellij: gradleProject) -// checkChanges { } // No changes -// checkTree { -// project { -// module1 { -// dependencies { -// 'lib-2' { -// 'jar1-2'() -// 'jar2-2'() } } } -// module2 { -// dependencies { -// 'lib-2' { -// 'jar1-2'() -// 'jar2-2'() } } } } } -// } -// -// @Test -// void "'outdated' filter processing"() { -// init( -// gradle: { -// project { -// module('module1') { -// dependencies { -// library('lib-2', bin: ['jar1-2', 'jar2-2']) -// library('same-lib') } } -// module('module2') { -// dependencies { -// library('lib-2', bin: ['jar1-2', 'jar2-2']) } } } }, -// -// intellij: { -// project { -// module('module1') { -// dependencies { -// library('lib-1', bin: ['jar1-1', 'jar2-1']) -// library('same-lib')} } -// module('module2') { -// dependencies { -// library('lib-1', bin: ['jar1-1', 'jar2-1']) } } } } -// ) -// -// applyTreeFilter(ExternalSystemTextAttributes.OUTDATED_ENTITY) -// checkTree { -// project { -// module1 { -// dependencies { -// 'lib (1 -> 2)' ('outdated') -// } } -// module2 { -// dependencies { -// 'lib (1 -> 2)' ('outdated') } } } } -// -// resetTreeFilter(ExternalSystemTextAttributes.OUTDATED_ENTITY) -// checkTree { -// project { -// module1 { -// dependencies { -// 'lib (1 -> 2)' ('outdated') -// 'same-lib'() -// } } -// module2 { -// dependencies { -// 'lib (1 -> 2)' ('outdated') } } } } -// } -// -// @Test -// void "gradle-local library after outdated library"() { -// init( -// gradle: { -// project { -// module { -// dependencies { -// library('lib1-1') } } } }, -// intellij: { -// project { -// module { -// dependencies { -// library('lib1-1') } } } } ) -// checkChanges {} -// -// setState(gradle: { -// project { -// module { -// dependencies { -// library('lib1-2')} } } } ) -// -// checkChanges { -// libraryVersion ( -// name: 'lib1', -// gradleVersion: '2', -// gradleLibraryId: findLibraryId('lib1-2', true), -// ideVersion: '1', -// ideLibraryId: findLibraryId('lib1-1', false) -// ) -// } -// checkTree { -// project { -// module { -// dependencies { -// 'lib1 (1 -> 2)' ('outdated')} } } } -// -// setState(gradle: { -// project { -// module { -// dependencies { -// library('lib1-2') -// library('lib2-1') } } } } ) -// checkChanges { -// libraryVersion ( -// name: 'lib1', -// gradleVersion: '2', -// gradleLibraryId: findLibraryId('lib1-2', true), -// ideVersion: '1', -// ideLibraryId: findLibraryId('lib1-1', false) -// ) -// presence { -// library(gradle: gradle.libraryDependencies.values().flatten().findAll { it.name == "lib2-1" }) -// } -// } -// checkTree { -// project { -// module { -// dependencies { -// 'lib2-1' ('gradle') -// 'lib1 (1 -> 2)' ('outdated') -// } } } } -// } -// -// @Test -// void "outdated library dependencies at one module and gradle-local at another"() { -// init( -// gradle: { -// project { -// module('module1') { -// dependencies { -// library('lib-2')} } -// module ('module2') { -// dependencies { -// library('lib-2')} } } }, -// intellij: { -// project { -// module('module1') { -// dependencies { -// library('lib-1')} } -// module('module2') { -// dependencies()} } } -// ) -// checkTree { -// project { -// module1 { -// dependencies { -// 'lib (1 -> 2)'('outdated') } } -// module2 { -// dependencies { -// 'lib-2'('gradle') } } } } -// } -// -// @Test -// void "new outdated library dependency on active 'outdated' filter"() { -// Closure initialProject = { -// project { -// module { -// dependencies { -// library('lib-1') } } } } -// init(gradle: initialProject, intellij: initialProject) -// applyTreeFilter(ExternalSystemTextAttributes.OUTDATED_ENTITY) -// setState(gradle: { -// project { -// module { -// dependencies { -// library('lib-2')} } } } ) -// checkTree { -// project { -// module { -// dependencies { -// 'lib (1 -> 2)'('outdated') -// } } } } -// } -} diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/MovedJarsPostProcessorTest.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/MovedJarsPostProcessorTest.groovy deleted file mode 100644 index 398dec2f792a..000000000000 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/MovedJarsPostProcessorTest.groovy +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jetbrains.plugins.gradle.sync - -import com.intellij.openapi.roots.libraries.Library -import com.intellij.openapi.externalSystem.service.project.manage.JarDataService -import com.intellij.openapi.externalSystem.model.project.JarData -import com.intellij.openapi.externalSystem.model.project.LibraryData -import com.intellij.openapi.externalSystem.model.project.LibraryPathType -import org.jetbrains.plugins.gradle.testutil.AbstractGradleTest -import org.jetbrains.plugins.gradle.util.GradleUtil -import org.jetbrains.plugins.gradle.util.TestExternalJarManager -import org.junit.Assert -import org.junit.Test - -/** - * @author Denis Zhdanov - * @since 1/17/13 4:40 PM - */ -class MovedJarsPostProcessorTest extends AbstractGradleTest { - - @Test - void "moved jar matched"() { - // TODO den uncomment - //init( - // gradle: { - // project { - // module { - // dependencies { - // library('lib1', bin: ['repo1/jar1', 'repo1/jar2'], src: [ 'repo1/zip1', 'repo1/zip2']) }}}}, - // intellij: { - // project { - // module { - // dependencies { - // library('lib1', bin: ['repo2/jar1', 'repo2/jar2'], src: [ 'repo2/zip1', 'repo2/zip2']) }}}} - //) - // - //checkChanges { } - // - //def gradleLibrary = gradle.libraries['lib1'] as LibraryData - //def ideLibrary = intellij.libraries['lib1'] as Library - //def expectedImported = [ - // new JarData(GradleUtil.toCanonicalPath('repo1/jar1'), LibraryPathType.BINARY, null, gradleLibrary), - // new JarData(GradleUtil.toCanonicalPath('repo1/jar2'), LibraryPathType.BINARY, null, gradleLibrary), - // new JarData(GradleUtil.toCanonicalPath('repo1/zip1'), LibraryPathType.SOURCE, null, gradleLibrary), - // new JarData(GradleUtil.toCanonicalPath('repo1/zip2'), LibraryPathType.SOURCE, null, gradleLibrary), - //] - // - //def expectedRemoved = [ - // new JarData(GradleUtil.toCanonicalPath('repo2/jar1'), LibraryPathType.BINARY, ideLibrary, null), - // new JarData(GradleUtil.toCanonicalPath('repo2/jar2'), LibraryPathType.BINARY, ideLibrary, null), - // new JarData(GradleUtil.toCanonicalPath('repo2/zip1'), LibraryPathType.SOURCE, ideLibrary, null), - // new JarData(GradleUtil.toCanonicalPath('repo2/zip2'), LibraryPathType.SOURCE, ideLibrary, null), - //] - //TestExternalJarManager jarManager = container.getComponentInstance(JarDataService) - //Assert.assertEquals(expectedImported.toSet(), jarManager.importedJars.toSet()) - //Assert.assertEquals(expectedRemoved.toSet(), jarManager.removedJars.toSet()) - } -} diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/ProjectStructureChangesModelTest.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/ProjectStructureChangesModelTest.groovy deleted file mode 100644 index 8b129601b39d..000000000000 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/sync/ProjectStructureChangesModelTest.groovy +++ /dev/null @@ -1,925 +0,0 @@ -package org.jetbrains.plugins.gradle.sync - -import com.intellij.testFramework.SkipInHeadlessEnvironment -import com.intellij.openapi.externalSystem.model.project.change.JarPresenceChange -import com.intellij.openapi.externalSystem.model.project.change.ModulePresenceChange -import org.jetbrains.plugins.gradle.testutil.AbstractGradleTest -import org.jetbrains.plugins.gradle.testutil.AbstractProjectBuilder -import org.junit.Before -import org.junit.Test - -import static org.junit.Assert.assertEquals -import com.intellij.openapi.externalSystem.model.project.change.LibraryDependencyPresenceChange -import com.intellij.openapi.externalSystem.settings.ExternalSystemTextAttributes - -/** - * @author Denis Zhdanov - * @since 01/25/2012 - */ -@SkipInHeadlessEnvironment -public class ProjectStructureChangesModelTest extends AbstractGradleTest { - - @Before - public void setUp() { - super.setUp() - // TODO den uncomment -// clearChangePostProcessors() - } - - // TODO den remove - @Test - void "dummy"() { - } - - // TODO den uncomment -// @Test -// public void "obsolete gradle-local modules"() { -// // Configure initial projects state. -// init( -// gradle: { -// project { -// module { -// dependencies { -// library("lib1") -// library("lib2") -// library("lib3") -// } } } }, -// -// intellij: { -// project { -// module { -// dependencies { -// library("lib1") -// } } } }, -// changesSorter: { a, b -> -// b.getExternalEntity.dependencyName.compareTo(a.getExternalEntity.dependencyName) -// } -// ) -// -// // Check that the initial projects state is correctly parsed. -// checkChanges { -// presence { -// library(gradle: gradle.libraryDependencies.values().flatten().findAll { it.name == "lib2" }) -// library(gradle: gradle.libraryDependencies.values().flatten().findAll { it.name == "lib3" }) -// } } -// checkTree { -// project { -// module() { -// dependencies { -// lib2('gradle') // Gradle-local entities are on top -// lib3('gradle') // Gradle-local entities are on top -// lib1() -// } } } } -// -// // Add the same library at intellij side. Expecting to have the only change now. -// setState(intellij: { -// project { -// module { -// dependencies { -// library("lib1") -// library("lib2") -// } } } }) -// -// checkChanges { -// presence { -// library(gradle: gradle.libraryDependencies.values().flatten().findAll { it.name == "lib3" }) -// } } -// checkTree { -// project { -// module() { -// dependencies { -// lib3('gradle') // Gradle-local entities are on top -// lib1() -// lib2() -// } } } } -// -// // Remove the 'gradle local' dependency. -// setState(gradle: { -// project { -// module { -// dependencies { -// library("lib1") -// library("lib2") -// } } } }) -// -// checkChanges { } // no changes. -// assertEquals([].toSet(), changesModel.changes) -// checkTree { -// project { -// module { -// dependencies { -// lib1() -// lib2() -// } } } } -// } -// -// @Test -// public void "library dependencies on binary paths"() { -// // Let the model has two differences in a library setup initially. -// init( -// gradle: { -// project { -// module { -// dependencies { -// library("lib1") -// library("lib2", bin: ['jar1', 'jar2']) } } } }, -// intellij: { -// project { -// module { -// dependencies { -// library("lib1") -// library("lib2", bin: ['jar2', 'jar3']) } } } }) -// -// checkChanges { -// presence { -// jar(gradle: [findJarId('jar1')]) -// jar(intellij: [findJarId('jar3')]) -// } -// } -// -// checkTree { -// project { -// module { -// dependencies { -// lib1() -// lib2 { -// jar1('gradle') -// jar2() -// jar3('intellij') } } } } } -// -// // Remove one difference from the library setup and check that the corresponding node is still marked as conflicted -// setState( -// gradle: { -// project { -// module { -// dependencies { -// library("lib1") -// library("lib2", bin: ['jar2']) } } } }, -// intellij: { -// project { -// module { -// dependencies { -// library("lib1") -// library("lib2", bin: ['jar2', 'jar3']) } } } }) -// -// checkChanges { -// presence { -// jar(intellij: [findJarId('jar3')]) -// } -// } -// -// checkTree { -// project { -// module { -// dependencies { -// lib1() -// lib2 { -// jar2() -// jar3('intellij') } } } } } -// -// // Match the remaining change and check that the corresponding node is not marked as conflicted anymore. -// setState( -// gradle: { -// project { -// module { -// dependencies { -// library("lib1") -// library("lib2", bin: ['jar2', 'jar3']) -// } } } }, -// intellij: { -// project { -// module { -// dependencies { -// library("lib1") -// library("lib2", bin: ['jar2', 'jar3']) } } } }) -// checkChanges { } // No changes -// checkTree { -// project { -// module { -// dependencies { -// lib1() -// lib2 { -// jar2() -// jar3() } } } } } -// } -// -// @Test -// public void "gradle-local module which library setup differs from intellij when jar presence change goes first"() { -// init( -// gradle: { -// project { -// module('module1') { -// dependencies { -// library("lib1", bin: ['jar1', 'jar2']) }} -// module('module2') { -// dependencies { -// library("lib1", bin: ['jar1', 'jar2']) } } } }, -// intellij: { -// project { -// module('module1') { -// dependencies { -// library("lib1", bin: ['jar2', 'jar3']) } } } }, -// changesSorter: changeByClassSorter([ -// (JarPresenceChange) : 1, -// (LibraryDependencyPresenceChange) : 2, -// (ModulePresenceChange) : 3, -// ]) -// ) -// -// checkChanges { -// presence { -// jar(gradle: [findJarId('jar1')]) -// jar(intellij: [findJarId('jar3')]) -// library(gradle: gradle.libraryDependencies[gradle.modules['module2']].find { it.name == "lib1" }) -// module(gradle: gradle.modules['module2']) -// } -// } -// -// checkTree { -// project { -// module2('gradle') { -// dependencies { -// lib1('gradle') { -// jar1('gradle') -// jar2() -// jar3('intellij')} } } -// module1 { -// dependencies { -// lib1 { -// jar1('gradle') -// jar2() -// jar3('intellij') } } } } } -// } -// -// @Test -// public void "adding intellij-local jar"() { -// Closure initialProject = { -// project { -// module { -// dependencies { -// library('lib1', bin: ['jar1'])} } } } -// init(gradle: initialProject, intellij: initialProject) -// checkChanges {} // empty -// -// setState( -// intellij: { -// project { -// module { -// dependencies { -// library('lib1', bin: ['jar1', 'jar2']) -// } } } } -// ) -// -// checkChanges { -// presence { -// jar(intellij: [findJarId('jar2')]) -// } } -// checkTree { -// project { -// module { -// dependencies { -// lib1 { -// jar1() -// jar2('intellij')} } } } } -// } -// -// @Test -// public void "intellij module removal"() { -// Closure initialClosure = { -// project { -// module('module1') -// module('module2') { -// dependencies { -// library('lib1') -// library('lib2') -// } } } } -// init(gradle: initialClosure, intellij: initialClosure) -// checkChanges { } // No changes -// checkTree { -// project { -// module1() -// module2() { -// dependencies { -// lib1() -// lib2() -// } } } } -// -// setState(intellij: { -// project { -// module('module1') -// } } ) -// checkChanges { -// presence { -// module(gradle: gradle.modules['module2']) -// libraryDependency(gradle: gradle.modules['module2'].dependencies) -// } } -// checkTree { -// project { -// module2('gradle') { -// dependencies { -// lib1('gradle') -// lib2('gradle') -// } } -// module1() -// } } -// } -// -// @Test -// public void "gradle-local module is not treated as 'local' after import"() { -// init( -// gradle: { -// project { -// module('module1') -// module('module2') -// } }, -// intellij: { -// project { -// module('module1') -// } } -// ) -// checkChanges { -// presence { -// module(gradle: gradle.modules['module2']) -// } } -// checkTree { -// project { -// module2('gradle') -// module1() -// } } -// -// // Emulate import gradle module to intellij. -// setState(intellij: { -// project { -// module('module1') -// module('module2') -// } }) -// checkChanges { } // No changes -// checkTree { -// project { -// module1() -// module2() // Imported module node is not highlighted anymore. -// } } -// } -// -// @Test -// public void "mismatched module dependency import"() { -// init( -// gradle: { -// project { -// module('module1') -// module('module2') -// module('module3') { -// dependencies { -// module('module1') -// module('module2') -// } } } }, -// intellij: { -// project { -// module('module2') -// module('module4') -// module('module3') { -// dependencies { -// module('module2') -// module('module4') -// } } } } -// ) -// checkChanges { -// presence { -// module(gradle: gradle.modules['module1']) -// module(intellij: intellij.modules['module4']) -// moduleDependency(gradle: gradle.moduleDependencies[gradle.modules['module3']].find { it.target == gradle.modules['module1']}) -// moduleDependency(intellij: intellij.moduleDependencies[intellij.modules['module3']].find { it.moduleName == 'module4'}) -// } } -// checkTree { -// project { -// module1('gradle') -// module2() -// module3() { -// dependencies { -// module1('gradle') -// module2() -// module4('intellij') -// } } -// module4('intellij') -// } } -// -// Closure newProjectState = { -// project { -// module('module1') -// module('module2') -// module('module4') -// module('module3') { -// dependencies { -// module('module1') -// module('module2') -// module('module4') -// } } } } -// setState(gradle: newProjectState, intellij: newProjectState) -// checkChanges { } // No changes -// checkTree { -// project { -// module1() -// module2() -// module3 { -// dependencies { -// module1() -// module2() -// module4() -// } } -// module4() -// } } -// } -// -// @Test -// public void "mismatched module dependency removal"() { -// init( -// gradle: { -// project { -// module('module1') -// module('module2') -// module('module3') { -// dependencies { -// module('module1') -// module('module2') -// } } } }, -// intellij: { -// project { -// module('module2') -// module('module4') -// module('module3') { -// dependencies { -// module('module2') -// module('module4') -// } } } } -// ) -// checkChanges { -// presence { -// module(gradle: gradle.modules['module1']) -// module(intellij: intellij.modules['module4']) -// moduleDependency(gradle: gradle.moduleDependencies[gradle.modules['module3']].find { it.target == gradle.modules['module1']}) -// moduleDependency(intellij: intellij.moduleDependencies[intellij.modules['module3']].find { it.moduleName == 'module4'}) -// } } -// checkTree { -// project { -// module1('gradle') -// module2() -// module3() { -// dependencies { -// module1('gradle') -// module2() -// module4('intellij') -// } } -// module4('intellij') -// } } -// -// Closure newProjectState = { -// project { -// module('module2') -// module('module3') { -// dependencies { -// module('module2') -// } } } } -// setState(gradle: newProjectState, intellij: newProjectState) -// checkChanges { } // No changes -// checkTree { -// project { -// module2() -// module3 { -// dependencies { -// module2() -// } } } } -// } -// -// @Test -// public void "cycled module dependencies"() { -// init( -// gradle: { -// project { -// module('module1') { -// dependencies { -// module('module2') -// } } -// module('module2') { -// dependencies { -// module('module1') -// } } } }, -// intellij: { -// project { -// module('module2') { -// dependencies { -// module('module3') -// } } -// module('module3') { -// dependencies { -// module('module2') -// } } } } -// ) -// checkChanges { -// presence { -// module(gradle: gradle.modules['module1']) -// module(intellij: intellij.modules['module3']) -// moduleDependency(gradle: gradle.moduleDependencies.values().flatten()) -// moduleDependency(intellij: intellij.moduleDependencies.values().flatten()) -// } } -// checkTree { -// project { -// module1('gradle') { -// dependencies { -// module2('gradle') -// } } -// module2() { -// dependencies { -// module1('gradle') -// module3('intellij') -// } } -// module3('intellij') { -// dependencies { -// module2('intellij') -// } } } } -// } -// -// @Test -// public void "local content root importing"() { -// init( -// gradle: { -// project { -// module { -// contentRoot('1') -// contentRoot('2') -// } } }, -// intellij: { -// project { -// module { -// contentRoot('2') -// contentRoot('3') -// } } } -// ) -// checkChanges { -// presence { -// contentRoot(gradle: gradle.contentRoots.values().flatten().find { it.rootPath.endsWith('1') }) -// contentRoot(intellij: intellij.contentRoots.values().flatten().find { it.file.path.endsWith('3') }) -// } } -// checkTree { -// project { -// module { -// "content-root:1"('gradle') -// "content-root:2"() -// "content-root:3"('intellij') -// } } } -// -// // Import local content roots. -// Closure projectState = { -// project { -// module { -// contentRoot('1') -// contentRoot('2') -// contentRoot('3') -// } } } -// setState(intellij: projectState, gradle: projectState) -// checkChanges { } // No changes -// checkTree { -// project { -// module { -// "content-root:1"() -// "content-root:2"() -// "content-root:3"() -// } } } -// } -// -// @Test -// public void "module removal at intellij"() { -// Closure initial = { -// project { -// module { -// contentRoot('1') -// dependencies { -// library('lib1') -// } } } } -// init(gradle: initial, intellij: initial) -// checkChanges { } -// checkTree { -// project { -// module { -// "content-root"() -// dependencies { -// lib1() -// } } } } -// -// setState(intellij: { project { }}) -// def m = gradle.modules.values().flatten().first() -// checkChanges { -// presence { -// module(gradle: m) -// contentRoot(gradle: gradle.contentRoots[m]) -// libraryDependency(gradle: gradle.libraryDependencies[m]) -// } } -// checkTree { -// project { -// module('gradle') { -// "content-root"('gradle') -// dependencies { -// lib1('gradle') -// } } } } -// } -// -// @Test -// public void "content root is correctly highlighted after importing gradle local module"() { -// Closure completeProject = { -// project { -// module { -// contentRoot('1') -// } } } -// init(gradle: completeProject, intellij: { project { }}) -// def m = gradle.modules.values().flatten().first() -// checkChanges { -// presence { -// module(gradle: m) -// contentRoot(gradle: gradle.contentRoots[m]) -// } } -// checkTree { -// project { -// module('gradle') { -// "content-root"('gradle') -// } } } -// -// // Import the whole module. -// setState(gradle: completeProject, intellij: completeProject) -// checkChanges { } -// checkTree { -// project { -// module() { -// "content-root"() -// } } } -// } -// -// @Test -// public void "filter new gradle local changes"() { -// Closure initial = { -// project { -// module('module1') { -// } } } -// init(gradle: initial, intellij: initial) -// -// // Apply filter. -// applyTreeFilter(ExternalSystemTextAttributes.CHANGE_CONFLICT) -// checkTree { -// project { -// } } -// -// // Introduce gradle-local entities. -// setState(gradle: { -// project { -// module('module1') -// module('module2') { -// contentRoot('1') -// dependencies { -// library('lib1') -// module('module1') -// } } } }) -// -// // Ensure that gradle-local entities have not been picked up. -// checkTree { -// project { -// } } -// } -// -// @Test -// public void "filter new conflict changes"() { -// Closure initial = { -// project { -// module('module1') -// module('module2') { -// dependencies { -// library('lib1', bin: ['1']) -// module('module1', scope: 'compile') -// } } } } -// init(gradle: initial, intellij: initial) -// -// // Apply filter. -// applyTreeFilter(ExternalSystemTextAttributes.EXTERNAL_SYSTEM_LOCAL_CHANGE) -// checkTree { -// project { -// } } -// -// // Introduce conflict changes. -// setState(gradle: { -// project { -// module('module1') -// module('module2') { -// dependencies { -// library('lib1', bin: ['2']) -// module('module1', scope: 'test') -// } } } }) -// -// // Ensure that conflict changes have not been processed. -// checkTree { -// project { -// } } -// } -// -// @Test -// public void "filter obsolete gradle local changes"() { -// Closure completeProject = { -// project { -// module('module1') -// module('module2') { -// contentRoot('1') -// dependencies { -// module('module1') -// library('lib1') -// } } } } -// init ( -// gradle: completeProject, -// intellij: { -// project { -// } } -// ) -// -// applyTreeFilter(ExternalSystemTextAttributes.EXTERNAL_SYSTEM_LOCAL_CHANGE) -// checkTree { -// project { -// module1('gradle') -// module2('gradle') { -// "content-root"('gradle') -// dependencies { -// module1('gradle') -// lib1('gradle') -// } } } } -// -// setState(intellij: completeProject) -// checkTree { -// project { -// } } -// } -// -// @Test -// public void "filter obsolete conflict changes"() { -// Closure gradleProject = { -// project { -// module('module1') -// module('module2') { -// dependencies { -// library('lib1', bin: ['jar1']) -// module('module1', scope: 'compile') -// } } } } -// init(gradle: gradleProject, intellij: { -// project { -// module('module1') -// module('module2') { -// dependencies { -// library('lib1', bin: ['jar2']) -// module('module1', scope: 'test') -// } } } }) -// -// applyTreeFilter(ExternalSystemTextAttributes.CHANGE_CONFLICT) -// checkTree { -// project { -// module2 { -// dependencies { -// module1('conflict') -// } } } } -// -// setState(intellij: gradleProject) -// checkTree { -// project { -// } } -// } -// -// @Test -// public void "gradle-local library dependency with mixed jars state"() { -// init( -// gradle: { -// project { -// module('module1') { -// dependencies { -// library('lib1', bin: ['jar1', 'jar2']) } } -// module('module2') { -// dependencies { -// library('lib1', bin: ['jar1', 'jar2'])} } } }, -// intellij: { -// project { -// module('module1') { -// dependencies { -// library('lib1', bin: ['jar2', 'jar3']) }} -// module('module2') }} -// ) -// -// checkChanges { -// presence { -// libraryDependency(gradle: gradle.modules['module2'].dependencies) -// jar(gradle: [findJarId('jar1')]) -// jar(intellij: [findJarId('jar3')]) -// } -// } -// checkTree { -// project { -// module1 { -// dependencies { -// lib1 { -// jar1('gradle') -// jar2() -// jar3('intellij')} } } -// module2 { -// dependencies { -// lib1('gradle') { -// jar1('gradle') -// jar2() -// jar3('intellij') } } } } } -// } -// -// @Test -// public void "gradle-local library dependency for gradle-local library"() { -// init( -// gradle: { -// project { -// module { -// dependencies { -// library('lib1', bin: ['jar1', 'jar2']) } } } }, -// intellij: { -// project { -// module() } }) -// -// checkChanges { -// presence { -// libraryDependency(gradle: gradle.modules[AbstractProjectBuilder.SAME_TOKEN].dependencies) -// jar(gradle: [findJarId('jar1')]) -// jar(gradle: [findJarId('jar2')]) -// } } -// -// checkTree { -// project { -// module { -// dependencies { -// lib1('gradle') { -// jar1('gradle') -// jar2('gradle') -// } } } } } -// } -// -// @Test -// public void "intellij-local library dependency with mixed jars state"() { -// init( -// gradle: { -// project { -// module('module1') { -// dependencies { -// library('lib1', bin: ['jar1', 'jar2']) } } -// module('module2')} }, -// intellij: { -// project { -// module('module1') { -// dependencies { -// library('lib1', bin: ['jar2', 'jar3']) }} -// module('module2') { -// dependencies { -// library('lib1', bin: ['jar1', 'jar2'])}}}} -// ) -// -// checkChanges { -// presence { -// libraryDependency(intellij: intellij.libraryDependencies[intellij.modules['module2']]) -// jar(gradle: [findJarId('jar1')]) -// jar(intellij: [findJarId('jar3')]) -// } -// } -// checkTree { -// project { -// module1 { -// dependencies { -// lib1 { -// jar1('gradle') -// jar2() -// jar3('intellij')} } } -// module2 { -// dependencies { -// lib1('intellij') { -// jar1('gradle') -// jar2() -// jar3('intellij') } } } } } -// } -// -// @Test -// void "ide-local library jars are highlighted accordingly"() { -// init( -// gradle: { -// project { -// module() } }, -// intellij: { -// project { -// module { -// dependencies { -// library('lib', bin: ['jar']) } } } } -// ) -// checkChanges { -// presence { -// libraryDependency(intellij: intellij.libraryDependencies.values().flatten()) -// jar(intellij: [findJarId('jar')]) -// } } -// checkTree { -// project { -// module { -// dependencies { -// lib('intellij') { -// jar('intellij') } } } } } -// } -} \ No newline at end of file diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/AbstractGradleTest.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/AbstractGradleTest.groovy deleted file mode 100644 index 7b3b1c33326a..000000000000 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/AbstractGradleTest.groovy +++ /dev/null @@ -1,246 +0,0 @@ -package org.jetbrains.plugins.gradle.testutil - -import com.intellij.openapi.components.ServiceManager -import com.intellij.openapi.editor.colors.TextAttributesKey -import com.intellij.openapi.externalSystem.service.project.ExternalLibraryPathTypeMapper -import com.intellij.openapi.externalSystem.service.project.ProjectStructureServices -import com.intellij.openapi.project.Project -import com.intellij.openapi.roots.OrderRootType -import com.intellij.openapi.roots.libraries.Library -import org.jetbrains.annotations.NotNull -import org.jetbrains.plugins.gradle.action.AbstractGradleSyncTreeFilterAction -import com.intellij.openapi.externalSystem.service.project.change.AutoImporter -import org.jetbrains.plugins.gradle.config.GradleColorAndFontDescriptorsProvider -import org.jetbrains.plugins.gradle.settings.GradleLocalSettings -import org.jetbrains.plugins.gradle.settings.GradleSettings -import com.intellij.openapi.externalSystem.service.project.PlatformFacade -import com.intellij.openapi.externalSystem.model.project.change.ExternalProjectStructureChangesCalculator -import org.jetbrains.plugins.gradle.diff.contentroot.GradleContentRootStructureChangesCalculator -import org.jetbrains.plugins.gradle.diff.dependency.GradleLibraryDependencyStructureChangesCalculator -import org.jetbrains.plugins.gradle.diff.dependency.GradleModuleDependencyStructureChangesCalculator -import org.jetbrains.plugins.gradle.diff.library.GradleLibraryStructureChangesCalculator -import org.jetbrains.plugins.gradle.diff.module.GradleModuleStructureChangesCalculator -import org.jetbrains.plugins.gradle.diff.project.GradleProjectStructureChangesCalculator -import com.intellij.openapi.externalSystem.service.project.manage.EntityManageHelper -import com.intellij.openapi.externalSystem.service.project.manage.JarDataService -import com.intellij.openapi.externalSystem.service.project.manage.LibraryDataService -import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataServiceImpl -import com.intellij.openapi.externalSystem.model.ProjectSystemId -import com.intellij.openapi.externalSystem.model.project.LibraryData -import com.intellij.openapi.externalSystem.model.project.LibraryPathType -import com.intellij.openapi.externalSystem.model.project.id.EntityIdMapper -import com.intellij.openapi.externalSystem.model.project.id.JarId -import com.intellij.openapi.externalSystem.model.project.id.LibraryId -import org.jetbrains.plugins.gradle.sync.GradleDuplicateLibrariesPreProcessor -import com.intellij.openapi.externalSystem.service.project.change.MovedJarsPostProcessor -import com.intellij.openapi.externalSystem.service.project.change.OutdatedLibraryVersionPostProcessor -import com.intellij.openapi.externalSystem.service.project.change.ProjectStructureChangesModel -import com.intellij.openapi.externalSystem.service.project.ProjectStructureHelper -import com.intellij.openapi.externalSystem.ui.ExternalProjectStructureTreeModel -import com.intellij.openapi.externalSystem.ui.ExternalProjectStructureNodeFilter -import org.jetbrains.plugins.gradle.util.* -import org.junit.Before -import org.picocontainer.MutablePicoContainer -import org.picocontainer.defaults.DefaultPicoContainer - -import static org.junit.Assert.fail - -/** - * @author Denis Zhdanov - * @since 2/13/12 10:43 AM - */ -public abstract class AbstractGradleTest { - - ProjectStructureChangesModel changesModel - ExternalProjectStructureTreeModel treeModel - GradleProjectBuilder gradle - IntellijProjectBuilder intellij - ChangeBuilder changesBuilder - ProjectStructureChecker treeChecker - def container - private Map treeFilters = [:] - - @Before - public void setUp() { - // TODO den uncomment - //gradle = new GradleProjectBuilder() - //intellij = new IntellijProjectBuilder() - //changesBuilder = new ChangeBuilder() - //treeChecker = new ProjectStructureChecker() - //container = new DefaultPicoContainer() { - // @Override - // Object getComponentInstance(Object componentKey) { - // def result = super.getComponentInstance(componentKey) - // if (result == null && componentKey instanceof String) { - // def clazz = Class.forName(componentKey) - // if (clazz != null) { - // result = super.getComponentInstance(clazz) - // } - // } - // result - // } - //} - //container.registerComponentInstance(Project, intellij.project) - //container.registerComponentInstance(PlatformFacade, intellij.platformFacade as PlatformFacade) - //container.registerComponentImplementation(ProjectStructureChangesModel) - //container.registerComponentImplementation(ExternalProjectStructureTreeModel) - //container.registerComponentImplementation(ProjectStructureHelper) - //container.registerComponentImplementation(ExternalProjectStructureChangesCalculator, GradleProjectStructureChangesCalculator) - //container.registerComponentImplementation(GradleModuleStructureChangesCalculator) - //container.registerComponentImplementation(GradleContentRootStructureChangesCalculator) - //container.registerComponentImplementation(GradleModuleDependencyStructureChangesCalculator) - //container.registerComponentImplementation(GradleLibraryDependencyStructureChangesCalculator) - //container.registerComponentImplementation(GradleLibraryStructureChangesCalculator) - //container.registerComponentImplementation(EntityIdMapper) - //container.registerComponentImplementation(ProjectStructureServices) - //container.registerComponentImplementation(ExternalLibraryPathTypeMapper, TestExternalLibraryPathTypeMapper) - //container.registerComponentImplementation(ExternalDependencyManager) - //container.registerComponentImplementation(LibraryDataService) - //container.registerComponentImplementation(JarDataService, TestExternalJarManager) - //container.registerComponentImplementation(ProjectDataServiceImpl) - //container.registerComponentImplementation(GradleDuplicateLibrariesPreProcessor) - //container.registerComponentImplementation(MovedJarsPostProcessor, TestMovedJarsPostProcessor) - //container.registerComponentImplementation(OutdatedLibraryVersionPostProcessor) - //container.registerComponentImplementation(AutoImporter) - //container.registerComponentImplementation(GradleSettings) - //container.registerComponentImplementation(GradleLocalSettings) - //container.registerComponentImplementation(EntityManageHelper) - //configureContainer(container) - // - //intellij.projectStub.getComponent = { clazz -> container.getComponentInstance(clazz) } - //intellij.projectStub.getPicoContainer = { container } - // - //changesModel = container.getComponentInstance(ProjectStructureChangesModel) as ProjectStructureChangesModel - // - //for (d in GradleColorAndFontDescriptorsProvider.DESCRIPTORS) { - // treeFilters[d.key] = AbstractGradleSyncTreeFilterAction.createFilter(d.key) - //} - // - //def settings = ServiceManager.getService(intellij.project, GradleSettings.class) - //settings.useAutoImport = false - } - - protected void clearChangePostProcessors() { - changesModel.commonPreProcessors.clear() - changesModel.commonPostProcessors.clear() - } - - protected void configureContainer(MutablePicoContainer container) { - } - - @SuppressWarnings("GroovyAssignabilityCheck") - protected def init(map = [:]) { - treeModel = container.getComponentInstance(ExternalProjectStructureTreeModel) as ExternalProjectStructureTreeModel - treeModel.processChangesAtTheSameThread = true; - setState(map, false) - treeModel.rebuild() - changesModel.update(gradle.project) - } - - protected def setState(map, update = true) { - map.intellij?.delegate = intellij - map.intellij?.call() - map.gradle?.delegate = gradle - map.gradle?.call() - treeModel.changesComparator = map.changesSorter as Comparator - if (update) { - changesModel.update(gradle.project) - } - } - - protected def checkChanges(Closure c) { - changesBuilder.changes.clear() - c.delegate = changesBuilder - def expected = c() - if (!expected) { - expected = [].toSet() - } - def actual = new HashSet(changesModel.changes) - if (expected == actual) { - return - } - actual.removeAll(expected) - expected.removeAll(changesModel.changes) - def message = "Project structure changes are mismatched." - if (expected) { - message += "\n Expected but not matched:" - expected.each { message += "\n * $it"} - } - if (actual) { - message += "\n Unexpected:" - actual.each { message += "\n * $it"} - } - fail(message) - } - - protected def checkTree(c) { - def nodeBuilder = new NodeBuilder() - c.delegate = nodeBuilder - def expected = c() - treeChecker.check(expected, treeModel.root) - } - - protected static Closure changeByClassSorter(Map, Integer> rules) { - { a, b -> - def weightA = rules[a.class] ?: Integer.MAX_VALUE - def weightB = rules[b.class] ?: Integer.MAX_VALUE - if (weightA == weightB) { - return a.hashCode() - b.hashCode() - } - else { - return weightA - weightB - } - } - } - - protected def applyTreeFilter(@NotNull TextAttributesKey toShow) { - treeModel.addFilter(treeFilters[toShow]) - } - - protected def resetTreeFilter(@NotNull TextAttributesKey filterKey) { - treeModel.removeFilter(treeFilters[filterKey]) - } - - @NotNull - protected JarId findJarId(@NotNull String path) { - String pathToUse = GradleUtil.toCanonicalPath(path) - for (LibraryData library in (gradle.libraries.values() as Collection)) { - for (libPath in library.getPaths(LibraryPathType.BINARY)) { - if (libPath == pathToUse) { - return new JarId(pathToUse, LibraryPathType.BINARY, new LibraryId(ProjectSystemId.GRADLE, library.name)) - } - } - } - - for (Library library in (intellij.libraries.values() as Collection)) { - for (jarFile in library.getFiles(OrderRootType.CLASSES)) { - if (pathToUse == jarFile.path) { - return new JarId(pathToUse, LibraryPathType.BINARY, new LibraryId(ProjectSystemId.IDE, library.name)) - } - } - } - - String errorMessage = """ -Can't build an id object for given jar path ($path). - Available gradle libraries: - ${gradle.libraries.values().collect { LibraryData lib -> "${lib.name}: ${lib.getPaths(LibraryPathType.BINARY)}" }.join('\n ') } - Available intellij libraries: - ${intellij.libraries.values().collect { Library lib -> "${lib.name}: ${lib.getFiles(OrderRootType.CLASSES).collect{it.path}}" } - .join('\n ')} -""" - - throw new IllegalArgumentException(errorMessage) - } - - @NotNull - protected LibraryId findLibraryId(@NotNull String name, boolean gradleLibrary) { - def libraries = gradleLibrary ? gradle.libraries : intellij.libraries - def library = libraries[name] - if (library == null) { - def errorMessage = - "Can't find ${gradleLibrary ? 'gradle' : 'ide'} library with name '$name'. Available libraries: ${libraries.keySet()}" - throw new IllegalArgumentException(errorMessage) - } - new LibraryId(gradleLibrary ? ProjectSystemId.GRADLE : ProjectSystemId.IDE, name) - } -} diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/ChangeBuilder.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/ChangeBuilder.groovy deleted file mode 100644 index 0af1f810265c..000000000000 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/ChangeBuilder.groovy +++ /dev/null @@ -1,83 +0,0 @@ -package org.jetbrains.plugins.gradle.testutil - -import com.intellij.openapi.externalSystem.model.project.change.ContentRootPresenceChange -import com.intellij.openapi.externalSystem.model.project.change.LibraryDependencyPresenceChange -import com.intellij.openapi.externalSystem.model.project.change.ModuleDependencyPresenceChange -import com.intellij.openapi.externalSystem.model.project.change.OutdatedLibraryVersionChange -import com.intellij.openapi.externalSystem.model.project.change.JarPresenceChange -import com.intellij.openapi.externalSystem.model.project.change.ModulePresenceChange - -/** - * @author Denis Zhdanov - * @since 1/26/12 3:25 PM - */ -public class ChangeBuilder extends BuilderSupport { - - def changes = [] - - @Override - protected void setParent(Object parent, Object child) { - } - - @Override - protected Object createNode(Object name) { - createNode(name, [:]) - } - - @Override - protected Object createNode(Object name, Object value) { changes } - - @Override - protected Object createNode(Object name, Map attributes) { - switch (name) { - case "module": - changes.addAll attributes.gradle.collect { new ModulePresenceChange(it, null)} - changes.addAll attributes.intellij.collect { new ModulePresenceChange(null, it)} - return changes - case "moduleDependency": - changes.addAll attributes.gradle.collect { new ModuleDependencyPresenceChange(it, null) } - changes.addAll attributes.intellij.collect { new ModuleDependencyPresenceChange(null, it) } - return changes - case "library": - changes.addAll attributes.gradle.collect { new LibraryDependencyPresenceChange(it, null)} - changes.addAll attributes.intellij.collect { new LibraryDependencyPresenceChange(null, it)} - return changes - case "libraryDependency": - changes.addAll attributes.gradle.collect { new LibraryDependencyPresenceChange(it, null)} - changes.addAll attributes.intellij.collect { new LibraryDependencyPresenceChange(null, it)} - return changes - case "libraryConflict": - def library = attributes.entity - if (!library) { - throw new IllegalArgumentException("No entity is defined for the library conflict change. Known attributes: $attributes") - } - return library - case "contentRoot": - changes.addAll attributes.gradle.collect { new ContentRootPresenceChange(it, null)} - changes.addAll attributes.intellij.collect { new ContentRootPresenceChange(null, it)} - return changes - case "jar": - changes.addAll attributes.gradle.collect { new JarPresenceChange(it, null) } - changes.addAll attributes.intellij.collect { new JarPresenceChange(null, it) } - return changes - case "libraryVersion": - changes.add(new OutdatedLibraryVersionChange( - attributes.name, attributes.gradleLibraryId, attributes.gradleVersion, attributes.ideLibraryId, attributes.ideVersion - )) - } - changes - } - - @Override - protected Object createNode(Object name, Map attributes, Object value) { changes } - - @Override - protected Object postNodeCompletion(Object parent, Object node) { - parent == null ? changes.toSet() : node - } - - protected def register(change) { - changes << change - changes - } -} diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/ProjectStructureChecker.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/ProjectStructureChecker.groovy deleted file mode 100644 index e9d75adf4aa2..000000000000 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/testutil/ProjectStructureChecker.groovy +++ /dev/null @@ -1,89 +0,0 @@ -package org.jetbrains.plugins.gradle.testutil - -import com.intellij.openapi.module.Module -import com.intellij.openapi.project.Project -import org.jetbrains.annotations.NotNull -import com.intellij.openapi.externalSystem.model.project.id.ProjectEntityId -import com.intellij.openapi.externalSystem.ui.ProjectStructureNode - -import javax.swing.tree.DefaultMutableTreeNode -import com.intellij.openapi.externalSystem.settings.ExternalSystemTextAttributes -import com.intellij.openapi.externalSystem.ui.ProjectStructureNodeDescriptor -import org.junit.Assert -import static junit.framework.Assert.assertEquals -import static junit.framework.Assert.fail -import com.intellij.openapi.externalSystem.model.ProjectSystemId - -import com.intellij.openapi.externalSystem.model.project.ProjectEntityType - -/** - * @author Denis Zhdanov - * @since 1/30/12 6:04 PM - */ -class ProjectStructureChecker { - - static def BUILT_IN = [ - "project": Project, - "module" : Module - ] - - static def COLORS = [ - 'gradle' : ExternalSystemTextAttributes.EXTERNAL_SYSTEM_LOCAL_CHANGE, - 'intellij': ExternalSystemTextAttributes.IDE_LOCAL_CHANGE, - 'conflict': ExternalSystemTextAttributes.CHANGE_CONFLICT, - 'outdated': ExternalSystemTextAttributes.OUTDATED_ENTITY - ] - - def check(Node expected, DefaultMutableTreeNode actual) { - ProjectStructureNodeDescriptor descriptor = actual.userObject as ProjectStructureNodeDescriptor - checkName(expected, descriptor) - checkMarkup(expected, descriptor) - int childIndex = 0 - for (it in expected.children().findAll { it instanceof Collection }) { - check it as Node, actual.getChildAt(childIndex++) as DefaultMutableTreeNode - } - for (it in expected.children().findAll { it instanceof Node }) { - if (childIndex >= actual.childCount) { - fail "Expected node is not matched: $it" - } - check it as Node, actual.getChildAt(childIndex++) as DefaultMutableTreeNode - } - if (childIndex < actual.childCount) { - def transform = { nodePath(actual.getChildAt(it) as ProjectStructureNode) } - fail("Unexpected nodes detected: ${(childIndex.. node) { - StringBuilder result = new StringBuilder("'${node.descriptor.name}") - for (ProjectStructureNode n = node.parent; n != null; n = n.parent) { - result.append(" -> ${n.descriptor.name}") - } - result.append("'") - result.toString() - } - - private static void checkName(Node expected, ProjectStructureNodeDescriptor actual) { - if (AbstractProjectBuilder.SAME_TOKEN == actual.toString() || expected.name() == actual.toString()) { - return - } - def clazz = BUILT_IN[expected.name().toString()] - if (clazz == null || !clazz.isAssignableFrom(actual.element.class)) { - Assert.fail( - "Failed node name check. Expected to find name '${expected.name()}'" + (clazz ? " or user object of type ${clazz.simpleName}" : "") - + " but got: name='$actual', user object=${actual.element} " - ) - } - } - - static def checkMarkup(Node node, ProjectStructureNodeDescriptor descriptor) { - def expectedMarkup = COLORS[node.children().find {it instanceof CharSequence}.toString()]?: ExternalSystemTextAttributes.NO_CHANGE - assertEquals("node '$descriptor'", expectedMarkup, descriptor.attributes) - - if (descriptor.element.type != ProjectEntityType.SYNTHETIC) { - def expectedOwner = expectedMarkup == ExternalSystemTextAttributes.EXTERNAL_SYSTEM_LOCAL_CHANGE ? ProjectSystemId.GRADLE : ProjectSystemId.IDE - assertEquals("node '$descriptor'", expectedOwner, descriptor.element.owner) - } - } -} diff --git a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/TestExternalJarManager.groovy b/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/TestExternalJarManager.groovy deleted file mode 100644 index d0f1dcf77076..000000000000 --- a/plugins/gradle/testSources/org/jetbrains/plugins/gradle/util/TestExternalJarManager.groovy +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2000-2013 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jetbrains.plugins.gradle.util - -import com.intellij.openapi.externalSystem.service.project.ExternalLibraryPathTypeMapper -import com.intellij.openapi.externalSystem.service.project.ProjectStructureHelper -import com.intellij.openapi.project.Project -import org.jetbrains.annotations.NotNull -import com.intellij.openapi.externalSystem.service.project.PlatformFacade -import com.intellij.openapi.externalSystem.service.project.manage.JarDataService -import com.intellij.openapi.externalSystem.model.project.JarData - -/** - * @author Denis Zhdanov - * @since 1/18/13 2:16 PM - */ -class TestExternalJarManager extends JarDataService { - - def importedJars = [] - def removedJars = [] - - TestExternalJarManager(@NotNull PlatformFacade facade, - @NotNull ProjectStructureHelper helper, - @NotNull ExternalLibraryPathTypeMapper mapper) { - super(facade, helper, mapper); - } - - void importJars(@NotNull Collection jars, @NotNull Project project, boolean synchronous) { - importedJars.addAll(jars) - } - - void removeJars(@NotNull Collection jars, @NotNull Project project, boolean synchronous) { - removedJars.addAll(jars) - } -}