mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Fondermann <bf_...@brainlounge.de>
Subject Re: svn commit: r1056818 - in /mina/vysper/trunk: examples/embedded-war/src/main/java/org/apache/vysper/xmpp/exemples/embeddedwar/ server/core/src/main/java/org/apache/vysper/spring/ server/core/src/main/java/org/apache/vysper/storage/jcr/user/ server/core...
Date Sun, 09 Jan 2011 21:31:04 GMT
Just to get this off my chest: When I introduced this interface, I 
thought the account management could benefit from not needing to know 
what that an account must be a JID, just a String. Which, I think now, 
was a lil bit overdesigned.

Thanks for taking cleaning that up. :)

   Bernd

On 08.01.11 23:16, ngn@apache.org wrote:
> Author: ngn
> Date: Sat Jan  8 22:16:10 2011
> New Revision: 1056818
>
> URL: http://svn.apache.org/viewvc?rev=1056818&view=rev
> Log:
> Make AccountManagement be consistent in always using Entity
>
> Modified:
>      mina/vysper/trunk/examples/embedded-war/src/main/java/org/apache/vysper/xmpp/exemples/embeddedwar/VysperListener.java
>      mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/spring/AddUserHelper.java
>      mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/storage/jcr/user/JcrUserManagement.java
>      mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/authorization/AccountManagement.java
>      mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/authorization/SimpleUserAuthorization.java
>      mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0133_service_administration/command/AddUserCommandHandler.java
>      mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0133_service_administration/command/ChangeUserPasswordCommandHandler.java
>      mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java
>      mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInteralInboundStanzaRelayTestCase.java
>      mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbortHandlerTestCase.java
>      mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerPlainMechanismTestCase.java
>      mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/server/s2s/Server2Server.java
>      mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/server/s2s/ServerMain.java
>      mina/vysper/trunk/server/extensions/websockets/src/examples/java/org/apache/vysper/xmpp/extension/websockets/DemoServer.java
>      mina/vysper/trunk/server/extensions/websockets/src/examples/java/org/apache/vysper/xmpp/extension/websockets/ServerMain.java
>      mina/vysper/trunk/server/extensions/xep0045-muc/src/test/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/ServerMain.java
>      mina/vysper/trunk/server/extensions/xep0060-pubsub/src/test/java/org/apache/vysper/demo/pubsub/client/ServerMain.java
>      mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/main/java/org/apache/vysper/xmpp/extension/xep0124/ServerMain.java
>      mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/test/java/org/apache/vysper/xmpp/extension/xep0124/inttests/IntegrationTestTemplate.java
>
> Modified: mina/vysper/trunk/examples/embedded-war/src/main/java/org/apache/vysper/xmpp/exemples/embeddedwar/VysperListener.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/examples/embedded-war/src/main/java/org/apache/vysper/xmpp/exemples/embeddedwar/VysperListener.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/examples/embedded-war/src/main/java/org/apache/vysper/xmpp/exemples/embeddedwar/VysperListener.java
(original)
> +++ mina/vysper/trunk/examples/embedded-war/src/main/java/org/apache/vysper/xmpp/exemples/embeddedwar/VysperListener.java
Sat Jan  8 22:16:10 2011
> @@ -6,6 +6,7 @@ import javax.servlet.ServletContextListe
>   import org.apache.vysper.mina.TCPEndpoint;
>   import org.apache.vysper.storage.StorageProviderRegistry;
>   import org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry;
> +import org.apache.vysper.xmpp.addressing.Entity;
>   import org.apache.vysper.xmpp.addressing.EntityImpl;
>   import org.apache.vysper.xmpp.authorization.AccountManagement;
>   import org.apache.vysper.xmpp.extension.websockets.XmppWebSocketServlet;
> @@ -25,14 +26,13 @@ public class VysperListener implements S
>
>               StorageProviderRegistry providerRegistry = new MemoryStorageProviderRegistry();
>
> -            final String adminJID = "admin@" + domain;
>               final AccountManagement accountManagement = (AccountManagement) providerRegistry
>                       .retrieve(AccountManagement.class);
> -
> -            String initialPassword = System.getProperty("vysper.admin.initial.password",
"CHOOSE SECURE PASSWORD");
> -                if (!accountManagement.verifyAccountExists(EntityImpl.parse(adminJID)))
{
> -                    accountManagement.addUser(adminJID, initialPassword);
> -                }
> +
> +            Entity user1 = EntityImpl.parse("user1@vysper.org");
> +            if (!accountManagement.verifyAccountExists(user1)) {
> +                accountManagement.addUser(user1, "password1");
> +            }
>
>               server = new XMPPServer(domain);
>               server.addEndpoint(new TCPEndpoint());
>
> Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/spring/AddUserHelper.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/spring/AddUserHelper.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/spring/AddUserHelper.java
(original)
> +++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/spring/AddUserHelper.java
Sat Jan  8 22:16:10 2011
> @@ -25,6 +25,7 @@ import java.util.Map;
>   import org.apache.commons.lang.RandomStringUtils;
>   import org.apache.commons.lang.StringUtils;
>   import org.apache.vysper.storage.StorageProviderRegistry;
> +import org.apache.vysper.xmpp.addressing.Entity;
>   import org.apache.vysper.xmpp.addressing.EntityFormatException;
>   import org.apache.vysper.xmpp.addressing.EntityImpl;
>   import org.apache.vysper.xmpp.authorization.AccountCreationException;
> @@ -49,13 +50,14 @@ public class AddUserHelper {
>               throw new IllegalStateException("no account manager accessible.");
>
>           for (String user : userPasswordMap.keySet()) {
> -            if (!accountManagement.verifyAccountExists(EntityImpl.parse(user))) {
> +            Entity entity = EntityImpl.parse(user);
> +            if (!accountManagement.verifyAccountExists(entity)) {
>                   String password = userPasswordMap.get(user);
>                   if (StringUtils.isEmpty(password)) {
>                       password = RandomStringUtils.randomAlphanumeric(8);
>                       System.out.println(user + " user will be added with random password:
'" + password + "'");
>                   }
> -                accountManagement.addUser(user, password);
> +                accountManagement.addUser(entity, password);
>               }
>           }
>       }
>
> Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/storage/jcr/user/JcrUserManagement.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/storage/jcr/user/JcrUserManagement.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/storage/jcr/user/JcrUserManagement.java
(original)
> +++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/storage/jcr/user/JcrUserManagement.java
Sat Jan  8 22:16:10 2011
> @@ -82,24 +82,18 @@ public class JcrUserManagement implement
>           }
>       }
>
> -    public void addUser(String username, String password) throws AccountCreationException
{
> -        final EntityImpl entity;
> -        try {
> -            entity = EntityImpl.parse(username);
> -        } catch (EntityFormatException e) {
> -            throw new AccountCreationException("username is expected to be in proper
entity format, not " + username, e); // wrap as unchecked
> -        }
> +    public void addUser(Entity username, String password) throws AccountCreationException
{
>           // if already existent, don't create, throw error
>           try {
> -            if (jcrStorage.getEntityNode(entity, CREDENTIALS_NAMESPACE, false) != null)
{
> -                throw new AccountCreationException("account already exists: " + entity.getFullQualifiedName());
> +            if (jcrStorage.getEntityNode(username, CREDENTIALS_NAMESPACE, false) !=
null) {
> +                throw new AccountCreationException("account already exists: " + username.getFullQualifiedName());
>               }
>           } catch (JcrStorageException e) {
> -            throw new AccountCreationException("account exists check failed for " +
entity.getFullQualifiedName(), e);
> +            throw new AccountCreationException("account exists check failed for " +
username.getFullQualifiedName(), e);
>           }
>           // now, finally, create
>           try {
> -            final Node credentialsNode = jcrStorage.getEntityNode(entity, CREDENTIALS_NAMESPACE,
true);
> +            final Node credentialsNode = jcrStorage.getEntityNode(username, CREDENTIALS_NAMESPACE,
true);
>               credentialsNode.setProperty("password", password);
>               credentialsNode.save();
>               logger.info("JCR node created: " + credentialsNode);
> @@ -110,15 +104,9 @@ public class JcrUserManagement implement
>
>       }
>
> -    public void changePassword(String username, String password) throws AccountCreationException
{
> -        final EntityImpl entity;
> -        try {
> -            entity = EntityImpl.parse(username);
> -        } catch (EntityFormatException e) {
> -            throw new AccountCreationException("username is expected to be in proper
entity format, not " + username, e); // wrap as unchecked
> -        }
> +    public void changePassword(Entity username, String password) throws AccountCreationException
{
>           try {
> -            final Node credentialsNode = jcrStorage.getEntityNode(entity, CREDENTIALS_NAMESPACE,
false);
> +            final Node credentialsNode = jcrStorage.getEntityNode(username, CREDENTIALS_NAMESPACE,
false);
>               credentialsNode.setProperty("password", password);
>               credentialsNode.save();
>               logger.info("JCR password changed: " + credentialsNode);
>
> Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/authorization/AccountManagement.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/authorization/AccountManagement.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/authorization/AccountManagement.java
(original)
> +++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/authorization/AccountManagement.java
Sat Jan  8 22:16:10 2011
> @@ -27,9 +27,9 @@ import org.apache.vysper.xmpp.addressing
>    * @author The Apache MINA Project (dev@mina.apache.org)
>    */
>   public interface AccountManagement extends StorageProvider {
> -    void addUser(String username, String password) throws AccountCreationException;
> +    void addUser(Entity username, String password) throws AccountCreationException;
>
> -    void changePassword(String username, String password) throws AccountCreationException;
> +    void changePassword(Entity username, String password) throws AccountCreationException;
>
>       /**
>        * checks if there is this jid is registered with the server
>
> Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/authorization/SimpleUserAuthorization.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/authorization/SimpleUserAuthorization.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/authorization/SimpleUserAuthorization.java
(original)
> +++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/authorization/SimpleUserAuthorization.java
Sat Jan  8 22:16:10 2011
> @@ -31,21 +31,21 @@ import org.apache.vysper.xmpp.addressing
>    */
>   public class SimpleUserAuthorization implements UserAuthorization, AccountManagement
{
>
> -    private final Map<String, String>  userPasswordMap = new HashMap<String,
String>();
> +    private final Map<Entity, String>  userPasswordMap = new HashMap<Entity,
String>();
>
>       public SimpleUserAuthorization() {
>           ; // empty
>       }
>
> -    public SimpleUserAuthorization(Map<String, String>  userPasswordMap) {
> +    public SimpleUserAuthorization(Map<Entity, String>  userPasswordMap) {
>           this.userPasswordMap.putAll(userPasswordMap);
>       }
>
> -    public void addUser(String username, String password) {
> +    public void addUser(Entity username, String password) {
>           userPasswordMap.put(username, password);
>       }
>
> -    public void changePassword(String username, String password) throws AccountCreationException
{
> +    public void changePassword(Entity username, String password) throws AccountCreationException
{
>           if (!userPasswordMap.containsKey(username)) {
>               throw new AccountCreationException("could not change password for unknown
user " + username);
>           }
>
> Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0133_service_administration/command/AddUserCommandHandler.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0133_service_administration/command/AddUserCommandHandler.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0133_service_administration/command/AddUserCommandHandler.java
(original)
> +++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0133_service_administration/command/AddUserCommandHandler.java
Sat Jan  8 22:16:10 2011
> @@ -73,7 +73,7 @@ public class AddUserCommandHandler exten
>           }
>
>           try {
> -            accountManagement.addUser(accountjid.getFullQualifiedName(), password);
> +            accountManagement.addUser(accountjid, password);
>           } catch (AccountCreationException e) {
>               notes.add(Note.error("account creation failed for " + accountjid));
>               return sendForm();
>
> Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0133_service_administration/command/ChangeUserPasswordCommandHandler.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0133_service_administration/command/ChangeUserPasswordCommandHandler.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0133_service_administration/command/ChangeUserPasswordCommandHandler.java
(original)
> +++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/modules/extension/xep0133_service_administration/command/ChangeUserPasswordCommandHandler.java
Sat Jan  8 22:16:10 2011
> @@ -70,7 +70,7 @@ public class ChangeUserPasswordCommandHa
>           }
>
>           try {
> -            accountManagement.changePassword(accountjid.getFullQualifiedName(), password);
> +            accountManagement.changePassword(accountjid, password);
>           } catch (AccountCreationException e) {
>               notes.add(Note.error("changing password failed for " + accountjid));
>               return sendForm();
>
> Modified: mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java
(original)
> +++ mina/vysper/trunk/server/core/src/main/java/org/apache/vysper/xmpp/server/ServerMain.java
Sat Jan  8 22:16:10 2011
> @@ -23,6 +23,7 @@ import org.apache.commons.lang.RandomStr
>   import org.apache.vysper.mina.TCPEndpoint;
>   import org.apache.vysper.storage.StorageProviderRegistry;
>   import org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry;
> +import org.apache.vysper.xmpp.addressing.Entity;
>   import org.apache.vysper.xmpp.addressing.EntityFormatException;
>   import org.apache.vysper.xmpp.addressing.EntityImpl;
>   import org.apache.vysper.xmpp.authorization.AccountCreationException;
> @@ -58,7 +59,7 @@ public class ServerMain {
>        *
>        * @param args
>        */
> -    public static void main(String[] args) throws AccountCreationException, EntityFormatException,
FileNotFoundException {
> +    public static void main(String[] args) throws AccountCreationException, FileNotFoundException
{
>
>           String domain = "vysper.org";
>
> @@ -73,12 +74,12 @@ public class ServerMain {
>           //StorageProviderRegistry providerRegistry = new JcrStorageProviderRegistry();
>           StorageProviderRegistry providerRegistry = new MemoryStorageProviderRegistry();
>
> -        final String adminJID = "admin@" + domain;
> +        final Entity adminJID = EntityImpl.parseUnchecked("admin@" + domain);
>           final AccountManagement accountManagement = (AccountManagement) providerRegistry
>                   .retrieve(AccountManagement.class);
>
>           String initialPassword = System.getProperty("vysper.admin.initial.password",
"CHOOSE SECURE PASSWORD");
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse(adminJID))) {
> +        if (!accountManagement.verifyAccountExists(adminJID)) {
>               accountManagement.addUser(adminJID, initialPassword);
>           }
>
> @@ -104,7 +105,7 @@ public class ServerMain {
>           server.addModule(new AdhocCommandsModule());
>           final ServiceAdministrationModule serviceAdministrationModule = new ServiceAdministrationModule();
>           // unless admin user account with a secure password is added, this will be
not become effective
> -        serviceAdministrationModule.setAddAdmins(Arrays.asList(adminJID));
> +        serviceAdministrationModule.setAddAdminJIDs(Arrays.asList(adminJID));
>           server.addModule(serviceAdministrationModule);
>
>           if (listOfModules != null) {
>
> Modified: mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInteralInboundStanzaRelayTestCase.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInteralInboundStanzaRelayTestCase.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInteralInboundStanzaRelayTestCase.java
(original)
> +++ mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInteralInboundStanzaRelayTestCase.java
Sat Jan  8 22:16:10 2011
> @@ -48,7 +48,7 @@ public class DeliveringInteralInboundSta
>       protected DeliveringInternalInboundStanzaRelay stanzaRelay;
>
>       static class AccountVerificationMock implements AccountManagement {
> -        public void addUser(String username, String password) throws AccountCreationException
{
> +        public void addUser(Entity username, String password) throws AccountCreationException
{
>               ; // empty
>           }
>
> @@ -56,7 +56,7 @@ public class DeliveringInteralInboundSta
>               return true;
>           }
>
> -        public void changePassword(String username, String password) throws AccountCreationException
{
> +        public void changePassword(Entity username, String password) throws AccountCreationException
{
>               ; // empty
>           }
>       }
>
> Modified: mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbortHandlerTestCase.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbortHandlerTestCase.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbortHandlerTestCase.java
(original)
> +++ mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AbortHandlerTestCase.java
Sat Jan  8 22:16:10 2011
> @@ -27,6 +27,7 @@ import junit.framework.TestCase;
>   import org.apache.commons.codec.binary.Base64;
>   import org.apache.vysper.storage.OpenStorageProviderRegistry;
>   import org.apache.vysper.xml.fragment.XMLSemanticError;
> +import org.apache.vysper.xmpp.addressing.EntityImpl;
>   import org.apache.vysper.xmpp.authorization.Plain;
>   import org.apache.vysper.xmpp.authorization.SASLMechanism;
>   import org.apache.vysper.xmpp.authorization.SimpleUserAuthorization;
> @@ -59,7 +60,7 @@ public class AbortHandlerTestCase extend
>
>           sessionContext.getServerRuntimeContext().getServerFeatures().setAuthenticationMethods(methods);
>           SimpleUserAuthorization users = new SimpleUserAuthorization();
> -        users.addUser("user007@test", "pass007");
> +        users.addUser(EntityImpl.parseUnchecked("user007@test"), "pass007");
>           OpenStorageProviderRegistry providerRegistry = new OpenStorageProviderRegistry();
>           providerRegistry.add(users);
>           ((DefaultServerRuntimeContext) sessionContext.getServerRuntimeContext())
>
> Modified: mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerPlainMechanismTestCase.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerPlainMechanismTestCase.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerPlainMechanismTestCase.java
(original)
> +++ mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/modules/core/sasl/handler/AuthHandlerPlainMechanismTestCase.java
Sat Jan  8 22:16:10 2011
> @@ -27,6 +27,7 @@ import junit.framework.TestCase;
>   import org.apache.commons.codec.binary.Base64;
>   import org.apache.vysper.storage.OpenStorageProviderRegistry;
>   import org.apache.vysper.xml.fragment.XMLSemanticError;
> +import org.apache.vysper.xmpp.addressing.EntityImpl;
>   import org.apache.vysper.xmpp.authorization.Plain;
>   import org.apache.vysper.xmpp.authorization.SASLMechanism;
>   import org.apache.vysper.xmpp.authorization.SimpleUserAuthorization;
> @@ -59,7 +60,7 @@ public class AuthHandlerPlainMechanismTe
>
>           sessionContext.getServerRuntimeContext().getServerFeatures().setAuthenticationMethods(methods);
>           SimpleUserAuthorization users = new SimpleUserAuthorization();
> -        users.addUser("user007@test", "pass007");
> +        users.addUser(EntityImpl.parseUnchecked("user007@test"), "pass007");
>           OpenStorageProviderRegistry providerRegistry = new OpenStorageProviderRegistry();
>           providerRegistry.add(users);
>           ((DefaultServerRuntimeContext) sessionContext.getServerRuntimeContext())
>
> Modified: mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/server/s2s/Server2Server.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/server/s2s/Server2Server.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/server/s2s/Server2Server.java
(original)
> +++ mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/server/s2s/Server2Server.java
Sat Jan  8 22:16:10 2011
> @@ -47,7 +47,7 @@ public class Server2Server {
>           .retrieve(AccountManagement.class);
>
>           if (!accountManagement.verifyAccountExists(localUser)) {
> -            accountManagement.addUser(localUser.getFullQualifiedName(), "password1");
> +            accountManagement.addUser(localUser, "password1");
>           }
>
>           // S2S endpoint
>
> Modified: mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/server/s2s/ServerMain.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/server/s2s/ServerMain.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/server/s2s/ServerMain.java
(original)
> +++ mina/vysper/trunk/server/core/src/test/java/org/apache/vysper/xmpp/server/s2s/ServerMain.java
Sat Jan  8 22:16:10 2011
> @@ -84,7 +84,7 @@ public class ServerMain {
>           final AccountManagement accountManagement = (AccountManagement) providerRegistry
>                   .retrieve(AccountManagement.class);
>
> -        accountManagement.addUser(localUser.getFullQualifiedName(), "password1");
> +        accountManagement.addUser(localUser, "password1");
>
>           XMPPServer server = new XMPPServer(localServer.getFullQualifiedName());
>
>
> Modified: mina/vysper/trunk/server/extensions/websockets/src/examples/java/org/apache/vysper/xmpp/extension/websockets/DemoServer.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/extensions/websockets/src/examples/java/org/apache/vysper/xmpp/extension/websockets/DemoServer.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/extensions/websockets/src/examples/java/org/apache/vysper/xmpp/extension/websockets/DemoServer.java
(original)
> +++ mina/vysper/trunk/server/extensions/websockets/src/examples/java/org/apache/vysper/xmpp/extension/websockets/DemoServer.java
Sat Jan  8 22:16:10 2011
> @@ -25,6 +25,7 @@ import java.io.FileNotFoundException;
>   import org.apache.vysper.mina.TCPEndpoint;
>   import org.apache.vysper.storage.StorageProviderRegistry;
>   import org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry;
> +import org.apache.vysper.xmpp.addressing.Entity;
>   import org.apache.vysper.xmpp.addressing.EntityFormatException;
>   import org.apache.vysper.xmpp.addressing.EntityImpl;
>   import org.apache.vysper.xmpp.authorization.AccountCreationException;
> @@ -59,14 +60,17 @@ public class DemoServer {
>           final AccountManagement accountManagement = (AccountManagement) providerRegistry
>                   .retrieve(AccountManagement.class);
>
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user1@vysper.org")))
{
> -            accountManagement.addUser("user1@vysper.org", "password1");
> +        Entity user1 = EntityImpl.parse("user1@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user1)) {
> +            accountManagement.addUser(user1, "password1");
>           }
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user2@vysper.org")))
{
> -            accountManagement.addUser("user2@vysper.org", "password1");
> +        Entity user2 = EntityImpl.parse("user2@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user2)) {
> +            accountManagement.addUser(user2, "password1");
>           }
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user3@vysper.org")))
{
> -            accountManagement.addUser("user3@vysper.org", "password1");
> +        Entity user3 = EntityImpl.parse("user3@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user3)) {
> +            accountManagement.addUser(user3, "password1");
>           }
>
>
>
> Modified: mina/vysper/trunk/server/extensions/websockets/src/examples/java/org/apache/vysper/xmpp/extension/websockets/ServerMain.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/extensions/websockets/src/examples/java/org/apache/vysper/xmpp/extension/websockets/ServerMain.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/extensions/websockets/src/examples/java/org/apache/vysper/xmpp/extension/websockets/ServerMain.java
(original)
> +++ mina/vysper/trunk/server/extensions/websockets/src/examples/java/org/apache/vysper/xmpp/extension/websockets/ServerMain.java
Sat Jan  8 22:16:10 2011
> @@ -27,6 +27,7 @@ import java.util.List;
>   import org.apache.vysper.mina.TCPEndpoint;
>   import org.apache.vysper.storage.StorageProviderRegistry;
>   import org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry;
> +import org.apache.vysper.xmpp.addressing.Entity;
>   import org.apache.vysper.xmpp.addressing.EntityFormatException;
>   import org.apache.vysper.xmpp.addressing.EntityImpl;
>   import org.apache.vysper.xmpp.authorization.AccountCreationException;
> @@ -71,14 +72,17 @@ public class ServerMain {
>           final AccountManagement accountManagement = (AccountManagement) providerRegistry
>                   .retrieve(AccountManagement.class);
>
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user1@vysper.org")))
{
> -            accountManagement.addUser("user1@vysper.org", "password1");
> -        }
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user2@vysper.org")))
{
> -            accountManagement.addUser("user2@vysper.org", "password1");
> -        }
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user3@vysper.org")))
{
> -            accountManagement.addUser("user3@vysper.org", "password1");
> +        Entity user1 = EntityImpl.parse("user1@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user1)) {
> +            accountManagement.addUser(user1, "password1");
> +        }
> +        Entity user2 = EntityImpl.parse("user2@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user2)) {
> +            accountManagement.addUser(user2, "password1");
> +        }
> +        Entity user3 = EntityImpl.parse("user3@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user3)) {
> +            accountManagement.addUser(user3, "password1");
>           }
>
>           XMPPServer server = new XMPPServer("vysper.org");
>
> Modified: mina/vysper/trunk/server/extensions/xep0045-muc/src/test/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/ServerMain.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/extensions/xep0045-muc/src/test/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/ServerMain.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/extensions/xep0045-muc/src/test/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/ServerMain.java
(original)
> +++ mina/vysper/trunk/server/extensions/xep0045-muc/src/test/java/org/apache/vysper/xmpp/modules/extension/xep0045_muc/ServerMain.java
Sat Jan  8 22:16:10 2011
> @@ -24,6 +24,7 @@ import java.io.File;
>   import org.apache.vysper.mina.TCPEndpoint;
>   import org.apache.vysper.storage.StorageProviderRegistry;
>   import org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry;
> +import org.apache.vysper.xmpp.addressing.EntityImpl;
>   import org.apache.vysper.xmpp.authorization.AccountManagement;
>   import org.apache.vysper.xmpp.modules.extension.xep0049_privatedata.PrivateDataModule;
>   import org.apache.vysper.xmpp.modules.extension.xep0054_vcardtemp.VcardTempModule;
> @@ -48,8 +49,9 @@ public class ServerMain {
>
>           AccountManagement accountManagement = (AccountManagement) providerRegistry.retrieve(AccountManagement.class);
>
> -        accountManagement.addUser("user1@vysper.org", "password1");
> -        accountManagement.addUser("user2@vysper.org", "password1");
> +
> +        accountManagement.addUser(EntityImpl.parseUnchecked("user1@vysper.org"), "password1");
> +        accountManagement.addUser(EntityImpl.parseUnchecked("user2@vysper.org"), "password1");
>
>           XMPPServer server = new XMPPServer("vysper.org");
>           server.addEndpoint(new TCPEndpoint());
>
> Modified: mina/vysper/trunk/server/extensions/xep0060-pubsub/src/test/java/org/apache/vysper/demo/pubsub/client/ServerMain.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/extensions/xep0060-pubsub/src/test/java/org/apache/vysper/demo/pubsub/client/ServerMain.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/extensions/xep0060-pubsub/src/test/java/org/apache/vysper/demo/pubsub/client/ServerMain.java
(original)
> +++ mina/vysper/trunk/server/extensions/xep0060-pubsub/src/test/java/org/apache/vysper/demo/pubsub/client/ServerMain.java
Sat Jan  8 22:16:10 2011
> @@ -25,6 +25,7 @@ import java.io.FileNotFoundException;
>   import org.apache.vysper.mina.TCPEndpoint;
>   import org.apache.vysper.storage.StorageProviderRegistry;
>   import org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry;
> +import org.apache.vysper.xmpp.addressing.Entity;
>   import org.apache.vysper.xmpp.addressing.EntityFormatException;
>   import org.apache.vysper.xmpp.addressing.EntityImpl;
>   import org.apache.vysper.xmpp.authorization.AccountCreationException;
> @@ -62,14 +63,17 @@ public class ServerMain {
>           final AccountManagement accountManagement = (AccountManagement) providerRegistry
>                   .retrieve(AccountManagement.class);
>
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user1@vysper.org")))
{
> -            accountManagement.addUser("user1@vysper.org", "password1");
> +        Entity user1 = EntityImpl.parse("user1@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user1)) {
> +            accountManagement.addUser(user1, "password1");
>           }
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user2@vysper.org")))
{
> -            accountManagement.addUser("user2@vysper.org", "password1");
> +        Entity user2 = EntityImpl.parse("user2@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user2)) {
> +            accountManagement.addUser(user2, "password1");
>           }
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user3@vysper.org")))
{
> -            accountManagement.addUser("user3@vysper.org", "password1");
> +        Entity user3 = EntityImpl.parse("user3@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user3)) {
> +            accountManagement.addUser(user3, "password1");
>           }
>
>           XMPPServer server = new XMPPServer("vysper.org");
>
> Modified: mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/main/java/org/apache/vysper/xmpp/extension/xep0124/ServerMain.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/main/java/org/apache/vysper/xmpp/extension/xep0124/ServerMain.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/main/java/org/apache/vysper/xmpp/extension/xep0124/ServerMain.java
(original)
> +++ mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/main/java/org/apache/vysper/xmpp/extension/xep0124/ServerMain.java
Sat Jan  8 22:16:10 2011
> @@ -28,6 +28,7 @@ import java.util.List;
>   import org.apache.vysper.mina.TCPEndpoint;
>   import org.apache.vysper.storage.StorageProviderRegistry;
>   import org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry;
> +import org.apache.vysper.xmpp.addressing.Entity;
>   import org.apache.vysper.xmpp.addressing.EntityFormatException;
>   import org.apache.vysper.xmpp.addressing.EntityImpl;
>   import org.apache.vysper.xmpp.authorization.AccountCreationException;
> @@ -72,14 +73,17 @@ public class ServerMain {
>           final AccountManagement accountManagement = (AccountManagement) providerRegistry
>                   .retrieve(AccountManagement.class);
>
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user1@vysper.org")))
{
> -            accountManagement.addUser("user1@vysper.org", "password1");
> -        }
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user2@vysper.org")))
{
> -            accountManagement.addUser("user2@vysper.org", "password1");
> -        }
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user3@vysper.org")))
{
> -            accountManagement.addUser("user3@vysper.org", "password1");
> +        Entity user1 = EntityImpl.parse("user1@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user1)) {
> +            accountManagement.addUser(user1, "password1");
> +        }
> +        Entity user2 = EntityImpl.parse("user2@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user2)) {
> +            accountManagement.addUser(user2, "password1");
> +        }
> +        Entity user3 = EntityImpl.parse("user3@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user3)) {
> +            accountManagement.addUser(user3, "password1");
>           }
>
>           XMPPServer server = new XMPPServer("vysper.org");
>
> Modified: mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/test/java/org/apache/vysper/xmpp/extension/xep0124/inttests/IntegrationTestTemplate.java
> URL: http://svn.apache.org/viewvc/mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/test/java/org/apache/vysper/xmpp/extension/xep0124/inttests/IntegrationTestTemplate.java?rev=1056818&r1=1056817&r2=1056818&view=diff
> ==============================================================================
> --- mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/test/java/org/apache/vysper/xmpp/extension/xep0124/inttests/IntegrationTestTemplate.java
(original)
> +++ mina/vysper/trunk/server/extensions/xep0124-xep0206-bosh/src/test/java/org/apache/vysper/xmpp/extension/xep0124/inttests/IntegrationTestTemplate.java
Sat Jan  8 22:16:10 2011
> @@ -35,6 +35,7 @@ import org.apache.http.entity.StringEnti
>   import org.apache.http.impl.client.DefaultHttpClient;
>   import org.apache.vysper.storage.StorageProviderRegistry;
>   import org.apache.vysper.storage.inmemory.MemoryStorageProviderRegistry;
> +import org.apache.vysper.xmpp.addressing.Entity;
>   import org.apache.vysper.xmpp.addressing.EntityImpl;
>   import org.apache.vysper.xmpp.authorization.AccountManagement;
>   import org.apache.vysper.xmpp.extension.xep0124.BoshEndpoint;
> @@ -97,8 +98,9 @@ public class IntegrationTestTemplate {
>           final AccountManagement accountManagement = (AccountManagement) providerRegistry
>                   .retrieve(AccountManagement.class);
>
> -        if (!accountManagement.verifyAccountExists(EntityImpl.parse("user1@vysper.org")))
{
> -            accountManagement.addUser("user1@vysper.org", "password1");
> +        Entity user1 = EntityImpl.parseUnchecked("user1@vysper.org");
> +        if (!accountManagement.verifyAccountExists(user1)) {
> +            accountManagement.addUser(user1, "password1");
>           }
>
>           server = new XMPPServer("vysper.org");
>
>
>


Mime
View raw message