Author: rawagner
Date: 2012-01-11 05:58:21 -0500 (Wed, 11 Jan 2012)
New Revision: 37758
Added:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/usersettings/
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/usersettings/settings.xml
Modified:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/projects/simple-jar/pom.xml
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java
Log:
Profile selection test now uses custom user settings.xml
Modified: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/projects/simple-jar/pom.xml
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/projects/simple-jar/pom.xml 2012-01-11
08:55:39 UTC (rev 37757)
+++
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/projects/simple-jar/pom.xml 2012-01-11
10:58:21 UTC (rev 37758)
@@ -6,13 +6,35 @@
<artifactId>simple-jar</artifactId>
<version>1.0.0-SNAPSHOT</version>
<profiles>
- <profile>
- <id>active-profile</id>
-
<activation><activeByDefault>true</activeByDefault></activation>
- </profile>
- <profile>
- <id>inactive-profile</id>
- </profile>
+ <profile>
+ <id>active-profile</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ </profile>
+ <profile>
+ <id>inactive-profile</id>
+ </profile>
+ <profile>
+ <id>common-profile</id>
+ </profile>
</profiles>
+
+ <repositories>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Maven Repository Group</name>
+ <
url>https://repository.jboss.org/nexus/content/groups/public-jboss/<...
+ <layout>default</layout>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
</project>
Modified:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java 2012-01-11
08:55:39 UTC (rev 37757)
+++
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenProjectsTest.java 2012-01-11
10:58:21 UTC (rev 37758)
@@ -48,6 +48,7 @@
buildProject(projectName,"5 Maven build...", "jar");
}
+
@Test
public void createSimpleJarProjectArchetype() throws Exception {
String projectName = "ArchetypeQuickstart";
@@ -59,6 +60,7 @@
}
+
@Test
public void createSimpleJarMavenizedProject() throws InterruptedException,
CoreException{
String projectName = "JarMavenized";
@@ -142,7 +144,7 @@
shell.button("Next >").click();
Thread.sleep(2000);
shell.comboBox().setSelection(catalog);
- Thread.sleep(1000);
+ Thread.sleep(2000);
int index = botExt.table(0).indexOf(projectType, "Artifact Id");
if (index == -1) {
fail(projectType + " not found");
Modified:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java 2012-01-11
08:55:39 UTC (rev 37757)
+++
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/CreateMavenizedEARProjectTest.java 2012-01-11
10:58:21 UTC (rev 37758)
@@ -26,7 +26,9 @@
@Test
public void createEARProject() throws Exception{
createWarProject(WAR_PROJECT_NAME);
+ Thread.sleep(500);
createEJBProject(EJB_PROJECT_NAME);
+ Thread.sleep(500);
botext.menu("File").menu("Enterprise Application
Project").click();
botext.textWithLabel("Project name:").setText(EAR_PROJECT_NAME);
botext.button("Modify...").click();
Modified:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java 2012-01-11
08:55:39 UTC (rev 37757)
+++
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenAllBotTests.java 2012-01-11
10:58:21 UTC (rev 37758)
@@ -21,12 +21,12 @@
*/
@RunWith(RequirementAwareSuite.class)
@Suite.SuiteClasses({
- MavenProfileSelectionTest.class,
CreateMavenizedSeamProjectTest.class,
- CreateMavenProjectsTest.class,
CreateMavenizedEARProjectTest.class,
CreateMavenizedJSFProjectTest.class,
- MaterializeLibraryTest.class
+ MavenProfileSelectionTest.class,
+ MaterializeLibraryTest.class,
+ CreateMavenProjectsTest.class
})
public class MavenAllBotTests {
Modified:
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java
===================================================================
---
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java 2012-01-11
08:55:39 UTC (rev 37757)
+++
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/MavenProfileSelectionTest.java 2012-01-11
10:58:21 UTC (rev 37758)
@@ -1,11 +1,14 @@
package org.jboss.tools.maven.ui.bot.test;
+import java.io.File;
+import java.io.IOException;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.apache.maven.model.Profile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.bindings.keys.KeyStroke;
import org.eclipse.jface.bindings.keys.ParseException;
import org.eclipse.m2e.core.MavenPlugin;
@@ -17,6 +20,7 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -26,9 +30,11 @@
public static final String AUTOACTIVATED_PROFILE_IN_POM = "active-profile";
public static final String AUTOACTIVATED_PROFILE_IN_USER_SETTINGS =
"jboss.repository";
-
+ public static final String COMMON_PROFILE = "common-profile";
+
@Test
public void testOpenMavenProfiles() throws Exception {
+ setUserSettings();
IProject project = importProject("projects/simple-jar/pom.xml");
waitForJobsToComplete();
testAutoActivatedProfiles();
@@ -46,7 +52,7 @@
String selectedProfiles = shell.textWithLabel("Active profiles for simple-jar
:").getText();
shell.button("OK").click();
- testActivatedProfiles(project.getName(), selectedProfiles);
+ testActivatedProfiles(project.getName(), selectedProfiles, false);
Thread.sleep(1000);
openProfilesDialog(projectItem);
@@ -56,9 +62,38 @@
selectedProfiles = bot.textWithLabel("Active profiles for simple-jar
:").getText();
bot.button("OK").click();
- testActivatedProfiles(project.getName(), selectedProfiles);
+ testActivatedProfiles(project.getName(), selectedProfiles, true);
}
+ @Test
+ public void testOpenMultipleMavenProfiles() throws Exception{
+ IProject project = importProject("projects/simple-jar/pom.xml");
+ IProject project1 = importProject("projects/simple-jar1/pom.xml");
+ IProject project2 = importProject("projects/simple-jar2/pom.xml");
+ waitForJobsToComplete();
+ final SWTBotView packageExplorer = bot.viewByTitle("Project Explorer");
+ SWTBot innerBot = packageExplorer.bot();
+ innerBot.activeShell().activate();
+ SWTBotTree tree = innerBot.tree();
+ tree.select("simple-jar","simple-jar1","simple-jar2").pressShortcut(Keystrokes.CTRL,
Keystrokes.ALT,KeyStroke.getInstance("P"));
+ SWTBot shell = bot.shell("Select Maven profiles").activate().bot();
+ shell.button("Select All").click();
+ shell.button("Activate").click();
+ shell.button("OK").click();
+ testActivatedProfiles(project.getName(), COMMON_PROFILE+",
"+AUTOACTIVATED_PROFILE_IN_USER_SETTINGS, false);
+ testActivatedProfiles(project1.getName(), COMMON_PROFILE+",
"+AUTOACTIVATED_PROFILE_IN_USER_SETTINGS, false);
+ testActivatedProfiles(project2.getName(), COMMON_PROFILE+",
"+AUTOACTIVATED_PROFILE_IN_USER_SETTINGS, false);
+ }
+
+ private void setUserSettings() throws InterruptedException, IOException, CoreException{
+ SWTBotExt botExt = new SWTBotExt();
+ botExt.menu("Window").menu("Preferences").click();
+ botExt.tree().expandNode("Maven").select("User Settings").click();
+ File f = new File("usersettings/settings.xml");
+ botExt.text(1).setText(f.getAbsolutePath());
+ botExt.button("OK").click();
+ }
+
private void openProfilesDialog(SWTBotTreeItem projectItem) throws ParseException,
InterruptedException{
projectItem.pressShortcut(Keystrokes.CTRL,
Keystrokes.ALT,KeyStroke.getInstance("P"));
//projectItem.pressShortcut(Keystrokes.DOWN);
@@ -68,7 +103,7 @@
Thread.sleep(1000);
}
- private void testActivatedProfiles(String projectName, String profilesToCheck){
+ private void testActivatedProfiles(String projectName, String profilesToCheck, boolean
defaultProfile){
IMavenProjectFacade facade =
MavenPlugin.getMavenProjectRegistry().getMavenProject("org.jboss.tools.maven.tests",
"simple-jar", "1.0.0-SNAPSHOT");
assertNotNull("facade is null",facade);
@@ -76,16 +111,19 @@
String empty = "";
Set<String> setOfProfiles = new HashSet<String>();
Collections.addAll(setOfProfiles, parsedProfiles);
- setOfProfiles.add(AUTOACTIVATED_PROFILE_IN_POM);
setOfProfiles.add(AUTOACTIVATED_PROFILE_IN_USER_SETTINGS);
+ if(defaultProfile){
+ setOfProfiles.add(AUTOACTIVATED_PROFILE_IN_POM);
+ }
setOfProfiles.remove(empty);
Set<String> setOfProfilesFacade = new HashSet<String>();
for(Profile profile : facade.getMavenProject().getActiveProfiles()){
+ System.out.println(profile.getId());
setOfProfilesFacade.add(profile.getId());
}
- assertEquals("Selected profiles doesn't match", setOfProfilesFacade,
setOfProfiles);
+ assertEquals("Selected profiles in project " +projectName+ "
doesn't match", setOfProfilesFacade, setOfProfiles);
}
private void testAutoActivatedProfiles(){
Added: trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/usersettings/settings.xml
===================================================================
--- trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/usersettings/settings.xml
(rev 0)
+++
trunk/maven/tests/org.jboss.tools.maven.ui.bot.test/usersettings/settings.xml 2012-01-11
10:58:21 UTC (rev 37758)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"
standalone="no"?>
+<settings>
+ <profiles>
+ <profile>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <id>jboss.repository</id>
+ </profile>
+ </profiles>
+</settings>
\ No newline at end of file