Examples of DerivedTestBean


Examples of org.springframework.beans.DerivedTestBean

    RequestContextHolder.setRequestAttributes(requestAttributes);
    try {
      String name = "sessionScopedDisposableObject";
      assertNull(session.getAttribute(name));
      DerivedTestBean bean = (DerivedTestBean) this.beanFactory.getBean(name);
      assertEquals(session.getAttribute(name), bean);
      assertSame(bean, this.beanFactory.getBean(name));

      requestAttributes.requestCompleted();
      session.invalidate();
      assertTrue(bean.wasDestroyed());
    }
    finally {
      RequestContextHolder.setRequestAttributes(null);
    }
  }
View Full Code Here

Examples of org.springframework.beans.DerivedTestBean

    RequestContextHolder.setRequestAttributes(requestAttributes);
    try {
      String name = "sessionScopedDisposableObject";
      assertNull(session.getAttribute(name));
      DerivedTestBean bean = (DerivedTestBean) this.beanFactory.getBean(name);
      assertEquals(session.getAttribute(name), bean);
      assertSame(bean, this.beanFactory.getBean(name));

      requestAttributes.requestCompleted();
      serializedState = session.serializeState();
      assertFalse(bean.wasDestroyed());
    }
    finally {
      RequestContextHolder.setRequestAttributes(null);
    }

    serializedState = (Serializable) SerializationTestUtils.serializeAndDeserialize(serializedState);

    session = new MockHttpSession();
    session.deserializeState(serializedState);
    request = new MockHttpServletRequest();
    request.setSession(session);
    requestAttributes = new ServletRequestAttributes(request);

    RequestContextHolder.setRequestAttributes(requestAttributes);
    try {
      String name = "sessionScopedDisposableObject";
      assertNotNull(session.getAttribute(name));
      DerivedTestBean bean = (DerivedTestBean) this.beanFactory.getBean(name);
      assertEquals(session.getAttribute(name), bean);
      assertSame(bean, this.beanFactory.getBean(name));

      requestAttributes.requestCompleted();
      session.invalidate();
      assertTrue(bean.wasDestroyed());

      if (beanNameReset) {
        assertNull(bean.getBeanName());
      }
      else {
        assertNotNull(bean.getBeanName());
      }
    }
    finally {
      RequestContextHolder.setRequestAttributes(null);
    }
View Full Code Here

Examples of org.springframework.beans.DerivedTestBean

  public void testDirectBindingToIndexedField() {
    IndexedTestBean tb = new IndexedTestBean();
    DataBinder binder = new DataBinder(tb, "tb");
    binder.registerCustomEditor(TestBean.class, "array", new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        DerivedTestBean tb = new DerivedTestBean();
        tb.setName("array" + text);
        setValue(tb);
      }
      public String getAsText() {
        return ((TestBean) getValue()).getName();
      }
View Full Code Here

Examples of org.springframework.beans.DerivedTestBean

  public void testDirectBindingToEmptyIndexedFieldWithRegisteredSpecificEditor() {
    IndexedTestBean tb = new IndexedTestBean();
    DataBinder binder = new DataBinder(tb, "tb");
    binder.registerCustomEditor(TestBean.class, "map[key0]", new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        DerivedTestBean tb = new DerivedTestBean();
        tb.setName("array" + text);
        setValue(tb);
      }
      public String getAsText() {
        return ((TestBean) getValue()).getName();
      }
View Full Code Here

Examples of org.springframework.beans.DerivedTestBean

  public void testDirectBindingToEmptyIndexedFieldWithRegisteredGenericEditor() {
    IndexedTestBean tb = new IndexedTestBean();
    DataBinder binder = new DataBinder(tb, "tb");
    binder.registerCustomEditor(TestBean.class, "map", new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        DerivedTestBean tb = new DerivedTestBean();
        tb.setName("array" + text);
        setValue(tb);
      }
      public String getAsText() {
        return ((TestBean) getValue()).getName();
      }
View Full Code Here

Examples of org.springframework.beans.DerivedTestBean

  public void testCustomEditorWithSubclass() {
    IndexedTestBean tb = new IndexedTestBean();
    DataBinder binder = new DataBinder(tb, "tb");
    binder.registerCustomEditor(TestBean.class, new PropertyEditorSupport() {
      public void setAsText(String text) throws IllegalArgumentException {
        DerivedTestBean tb = new DerivedTestBean();
        tb.setName("array" + text);
        setValue(tb);
      }
      public String getAsText() {
        return ((TestBean) getValue()).getName();
      }
View Full Code Here

Examples of org.springframework.beans.DerivedTestBean

      return super.myHandle(tbReal, errors, model);
    }

    @ModelAttribute
    protected TB2 getModelAttr() {
      return (TB2) new DerivedTestBean();
    }
View Full Code Here

Examples of org.springframework.beans.DerivedTestBean

  public static final int NR_OF_ITERATIONS = 1000;


  public void testSerializable() throws Exception {
    DerivedTestBean tb = new DerivedTestBean();
    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setInterfaces(new Class[] {ITestBean.class});
    ConcurrencyThrottleInterceptor cti = new ConcurrencyThrottleInterceptor();
    proxyFactory.addAdvice(cti);
    proxyFactory.setTarget(tb);
View Full Code Here

Examples of org.springframework.beans.DerivedTestBean

      return "myView";
    }

    @ModelAttribute
    protected TB2 getModelAttr() {
      return (TB2) new DerivedTestBean();
    }
View Full Code Here

Examples of org.springframework.beans.DerivedTestBean

      return super.myHandle(tbReal, errors, model);
    }

    @ModelAttribute
    protected TB2 getModelAttr() {
      return (TB2) new DerivedTestBean();
    }
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.