use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenProjectsTreeReadingTest method testSameProjectAsModuleOfSeveralProjects.
public void testSameProjectAsModuleOfSeveralProjects() throws Exception {
VirtualFile p1 = createModulePom("project1", "<groupId>test</groupId>" + "<artifactId>project1</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + " <module>../module</module>" + "</modules>");
VirtualFile p2 = createModulePom("project2", "<groupId>test</groupId>" + "<artifactId>project2</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + " <module>../module</module>" + "</modules>");
VirtualFile m = createModulePom("module", "<groupId>test</groupId>" + "<artifactId>module</artifactId>" + "<version>1</version>");
updateAll(p1, p2);
List<MavenProject> roots = myTree.getRootProjects();
assertEquals(2, roots.size());
assertEquals(p1, roots.get(0).getFile());
assertEquals(p2, roots.get(1).getFile());
assertEquals(1, myTree.getModules(roots.get(0)).size());
assertEquals(m, myTree.getModules(roots.get(0)).get(0).getFile());
assertEquals(0, myTree.getModules(roots.get(1)).size());
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenProjectsTreeReadingTest method testUpdatingAddsModulesFromRootProjects.
public void testUpdatingAddsModulesFromRootProjects() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>");
VirtualFile m = createModulePom("m", "<groupId>test</groupId>" + "<artifactId>m</artifactId>" + "<version>1</version>");
updateAll(myProjectPom, m);
List<MavenProject> roots = myTree.getRootProjects();
assertEquals(2, roots.size());
assertEquals(myProjectPom, roots.get(0).getFile());
assertEquals(m, roots.get(1).getFile());
assertEquals("m", roots.get(1).getMavenId().getArtifactId());
assertEquals(0, myTree.getModules(roots.get(0)).size());
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + " <module>m</module>" + "</modules>");
update(myProjectPom);
roots = myTree.getRootProjects();
assertEquals(1, roots.size());
assertEquals(myProjectPom, roots.get(0).getFile());
assertEquals(1, myTree.getModules(roots.get(0)).size());
assertEquals(m, myTree.getModules(roots.get(0)).get(0).getFile());
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenProjectsTreeReadingTest method testUpdatingModelWhenActiveProfilesChange.
public void testUpdatingModelWhenActiveProfilesChange() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<profiles>" + " <profile>" + " <id>one</id>" + " <properties>" + " <prop>value1</prop>" + " </properties>" + " </profile>" + " <profile>" + " <id>two</id>" + " <properties>" + " <prop>value2</prop>" + " </properties>" + " </profile>" + "</profiles>" + "<modules>" + " <module>m</module>" + "</modules>" + "<build>" + " <sourceDirectory>${prop}</sourceDirectory>" + "</build>");
createModulePom("m", "<groupId>test</groupId>" + "<artifactId>m</artifactId>" + "<version>1</version>" + "<parent>" + " <groupId>test</groupId>" + " <artifactId>project</artifactId>" + " <version>1</version>" + "</parent>" + "<build>" + " <sourceDirectory>${prop}</sourceDirectory>" + "</build>");
updateAll(Arrays.asList("one"), myProjectPom);
List<MavenProject> roots = myTree.getRootProjects();
MavenProject parentNode = roots.get(0);
MavenProject childNode = myTree.getModules(roots.get(0)).get(0);
assertUnorderedPathsAreEqual(parentNode.getSources(), Arrays.asList(FileUtil.toSystemDependentName(getProjectPath() + "/value1")));
assertUnorderedPathsAreEqual(childNode.getSources(), Arrays.asList(FileUtil.toSystemDependentName(getProjectPath() + "/m/value1")));
updateAll(Arrays.asList("two"), myProjectPom);
assertUnorderedPathsAreEqual(parentNode.getSources(), Arrays.asList(FileUtil.toSystemDependentName(getProjectPath() + "/value2")));
assertUnorderedPathsAreEqual(childNode.getSources(), Arrays.asList(FileUtil.toSystemDependentName(getProjectPath() + "/m/value2")));
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenProjectsTreeReadingTest method testUpdatingAddsModules.
public void testUpdatingAddsModules() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>");
VirtualFile m = createModulePom("m", "<groupId>test</groupId>" + "<artifactId>m</artifactId>" + "<version>1</version>");
updateAll(myProjectPom);
List<MavenProject> roots = myTree.getRootProjects();
assertEquals(1, roots.size());
assertEquals(myProjectPom, roots.get(0).getFile());
assertEquals(0, myTree.getModules(roots.get(0)).size());
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + " <module>m</module>" + "</modules>");
update(myProjectPom);
roots = myTree.getRootProjects();
assertEquals(1, roots.size());
assertEquals(myProjectPom, roots.get(0).getFile());
assertEquals(1, myTree.getModules(roots.get(0)).size());
assertEquals(m, myTree.getModules(roots.get(0)).get(0).getFile());
}
use of org.jetbrains.idea.maven.project.MavenProject in project intellij-community by JetBrains.
the class MavenProjectsTreeReadingTest method testDeletingProject.
public void testDeletingProject() throws Exception {
createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + " <module>m</module>" + "</modules>");
VirtualFile m = createModulePom("m", "<groupId>test</groupId>" + "<artifactId>m</artifactId>" + "<version>1</version>");
updateAll(myProjectPom);
List<MavenProject> roots = myTree.getRootProjects();
assertEquals(1, roots.size());
assertEquals(1, myTree.getModules(roots.get(0)).size());
deleteProject(m);
roots = myTree.getRootProjects();
assertEquals(1, roots.size());
assertEquals(0, myTree.getModules(roots.get(0)).size());
}
Aggregations