mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22:05 +01:00
default username to use for test cases is now configurable. SMACK-206
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7329 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
8775331293
commit
9189d74d0a
2 changed files with 10 additions and 3 deletions
|
@ -6,6 +6,9 @@
|
|||
<host>localhost</host>
|
||||
<port>5222</port>
|
||||
|
||||
<!-- Username prefix to use for creating accounts. Same value will be used for passwords. -->
|
||||
<username>user</username>
|
||||
|
||||
<!-- Chat and MUC domain names to use -->
|
||||
<chat>chat</chat>
|
||||
<muc>conference</muc>
|
||||
|
|
|
@ -52,6 +52,7 @@ public abstract class SmackTestCase extends TestCase {
|
|||
private String host = "localhost";
|
||||
private String serviceName = "localhost";
|
||||
private int port = 5222;
|
||||
private String usernamnePrefix = "user";
|
||||
|
||||
private String chatDomain = "chat";
|
||||
private String mucDomain = "conference";
|
||||
|
@ -134,7 +135,7 @@ public abstract class SmackTestCase extends TestCase {
|
|||
if (index > getMaxConnections()) {
|
||||
throw new IllegalArgumentException("Index out of bounds");
|
||||
}
|
||||
return "user" + index;
|
||||
return usernamnePrefix + index;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -214,7 +215,7 @@ public abstract class SmackTestCase extends TestCase {
|
|||
for (int i = 0; i < getMaxConnections(); i++) {
|
||||
// Create the test account
|
||||
try {
|
||||
getConnection(i).getAccountManager().createAccount("user" + i, "user" + i);
|
||||
getConnection(i).getAccountManager().createAccount(usernamnePrefix + i, usernamnePrefix + i);
|
||||
} catch (XMPPException e) {
|
||||
// Do nothing if the accout already exists
|
||||
if (e.getXMPPError() == null || e.getXMPPError().getCode() != 409) {
|
||||
|
@ -222,7 +223,7 @@ public abstract class SmackTestCase extends TestCase {
|
|||
}
|
||||
}
|
||||
// Login with the new test account
|
||||
getConnection(i).login("user" + i, "user" + i, "Smack", sendInitialPresence());
|
||||
getConnection(i).login(usernamnePrefix + i, usernamnePrefix + i, "Smack", sendInitialPresence());
|
||||
}
|
||||
// Let the server process the available presences
|
||||
Thread.sleep(150);
|
||||
|
@ -331,6 +332,9 @@ public abstract class SmackTestCase extends TestCase {
|
|||
else if (parser.getName().equals("muc")) {
|
||||
mucDomain = parser.nextText();
|
||||
}
|
||||
else if (parser.getName().equals("username")) {
|
||||
usernamnePrefix = parser.nextText();
|
||||
}
|
||||
}
|
||||
eventType = parser.next();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue