Policy failures:
Code warning - failed on resource UserManagerTest.java. Reason: The local variable role is never read, line 5 Override reason: d
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
package org.yacos.tests.core;
|
package org.yacos.tests.core;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.naming.Context;
|
import javax.naming.Context;
|
||||||
@@ -12,6 +13,7 @@ import org.junit.After;
|
|||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.yacos.core.conferences.Conference;
|
||||||
import org.yacos.core.conferences.IConferenceManager;
|
import org.yacos.core.conferences.IConferenceManager;
|
||||||
import org.yacos.core.exceptions.PKAlreadyUsedException;
|
import org.yacos.core.exceptions.PKAlreadyUsedException;
|
||||||
import org.yacos.core.users.IUserManager;
|
import org.yacos.core.users.IUserManager;
|
||||||
@@ -23,6 +25,7 @@ import org.yacos.core.users.Role.RoleType;
|
|||||||
public class UserManagerTest {
|
public class UserManagerTest {
|
||||||
private static IUserManager um;
|
private static IUserManager um;
|
||||||
private static IConferenceManager cm;
|
private static IConferenceManager cm;
|
||||||
|
private static int conf_id;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpManager() throws NamingException {
|
public static void setUpManager() throws NamingException {
|
||||||
@@ -30,7 +33,12 @@ public class UserManagerTest {
|
|||||||
|
|
||||||
um = (IUserManager) context.lookup("UserManagerBean/remote");
|
um = (IUserManager) context.lookup("UserManagerBean/remote");
|
||||||
cm = (IConferenceManager) context.lookup("ConferenceManagerBean/remote");
|
cm = (IConferenceManager) context.lookup("ConferenceManagerBean/remote");
|
||||||
|
if (cm.exists(1)){
|
||||||
|
conf_id = 1;
|
||||||
|
}else{
|
||||||
|
Conference conf = cm.addConference("titi","desc conf","info en plus",new Date(),new Date(),new Date(),new Date(),new Date());
|
||||||
|
conf_id = conf.getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
@@ -42,10 +50,11 @@ public class UserManagerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getUserByRoleType(){
|
public void getUserByRoleType(){
|
||||||
Role role = cm.addRole(RoleType.PCMEMBER, "truc", 1);
|
Role role = cm.addRole(RoleType.PCMEMBER, "truc", conf_id);
|
||||||
List<User> list = um.getUsers(RoleType.PCMEMBER);
|
List<User> list = um.getUsers(conf_id,RoleType.PCMEMBER);
|
||||||
assertFalse(list.isEmpty());
|
assertFalse(list.isEmpty());
|
||||||
cm.removeRole(role);
|
User user = list.get(0);
|
||||||
|
assertEquals("truc",user.getLogin());
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|||||||
Reference in New Issue
Block a user