Package org.springframework.scripting

Examples of org.springframework.scripting.CallCounter


  }

  public void testResourceScriptFromTag() throws Exception {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass());
    Messenger messenger = (Messenger) ctx.getBean("messenger");
    CallCounter countingAspect = (CallCounter) ctx.getBean("getMessageAspect");

    assertTrue(AopUtils.isAopProxy(messenger));
    assertFalse(messenger instanceof Refreshable);
    assertEquals(0, countingAspect.getCalls());
    assertEquals("Hello World!", messenger.getMessage());
    assertEquals(1, countingAspect.getCalls());

    ctx.close();
    assertEquals(-200, countingAspect.getCalls());
  }
View Full Code Here


  public void testRefreshableFromTag() throws Exception {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass());
    assertTrue(Arrays.asList(ctx.getBeanNamesForType(Messenger.class)).contains("refreshableMessenger"));

    Messenger messenger = (Messenger) ctx.getBean("refreshableMessenger");
    CallCounter countingAspect = (CallCounter) ctx.getBean("getMessageAspect");

    assertTrue(AopUtils.isAopProxy(messenger));
    assertTrue(messenger instanceof Refreshable);
    assertEquals(0, countingAspect.getCalls());
    assertEquals("Hello World!", messenger.getMessage());
    assertEquals(1, countingAspect.getCalls());

    assertTrue(ctx.getBeansOfType(Messenger.class).values().contains(messenger));
  }
View Full Code Here

  // see http://build.springframework.org/browse/SPR-TRUNKQUICK-908
  @Test
  public void testResourceScriptFromTag() throws Exception {
    ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass());
    Messenger messenger = (Messenger) ctx.getBean("messenger");
    CallCounter countingAspect = (CallCounter) ctx.getBean("getMessageAspect");

    assertTrue(AopUtils.isAopProxy(messenger));
    assertFalse(messenger instanceof Refreshable);
    assertEquals(0, countingAspect.getCalls());
    assertEquals("Hello World!", messenger.getMessage());
    assertEquals(1, countingAspect.getCalls());

    ctx.close();
    assertEquals(-200, countingAspect.getCalls());
  }
View Full Code Here

  public void testRefreshableFromTag() throws Exception {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass());
    assertTrue(Arrays.asList(ctx.getBeanNamesForType(Messenger.class)).contains("refreshableMessenger"));

    Messenger messenger = (Messenger) ctx.getBean("refreshableMessenger");
    CallCounter countingAspect = (CallCounter) ctx.getBean("getMessageAspect");

    assertTrue(AopUtils.isAopProxy(messenger));
    assertTrue(messenger instanceof Refreshable);
    assertEquals(0, countingAspect.getCalls());
    assertEquals("Hello World!", messenger.getMessage());
    assertEquals(1, countingAspect.getCalls());

    assertTrue(ctx.getBeansOfType(Messenger.class).values().contains(messenger));
  }
View Full Code Here

TOP

Related Classes of org.springframework.scripting.CallCounter

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.