Author: pete.muir(a)jboss.org
Date: 2008-10-20 14:32:52 -0400 (Mon, 20 Oct 2008)
New Revision: 122
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BasicContext.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbManager.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventBus.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventComponentModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java
Log:
Fix compile problems from API update
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BasicContext.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BasicContext.java 2008-10-20
18:15:46 UTC (rev 121)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BasicContext.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -26,7 +26,7 @@
}
@SuppressWarnings("unchecked")
- public <T> T get(Manager container, Bean<T> component, boolean create)
+ public <T> T get(Bean<T> component, boolean create)
{
T instance = (T) values.get(component);
if (instance != null)
@@ -41,7 +41,7 @@
// TODO should component creation be synchronized?
- instance = component.create(container);
+ instance = component.create();
values.put(component, instance);
return instance;
@@ -60,7 +60,7 @@
if (instance != null)
{
values.remove(component);
- component.destroy(container, instance);
+ component.destroy(instance);
}
else
{
@@ -77,10 +77,15 @@
for (Bean c : values.keySet())
{
- c.destroy(container, values.get(c));
+ c.destroy(values.get(c));
}
values.clear();
}
+
+ public boolean isActive() {
+ // TODO Auto-generated method stub
+ return false;
+ }
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanImpl.java 2008-10-20
18:15:46 UTC (rev 121)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/BeanImpl.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -26,13 +26,13 @@
}
@Override
- public T create(Manager container)
+ public T create()
{
- return componentMetaModel.getConstructor().invoke(container);
+ return componentMetaModel.getConstructor().invoke(getManager());
}
@Override
- public void destroy(Manager container, T instance)
+ public void destroy(T instance)
{
// TODO Auto-generated method stub
@@ -45,9 +45,9 @@
}
@Override
- public Annotation getDeploymentType()
+ public Class<Annotation> getDeploymentType()
{
- return componentMetaModel.getDeploymentType();
+ return null; // componentMetaModel.getDeploymentType();
}
@Override
@@ -57,13 +57,13 @@
}
@Override
- public Annotation getScopeType()
+ public Class<Annotation> getScopeType()
{
- return componentMetaModel.getScopeType();
+ return null; //componentMetaModel.getScopeType();
}
@Override
- public Set<Class> getTypes()
+ public Set<Class<?>> getTypes()
{
// TODO Auto-generated method stub
return null;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-10-20
18:15:46 UTC (rev 121)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -8,191 +8,201 @@
import java.util.Map;
import java.util.Set;
-import javax.webbeans.ContextNotActiveException;
import javax.webbeans.Standard;
import javax.webbeans.TypeLiteral;
import javax.webbeans.manager.Bean;
import javax.webbeans.manager.Context;
+import javax.webbeans.manager.Decorator;
+import javax.webbeans.manager.InterceptionType;
+import javax.webbeans.manager.Interceptor;
import javax.webbeans.manager.Manager;
-import javax.webbeans.manager.Observer;
+import javax.webbeans.Observer;
import org.jboss.webbeans.bindings.ProductionAnnotationLiteral;
import org.jboss.webbeans.bindings.StandardAnnotationLiteral;
import org.jboss.webbeans.ejb.EjbManager;
import org.jboss.webbeans.event.EventBus;
-import org.jboss.webbeans.injectable.Injectable;
import org.jboss.webbeans.injectable.SimpleInjectable;
-public class ManagerImpl implements Manager
-{
-
- private List<Annotation> enabledDeploymentTypes;
- private ModelManager modelManager;
- private EjbManager ejbLookupManager;
- private EventBus eventBus;
- private ResolutionManager resolutionManager;
-
- private boolean containerInitialized = false;
+public class ManagerImpl implements Manager {
-
- private ThreadLocal<Map<Class<Annotation>, Context>> contexts =
- new ThreadLocal<Map<Class<Annotation>, Context>>();
+ private List<Annotation> enabledDeploymentTypes;
+ private ModelManager modelManager;
+ private EjbManager ejbLookupManager;
+ private EventBus eventBus;
+ private ResolutionManager resolutionManager;
- private Set<Bean<?>> beans;
-
- public ManagerImpl(List<Annotation> enabledDeploymentTypes)
- {
- initEnabledDeploymentTypes(enabledDeploymentTypes);
- this.modelManager = new ModelManager();
- this.ejbLookupManager = new EjbManager();
- this.beans = new HashSet<Bean<?>>();
- this.eventBus = new EventBus();
- resolutionManager = new ResolutionManager(this);
- }
-
- private void initEnabledDeploymentTypes(List<Annotation>
enabledDeploymentTypes)
- {
- this.enabledDeploymentTypes = new ArrayList<Annotation>();
- if (enabledDeploymentTypes == null)
- {
- this.enabledDeploymentTypes.add(0, new StandardAnnotationLiteral());
- this.enabledDeploymentTypes.add(1, new ProductionAnnotationLiteral());
- }
- else
- {
- this.enabledDeploymentTypes.addAll(enabledDeploymentTypes);
- if
(!this.enabledDeploymentTypes.get(0).annotationType().equals(Standard.class))
- {
- throw new RuntimeException("@Standard must be the lowest precedence
deployment type");
- }
- }
- }
+ private boolean containerInitialized = false;
- public Manager addBean(Bean<?> bean)
- {
- beans.add(bean);
- if (containerInitialized)
- {
- // TODO Somehow deal with dynamically reigstered components
- }
- return this;
- }
+ private ThreadLocal<Map<Class<Annotation>, Context>> contexts = new
ThreadLocal<Map<Class<Annotation>, Context>>();
- public void addContext(Context context)
- {
- // TODO Auto-generated method stub
-
- }
+ private Set<Bean<?>> beans;
- public <T> void addObserver(Observer<T> observer)
- {
- eventBus.addObserver(observer);
- }
+ public ManagerImpl(List<Annotation> enabledDeploymentTypes) {
+ initEnabledDeploymentTypes(enabledDeploymentTypes);
+ this.modelManager = new ModelManager();
+ this.ejbLookupManager = new EjbManager();
+ this.beans = new HashSet<Bean<?>>();
+ this.eventBus = new EventBus();
+ resolutionManager = new ResolutionManager(this);
+ }
- public void fireEvent(Object event, Annotation... bindings)
- {
- // TODO Auto-generated method stub
-
- }
+ private void initEnabledDeploymentTypes(
+ List<Annotation> enabledDeploymentTypes) {
+ this.enabledDeploymentTypes = new ArrayList<Annotation>();
+ if (enabledDeploymentTypes == null) {
+ this.enabledDeploymentTypes.add(0, new StandardAnnotationLiteral());
+ this.enabledDeploymentTypes.add(1,
+ new ProductionAnnotationLiteral());
+ } else {
+ this.enabledDeploymentTypes.addAll(enabledDeploymentTypes);
+ if (!this.enabledDeploymentTypes.get(0).annotationType().equals(
+ Standard.class)) {
+ throw new RuntimeException(
+ "@Standard must be the lowest precedence deployment type");
+ }
+ }
+ }
- public Context getContext(Class<Annotation> scopeType)
- {
- Context context = contexts.get().get(scopeType);
-
- if (context == null)
- {
- // If context can't be found throw an exception (section 9.4 of spec)
- throw new ContextNotActiveException();
- }
- else
- {
- return context;
- }
- }
+ public Manager addBean(Bean<?> bean) {
+ beans.add(bean);
+ if (containerInitialized) {
+ // TODO Somehow deal with dynamically reigstered components
+ }
+ return this;
+ }
- public Object getInstanceByName(String name)
- {
- // TODO Auto-generated method stub
- return null;
- }
+ public <T> void removeObserver(Observer<T> observer) {
- public <T> T getInstanceByType(Class<T> type, Annotation... bindingTypes)
- {
- // TODO Auto-generated method stub
- return null;
- }
+ }
- public <T> T getInstanceByType(TypeLiteral<T> type,
- Annotation... bindingTypes)
- {
- // TODO Auto-generated method stub
- return null;
- }
+ public <T> Set<Method> resolveDisposalMethods(Class<T> apiType,
+ Annotation... bindingTypes) {
+ return new HashSet<Method>();
+ }
- public<T> void removeObserver(Observer<T> observer)
- {
- eventBus.removeObserver(observer);
- }
+ public <T> Set<Observer<T>> resolveObservers(T event,
+ Annotation... bindings) {
+ return (Set<Observer<T>>) eventBus.getObservers(event, bindings);
+ }
- public Set<Bean<?>> resolveByName(String name)
- {
- // TODO Auto-generated method stub
- return null;
- }
+ public List<Annotation> getEnabledDeploymentTypes() {
+ return enabledDeploymentTypes;
+ }
-
-
- public <T> Set<Method> resolveDisposalMethods(Class<T> apiType,
Annotation... bindingTypes)
- {
- return new HashSet<Method>();
- }
+ public ModelManager getModelManager() {
+ return this.modelManager;
+ }
- public <T> Set<Observer<T>> resolveObservers(T event, Annotation...
bindings)
- {
- return (Set<Observer<T>>) eventBus.getObservers(event, bindings);
- }
-
- public List<Annotation> getEnabledDeploymentTypes()
- {
- return enabledDeploymentTypes;
- }
-
- public ModelManager getModelManager()
- {
- return this.modelManager;
- }
-
- public EjbManager getEjbManager()
- {
- return ejbLookupManager;
- }
+ public EjbManager getEjbManager() {
+ return ejbLookupManager;
+ }
- public <T> T getInstance(Bean<T> bean)
- {
- // TODO Auto-generated method stub
- return null;
- }
+ public <T> Set<Bean<T>> resolveByType(Class<T> apiType,
+ Annotation... bindingTypes) {
+ return getResolutionManager().get(
+ new SimpleInjectable<T>(apiType, bindingTypes));
+ }
- public <T> Set<Bean<T>> resolveByType(Class<T> apiType,
- Annotation... bindingTypes)
- {
- return getResolutionManager().get(new SimpleInjectable<T>(apiType,
bindingTypes));
- }
+ public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> apiType,
+ Annotation... bindingTypes) {
+ return resolveByType(apiType.getRawType(), bindingTypes);
+ }
- public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> apiType,
- Annotation... bindingTypes)
- {
- return resolveByType(apiType.getRawType(), bindingTypes);
- }
-
- public ResolutionManager getResolutionManager()
- {
- return resolutionManager;
- }
-
- public Set<Bean<?>> getBeans()
- {
- return beans;
- }
-
+ public ResolutionManager getResolutionManager() {
+ return resolutionManager;
+ }
+
+ public Set<Bean<?>> getBeans() {
+ return beans;
+ }
+
+ public void addContext(Context context) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Manager addDecorator(Decorator decorator) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Manager addInterceptor(Interceptor interceptor) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> void addObserver(Observer<T> observer, Class<T> eventType,
+ Annotation... bindings) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public <T> void addObserver(Observer<T> observer, TypeLiteral<T>
eventType,
+ Annotation... bindings) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void fireEvent(Object event, Annotation... bindings) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Context getContext(Class<Annotation> scopeType) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> T getInstance(Bean<T> bean) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Object getInstanceByName(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> T getInstanceByType(Class<T> type, Annotation... bindingTypes) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> T getInstanceByType(TypeLiteral<T> type,
+ Annotation... bindingTypes) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> void removeObserver(Observer<T> observer, Class<T>
eventType,
+ Annotation... bindings) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public <T> void removeObserver(Observer<T> observer,
+ TypeLiteral<T> eventType, Annotation... bindings) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Set<Bean<?>> resolveByName(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<Decorator> resolveDecorators(Set<Class<?>> types,
+ Annotation... bindingTypes) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public List<Interceptor> resolveInterceptors(InterceptionType type,
+ Annotation... interceptorBindings) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbManager.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbManager.java 2008-10-20
18:15:46 UTC (rev 121)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbManager.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -3,7 +3,7 @@
import java.util.HashMap;
import java.util.Map;
-import javax.webbeans.EnterpriseBeanLookup;
+import javax.webbeans.manager.EnterpriseBeanLookup;
import org.jboss.webbeans.util.JNDI;
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java 2008-10-20
18:15:46 UTC (rev 121)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/DeferredEventNotification.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -2,7 +2,7 @@
import javax.transaction.Synchronization;
import javax.webbeans.manager.Manager;
-import javax.webbeans.manager.Observer;
+import javax.webbeans.Observer;
/**
* A synchronization object which will deliver the event to the observer
@@ -13,7 +13,6 @@
*/
public class DeferredEventNotification implements Synchronization
{
- private Manager manager;
private Observer<Object> observer;
private Object event;
@@ -25,9 +24,8 @@
* @param event The event being fired
*/
@SuppressWarnings("unchecked")
- public DeferredEventNotification(Manager manager, Object event, Observer observer)
+ public DeferredEventNotification(Object event, Observer observer)
{
- this.manager = manager;
this.observer = observer;
this.event = event;
}
@@ -40,7 +38,7 @@
public void beforeCompletion()
{
// Execute the observer method on the event
- observer.notify(manager, event);
+ observer.notify(event);
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventBus.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventBus.java 2008-10-20
18:15:46 UTC (rev 121)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventBus.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -12,8 +12,7 @@
import javax.transaction.SystemException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
-import javax.webbeans.manager.Manager;
-import javax.webbeans.manager.Observer;
+import javax.webbeans.Observer;
import org.jboss.webbeans.util.JNDI;
@@ -67,13 +66,13 @@
* @throws IllegalStateException
* @throws RollbackException
*/
- public void deferEvent(Manager container, Object event, Observer<?> o) throws
SystemException, IllegalStateException, RollbackException
+ public void deferEvent(Object event, Observer<?> o) throws SystemException,
IllegalStateException, RollbackException
{
if (tm != null) {
// Get the current transaction associated with the thread
Transaction t = tm.getTransaction();
if (t != null)
- t.registerSynchronization(new DeferredEventNotification(container, event,
o));
+ t.registerSynchronization(new DeferredEventNotification(event, o));
}
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java 2008-10-20
18:15:46 UTC (rev 121)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/EventImpl.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -11,7 +11,7 @@
import javax.webbeans.DuplicateBindingTypeException;
import javax.webbeans.Event;
import javax.webbeans.manager.Manager;
-import javax.webbeans.manager.Observer;
+import javax.webbeans.Observer;
/**
* Implementation of the {@link Event} interface used for the container provided
@@ -55,7 +55,7 @@
.fireEvent(event, eventBindings.toArray(new Annotation[0]));
}
- public void observes(Observer<T> observe, Annotation... bindings)
+ public void observe(Observer<T> observe, Annotation... bindings)
{
// TODO Auto-generated method stub
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-10-20
18:15:46 UTC (rev 121)
+++
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -3,7 +3,7 @@
import java.lang.annotation.Annotation;
import javax.webbeans.manager.Manager;
-import javax.webbeans.manager.Observer;
+import javax.webbeans.Observer;
import org.jboss.webbeans.injectable.InjectableMethod;
import org.jboss.webbeans.injectable.InjectableParameter;
@@ -67,10 +67,10 @@
* java.lang.Object)
*/
@SuppressWarnings("unchecked")
- public void notify(Manager manager, final T event)
+ public void notify(final T event)
{
// Get the most specialized instance of the component
- Object instance = getInstance(manager);
+ Object instance = null /*getInstance(manager)*/;
if (instance != null)
{
// Let the super class get the parameter values, but substitute the event
@@ -91,7 +91,7 @@
observerMethod.getParameters().set(i, newParameter);
}
}
- this.observerMethod.invoke(manager, instance);
+ // this.observerMethod.invoke(manager, instance);
}
}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java 2008-10-20
18:15:46 UTC (rev 121)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -8,7 +8,6 @@
import javax.webbeans.Production;
import javax.webbeans.Stereotype;
-import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
import org.jboss.webbeans.test.components.Antelope;
@@ -21,7 +20,7 @@
@Test
public void testDeclaredAnnotations()
{
- AnnotatedType annotatedElement = new SimpleAnnotatedType(Order.class);
+ AnnotatedType<Order> annotatedElement = new
SimpleAnnotatedType<Order>(Order.class);
assert annotatedElement.getAnnotations().size() == 1;
assert annotatedElement.getAnnotation(Production.class) != null;
assert annotatedElement.getAnnotatedClass().equals(Order.class);
@@ -30,7 +29,7 @@
@Test
public void testMetaAnnotations()
{
- AnnotatedItem annotatedElement = new SimpleAnnotatedType(Order.class);
+ AnnotatedType<Order> annotatedElement = new
SimpleAnnotatedType<Order>(Order.class);
Set<Annotation> annotations =
annotatedElement.getAnnotations(DeploymentType.class);
assert annotations.size() == 1;
Iterator<Annotation> it = annotations.iterator();
@@ -41,10 +40,10 @@
@Test
public void testEmpty()
{
- AnnotatedItem annotatedElement = new SimpleAnnotatedType(Order.class);
+ AnnotatedType<Order> annotatedElement = new
SimpleAnnotatedType<Order>(Order.class);
assert annotatedElement.getAnnotation(Stereotype.class) == null;
assert annotatedElement.getAnnotations(Stereotype.class).size() == 0;
- AnnotatedItem classWithNoAnnotations = new SimpleAnnotatedType(Antelope.class);
+ AnnotatedType<Antelope> classWithNoAnnotations = new
SimpleAnnotatedType<Antelope>(Antelope.class);
assert classWithNoAnnotations.getAnnotations().size() == 0;
}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java 2008-10-20
18:15:46 UTC (rev 121)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorModelTest.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -29,12 +29,12 @@
private ManagerImpl container;
- private AnnotatedType emptyAnnotatedItem;
+ private AnnotatedType<Object> emptyAnnotatedItem;
@BeforeMethod
public void before()
{
- emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
+ emptyAnnotatedItem = new SimpleAnnotatedType<Object>(null, new
HashMap<Class<? extends Annotation>, Annotation>());
container = new MockContainerImpl(null);
}
@@ -43,18 +43,18 @@
public void testImplicitConstructor()
{
SimpleConstructor<Order> constructor = new
SimpleComponentModel<Order>(new SimpleAnnotatedType<Order>(Order.class),
emptyAnnotatedItem, container).getConstructor();
- assert constructor.getConstructor().getDeclaringClass().equals(Order.class);
- assert constructor.getConstructor().getParameterTypes().length == 0;
+ assert
constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
+ assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length ==
0;
assert constructor.getParameters().size() == 0;
}
@Test
public void testSingleConstructor()
{
- SimpleConstructor<Donkey> constructor = new
SimpleComponentModel<Donkey>(new SimpleAnnotatedType(Donkey.class),
emptyAnnotatedItem, container).getConstructor();
- assert constructor.getConstructor().getDeclaringClass().equals(Donkey.class);
- assert constructor.getConstructor().getParameterTypes().length == 1;
- assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
+ SimpleConstructor<Donkey> constructor = new
SimpleComponentModel<Donkey>(new SimpleAnnotatedType<Donkey>(Donkey.class),
emptyAnnotatedItem, container).getConstructor();
+ assert
constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Donkey.class);
+ assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length ==
1;
+ assert
constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
assert constructor.getParameters().size() == 1;
assert constructor.getParameters().get(0).getType().equals(String.class);
assert constructor.getParameters().get(0).getBindingTypes().length == 1;
@@ -64,11 +64,11 @@
@Test
public void testInitializerAnnotatedConstructor()
{
- SimpleConstructor<Sheep> constructor = new
SimpleComponentModel<Sheep>(new SimpleAnnotatedType(Sheep.class),
emptyAnnotatedItem, container).getConstructor();
- assert constructor.getConstructor().getDeclaringClass().equals(Sheep.class);
- assert constructor.getConstructor().getParameterTypes().length == 2;
- assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
- assert constructor.getConstructor().getParameterTypes()[1].equals(Double.class);
+ SimpleConstructor<Sheep> constructor = new
SimpleComponentModel<Sheep>(new SimpleAnnotatedType<Sheep>(Sheep.class),
emptyAnnotatedItem, container).getConstructor();
+ assert
constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Sheep.class);
+ assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length ==
2;
+ assert
constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
+ assert
constructor.getAnnotatedItem().getDelegate().getParameterTypes()[1].equals(Double.class);
assert constructor.getParameters().size() == 2;
assert constructor.getParameters().get(0).getType().equals(String.class);
assert constructor.getParameters().get(1).getType().equals(Double.class);
@@ -81,11 +81,11 @@
@Test
public void testBindingTypeAnnotatedConstructor()
{
- SimpleConstructor<Duck> constructor = new
SimpleComponentModel<Duck>(new SimpleAnnotatedType(Duck.class), emptyAnnotatedItem,
container).getConstructor();
- assert constructor.getConstructor().getDeclaringClass().equals(Duck.class);
- assert constructor.getConstructor().getParameterTypes().length == 2;
- assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
- assert constructor.getConstructor().getParameterTypes()[1].equals(Integer.class);
+ SimpleConstructor<Duck> constructor = new
SimpleComponentModel<Duck>(new SimpleAnnotatedType<Duck>(Duck.class),
emptyAnnotatedItem, container).getConstructor();
+ assert
constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Duck.class);
+ assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length ==
2;
+ assert
constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
+ assert
constructor.getAnnotatedItem().getDelegate().getParameterTypes()[1].equals(Integer.class);
assert constructor.getParameters().size() == 2;
assert constructor.getParameters().get(0).getType().equals(String.class);
assert constructor.getParameters().get(1).getType().equals(Integer.class);
@@ -101,7 +101,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Chicken>(new SimpleAnnotatedType(Chicken.class),
emptyAnnotatedItem, container);
+ new SimpleComponentModel<Chicken>(new
SimpleAnnotatedType<Chicken>(Chicken.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -117,7 +117,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Turkey>(new SimpleAnnotatedType(Turkey.class),
emptyAnnotatedItem, container);
+ new SimpleComponentModel<Turkey>(new
SimpleAnnotatedType<Turkey>(Turkey.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -133,7 +133,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Goat>(new SimpleAnnotatedType(Goat.class),
emptyAnnotatedItem, container);
+ new SimpleComponentModel<Goat>(new
SimpleAnnotatedType<Goat>(Goat.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
@@ -149,7 +149,7 @@
boolean exception = false;
try
{
- new SimpleComponentModel<Goose>(new SimpleAnnotatedType(Goose.class),
emptyAnnotatedItem, container);
+ new SimpleComponentModel<Goose>(new
SimpleAnnotatedType<Goose>(Goose.class), emptyAnnotatedItem, container);
}
catch (Exception e)
{
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-10-20
18:15:46 UTC (rev 121)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -6,13 +6,13 @@
import java.util.List;
import java.util.Map;
-import javax.webbeans.manager.Observer;
+import javax.webbeans.Observer;
import javax.webbeans.Observes;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bindings.StandardAnnotationLiteral;
import org.jboss.webbeans.event.DeferredEventNotification;
-import org.jboss.webbeans.event.ObserverMethod;
+import org.jboss.webbeans.injectable.InjectableMethod;
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
import org.jboss.webbeans.model.SimpleComponentModel;
@@ -63,7 +63,7 @@
// is used to keep track of the event being fired.
ManagerImpl manager;
SimpleComponentModel<Tuna> tuna;
- ObserverMethod om;
+ InjectableMethod<Object> om;
List<Annotation> enabledDeploymentTypes = new ArrayList<Annotation>();
enabledDeploymentTypes.add(new StandardAnnotationLiteral());
enabledDeploymentTypes.add(new AnotherDeploymentTypeAnnotationLiteral());
@@ -74,13 +74,13 @@
annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
AnnotatedType<Tuna> annotatedItem = new
SimpleAnnotatedType<Tuna>(Tuna.class, annotations);
tuna = new SimpleComponentModel<Tuna>(new
SimpleAnnotatedType<Tuna>(Tuna.class), annotatedItem, manager);
- om = new ObserverMethod(AnObserver.class.getMethod("observe", new Class[]
{ Event.class }));
+ om = new
InjectableMethod<Object>(AnObserver.class.getMethod("observe", new Class[]
{ Event.class }));
AnObserver observerInstance = new AnObserver();
Observer<Event> observer = new MockObserverImpl<Event>(tuna, om,
Event.class);
((MockObserverImpl<Event>) observer).setInstance(observerInstance);
Event event = new Event();
- DeferredEventNotification deferredNotification = new
DeferredEventNotification(manager, event, observer);
+ DeferredEventNotification deferredNotification = new
DeferredEventNotification(event, observer);
deferredNotification.beforeCompletion();
assert observerInstance.notified;
}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java 2008-10-20
18:15:46 UTC (rev 121)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -31,14 +31,14 @@
public class EnterpriseComponentModelTest
{
-private ManagerImpl container;
+ private ManagerImpl container;
private AnnotatedType emptyAnnotatedItem;
@BeforeMethod
public void before()
{
- emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<?
extends Annotation>, Annotation>());
+ emptyAnnotatedItem = new SimpleAnnotatedType<Object>(null, new
HashMap<Class<? extends Annotation>, Annotation>());
container = new MockContainerImpl(null);
}
@@ -52,7 +52,7 @@
@Test
public void testStateless()
{
- EnterpriseComponentModel<Lion> lion = new
EnterpriseComponentModel<Lion>(new SimpleAnnotatedType(Lion.class),
emptyAnnotatedItem, container);
+ EnterpriseComponentModel<Lion> lion = new
EnterpriseComponentModel<Lion>(new SimpleAnnotatedType<Lion>(Lion.class),
emptyAnnotatedItem, container);
assert lion.getScopeType().annotationType().equals(Dependent.class);
Reflections.annotationSetMatches(lion.getBindingTypes(), Current.class);
assert lion.getName().equals("lion");
@@ -108,7 +108,7 @@
AbstractEnterpriseComponentModel<Tiger> tiger = new
EnterpriseComponentModel<Tiger>(new SimpleAnnotatedType(Tiger.class),
emptyAnnotatedItem, container);
Reflections.annotationSetMatches(tiger.getBindingTypes(), Synchronous.class);
- assert tiger.getRemoveMethod().getMethod().getName().equals("remove");
+ assert
tiger.getRemoveMethod().getAnnotatedItem().getDelegate().getName().equals("remove");
assert tiger.getName() == null;
}
@@ -118,7 +118,7 @@
{
AbstractEnterpriseComponentModel<Elephant> elephant = new
EnterpriseComponentModel<Elephant>(new SimpleAnnotatedType(Elephant.class),
emptyAnnotatedItem, container);
- assert
elephant.getRemoveMethod().getMethod().getName().equals("remove2");
+ assert
elephant.getRemoveMethod().getAnnotatedItem().getDelegate().getName().equals("remove2");
}
@SuppressWarnings("unchecked")
@@ -175,7 +175,7 @@
AbstractEnterpriseComponentModel<Panther> panther = new
EnterpriseComponentModel<Panther>(new SimpleAnnotatedType(Panther.class),
emptyAnnotatedItem, container);
- assert panther.getRemoveMethod().getMethod().getName().equals("remove");
+ assert
panther.getRemoveMethod().getAnnotatedItem().getDelegate().getName().equals("remove");
assert panther.getRemoveMethod().getParameters().size() == 1;
assert
panther.getRemoveMethod().getParameters().get(0).getType().equals(String.class);
assert panther.getRemoveMethod().getParameters().get(0).getBindingTypes().length ==
1;
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventComponentModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventComponentModelTest.java 2008-10-20
18:15:46 UTC (rev 121)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EventComponentModelTest.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -39,9 +39,9 @@
enabledDeploymentTypes.add(new AnotherDeploymentTypeAnnotationLiteral());
manager = new MockContainerImpl(enabledDeploymentTypes);
eventComponentModel = new EventComponentModel<Event<? extends
Object>>(
- new SimpleAnnotatedItem<Object>(
+ new SimpleAnnotatedItem<Event<? extends Object>, Object>(
new HashMap<Class<? extends Annotation>, Annotation>()),
- new SimpleAnnotatedItem<Object>(
+ new SimpleAnnotatedItem<Event<? extends Object>, Object>(
new HashMap<Class<? extends Annotation>, Annotation>()),
manager);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-10-20
18:15:46 UTC (rev 121)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -7,12 +7,12 @@
import java.util.Map;
import javax.webbeans.Observes;
-import javax.webbeans.manager.Observer;
+import javax.webbeans.Observer;
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bindings.StandardAnnotationLiteral;
import org.jboss.webbeans.event.ObserverImpl;
-import org.jboss.webbeans.event.ObserverMethod;
+import org.jboss.webbeans.injectable.InjectableMethod;
import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
import org.jboss.webbeans.model.SimpleComponentModel;
@@ -36,7 +36,7 @@
{
private ManagerImpl manager;
private SimpleComponentModel<Tuna> tuna;
- private ObserverMethod om;
+ private InjectableMethod<?> om;
public class Event
{
@@ -67,7 +67,7 @@
annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
AnnotatedType<Tuna> annotatedItem = new
SimpleAnnotatedType<Tuna>(Tuna.class, annotations);
tuna = new SimpleComponentModel<Tuna>(new
SimpleAnnotatedType<Tuna>(Tuna.class), annotatedItem, manager);
- om = new ObserverMethod(AnObserver.class.getMethod("observe", new Class[]
{ Event.class }));
+ om = new
InjectableMethod<Object>(AnObserver.class.getMethod("observe", new Class[]
{ Event.class }));
}
/**
@@ -79,9 +79,9 @@
public final void testGetEventBindingTypes() throws Exception
{
Observer<Event> o = new ObserverImpl<Event>(tuna, om, Event.class);
- assert o.getEventBindingTypes().size() == 1;
- assert Reflections.annotationSetMatches(o.getEventBindingTypes(),
Asynchronous.class);
- assert o.getEventType().equals(Event.class);
+ //assert o.getEventBindingTypes().size() == 1;
+ //assert Reflections.annotationSetMatches(o.getEventBindingTypes(),
Asynchronous.class);
+ //assert o.getEventType().equals(Event.class);
}
/**
@@ -95,7 +95,7 @@
public final void testGetEventType() throws Exception
{
Observer<Event> o = new ObserverImpl<Event>(tuna, om, Event.class);
- assert o.getEventType().equals(Event.class);
+ //assert o.getEventType().equals(Event.class);
}
/**
@@ -110,7 +110,7 @@
Observer<Event> observer = new MockObserverImpl<Event>(tuna, om,
Event.class);
((MockObserverImpl<Event>) observer).setInstance(observerInstance);
Event event = new Event();
- observer.notify(manager, event);
+ observer.notify(event);
assert observerInstance.notified;
}
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java 2008-10-20
18:15:46 UTC (rev 121)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeModelTest.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -2,8 +2,6 @@
import java.util.Arrays;
-import javax.webbeans.Model;
-import javax.webbeans.Production;
import javax.webbeans.RequestScoped;
import org.jboss.webbeans.introspector.SimpleAnnotatedType;
@@ -42,18 +40,6 @@
assert false;
}
- @Test @SpecAssertion(section="2.7.5")
- public void testModelStereotype()
- {
- StereotypeModel<Model> modelStereotype = new StereotypeModel<Model>(new
SimpleAnnotatedType<Model>(Model.class));
- assert
Production.class.equals(modelStereotype.getDefaultDeploymentType().annotationType());
- assert
RequestScoped.class.equals(modelStereotype.getDefaultScopeType().annotationType());
- assert modelStereotype.isComponentNameDefaulted();
- assert modelStereotype.getInterceptorBindings().size() == 0;
- assert modelStereotype.getRequiredTypes().size() == 0;
- assert modelStereotype.getSupportedScopes().size() == 0;
- }
-
@Test
public void testAnimalStereotype()
{
Modified:
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java
===================================================================
---
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java 2008-10-20
18:15:46 UTC (rev 121)
+++
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/mock/MockObserverImpl.java 2008-10-20
18:32:52 UTC (rev 122)
@@ -3,7 +3,7 @@
import javax.webbeans.manager.Manager;
import org.jboss.webbeans.event.ObserverImpl;
-import org.jboss.webbeans.event.ObserverMethod;
+import org.jboss.webbeans.injectable.InjectableMethod;
import org.jboss.webbeans.model.AbstractComponentModel;
/**
@@ -15,12 +15,15 @@
private Object specializedInstance;
+
+
public MockObserverImpl(AbstractComponentModel<?, ?> componentModel,
- ObserverMethod observer, Class<T> eventType) {
- super(componentModel, observer, eventType);
- }
+ InjectableMethod<?> observer, Class<T> eventType)
+ {
+ super(componentModel, observer, eventType);
+ }
- @Override
+ @Override
protected final Object getInstance(Manager manager) {
return specializedInstance;
}