diff --git a/YACOSTest/src/org/yacos/tests/core/ConferenceManagerTest.java b/YACOSTest/src/org/yacos/tests/core/ConferenceManagerTest.java index 9e3110c..de02775 100644 --- a/YACOSTest/src/org/yacos/tests/core/ConferenceManagerTest.java +++ b/YACOSTest/src/org/yacos/tests/core/ConferenceManagerTest.java @@ -24,8 +24,8 @@ import org.yacos.core.users.User; public class ConferenceManagerTest { static IConferenceManager cm; static IUserManager um; - int id; - Conference conf; + static int id; + static Conference conf; @BeforeClass public static void setUpManager() throws NamingException, PKAlreadyUsedException { @@ -36,21 +36,11 @@ public class ConferenceManagerTest { if(!um.exists("max")){ um.addUser("max","pw","maxime","dagn","ipint", "e@e.fr"); } - } - - @Before - public void setUpConferences() { conf = cm.addConference("titre","desc conf","info en plus",new Date(),new Date(),new Date(),new Date(),new Date()); id = conf.getId(); } - @After - public void unSetUpConferences(){ - conf = cm.getConference(id); - if (conf != null){ - cm.remove(conf); - } - } + @Test public void getConferenceTest(){ @@ -86,7 +76,6 @@ public class ConferenceManagerTest { User user = um.getUser("max"); cm.addRole(Role.RoleType.AUTHOR, user , conf); } - @Test public void getRolesTest(){ @@ -102,12 +91,11 @@ public class ConferenceManagerTest { public void getConferencesForUserTest(){ User user = um.getUser("max"); List list = cm.getConferences(user); - conf = list.get(0); assertNotNull(conf); } @Test - public void getRolesForUserConfTest(){ + public void getRolesForUserAndConfTest(){ User user = um.getUser("max"); List list = cm.getRoles(user, conf); assertFalse("liste vide",list.isEmpty()); diff --git a/YACOSTest/src/org/yacos/tests/core/UserManagerTest.java b/YACOSTest/src/org/yacos/tests/core/UserManagerTest.java new file mode 100644 index 0000000..7f1653e --- /dev/null +++ b/YACOSTest/src/org/yacos/tests/core/UserManagerTest.java @@ -0,0 +1,35 @@ +package org.yacos.tests.core; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; + +import org.junit.After; +import org.junit.BeforeClass; +import org.yacos.core.exceptions.PKAlreadyUsedException; +import org.yacos.core.users.IUserManager; + + +public class UserManagerTest { + static IUserManager um; + + @BeforeClass + public static void setUpManager() throws NamingException, PKAlreadyUsedException { + Context context = new InitialContext(); + + um = (IUserManager) context.lookup("UserManagerBean/remote"); + + if(!um.exists("max")){ + um.addUser("max","pw","maxime","dagn","ipint", "e@e.fr"); + } + } + + @After + public void ControleUser() throws PKAlreadyUsedException{ + if(!um.exists("max")){ + um.addUser("max","pw","maxime","dagn","ipint", "e@e.fr"); + } + } + + +}