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:
@@ -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(){
|
||||||
@@ -87,7 +77,6 @@ public class ConferenceManagerTest {
|
|||||||
cm.addRole(Role.RoleType.AUTHOR, user , conf);
|
cm.addRole(Role.RoleType.AUTHOR, user , conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getRolesTest(){
|
public void getRolesTest(){
|
||||||
User user = um.getUser("max");
|
User user = um.getUser("max");
|
||||||
@@ -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());
|
||||||
|
|||||||
35
YACOSTest/src/org/yacos/tests/core/UserManagerTest.java
Normal file
35
YACOSTest/src/org/yacos/tests/core/UserManagerTest.java
Normal 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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user