this.addParameter("vote", 2);
result2 = this.executeAction();
assertEquals(Action.SUCCESS, result2);
ContentFeedbackAction action = (ContentFeedbackAction)this.getAction();
IRating ratingConten_0 = action.getCommentRating(Integer.parseInt(listaIds.get(0)));
assertNotNull(ratingConten_0);
assertEquals(1, ratingConten_0.getVoters());
assertEquals(2, ratingConten_0.getSumvote());
IRating ratingConten_1 = action.getCommentRating(Integer.parseInt(listaIds.get(1)));
assertNull(ratingConten_1);
IRating ratingConten = action.getContentRating();
assertNull(ratingConten);
// Inserimento votazione su contenuto
this.initAction("/do/jpcontentfeedback/FrontEnd/contentfeedback", "insertVote");
this.setToken();
this.addParameter("formContentId", contentId);
this.addParameter("vote", 4);
result2 = this.executeAction();
assertEquals(Action.SUCCESS, result2);
ContentFeedbackAction action_1 = (ContentFeedbackAction)this.getAction();
ratingConten_0 = action_1.getCommentRating(Integer.parseInt(listaIds.get(0)));
assertNotNull(ratingConten_0);
assertEquals(1, ratingConten_0.getVoters());
assertEquals(2, ratingConten_0.getSumvote());
// ratingConten_1 = action.getCommentRating(Integer.parseInt(listaIds.get(1)));
// assertNull(ratingConten_1);
//
// ratingConten = action.getContentRating();
// assertEquals(1, ratingConten.getVoters());
// assertEquals(4, ratingConten.getSumvote());
} catch (Throwable t) {
throw t;
} finally{
List<String> listaIds = this._commentManager.searchCommentIds(null);
RatingDAO ratingDao = (RatingDAO) ((RatingManager)this._ratingManager).getRatingDAO();
for (int i=0; i< listaIds.size(); i++){
IRating rating = this._ratingManager.getCommentRating(Integer.parseInt(listaIds.get(i)));
if (rating!=null){
ratingDao.removeRating(rating.getCommentId());
}
this._commentManager.deleteComment(Integer.parseInt(listaIds.get(i)));
}
IRating rating = this._ratingManager.getContentRating(contentId);
if (rating!=null){
((RatingDAO)ratingDao).removeContentRating(rating.getContentId());
}
}
}