Policy failures:

Code warning
- failed on resource ConferenceManagerTest.java. Reason: The import org.junit.After is never used, line 12
- failed on resource ConferenceManagerTest.java. Reason: The import org.junit.Before is never used, line 13
- failed on resource ConferenceManagerTest.java. Reason: The local variable list is never read, line 9
Override reason:   
d
This commit is contained in:
Maxime Dagnicourt
2008-01-15 17:04:13 +00:00
parent c0d01d4a46
commit 0ee18ab654
2 changed files with 39 additions and 16 deletions

View File

@@ -24,8 +24,8 @@ import org.yacos.core.users.User;
public class ConferenceManagerTest { public class ConferenceManagerTest {
static IConferenceManager cm; static IConferenceManager cm;
static IUserManager um; static IUserManager um;
int id; static int id;
Conference conf; static Conference conf;
@BeforeClass @BeforeClass
public static void setUpManager() throws NamingException, PKAlreadyUsedException { public static void setUpManager() throws NamingException, PKAlreadyUsedException {
@@ -36,21 +36,11 @@ public class ConferenceManagerTest {
if(!um.exists("max")){ if(!um.exists("max")){
um.addUser("max","pw","maxime","dagn","ipint", "e@e.fr"); 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()); conf = cm.addConference("titre","desc conf","info en plus",new Date(),new Date(),new Date(),new Date(),new Date());
id = conf.getId(); id = conf.getId();
} }
@After
public void unSetUpConferences(){
conf = cm.getConference(id);
if (conf != null){
cm.remove(conf);
}
}
@Test @Test
public void getConferenceTest(){ public void getConferenceTest(){
@@ -86,7 +76,6 @@ public class ConferenceManagerTest {
User user = um.getUser("max"); User user = um.getUser("max");
cm.addRole(Role.RoleType.AUTHOR, user , conf); cm.addRole(Role.RoleType.AUTHOR, user , conf);
} }
@Test @Test
public void getRolesTest(){ public void getRolesTest(){
@@ -102,12 +91,11 @@ public class ConferenceManagerTest {
public void getConferencesForUserTest(){ public void getConferencesForUserTest(){
User user = um.getUser("max"); User user = um.getUser("max");
List<Conference> list = cm.getConferences(user); List<Conference> list = cm.getConferences(user);
conf = list.get(0);
assertNotNull(conf); assertNotNull(conf);
} }
@Test @Test
public void getRolesForUserConfTest(){ public void getRolesForUserAndConfTest(){
User user = um.getUser("max"); User user = um.getUser("max");
List<Role> list = cm.getRoles(user, conf); List<Role> list = cm.getRoles(user, conf);
assertFalse("liste vide",list.isEmpty()); assertFalse("liste vide",list.isEmpty());

View File

@@ -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");
}
}
}