Examples of SerializablePerson


Examples of org.springframework.tests.sample.beans.SerializablePerson

    assertEquals("general error", ms.getMessage(ex.getGlobalError(), Locale.US));
    assertEquals("invalid field", ms.getMessage(ex.getFieldError("age"), Locale.US));
  }

  public void testBindExceptionSerializable() throws Exception {
    SerializablePerson tb = new SerializablePerson();
    tb.setName("myName");
    tb.setAge(99);

    BindException ex = new BindException(tb, "tb");
    ex.reject("invalid", "someMessage");
    ex.rejectValue("age", "invalidField", "someMessage");
View Full Code Here

Examples of org.springframework.tests.sample.beans.SerializablePerson

  // how to decide what's valid?


  @Test
  public void testSerialization() throws Exception {
    SerializablePerson sp1 = new SerializablePerson();
    sp1.setName("Tony");
    SerializablePerson sp2 = new SerializablePerson();
    sp1.setName("Gordon");

    HotSwappableTargetSource hts = new HotSwappableTargetSource(sp1);
    ProxyFactory pf = new ProxyFactory();
    pf.addInterface(Person.class);
    pf.setTargetSource(hts);
    pf.addAdvisor(new DefaultPointcutAdvisor(new SerializableNopInterceptor()));
    Person p = (Person) pf.getProxy();

    assertEquals(sp1.getName(), p.getName());
    hts.swap(sp2);
    assertEquals(sp2.getName(), p.getName());

    p = (Person) SerializationTestUtils.serializeAndDeserialize(p);
    // We need to get a reference to the client-side targetsource
    hts = (HotSwappableTargetSource) ((Advised) p).getTargetSource();
    assertEquals(sp2.getName(), p.getName());
    hts.swap(sp1);
    assertEquals(sp1.getName(), p.getName());

  }
View Full Code Here

Examples of org.springframework.tests.sample.beans.SerializablePerson

    assertTrue("Introduced method returning delegate returns proxy", AopUtils.isAopProxy(introduction.getSpouse()));
  }

  @Test
  public void testSerializableDelegatingIntroductionInterceptorSerializable() throws Exception {
    SerializablePerson serializableTarget = new SerializablePerson();
    String name = "Tony";
    serializableTarget.setName("Tony");

    ProxyFactory factory = new ProxyFactory(serializableTarget);
    factory.addInterface(Person.class);
    long time = 1000;
    TimeStamped ts = new SerializableTimeStamped(time);
View Full Code Here

Examples of org.springframework.tests.sample.beans.SerializablePerson

  /**
   * Create an empty pointcut, populating instance variables.
   */
  @Before
  public void setUp() {
    ProxyFactory pf = new ProxyFactory(new SerializablePerson());
    nop = new SerializableNopInterceptor();
    pc = new NameMatchMethodPointcut();
    pf.addAdvisor(new DefaultPointcutAdvisor(pc, nop));
    proxied = (Person) pf.getProxy();
  }
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.