This commit is contained in:
Maxime Dagnicourt
2008-01-15 23:08:47 +00:00
parent df6f576807
commit a6a9468241

View File

@@ -9,8 +9,6 @@ import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.yacos.core.conferences.Conference;
@@ -42,6 +40,14 @@ public class ConferenceManagerTest {
@Test
public void addConferenceTest(){
conf = cm.addConference("titi","desc conf","info en plus",new Date(),new Date(),new Date(),new Date(),new Date());
assertEquals("titi", cm.getConference(conf.getId()).getTitle());
cm.remove(conf);
}
@Test
public void getConferenceTest(){
conf = cm.getConference(id);
@@ -60,6 +66,7 @@ public class ConferenceManagerTest {
public void removeConferenceTest(){
conf = cm.getConference(id);
cm.remove(conf);
cm.addConference("titre","desc conf","info en plus",new Date(),new Date(),new Date(),new Date(),new Date());
}
@Test
@@ -67,31 +74,34 @@ public class ConferenceManagerTest {
conf = cm.addConference("titre2","desc conf","info en plus",new Date(),new Date(),new Date(),new Date(),new Date());
List<Conference> list = cm.getConferences();
assertFalse("liste vide",list.isEmpty());
cm.remove(conf);
}
@Test
public void addRoleForUserTest(){
User user = um.getUser("max");
conf = cm.getConference(id);
cm.addRole(Role.RoleType.AUTHOR, user , conf);
}
@Test
public void getRolesTest(){
public void getRolesForConfTest(){
User user = um.getUser("max");
List<Role> list = cm.getRoles(user,conf);
assertFalse("liste vide",list.isEmpty());
Role role = list.get(0);
System.out.println(role.getType());
assertNotNull(role);
}
@Test
public void getConferencesForUserTest(){
public void getConferencesForUserTest() throws PKAlreadyUsedException{
User user = um.getUser("max");
List<Conference> list = cm.getConferences(user);
assertNotNull(conf);
assertFalse(list.isEmpty());
User user2 = um.addUser("max2","pw","maxime","dagn","ipint", "e@e.fr");
list = cm.getConferences(user2);
assertTrue(list.isEmpty());
um.removeUser(user2);
}
@Test
@@ -102,6 +112,4 @@ public class ConferenceManagerTest {
Role role = list.get(0);
assertNotNull(role);
}
}