Maven: tests fixed

This commit is contained in:
Anton.Makeev
2009-10-01 15:41:41 +04:00
parent ff72363308
commit 1b77fb7867
8 changed files with 22 additions and 22 deletions
@@ -14,7 +14,7 @@ import java.util.Map;
public class ArchetypesTest extends MavenTestCase {
public void testGenerating() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
File dir = new File(myDir.getPath(), "generated");
dir.mkdirs();
@@ -7,7 +7,7 @@ import java.util.Arrays;
public class DependenciesManagementTest extends MavenImportingTestCase {
public void testImportingDependencies() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
setRepositoryPath(new File(myDir, "/repo").getPath());
updateSettingsXml("<localRepository>" + getRepositoryPath() + "</localRepository>");
@@ -391,8 +391,8 @@ public abstract class MavenTestCase extends UsefulTestCase {
return true;
}
protected boolean hasM2Home() {
boolean result = System.getenv("M2_HOME") != null;
protected boolean hasMavenInstallation() {
boolean result = "true".equals(System.getProperty("idea.maven.test.has.installation"));
if (!result) System.out.println("Ignored, because Maven installation not found: " + getClass().getSimpleName() + "." + getName());
return result;
}
@@ -33,7 +33,7 @@ public class SnapshotDependenciesImportingTest extends MavenImportingTestCase {
}
private void performTestWithDependencyVersion(String version) throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
createProjectPom("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
@@ -81,7 +81,7 @@ public class SnapshotDependenciesImportingTest extends MavenImportingTestCase {
}
public void testNamingLibraryTheSameWayRegardlessAvailableSnapshotVersion() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
deployArtifact("test", "foo", "1-SNAPSHOT");
@@ -107,7 +107,7 @@ public class SnapshotDependenciesImportingTest extends MavenImportingTestCase {
}
public void testAttachingCorrectJavaDocsAndSources() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
deployArtifact("test", "foo", "1-SNAPSHOT",
"<build>" +
@@ -167,7 +167,7 @@ public class SnapshotDependenciesImportingTest extends MavenImportingTestCase {
}
public void testCorrectlryUpdateRootEntriesWithActualPathForSnapshotDependencies() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
deployArtifact("test", "foo", "1-SNAPSHOT",
"<build>" +
@@ -323,7 +323,7 @@ public class StructureImportingTest extends MavenImportingTestCase {
}
public void testParentInLocalRepository() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
VirtualFile parent = createModulePom("parent",
"<groupId>test</groupId>" +
@@ -9,7 +9,7 @@ import java.util.Arrays;
public class MavenExecutorsTest extends MavenTestCase {
public void testExternalExecutor() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
VfsUtil.saveText(createProjectSubFile("src/main/java/A.java"), "public class A {}");
@@ -6,7 +6,7 @@ import java.util.Arrays;
public class MavenRunnerTest extends MavenImportingTestCase {
public void testUpdatingExcludedFoldersAfterRun() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
createStdProjectFolders();
@@ -27,7 +27,7 @@ public class MavenModuleBuilderTest extends MavenImportingTestCase {
}
public void testCreatingBlank() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
MavenId id = new MavenId("org.foo", "module", "1.0");
createNewModule(id);
@@ -50,7 +50,7 @@ public class MavenModuleBuilderTest extends MavenImportingTestCase {
}
public void testInheritJdkFromProject() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
createNewModule(new MavenId("org.foo", "module", "1.0"));
ModuleRootManager manager = ModuleRootManager.getInstance(getModule("module"));
@@ -58,7 +58,7 @@ public class MavenModuleBuilderTest extends MavenImportingTestCase {
}
public void testCreatingFromArchetype() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
setArchetype(new ArchetypeInfo("org.apache.maven.archetypes", "maven-archetype-quickstart", "1.0", null, null));
MavenId id = new MavenId("org.foo", "module", "1.0");
@@ -78,7 +78,7 @@ public class MavenModuleBuilderTest extends MavenImportingTestCase {
}
public void testAddingNewlyCreatedModuleToTheAggregator() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
@@ -99,7 +99,7 @@ public class MavenModuleBuilderTest extends MavenImportingTestCase {
}
public void testAddingManagedProjectIfNoArrgerator() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
@@ -116,7 +116,7 @@ public class MavenModuleBuilderTest extends MavenImportingTestCase {
}
public void testDoNotAddManagedProjectIfAddingAsModuleToAggregator() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
@@ -133,7 +133,7 @@ public class MavenModuleBuilderTest extends MavenImportingTestCase {
}
public void testAddingParent() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
@@ -164,7 +164,7 @@ public class MavenModuleBuilderTest extends MavenImportingTestCase {
}
public void testAddingParentWithInheritedProperties() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
@@ -194,7 +194,7 @@ public class MavenModuleBuilderTest extends MavenImportingTestCase {
}
public void testAddingParentAndInheritWhenGeneratingFromArchetype() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
@@ -231,7 +231,7 @@ public class MavenModuleBuilderTest extends MavenImportingTestCase {
}
public void testAddingParentWithRelativePath() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
@@ -263,7 +263,7 @@ public class MavenModuleBuilderTest extends MavenImportingTestCase {
}
public void testFindingPotentialParentInNotMavenizedProject() throws Exception {
if (!hasM2Home()) return;
if (!hasMavenInstallation()) return;
Module module = createModule("project");
VirtualFile dir = module.getModuleFile().getParent();