Search in sources :

Example 1 with ManagedBean

use of org.jboss.weld.bean.ManagedBean in project core by weld.

the class BeanIdentifierIndexTest method testIndex.

@Test
public void testIndex() {
    BeanIdentifierIndex index = beanManager.getServices().get(BeanIdentifierIndex.class);
    // Index is enabled by default
    assertTrue(index.isBuilt());
    assertFalse(index.isEmpty());
    ManagedBean<?> indexedBean = (ManagedBean<?>) beanManager.resolve(beanManager.getBeans(Indexed.class));
    assertNotNull(index.getIndex(indexedBean.getIdentifier()));
    HttpSessionBean httpSessionBean = (HttpSessionBean) beanManager.resolve(beanManager.getBeans(HttpSession.class));
    // Built-in beans are not included
    assertNull(index.getIndex(httpSessionBean.getIdentifier()));
}
Also used : HttpSessionBean(org.jboss.weld.module.web.HttpSessionBean) ManagedBean(org.jboss.weld.bean.ManagedBean) BeanIdentifierIndex(org.jboss.weld.serialization.BeanIdentifierIndex) SerializationTest(org.jboss.weld.tests.serialization.noncontextual.SerializationTest) Test(org.junit.Test)

Aggregations

ManagedBean (org.jboss.weld.bean.ManagedBean)1 HttpSessionBean (org.jboss.weld.module.web.HttpSessionBean)1 BeanIdentifierIndex (org.jboss.weld.serialization.BeanIdentifierIndex)1 SerializationTest (org.jboss.weld.tests.serialization.noncontextual.SerializationTest)1 Test (org.junit.Test)1