Package org.springframework.util

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


  }

  public void testGetLongParameterWithDefaultValueHandlingIsFastEnough() {
    MockPortletRequest request = new MockPortletRequest();
    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());
View Full Code Here


  }

  public void testGetFloatParameterWithDefaultValueHandlingIsFastEnough() {
    MockPortletRequest request = new MockPortletRequest();
    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());
View Full Code Here

  }

  public void testGetDoubleParameterWithDefaultValueHandlingIsFastEnough() {
    MockPortletRequest request = new MockPortletRequest();
    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());
View Full Code Here

    rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
    ctx.registerBeanDefinition("test", rbd);
    ctx.registerBeanDefinition("spouse", new RootBeanDefinition(TestBean.class));
    TestBean spouse = (TestBean) ctx.getBean("spouse");
    StopWatch sw = new StopWatch();
    sw.start("prototype");
    for (int i = 0; i < 100000; i++) {
      TestBean tb = (TestBean) ctx.getBean("test");
      assertSame(spouse, tb.getSpouse());
    }
    sw.stop();
View Full Code Here

    rbd.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("spouse"));
    ctx.registerBeanDefinition("test", rbd);
    ctx.registerBeanDefinition("spouse", new RootBeanDefinition(TestBean.class));
    TestBean spouse = (TestBean) ctx.getBean("spouse");
    StopWatch sw = new StopWatch();
    sw.start("prototype");
    for (int i = 0; i < 100000; i++) {
      TestBean tb = (TestBean) ctx.getBean("test");
      assertSame(spouse, tb.getSpouse());
    }
    sw.stop();
View Full Code Here

    rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
    ctx.registerBeanDefinition("test", rbd);
    ctx.registerBeanDefinition("spouse", new RootBeanDefinition(TestBean.class));
    TestBean spouse = (TestBean) ctx.getBean("spouse");
    StopWatch sw = new StopWatch();
    sw.start("prototype");
    for (int i = 0; i < 100000; i++) {
      TestBean tb = (TestBean) ctx.getBean("test");
      assertSame(spouse, tb.getSpouse());
    }
    sw.stop();
View Full Code Here

    rbd.getPropertyValues().addPropertyValue("spouse", new RuntimeBeanReference("spouse"));
    ctx.registerBeanDefinition("test", rbd);
    ctx.registerBeanDefinition("spouse", new RootBeanDefinition(TestBean.class));
    TestBean spouse = (TestBean) ctx.getBean("spouse");
    StopWatch sw = new StopWatch();
    sw.start("prototype");
    for (int i = 0; i < 100000; i++) {
      TestBean tb = (TestBean) ctx.getBean("test");
      assertSame(spouse, tb.getSpouse());
    }
    sw.stop();
View Full Code Here

    Map orderServices = this.beanFactory.getBeansOfType(OrderService.class);
    for (Iterator it = orderServices.keySet().iterator(); it.hasNext();) {
      String beanName = (String) it.next();
      OrderService orderService = (OrderService) orderServices.get(beanName);
      System.out.println("Calling OrderService '" + beanName + "' with order ID " + orderId);
      stopWatch.start(beanName);
      Order order = null;
      for (int i = 0; i < nrOfCalls; i++) {
        order = orderService.getOrder(orderId);
      }
      stopWatch.stop();
View Full Code Here

   * CGLIB this will be slow or will run out of memory.
   */
  public void testManyProxies() {
    int howMany = 10000;
    StopWatch sw = new StopWatch();
    sw.start("Create " + howMany + " proxies");
    testManyProxies(howMany);
    sw.stop();
    System.out.println(sw.getTotalTimeMillis());
    assertTrue("Proxy creation was too slow",  sw.getTotalTimeMillis() < 5000);
  }
View Full Code Here

  private long testRepeatedAroundAdviceInvocations(String file, int howmany, String technology) {
    ClassPathXmlApplicationContext bf = new ClassPathXmlApplicationContext(file);

    StopWatch sw = new StopWatch();
    sw.start(howmany + " repeated around advice invocations with " + technology);
    ITestBean adrian = (ITestBean) bf.getBean("adrian");
   
    assertTrue(AopUtils.isAopProxy(adrian));
    assertEquals(68, adrian.getAge());
   
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.