-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setting Maven user settings as a part of IBeforeTest can be disabled …
…and configured
- Loading branch information
Showing
11 changed files
with
68 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...org/jboss/tools/maven/reddeer/junit/extensions/before/test/impl/SetMavenUserSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.jboss.tools.maven.reddeer.junit.extensions.before.test.impl; | ||
|
||
import java.io.File; | ||
|
||
import org.jboss.reddeer.common.exception.RedDeerException; | ||
import org.jboss.reddeer.common.logging.Logger; | ||
import org.jboss.reddeer.junit.extensionpoint.IBeforeTest; | ||
import org.jboss.reddeer.workbench.ui.dialogs.WorkbenchPreferenceDialog; | ||
import org.jboss.tools.maven.reddeer.preferences.MavenUserPreferencePage; | ||
|
||
/** | ||
* This extensions sets defined Maven settings.xml in Maven -> User Settings property page | ||
* | ||
* available properties: | ||
* maven.settings.path - path to settings.xml which should be set. If this property is not set this class wont run | ||
* @author rawagner | ||
* | ||
*/ | ||
public class SetMavenUserSettings implements IBeforeTest { | ||
|
||
private static final Logger log = Logger.getLogger(SetMavenUserSettings.class); | ||
|
||
@Override | ||
public void runBeforeTest() { | ||
setUserSettings(getMavenSettingsPath()); | ||
|
||
} | ||
|
||
@Override | ||
public boolean hasToRun() { | ||
return System.getProperty("maven.settings.path") != null; | ||
} | ||
|
||
private String getMavenSettingsPath(){ | ||
File userSettings = new File(System.getProperty("maven.settings.path")); | ||
if(!userSettings.exists()){ | ||
log.warn("Maven settings.xml does not exist"); | ||
} | ||
return userSettings.getAbsolutePath(); | ||
} | ||
|
||
private void setUserSettings(String mavenSettingsPath){ | ||
log.debug("Setting maven user settings to "+mavenSettingsPath); | ||
WorkbenchPreferenceDialog preferenceDialog = new WorkbenchPreferenceDialog(); | ||
preferenceDialog.open(); | ||
MavenUserPreferencePage mpreferences = new MavenUserPreferencePage(); | ||
preferenceDialog.select(mpreferences); | ||
if(!mpreferences.getUserSettings().equals(mavenSettingsPath)){ | ||
mpreferences.setUserSettings(mavenSettingsPath); | ||
mpreferences.apply(); | ||
} | ||
preferenceDialog.ok(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
plugin.xml | ||
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
...s.maven.ui.bot.test/src/org/jboss/tools/maven/ui/bot/test/utils/SetMavenUserSettings.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters