Package org.springframework.tests

Examples of org.springframework.tests.TimeStamped


    TestBean target = new TargetClass(t + 1);

    ProxyFactory pf = new ProxyFactory(target);
    pf.addAdvisor(0, new DefaultIntroductionAdvisor(ii));

    TimeStamped ts = (TimeStamped) pf.getProxy();
    // From introduction interceptor, not target
    assertTrue(ts.getTimeStamp() == t);
  }
View Full Code Here


    assertFalse(pf.replaceAdvisor(new DefaultPointcutAdvisor(null), advisor1));
  }

  @Test
  public void testAddRepeatedInterface() {
    TimeStamped tst = new TimeStamped() {
      @Override
      public long getTimeStamp() {
        throw new UnsupportedOperationException("getTimeStamp");
      }
    };
View Full Code Here

    factory.addAdvisor(0, new DefaultIntroductionAdvisor(ti, TimeStamped.class));

    Class<?>[] newProxiedInterfaces = factory.getProxiedInterfaces();
    assertEquals("Advisor proxies one more interface after introduction", oldProxiedInterfaces.length + 1, newProxiedInterfaces.length);

    TimeStamped ts = (TimeStamped) factory.getProxy();
    assertTrue(ts.getTimeStamp() == t);
    // Shouldn't fail;
     ((IOther) ts).absquatulate();
  }
View Full Code Here

    int oldCount = config.getAdvisors().length;
    config.addAdvisor(0, new DefaultIntroductionAdvisor(ti, TimeStamped.class));

    assertTrue(config.getAdvisors().length == oldCount + 1);

    TimeStamped ts = (TimeStamped) config.getProxy();
    assertTrue(ts.getTimeStamp() == time);

    // Can remove
    config.removeAdvice(ti);

    assertTrue(config.getAdvisors().length == oldCount);

    try {
      // Existing reference will fail
      ts.getTimeStamp();
      fail("Existing object won't implement this interface any more");
    }
    catch (RuntimeException ex) {
    }
View Full Code Here

TOP

Related Classes of org.springframework.tests.TimeStamped

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.