Skip to content

Commit

Permalink
Added a couple more test implementations for event bus.
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@487 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
drallen committed Dec 8, 2008
1 parent 7946c81 commit 2aa0a5f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
Expand Up @@ -18,6 +18,7 @@
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.test.beans.BananaSpider;
import org.jboss.webbeans.test.beans.RecluseSpider;
import org.jboss.webbeans.test.beans.SweeWaxbill;
import org.jboss.webbeans.test.beans.TeaCupPomeranian;
import org.jboss.webbeans.test.bindings.AnimalStereotypeAnnotationLiteral;
import org.jboss.webbeans.test.bindings.RoleBinding;
Expand Down Expand Up @@ -567,18 +568,24 @@ public void testNonTransactionalObserverThrownCheckedExceptionIsWrappedAndRethro
manager.fireEvent(new Integer(1));
}

@Test(groups = { "stub", "events" })
@Test(groups = { "broken", "events" }, expectedExceptions = { DuplicateBindingTypeException.class })
@SpecAssertion(section = "8.6")
public void testDuplicateBindingsToFireFails()
{
assert false;
Set<AbstractBean<?, ?>> beans = webBeansBootstrap.createBeans(SweeWaxbill.class);
assert beans.size() == 1;
SweeWaxbill bean = (SweeWaxbill)beans.iterator().next().create();
bean.methodThatFiresEvent();
}

@Test(groups = { "stub", "events" })
@Test(groups = { "broken", "events" })
@SpecAssertion(section = "8.6")
public void testDuplicateBindingsToObservesFails()
{
assert false;
Set<AbstractBean<?, ?>> beans = webBeansBootstrap.createBeans(SweeWaxbill.class);
assert beans.size() == 1;
SweeWaxbill bean = (SweeWaxbill)beans.iterator().next().create();
bean.methodThatRegistersObserver();
}

@Test(groups = { "stub", "events" })
Expand Down
@@ -0,0 +1,31 @@
package org.jboss.webbeans.test.beans;

import javax.webbeans.Event;
import javax.webbeans.Observable;
import javax.webbeans.Observer;

import org.jboss.webbeans.test.annotations.Role;
import org.jboss.webbeans.test.bindings.RoleBinding;

public class SweeWaxbill
{
@Observable
@Role("Admin")
private Event<String> simpleEvent;

public void methodThatFiresEvent()
{
simpleEvent.fire("An event", new RoleBinding("Admin"));
}

public void methodThatRegistersObserver()
{
simpleEvent.observe(new Observer<String>()
{

public void notify(String event)
{
}
}, new RoleBinding("Admin"));
}
}

0 comments on commit 2aa0a5f

Please sign in to comment.