You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2010/01/07 15:03:00 UTC
svn commit: r896884 -
/james/mpt/trunk/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java
Author: norman
Date: Thu Jan 7 14:01:29 2010
New Revision: 896884
URL: http://svn.apache.org/viewvc?rev=896884&view=rev
Log:
Add support for scriptFile in AddUser
Modified:
james/mpt/trunk/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java
Modified: james/mpt/trunk/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java
URL: http://svn.apache.org/viewvc/james/mpt/trunk/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java?rev=896884&r1=896883&r2=896884&view=diff
==============================================================================
--- james/mpt/trunk/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java (original)
+++ james/mpt/trunk/mavenplugin/src/main/java/org/apache/james/mpt/maven/MailProtocolTestMojo.java Thu Jan 7 14:01:29 2010
@@ -21,11 +21,11 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;
-import java.util.List;
import org.apache.james.mpt.ExternalHostSystem;
import org.apache.james.mpt.Monitor;
@@ -103,8 +103,12 @@
AddUser addUser = (AddUser) addUsers[i];
try {
- final Reader reader = new StringReader(addUser.getText());
-
+ final Reader reader;
+ if (addUser.getScriptText() != null) {
+ reader = new StringReader(addUser.getScriptText());
+ } else {
+ reader = new FileReader(addUser.getScriptFile());
+ }
final ScriptedUserAdder adder = new ScriptedUserAdder(addUser.getHost(), addUser.getPort(), MailProtocolTestMojo.this);
adder.addUser(addUser.getUser(), addUser.getPasswd(), reader);
} catch (Exception e) {
@@ -148,8 +152,8 @@
for (int i = 0; i < addUsers.length; i++) {
AddUser addUser = (AddUser)addUsers[i];
- if (addUser.getText() == null) {
- throw new MojoFailureException("AddUser must contain the text of the script");
+ if (addUser.getScriptText() == null && addUser.getScriptFile() == null) {
+ throw new MojoFailureException("AddUser must contain the text of the script or a scriptFile");
}
if (addUser.getPort() <= 0) {
@@ -200,7 +204,8 @@
private String passwd;
private String scriptText;
private String host;
-
+ private File scriptFile;
+
/**
* Gets the host (either name or number) against which this
* test will run.
@@ -269,15 +274,22 @@
* Sets user addition script.
* @param scriptText not null
*/
- public void setText(String scriptText) {
+ public void setScriptText(String scriptText) {
this.scriptText = scriptText;
}
- public String getText() {
+ public String getScriptText() {
return scriptText;
}
+ public File getScriptFile() {
+ return scriptFile;
+ }
+
+ public void setScriptFile(File scriptFile) {
+ this.scriptFile = scriptFile;
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org