@@ -0,0 +1,1916 @@
+/*%0A * %0A * %0A * Copyright (C) 2005 SIPfoundry Inc.%0A * Licensed by SIPfoundry under the LGPL license.%0A * %0A * Copyright (C) 2005 Pingtel Corp.%0A * Licensed to SIPfoundry under a Contributor Agreement.%0A * %0A * $%0A */%0Apackage org.sipfoundry.sipxconfig.security;%0A%0Aimport junit.framework.TestCase;%0Aimport net.sf.acegisecurity.UserDetails;%0A%0Aimport org.easymock.MockControl;%0Aimport org.easymock.classextension.MockClassControl;%0Aimport org.sipfoundry.sipxconfig.common.CoreContext;%0Aimport org.sipfoundry.sipxconfig.common.Permission;%0Aimport org.sipfoundry.sipxconfig.common.User;%0A%0Apublic class AuthenticationDaoImplTest extends TestCase %7B%0A    private static final String USER_NAME = %22Hjelje%22;%0A    private static User s_user = null;%0A    %0A    private MockControl m_coreControl;%0A    private CoreContext m_coreContext;%0A    private AuthenticationDaoImpl m_authenticationDaoImpl;%0A%0A    protected void setUp() throws Exception %7B%0A        m_coreControl = MockClassControl.createStrictControl(CoreContext.class);%0A        m_coreContext = (CoreContext) m_coreControl.getMock();%0A        m_authenticationDaoImpl = new AuthenticationDaoImpl();%0A        m_authenticationDaoImpl.setCoreContext(m_coreContext);%0A        s_user = new User() %7B%0A            public boolean hasPermission(Permission permission) %7B%0A                return true;%0A            %7D%0A        %7D;%0A        s_user.setUserName(USER_NAME);%0A    %7D%0A    %0A    public void testLoadUserByUsername() %7B%0A        // prep the mock core context%0A        m_coreContext.loadUserByUserNameOrAlias(USER_NAME);%0A        m_coreControl.setReturnValue(s_user);%0A        m_coreControl.replay();%0A        %0A        // load the user details%0A        UserDetails details = m_authenticationDaoImpl.loadUserByUsername(USER_NAME);%0A        assertEquals(USER_NAME, details.getUsername());%0A        assertEquals(AuthenticationDaoImpl.AUTH_USER_AND_ADMIN_ARRAY, details.getAuthorities());%0A        m_coreControl.verify();%0A    %7D%0A%7D%0A

Add unit test for AuthenticationDaoImpl