Skip to content

Commit

Permalink
A couple more tests now work for Observables.
Browse files Browse the repository at this point in the history
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@526 1c488680-804c-0410-94cd-c6b725194a0e
  • Loading branch information
drallen committed Dec 14, 2008
1 parent edeada6 commit cf81506
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions webbeans-api/src/main/java/javax/webbeans/Observable.java
Expand Up @@ -28,10 +28,10 @@

/**
* Annotates a variable to be injected with an Event object that can be fired and
* observed by observer methods.
* observed by observer methods
*
* @author David Allen
* @author Gvin King
* @author Gavin King
*/

@BindingType
Expand Down
Expand Up @@ -95,7 +95,6 @@ public class ManagerImpl implements Manager
* @param enabledDeploymentTypes any enabled deployment types, an empty set
* if none are specified
*/
@SuppressWarnings("unchecked")
public ManagerImpl()
{
this.beans = new CopyOnWriteArrayList<Bean<?>>();
Expand Down
Expand Up @@ -35,7 +35,7 @@
*
* @author David Allen
*
* @param <T>
* @param <T> The type of event being wrapped
* @see javax.webbeans.Event
*/
public class EventImpl<T> extends FacadeImpl<T> implements Event<T>
Expand Down
Expand Up @@ -568,23 +568,21 @@ public void testNonTransactionalObserverThrownCheckedExceptionIsWrappedAndRethro
manager.fireEvent(new Integer(1));
}

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

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

Expand Down
@@ -1,8 +1,13 @@
package org.jboss.webbeans.test.annotations;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import javax.webbeans.BindingType;

@BindingType
@Retention(RUNTIME)
public @interface Role
{
String value();
Expand Down
Expand Up @@ -9,8 +9,7 @@

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

public void methodThatFiresEvent()
Expand Down

0 comments on commit cf81506

Please sign in to comment.