Examples of rate()


Examples of com.jitlogic.zorka.core.perfmon.RateAggregate.rate()


  @Test
  public void testQueryEmptyWindow() throws Exception {
    RateAggregate wnd = new RateAggregate(100, -1);
    assertEquals(-1.0, wnd.rate(), 0.0001);
  }
 
 
  @Test
  public void testSlidingWindowWithSingleItem() throws Exception {
View Full Code Here

Examples of com.jitlogic.zorka.core.perfmon.RateAggregate.rate()

 
  @Test
  public void testSlidingWindowWithSingleItem() throws Exception {
    RateAggregate wnd = new RateAggregate(100, -1);
    wnd.feed(100, 1);
    assertEquals(0.0, wnd.rate(), 0.0001);
  }
 
 
  @Test
  public void testSlidingWindowWithTwoItems() throws Exception {
View Full Code Here

Examples of com.jitlogic.zorka.core.perfmon.RateAggregate.rate()

  @Test
  public void testSlidingWindowWithTwoItems() throws Exception {
    RateAggregate wnd = new RateAggregate(100, -1);
    wnd.feed(100, 1);
    wnd.feed(150, 1);
    assertEquals(50.0, wnd.rate(), 0.0001);
  }

 
  @Test
  public void testWindowNotYetSlide() throws Exception {
View Full Code Here

Examples of com.jitlogic.zorka.core.perfmon.RateAggregate.rate()

    RateAggregate wnd = new RateAggregate(100, -1);
    testUtil.mockCurrentTimeMillis(0, 0, 50, 50, 100, 100, 100);
    wnd.feed(100);
    wnd.feed(150);
    wnd.feed(200);
    assertEquals(100.0, wnd.rate(), 0.0001);
  }

  @Test
  public void testWindowSlide() throws Exception {
    RateAggregate wnd = new RateAggregate(100, -1);
View Full Code Here

Examples of com.jitlogic.zorka.core.perfmon.RateAggregate.rate()

    RateAggregate wnd = new RateAggregate(100, -1);
    testUtil.mockCurrentTimeMillis(0, 0, 50, 50, 100, 100, 150);
    wnd.feed(100);
    wnd.feed(150);
    wnd.feed(200);
    assertEquals(50.0, wnd.rate(), 0.0001);
  }
 
  @Test
  public void testWindowSlideOutOfHorizon() throws Exception {
    RateAggregate wnd = new RateAggregate(100, -1);
View Full Code Here

Examples of com.jitlogic.zorka.core.perfmon.RateAggregate.rate()

    RateAggregate wnd = new RateAggregate(100, -1);
    testUtil.mockCurrentTimeMillis(0, 0, 50, 50, 100, 100, 1500);
    wnd.feed(100);
    wnd.feed(150);
    wnd.feed(200);
    assertEquals(-1.0, wnd.rate(), 0.0001);   
  }
}
View Full Code Here

Examples of com.springone.myrestaurants.domain.Recommendation.rate()

        if (result.hasErrors()) {
            model.addAttribute("recommendation", recommendationFormBean);
            return "recommendations/update";
        }
        Recommendation foundRec = findRecommendation(userId, recommendationFormBean.getId());
        foundRec.rate(recommendationFormBean.getRating(), recommendationFormBean.getComments())
        model.addAttribute("itemId", recommendationFormBean.getId());
        return "redirect:/recommendations/" + recommendationFormBean.getId();
    }
 
    @RequestMapping(value = "/{id}", params = "form", method = RequestMethod.GET)
View Full Code Here

Examples of com.springone.myrestaurants.domain.UserAccount.rate()

    @Transactional
    @Test
    public void testAddRecommendation() {
      UserAccount user = userAccountRepo.findUserAccount(userId);
      Restaurant rest = restaurantRepository.findRestaurant(22L);
      user.rate(rest, 3, "Pretty Good");
      em.flush();
      UserAccount updatedUser = userAccountRepo.findUserAccount(userId);
      Assert.assertNotNull("should have found something" ,updatedUser);
      List<Recommendation> recommendations = new ArrayList<Recommendation>();
      for (Recommendation r : updatedUser.getRecommendations()) {
View Full Code Here

Examples of com.springone.myrestaurants.domain.UserAccount.rate()

      return "recommendations/create";
    }
    long restaurantId = recommendationFormBean.getRestaurantId();
    Restaurant restaurant = this.restaurantRepository.findRestaurant(restaurantId);
    UserAccount account = this.userAccountRepository.findUserAccount(userId);
    Recommendation recommendation = account.rate(restaurant,
        recommendationFormBean.getRating(),
        recommendationFormBean.getComments());
    model.addAttribute("recommendationId", recommendation.getRelationshipId());
    return "redirect:/recommendations/" + recommendation.getRelationshipId();
  }
View Full Code Here

Examples of com.springone.myrestaurants.domain.UserAccount.rate()

    @Transactional
    @Test
    public void testAddRecommendation() {
      UserAccount user = userAccountRepo.findUserAccount(userId);
      Restaurant rest = restaurantRepository.findRestaurant(22L);
      user.rate(rest, 3, "Pretty Good");
      em.flush();
      UserAccount updatedUser = userAccountRepo.findUserAccount(userId);
      Assert.assertNotNull("should have found something" ,updatedUser);
      List<Recommendation> recommendations = new ArrayList<Recommendation>();
      for (Recommendation r : updatedUser.getRecommendations()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.