From 9189d74d0a202d0aa02574c6d0ef6f1920b56f40 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Wed, 28 Feb 2007 23:59:28 +0000 Subject: [PATCH] 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 --- test/config/test-case.xml | 3 +++ test/org/jivesoftware/smack/test/SmackTestCase.java | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/test/config/test-case.xml b/test/config/test-case.xml index d86db2f0f..5e61db9fb 100644 --- a/test/config/test-case.xml +++ b/test/config/test-case.xml @@ -6,6 +6,9 @@ localhost 5222 + + user + chat conference diff --git a/test/org/jivesoftware/smack/test/SmackTestCase.java b/test/org/jivesoftware/smack/test/SmackTestCase.java index 8c5cac89e..d570ba2d9 100644 --- a/test/org/jivesoftware/smack/test/SmackTestCase.java +++ b/test/org/jivesoftware/smack/test/SmackTestCase.java @@ -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(); }