ajout d'un user admin ayant tous les roles
This commit is contained in:
@@ -11,6 +11,7 @@ import org.yacos.core.article.Article;
|
||||
import org.yacos.core.article.IArticleManager;
|
||||
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.users.IUserManager;
|
||||
import org.yacos.core.users.User;
|
||||
@@ -23,7 +24,9 @@ import org.yacos.core.users.Role.RoleType;
|
||||
public class Filler {
|
||||
|
||||
|
||||
public static void main(String[] args) throws NamingException, PKAlreadyUsedException {
|
||||
public static void main(String[] args) throws NamingException, PKAlreadyUsedException, ConferenceDoesntExistException {
|
||||
|
||||
System.out.println("--> DEBUT REMPLISSAGE DATABASE");
|
||||
|
||||
IArticleManager am;
|
||||
IConferenceManager cm;
|
||||
@@ -35,6 +38,19 @@ public class Filler {
|
||||
am = (IArticleManager) context.lookup("ArticleManagerBean/remote");
|
||||
um = (IUserManager) context.lookup("UserManagerBean/remote");
|
||||
cm = (IConferenceManager) context.lookup("ConferenceManagerBean/remote");
|
||||
|
||||
// Supprime tout avant de repeupler
|
||||
// for (Conference conf : cm.getConferences()) {
|
||||
// for (Article art : am.getArticles(conf.getId())) {
|
||||
// am.removeArticle(art.getId());
|
||||
// }
|
||||
// cm.remove(conf.getId());
|
||||
// }
|
||||
for (User util : um.getUsers()) {
|
||||
um.removeUser(util.getLogin());
|
||||
}
|
||||
|
||||
|
||||
//ajout de 2 conferences
|
||||
Conference conf = cm.addConference("titre conf 1","desc conf","info en plus",
|
||||
new Date(),new Date(),new Date(),new Date(),new Date());
|
||||
@@ -47,12 +63,19 @@ public class Filler {
|
||||
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",
|
||||
@@ -60,7 +83,7 @@ public class Filler {
|
||||
am.addArticle("title article toto","topic","url_article",
|
||||
author2.getLogin(), new ArrayList<String>(), Article.State.SUMMARY, conf.getId());
|
||||
|
||||
|
||||
System.out.println("--> FIN OK");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public class UserTest {
|
||||
dateArticles,
|
||||
dateArticles,
|
||||
dateArticles);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user