Package org.springframework.util

Examples of org.springframework.util.StopWatch


    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }

  public void testGetStringParameterWithDefaultValueHandlingIsFastEnough() {
    MockHttpServletRequest request = new MockHttpServletRequest();
    StopWatch sw = new StopWatch();
    sw.start();
    for (int i = 0; i < 1000000; i++) {
      ServletRequestUtils.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


    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }

  public void testGetBooleanParameterWithDefaultValueHandlingIsFastEnough() {
    MockPortletRequest request = new MockPortletRequest();
    StopWatch sw = new StopWatch();
    sw.start();
    for (int i = 0; i < 1000000; i++) {
      PortletRequestUtils.getBooleanParameter(request, "nonExistingParam", false);
    }
    sw.stop();
    System.out.println(sw.getTotalTimeMillis());
    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }
View Full Code Here

    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }

  public void testGetStringParameterWithDefaultValueHandlingIsFastEnough() {
    MockPortletRequest request = new MockPortletRequest();
    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

    assertEquals("", PortletRequestUtils.getRequiredStringParameter(request, "paramEmpty"));
  }

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

    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }

  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());
    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }
View Full Code Here

    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }

  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());
    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }
View Full Code Here

    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }

  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());
    assertTrue("getStringParameter took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 250);
  }
View Full Code Here

    RootBeanDefinition rbd = new RootBeanDefinition(ResourceAnnotatedTestBean.class);
    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();
    //System.out.println(sw.getTotalTimeMillis());
    assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000);
  }
View Full Code Here

    rbd.setScope(RootBeanDefinition.SCOPE_PROTOTYPE);
    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();
    //System.out.println(sw.getTotalTimeMillis());
    assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000);
  }
View Full Code Here

    RootBeanDefinition rbd = new RootBeanDefinition(AutowiredAnnotatedTestBean.class);
    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();
    //System.out.println(sw.getTotalTimeMillis());
    assertTrue("Prototype creation took too long: " + sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 4000);
  }
View Full Code Here

TOP

Related Classes of org.springframework.util.StopWatch

Copyright © 2018 www.massapicom. 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.