Package org.springframework.util

Examples of org.springframework.util.StopWatch.stop()


    StopWatch sw = new StopWatch();
    sw.start();
    for (int i = 0; i < 1000000; i++) {
      PortletRequestUtils.getStringParameter(request, "nonExistingParam", "defaultValue");
    }
    sw.stop();
    System.out.println(sw.getTotalTimeMillis());
    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }

}
View Full Code Here


    StopWatch sw = new StopWatch();
    sw.start();
    for (int i = 0; i < 1000000; i++) {
      PortletRequestUtils.getIntParameter(request, "nonExistingParam", 0);
    }
    sw.stop();
    System.out.println(sw.getTotalTimeMillis());
    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }

  public void testGetLongParameterWithDefaultValueHandlingIsFastEnough() {
View Full Code Here

    StopWatch sw = new StopWatch();
    sw.start();
    for (int i = 0; i < 1000000; i++) {
      PortletRequestUtils.getLongParameter(request, "nonExistingParam", 0);
    }
    sw.stop();
    System.out.println(sw.getTotalTimeMillis());
    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }

  public void testGetFloatParameterWithDefaultValueHandlingIsFastEnough() {
View Full Code Here

    StopWatch sw = new StopWatch();
    sw.start();
    for (int i = 0; i < 1000000; i++) {
      PortletRequestUtils.getFloatParameter(request, "nonExistingParam", 0f);
    }
    sw.stop();
    System.out.println(sw.getTotalTimeMillis());
    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }

  public void testGetDoubleParameterWithDefaultValueHandlingIsFastEnough() {
View Full Code Here

    StopWatch sw = new StopWatch();
    sw.start();
    for (int i = 0; i < 1000000; i++) {
      PortletRequestUtils.getDoubleParameter(request, "nonExistingParam", 0d);
    }
    sw.stop();
    System.out.println(sw.getTotalTimeMillis());
    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }

  public void testGetBooleanParameterWithDefaultValueHandlingIsFastEnough() {
View Full Code Here

    sw.start("prototype");
    for (int i = 0; i < 100000; i++) {
      TestBean tb = (TestBean) ctx.getBean("test");
      assertSame(spouse, tb.getSpouse());
    }
    sw.stop();
    //System.out.println(sw.getTotalTimeMillis());
    assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000);
  }

  public void testPrototypeCreationWithOverriddenResourcePropertiesIsFastEnough() {
View Full Code Here

    sw.start("prototype");
    for (int i = 0; i < 100000; i++) {
      TestBean tb = (TestBean) ctx.getBean("test");
      assertSame(spouse, tb.getSpouse());
    }
    sw.stop();
    //System.out.println(sw.getTotalTimeMillis());
    assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000);
  }

  public void testPrototypeCreationWithAutowiredPropertiesIsFastEnough() {
View Full Code Here

    sw.start("prototype");
    for (int i = 0; i < 100000; i++) {
      TestBean tb = (TestBean) ctx.getBean("test");
      assertSame(spouse, tb.getSpouse());
    }
    sw.stop();
    //System.out.println(sw.getTotalTimeMillis());
    assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000);
  }

  public void testPrototypeCreationWithOverriddenAutowiredPropertiesIsFastEnough() {
View Full Code Here

    sw.start("prototype");
    for (int i = 0; i < 100000; i++) {
      TestBean tb = (TestBean) ctx.getBean("test");
      assertSame(spouse, tb.getSpouse());
    }
    sw.stop();
    //System.out.println(sw.getTotalTimeMillis());
    assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000);
  }

View Full Code Here

      stopWatch.start(beanName);
      Order order = null;
      for (int i = 0; i < nrOfCalls; i++) {
        order = orderService.getOrder(orderId);
      }
      stopWatch.stop();
      if (order != null) {
        printOrder(order);
      }
      else {
        System.out.println("Order with ID " + orderId + " not found");
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.