Correction des tests pour prendre en compte :

- le hashage des mots de passe
- la fonction getRolesForUser
This commit is contained in:
2008-02-03 20:35:54 +00:00
parent 8da531c355
commit fe062a6766
6 changed files with 67 additions and 43 deletions

View File

@@ -13,6 +13,7 @@ import org.yacos.core.conferences.Conference;
import org.yacos.core.conferences.IConferenceManager;
import org.yacos.core.exceptions.ConferenceDoesntExistException;
import org.yacos.core.exceptions.PKAlreadyUsedException;
import org.yacos.core.exceptions.UserEMailAlreadyExistsException;
import org.yacos.core.users.IUserManager;
import org.yacos.core.users.User;
import org.yacos.core.users.Role.RoleType;
@@ -58,30 +59,35 @@ public class Filler {
new Date(),new Date(),new Date(),new Date(),new Date());
//ajout de 2 users
User author = um.addUser("max","pw","maxime","dagn","ipint", "max@e.fr");
User author2 = um.addUser("toto","pw","toto","titu","ipint", "toto@e.fr");
User membre1 = um.addUser("login_membre1","pw","Jean","Bon","ipint", "meme@e.fr");
User membre2 = um.addUser("login_membre2","pw","Vincent","Tim","ipint", "meme@e.fr");
User membre3 = um.addUser("login_membre3","pw","Camille","Hon","ipint", "meme@e.fr");
User membre = um.addUser("login_membre","pw","nom_membre","meme","ipint", "meme@e.fr");
User admin = um.addUser("admin","admin","maxime","dagn","ipint", "max@e.fr");
//ajout des roles pr les users
cm.addRole(RoleType.AUTHOR, author.getLogin(), conf.getId());
cm.addRole(RoleType.PCMEMBER, membre1.getLogin(), conf.getId());
cm.addRole(RoleType.PCMEMBER, membre2.getLogin(), conf.getId());
cm.addRole(RoleType.PCMEMBER, membre3.getLogin(), conf.getId());
cm.addRole(RoleType.AUTHOR, admin.getLogin(), conf.getId());
cm.addRole(RoleType.CHAIRMAN, admin.getLogin(), conf.getId());
cm.addRole(RoleType.PCMEMBER, admin.getLogin(), conf.getId());
cm.addRole(RoleType.REFEREE, admin.getLogin(), conf.getId());
//ajout d'un article pr le user "max"
Article article = am.addArticle("title article max","topic","url_article",
author.getLogin(), new ArrayList<String>(), Article.State.SUMMARY, conf.getId());
am.addArticle("title article toto","topic","url_article",
author2.getLogin(), new ArrayList<String>(), Article.State.SUMMARY, conf.getId());
User author;
try {
author = um.addUser("max",User.hashPassword("pw"),"maxime","dagn","ipint", "max@e.fr");
User author2 = um.addUser("toto",User.hashPassword("pw"),"toto","titu","ipint", "toto@e.fr");
User membre1 = um.addUser("login_membre1",User.hashPassword("pw"),"Jean","Bon","ipint", "meme1@e.fr");
User membre2 = um.addUser("login_membre2",User.hashPassword("pw"),"Vincent","Tim","ipint", "meme2@e.fr");
User membre3 = um.addUser("login_membre3",User.hashPassword("pw"),"Camille","Hon","ipint", "meme3@e.fr");
User membre = um.addUser("login_membre",User.hashPassword("pw"),"nom_membre","meme","ipint", "meme4@e.fr");
User admin = um.addUser("admin",User.hashPassword("admin"),"maxime","dagn","ipint", "admin@yacos.org");
//ajout des roles pr les users
cm.addRole(RoleType.AUTHOR, author.getLogin(), conf.getId());
cm.addRole(RoleType.PCMEMBER, membre1.getLogin(), conf.getId());
cm.addRole(RoleType.PCMEMBER, membre2.getLogin(), conf.getId());
cm.addRole(RoleType.PCMEMBER, membre3.getLogin(), conf.getId());
cm.addRole(RoleType.AUTHOR, admin.getLogin(), conf.getId());
cm.addRole(RoleType.CHAIRMAN, admin.getLogin(), conf.getId());
cm.addRole(RoleType.PCMEMBER, admin.getLogin(), conf.getId());
cm.addRole(RoleType.REFEREE, admin.getLogin(), conf.getId());
//ajout d'un article pr le user "max"
Article article = am.addArticle("title article max","topic","url_article",
author.getLogin(), new ArrayList<String>(), Article.State.SUMMARY, conf.getId());
am.addArticle("title article toto","topic","url_article",
author2.getLogin(), new ArrayList<String>(), Article.State.SUMMARY, conf.getId());
} catch (UserEMailAlreadyExistsException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("--> FIN OK");