Add additional logining to understand cause of failing maven tests.

This commit is contained in:
Sergey Evdokimov
2012-03-30 14:15:00 +04:00
parent 7326b79b16
commit 2817dd09c8
2 changed files with 22 additions and 3 deletions
@@ -421,7 +421,7 @@ public class MavenIndex {
}
@TestOnly
protected File getDir() {
public File getDir() {
return myDir;
}
@@ -491,6 +491,17 @@ public class MavenIndex {
}, Collections.<String>emptySet());
}
@TestOnly
public void printInfo() {
doIndexTask(new IndexTask<Set<String>>() {
public Set<String> doTask() throws Exception {
System.out.println("BaseFile: " + myData.groupToArtifactMap.getBaseFile());
System.out.println("All data objects: " + myData.groupToArtifactMap.getAllDataObjects(null));
return Collections.<String>emptySet();
}
}, Collections.<String>emptySet());
}
public synchronized Set<String> getVersions(final String groupId, final String artifactId) {
return doIndexTask(new IndexTask<Set<String>>() {
public Set<String> doTask() throws Exception {
@@ -18,6 +18,7 @@ package org.jetbrains.idea.maven.dom;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiReference;
import org.jetbrains.idea.maven.indices.MavenIndex;
import org.jetbrains.idea.maven.indices.MavenIndicesTestFixture;
import org.jetbrains.idea.maven.indices.MavenProjectIndicesManager;
@@ -74,9 +75,16 @@ public class MavenExtensionCompletionAndResolutionTest extends MavenDomWithIndic
if (!new HashSet<String>(actual).equals(new HashSet<String>(Arrays.asList("maven-compiler-plugin", "maven-war-plugin", "maven-eclipse-plugin", "maven-surefire-plugin")))) {
MavenProjectIndicesManager instance = MavenProjectIndicesManager.getInstance(myProject);
System.out.println("GetArtifacts: " + instance.getArtifactIds("org.apache.maven.plugins"));
System.out.println("GetArtifacts: " + new HashSet<String>(instance.getArtifactIds("org.apache.maven.plugins")));
System.out.println("Indexes: " + instance.getIndices());
throw new AssertionError("GetArtifacts: " + instance.getArtifactIds("org.apache.maven.plugins") + "Indexes: " + instance.getIndices());
for (MavenIndex index : instance.getIndices()) {
System.out.println("Index: repositoryId=" + index.getRepositoryId() + " repositoryUrl=" + index.getRepositoryUrl() + " repositoryPathOrUrl" + index.getRepositoryPathOrUrl());
System.out.println("Dir: " + index.getDir());
index.printInfo();
}
throw new AssertionError("GetArtifacts: " + instance.getArtifactIds("org.apache.maven.plugins") + " Indexes: " + instance.getIndices());
}
assertUnorderedElementsAreEqual(actual, "maven-compiler-plugin", "maven-war-plugin", "maven-eclipse-plugin", "maven-surefire-plugin");