use of org.jboss.weld.test.util.ActionSequence in project core by weld.
the class ResourceInjectionTest method testResourceInjectionOrdering.
@SuppressWarnings("unchecked")
@Test
public void testResourceInjectionOrdering(BeanManager beanManager) {
ActionSequence.reset();
Bean<Alpha> bean = (Bean<Alpha>) beanManager.resolve(beanManager.getBeans(Alpha.class));
CreationalContext<Alpha> ctx = beanManager.createCreationalContext(bean);
Alpha instance = bean.create(ctx);
bean.destroy(instance, ctx);
ActionSequence sequence = ActionSequence.getSequence();
assertEquals(4, sequence.getData().size());
assertTrue(sequence.beginsWith(Charlie.class.getName() + String.class.getName(), Bravo.class.getName() + SessionBean.class.getName()));
}
use of org.jboss.weld.test.util.ActionSequence in project core by weld.
the class PersistenceInjectionTest method testResourceInjectionOrdering.
@SuppressWarnings("unchecked")
@Test
public void testResourceInjectionOrdering(BeanManager beanManager) {
ActionSequence.reset();
Bean<Alpha> bean = (Bean<Alpha>) beanManager.resolve(beanManager.getBeans(Alpha.class));
CreationalContext<Alpha> ctx = beanManager.createCreationalContext(bean);
Alpha instance = bean.create(ctx);
bean.destroy(instance, ctx);
ActionSequence sequence = ActionSequence.getSequence();
assertEquals(4, sequence.getData().size());
assertTrue(sequence.beginsWith(Charlie.class.getName() + EntityManager.class.getName(), Bravo.class.getName() + EntityManagerFactory.class.getName()));
}
use of org.jboss.weld.test.util.ActionSequence in project core by weld.
the class ConversationContextDestroyedOnSessionTimeoutTest method testConversationContextDestroyedCorrectly.
@Test
public void testConversationContextDestroyedCorrectly() throws FailingHttpStatusCodeException, MalformedURLException, IOException {
WebClient client = new WebClient();
client.setThrowExceptionOnFailingStatusCode(false);
String cid = client.getPage(contextPath + "/init").getWebResponse().getContentAsString();
ActionSequence sequence = new ActionSequence();
sequence.add(Foo.class.getSimpleName() + "pingStart");
sequence.add(SessionListener.class.getSimpleName() + "destroyed");
sequence.add(Foo.class.getSimpleName() + "destroy");
sequence.add(Foo.class.getSimpleName() + "pingEnd");
assertEquals(sequence.dataToCsv(), client.getPage(contextPath + "/test" + "?cid=" + cid).getWebResponse().getContentAsString().trim());
}
use of org.jboss.weld.test.util.ActionSequence in project core by weld.
the class InstanceIteratorTest method testIteration.
@Test
public void testIteration() {
ActionSequence.reset();
Bean<Master> bean = Utils.getBean(beanManager, Master.class);
CreationalContext<Master> ctx = beanManager.createCreationalContext(bean);
Master master = bean.create(ctx);
master.iterate();
bean.destroy(master, ctx);
ActionSequence init = ActionSequence.getSequence("init");
assertNotNull(init);
assertEquals(2, init.getData().size());
assertTrue(init.containsAll(Alpha.class.getName(), Bravo.class.getName()));
ActionSequence destroy = ActionSequence.getSequence("destroy");
assertNotNull(destroy);
assertEquals(2, destroy.getData().size());
assertTrue(destroy.containsAll(Alpha.class.getName(), Bravo.class.getName()));
}
Aggregations