ProductCartService extends WebService { @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) public List<Product> getProductsOfCart(String uuid, int skip, int top) throws UserNotExistingException { return productCartDao.scrollCartOfUser (getUser (uuid), skip, top); }  @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=false, propagation=Propagation.REQUIRED) ProductCart createCartOfUser(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=false, propagation=Propagation.REQUIRED) void deleteCartOfUser(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) ProductCart getCartOfUser(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) void addProductToCart(String uuid, Long p_id); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) void removeProductFromCart(String uuid, Long p_id); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) List<Long> getProductsIdOfCart(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) List<Product> getProductsOfCart(String uuid, int skip, int top); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) int countProductsInCart(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (readOnly=true, propagation=Propagation.REQUIRED) boolean hasProducts(String uuid); @PreAuthorize ("hasRole('ROLE_DOWNLOAD')") @Transactional (propagation=Propagation.REQUIRED) void clearCart(String uuid);  }
@Test (priority=1) public void getProductsOfCart() { List<Product>products = pcs.getProductsOfCart("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0", 0, 100); Assert.assertEquals (products.size(), 2); Assert.assertEquals (products.get (0).getId(), new Long(5L)); Assert.assertEquals (products.get (1).getId(), new Long(0L)); products = pcs.getProductsOfCart("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1", 0 , 100); Assert.assertEquals (products.size(), 0); products = pcs.getProductsOfCart("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa2", 0, 100); Assert.assertEquals (products.size(), 0); products = pcs.getProductsOfCart("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3", 0, 100); Assert.assertEquals (products.size(), 1); Assert.assertEquals (products.get (0).getId(), new Long(5L)); }