public Void execute() throws Throwable { RATING_SERVICE.applyRating(testDoc_UserTwo, 2.0f, FIVE_STAR_SCHEME_NAME); // A new score in a different rating scheme by the same user should not fail. RATING_SERVICE.applyRating(testDoc_UserTwo, 1.0f, LIKES_SCHEME_NAME); // There should be two rating child nodes under the rated node. assertEquals("Wrong number of child nodes", 2 , NODE_SERVICE.getChildAssocs(testDoc_UserTwo).size()); List<Rating> ratings = RATING_SERVICE.getRatingsByCurrentUser(testDoc_UserTwo); assertEquals(2, ratings.size()); assertEquals(FIVE_STAR_SCHEME_NAME, ratings.get(0).getScheme().getName()); assertEquals(LIKES_SCHEME_NAME, ratings.get(1).getScheme().getName()); return null; } });
@Override public NodeRef execute() throws Throwable { List<Rating> ratings = RATING_SERVICE.getRatingsByCurrentUser(copiedDoc); assertTrue("Expected there to be no ratings on the copied test doc.", ratings.isEmpty()); assertFalse("Unexpected cm:rateable aspect.", NODE_SERVICE.hasAspect(copiedDoc, ContentModel.ASPECT_RATEABLE)); assertFalse("Unexpected cm:likesRatingSchemeRollups aspect.", NODE_SERVICE.hasAspect(copiedDoc, ContentModel.ASPECT_LIKES_RATING_SCHEME_ROLLUPS)); assertFalse("Unexpected cm:fiveStarRatingSchemeRollups aspect.", NODE_SERVICE.hasAspect(copiedDoc, ContentModel.ASPECT_FIVESTAR_RATING_SCHEME_ROLLUPS)); return null; } });
List<Rating> ratings = RATING_SERVICE.getRatingsByCurrentUser(testDoc_UserTwo); assertEquals(2, ratings.size()); assertEquals(FIVE_STAR_SCHEME_NAME, ratings.get(0).getScheme().getName()); List<Rating> copiedRatings = RATING_SERVICE.getRatingsByCurrentUser(testDocCopy); assertEquals(0, copiedRatings.size());