Package org.springframework.tests.sample.beans

Examples of org.springframework.tests.sample.beans.DerivedTestBean.wasDestroyed()


      assertNull(request.getAttribute(NAME));
      DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class);
      assertSame(bean, request.getAttribute(NAME));
      assertSame(bean, ac.getBean(NAME));
      requestAttributes.requestCompleted();
      assertTrue(bean.wasDestroyed());
    }
    finally {
      RequestContextHolder.setRequestAttributes(null);
    }
  }
View Full Code Here


      assertNull(request.getPortletSession().getAttribute(NAME));
      DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class);
      assertSame(bean, request.getPortletSession().getAttribute(NAME));
      assertSame(bean, ac.getBean(NAME));
      request.getPortletSession().invalidate();
      assertTrue(bean.wasDestroyed());
    }
    finally {
      RequestContextHolder.setRequestAttributes(null);
    }
  }
View Full Code Here

      assertNull(request.getPortletSession().getAttribute(NAME, PortletSession.APPLICATION_SCOPE));
      DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class);
      assertSame(bean, request.getPortletSession().getAttribute(NAME, PortletSession.APPLICATION_SCOPE));
      assertSame(bean, ac.getBean(NAME));
      request.getPortletSession().invalidate();
      assertTrue(bean.wasDestroyed());
    }
    finally {
      RequestContextHolder.setRequestAttributes(null);
    }
  }
View Full Code Here

    assertNull(ac.getPortletContext().getAttribute(NAME));
    DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class);
    assertSame(bean, ac.getPortletContext().getAttribute(NAME));
    assertSame(bean, ac.getBean(NAME));
    new ContextCleanupListener().contextDestroyed(new ServletContextEvent(ac.getServletContext()));
    assertTrue(bean.wasDestroyed());
  }

}
View Full Code Here

    assertSame(tb, beanRegistry.getSingleton("tb"));
    assertEquals(1, beanRegistry.getSingletonCount());
    String[] names = beanRegistry.getSingletonNames();
    assertEquals(1, names.length);
    assertEquals("tb", names[0]);
    assertFalse(tb.wasDestroyed());

    beanRegistry.destroySingletons();
    assertEquals(0, beanRegistry.getSingletonCount());
    assertEquals(0, beanRegistry.getSingletonNames().length);
    assertTrue(tb.wasDestroyed());
View Full Code Here

    assertFalse(tb.wasDestroyed());

    beanRegistry.destroySingletons();
    assertEquals(0, beanRegistry.getSingletonCount());
    assertEquals(0, beanRegistry.getSingletonNames().length);
    assertTrue(tb.wasDestroyed());
  }

}
View Full Code Here

    assertEquals("inner1", innerForConstructor.getName());
    assertEquals(6, innerForConstructor.getAge());

    xbf.destroySingletons();
    assertTrue(inner1.wasDestroyed());
    assertTrue(inner2.wasDestroyed());
    assertTrue(innerFactory.getName() == null);
    assertTrue(inner5.wasDestroyed());
  }

  @Test
View Full Code Here

      assertNull(request.getAttribute(NAME));
      DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class);
      assertSame(bean, request.getAttribute(NAME));
      assertSame(bean, ac.getBean(NAME));
      requestAttributes.requestCompleted();
      assertTrue(bean.wasDestroyed());
    }
    finally {
      RequestContextHolder.setRequestAttributes(null);
    }
  }
View Full Code Here

      assertNull(request.getSession().getAttribute(NAME));
      DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class);
      assertSame(bean, request.getSession().getAttribute(NAME));
      assertSame(bean, ac.getBean(NAME));
      request.getSession().invalidate();
      assertTrue(bean.wasDestroyed());
    }
    finally {
      RequestContextHolder.setRequestAttributes(null);
    }
  }
View Full Code Here

    assertNull(ac.getServletContext().getAttribute(NAME));
    DerivedTestBean bean = ac.getBean(NAME, DerivedTestBean.class);
    assertSame(bean, ac.getServletContext().getAttribute(NAME));
    assertSame(bean, ac.getBean(NAME));
    new ContextCleanupListener().contextDestroyed(new ServletContextEvent(ac.getServletContext()));
    assertTrue(bean.wasDestroyed());
  }

}
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.