X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=security%2Fimpl%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsecurity%2Fauthentication%2FUsermgtTestUtils.java;fp=security%2Fimpl%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fsecurity%2Fauthentication%2FUsermgtTestUtils.java;h=0000000000000000000000000000000000000000;hb=9449ea0f360f6e9c14057db57f3ee0bfba947ab4;hp=c1dedaa44ae0aba983bfcaffe2f8f76958453260;hpb=e8b988e92306a4aea2f047af1b48588147288831;p=utils diff --git a/security/impl/src/test/java/org/wamblee/security/authentication/UsermgtTestUtils.java b/security/impl/src/test/java/org/wamblee/security/authentication/UsermgtTestUtils.java deleted file mode 100644 index c1dedaa4..00000000 --- a/security/impl/src/test/java/org/wamblee/security/authentication/UsermgtTestUtils.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2005-2010 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.wamblee.security.authentication; - -import org.wamblee.security.authentication.Group; -import org.wamblee.security.authentication.RegexpNameValidator; -import org.wamblee.security.authentication.User; -import org.wamblee.security.authentication.UserMgtException; -import org.wamblee.security.authentication.UserMgtException.Reason; -import org.wamblee.security.encryption.Md5HexMessageDigester; - - -/** - * User management test utilities. - * - * @author Erik Brakkee - */ -public class UsermgtTestUtils { - private static final String DUMMY_GROUP = "dummygroup"; - - private static final String DUMMY_PASSWD = "dummypasswd"; - - public static Group createGroup(String aName) { - return new Group(aName); - } - - public static User createUser(String aUsername) throws UserMgtException { - return createUser(aUsername, DUMMY_GROUP); - } - - public static User createUser(String aUsername, String aGroup) - throws UserMgtException { - return createUser(aUsername, createGroup(aGroup)); - } - - public static User createUser(String aUsername, Group aGroup) - throws UserMgtException { - return createUser(aUsername, DUMMY_PASSWD, aGroup); - } - - public static User createUser(String aName, String aPassword, Group aGroup) - throws UserMgtException { - User user = new User(aName, aPassword, new RegexpNameValidator( - RegexpNameValidator.PASSWORD_PATTERN, Reason.INVALID_PASSWORD, - "Password must be at least 6 chars"), new Md5HexMessageDigester()); - user.addGroup(aGroup); - return user; - } - - public static void addUserToGroup(User aUser, Group aGroup) - throws UserMgtException { - aUser.addGroup(aGroup); - } - - public static void removeUserFromGroup(User aUser, Group aGroup) - throws UserMgtException { - aUser.removeGroup(aGroup); - } -}