use of org.jetbrains.idea.maven.project.MavenProjectChanges in project intellij-community by JetBrains.
the class MavenProjectsTreeReadingTest method testDoNotUpdateChildAfterParentWasResolved.
public void testDoNotUpdateChildAfterParentWasResolved() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>parent</artifactId>" + "<version>1</version>");
VirtualFile child = createModulePom("child", "<groupId>test</groupId>" + "<artifactId>child</artifactId>" + "<version>1</version>" + "<parent>" + " <groupId>test</groupId>" + " <artifactId>parent</artifactId>" + " <version>1</version>" + "</parent>");
MyLoggingListener listener = new MyLoggingListener();
myTree.addListener(listener);
updateAll(myProjectPom, child);
MavenProject parentProject = myTree.findProject(myProjectPom);
MavenEmbeddersManager embeddersManager = new MavenEmbeddersManager(myProject);
try {
final NativeMavenProjectHolder[] nativeProject = new NativeMavenProjectHolder[1];
myTree.addListener(new MavenProjectsTree.Listener() {
@Override
public void projectResolved(Pair<MavenProject, MavenProjectChanges> projectWithChanges, NativeMavenProjectHolder nativeMavenProject) {
nativeProject[0] = nativeMavenProject;
}
});
myTree.resolve(myProject, parentProject, getMavenGeneralSettings(), embeddersManager, NULL_MAVEN_CONSOLE, EMPTY_MAVEN_PROCESS);
myTree.resolvePlugins(parentProject, nativeProject[0], embeddersManager, NULL_MAVEN_CONSOLE, EMPTY_MAVEN_PROCESS);
myTree.resolveFolders(parentProject, getMavenImporterSettings(), embeddersManager, NULL_MAVEN_CONSOLE, EMPTY_MAVEN_PROCESS);
} finally {
embeddersManager.releaseInTests();
}
assertEquals("updated: parent child deleted: <none> resolved: parent plugins: parent folders: parent ", listener.log);
myTree.updateAll(false, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
assertEquals("updated: parent child deleted: <none> resolved: parent plugins: parent folders: parent ", listener.log);
}
use of org.jetbrains.idea.maven.project.MavenProjectChanges in project intellij-community by JetBrains.
the class MavenProjectsTreeReadingTest method testSendingNotificationsWhenResolveFailed.
public void testSendingNotificationsWhenResolveFailed() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<name");
updateAll(myProjectPom);
MyLoggingListener listener = new MyLoggingListener();
myTree.addListener(listener);
MavenProject project = myTree.findProject(myProjectPom);
MavenEmbeddersManager embeddersManager = new MavenEmbeddersManager(myProject);
final List<NativeMavenProjectHolder> nativeProject = new ArrayList<>();
try {
myTree.addListener(new MavenProjectsTree.Listener() {
@Override
public void projectResolved(Pair<MavenProject, MavenProjectChanges> projectWithChanges, NativeMavenProjectHolder nativeMavenProject) {
nativeProject.add(nativeMavenProject);
}
});
myTree.resolve(myProject, project, getMavenGeneralSettings(), embeddersManager, NULL_MAVEN_CONSOLE, EMPTY_MAVEN_PROCESS);
} finally {
embeddersManager.releaseInTests();
}
assertEquals("resolved: project ", listener.log);
assertTrue(project.hasReadingProblems());
assertSize(1, nativeProject);
assertNull(nativeProject.get(0));
}
Aggregations