Policy failures:
Code warning - failed on resource EvaluationManagerTest.java. Reason: The field EvaluationManagerTest.article is never read locally, line 36 - failed on resource EvaluationManagerTest.java. Reason: The field EvaluationManagerTest.um is never read locally, line 34 - failed on resource EvaluationManagerTest.java. Reason: The import org.yacos.core.evaluation.Report is never used, line 25 - failed on resource Filler.java. Reason: The local variable article is never read, line 54 - failed on resource Filler.java. Reason: The local variable membre is never read, line 47 ... and more. Override reason: f
This commit is contained in:
@@ -14,6 +14,7 @@ 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;
|
||||||
import org.yacos.core.users.User;
|
import org.yacos.core.users.User;
|
||||||
|
import org.yacos.core.users.Role.RoleType;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fill the database for developpement and test
|
* fill the database for developpement and test
|
||||||
@@ -45,6 +46,9 @@ public class Filler {
|
|||||||
User author2 = um.addUser("toto","pw","toto","titu","ipint", "toto@e.fr");
|
User author2 = um.addUser("toto","pw","toto","titu","ipint", "toto@e.fr");
|
||||||
User membre = um.addUser("login_membre","pw","nom_membre","meme","ipint", "meme@e.fr");
|
User membre = um.addUser("login_membre","pw","nom_membre","meme","ipint", "meme@e.fr");
|
||||||
|
|
||||||
|
//ajout des roles pr les users
|
||||||
|
cm.addRole(RoleType.AUTHOR, author.getLogin(), conf.getId());
|
||||||
|
|
||||||
|
|
||||||
//ajout d'un article pr le user "max"
|
//ajout d'un article pr le user "max"
|
||||||
Article article = am.addArticle("title article max","topic","url_article",
|
Article article = am.addArticle("title article max","topic","url_article",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -15,29 +16,40 @@ 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.article.Article;
|
||||||
|
import org.yacos.core.article.IArticleManager;
|
||||||
import org.yacos.core.conferences.Conference;
|
import org.yacos.core.conferences.Conference;
|
||||||
import org.yacos.core.conferences.IConferenceManager;
|
import org.yacos.core.conferences.IConferenceManager;
|
||||||
import org.yacos.core.evaluation.Criterion;
|
import org.yacos.core.evaluation.Criterion;
|
||||||
import org.yacos.core.evaluation.IEvaluationManager;
|
import org.yacos.core.evaluation.IEvaluationManager;
|
||||||
|
import org.yacos.core.evaluation.Report;
|
||||||
import org.yacos.core.exceptions.PKAlreadyUsedException;
|
import org.yacos.core.exceptions.PKAlreadyUsedException;
|
||||||
|
import org.yacos.core.users.IUserManager;
|
||||||
|
|
||||||
public class EvaluationManagerTest {
|
public class EvaluationManagerTest {
|
||||||
|
|
||||||
private static IEvaluationManager em;
|
private static IEvaluationManager em;
|
||||||
|
private static IArticleManager am;
|
||||||
private static IConferenceManager cm;
|
private static IConferenceManager cm;
|
||||||
|
private static IUserManager um;
|
||||||
private int confId;
|
private int confId;
|
||||||
|
private Article article;
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpManager() throws NamingException, PKAlreadyUsedException {
|
public static void setUpManager() throws NamingException, PKAlreadyUsedException {
|
||||||
Context context = new InitialContext();
|
Context context = new InitialContext();
|
||||||
cm = (IConferenceManager) context.lookup("ConferenceManagerBean/remote");
|
cm = (IConferenceManager) context.lookup("ConferenceManagerBean/remote");
|
||||||
em = (IEvaluationManager) context.lookup("EvaluationManagerBean/remote");
|
em = (IEvaluationManager) context.lookup("EvaluationManagerBean/remote");
|
||||||
|
am = (IArticleManager) context.lookup("ArticleManagerBean/remote");
|
||||||
|
um = (IUserManager) context.lookup("UserManagerBean/remote");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void initDB(){
|
public void initDB(){
|
||||||
Conference conf = cm.addConference("titre","desc conf","info en plus",new Date(),new Date(),new Date(),new Date(),new Date());
|
Conference conf = cm.addConference("titre","desc conf","info en plus",new Date(),new Date(),new Date(),new Date(),new Date());
|
||||||
confId = conf.getId();
|
confId = conf.getId();
|
||||||
|
article = am.addArticle("title article max","topic","url_article",
|
||||||
|
"max", new ArrayList<String>(), Article.State.SUMMARY, confId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@@ -83,8 +95,8 @@ public class EvaluationManagerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void AddReportTest(){
|
public void AddReportTest(){
|
||||||
//TODO
|
List<Criterion> ratings = new ArrayList<Criterion>();
|
||||||
//Report report = em.addReport(articleId);
|
//Report report = em.addReport(article, "commentPCMember", "commentAuthor", ratings, um.getUser("max"));
|
||||||
//assertNotNull();
|
//assertNotNull();
|
||||||
//assertEquals(report.getCommentAuthor(), em.getReport(report.getId()).getCommentAuthor());
|
//assertEquals(report.getCommentAuthor(), em.getReport(report.getId()).getCommentAuthor());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user