Policy failures:
Code warning - failed on resource ConferenceManagerTest.java. Reason: List is a raw type. References to generic type List<E> should be parameterized, line 7 Override reason: d
This commit is contained in:
@@ -1,24 +1,84 @@
|
||||
package org.yacos.tests.core;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
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;
|
||||
import org.yacos.core.conferences.ConferenceManagerBean;
|
||||
import org.yacos.core.conferences.IConferenceManager;
|
||||
import org.yacos.core.users.IUserManager;
|
||||
import org.yacos.core.users.Role;
|
||||
|
||||
|
||||
public class ConferenceManagerTest {
|
||||
IConferenceManager conferenceManager;
|
||||
static IConferenceManager manager;
|
||||
static IUserManager userManager;
|
||||
int id;
|
||||
Conference conf;
|
||||
|
||||
@BeforeClass
|
||||
public void setUpManager() {
|
||||
conferenceManager = new ConferenceManagerBean();
|
||||
public static void setUpManager() throws NamingException {
|
||||
Context context = new InitialContext();
|
||||
manager = (IConferenceManager) context.lookup("ConferenceManagerBean/remote");
|
||||
userManager = (IUserManager) context.lookup("UserManagerBean/remote");
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUpConferences() {
|
||||
conferenceManager.getConferences();
|
||||
Conference conf = new Conference();
|
||||
conferenceManager.addConference(conf);
|
||||
conf = manager.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 = manager.getConference(id);
|
||||
if (conf != null){
|
||||
manager.remove(conf);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getConferenceTest(){
|
||||
conf = manager.getConference(id);
|
||||
assertNotNull(conf);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateConferenceTest(){
|
||||
conf = manager.getConference(id);
|
||||
conf.setTitle("autre titre");
|
||||
manager.update(conf);
|
||||
conf = manager.getConference(id);
|
||||
assertEquals("autre titre", conf.getTitle());
|
||||
}
|
||||
|
||||
public void removeConferenceTest(){
|
||||
conf = manager.getConference(id);
|
||||
manager.remove(conf);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getConferencesTest(){
|
||||
conf = manager.addConference("titre2","desc conf","info en plus",new Date(),new Date(),new Date(),new Date(),new Date());
|
||||
List list = manager.getConferences();
|
||||
assertEquals(1,list.size());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addRoleForUserTest(){
|
||||
manager.addRoleForUser(Role.RoleType.AUTHOR, userManager.getUser("toto") , conf);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user