[webbeans-commits] Webbeans SVN: r2197 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event.
by webbeans-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2009-03-24 19:39:31 -0400 (Tue, 24 Mar 2009)
New Revision: 2197
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IndirectStockWatcher.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IntermediateStockWatcher.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockPrice.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockWatcher.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
Log:
test for 4.2.di
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java 2009-03-24 23:33:28 UTC (rev 2196)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java 2009-03-24 23:39:31 UTC (rev 2197)
@@ -844,5 +844,28 @@
}.run();
}
+
+ @Test(groups = { "events", "inheritance" })
+ @SpecAssertion(section = "4.2", id = "di")
+ public void testNonStaticObserverMethodNotIndirectlyInherited() throws Exception
+ {
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Set<Observer<StockPrice>> observers = getCurrentManager().resolveObservers(new StockPrice());
+ assert observers.size() == 1;
+
+ // Notify the observer so we can confirm that it
+ // is a method only on StockWatcher, and not IntermediateStockWatcher
+ // or IndirectStockWatcher
+ observers.iterator().next().notify(new StockPrice());
+ assert StockWatcher.getObserverClazz().equals(StockWatcher.class);
+ }
+
+ }.run();
+ }
+
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IndirectStockWatcher.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IndirectStockWatcher.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IndirectStockWatcher.java 2009-03-24 23:39:31 UTC (rev 2197)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event;
+
+class IndirectStockWatcher extends IntermediateStockWatcher
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IntermediateStockWatcher.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IntermediateStockWatcher.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/IntermediateStockWatcher.java 2009-03-24 23:39:31 UTC (rev 2197)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event;
+
+class IntermediateStockWatcher extends StockWatcher
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockPrice.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockPrice.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockPrice.java 2009-03-24 23:39:31 UTC (rev 2197)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.event;
+
+class StockPrice
+{
+
+}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockWatcher.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockWatcher.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/StockWatcher.java 2009-03-24 23:39:31 UTC (rev 2197)
@@ -0,0 +1,18 @@
+package org.jboss.jsr299.tck.tests.event;
+
+import javax.event.Observes;
+
+class StockWatcher
+{
+ private static Class<?> observerClazz;
+
+ public void observeStockPrice(@Observes StockPrice price)
+ {
+ observerClazz = this.getClass();
+ }
+
+ public static Class<?> getObserverClazz()
+ {
+ return observerClazz;
+ }
+}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2196 - in ri/trunk/impl/src/main/java/org/jboss/webbeans: bean and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-24 19:33:28 -0400 (Tue, 24 Mar 2009)
New Revision: 2196
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
Log:
WBRI-206
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-03-24 21:17:57 UTC (rev 2195)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanValidator.java 2009-03-24 23:33:28 UTC (rev 2196)
@@ -25,6 +25,7 @@
import java.util.List;
import java.util.Set;
+import javax.context.Dependent;
import javax.event.Event;
import javax.event.Fires;
import javax.inject.AmbiguousDependencyException;
@@ -107,7 +108,7 @@
{
throw new NullableDependencyException("The injection point " + injectionPoint + " has nullable dependencies");
}
- if (Beans.isPassivatingBean(bean) && !resolvedBean.isSerializable())
+ if (Beans.isPassivatingBean(bean) && !resolvedBean.isSerializable() && resolvedBean.getScopeType().equals(Dependent.class))
{
throw new UnserializableDependencyException("The bean " + bean + " declares a passivating scopes but has non-serializable dependencies");
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-03-24 21:17:57 UTC (rev 2195)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-03-24 23:33:28 UTC (rev 2196)
@@ -17,7 +17,6 @@
package org.jboss.webbeans.bean;
-import java.io.Serializable;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import java.util.Arrays;
@@ -260,16 +259,14 @@
this.primitive = Reflections.isPrimitive(getType());
}
- protected boolean checkInjectionPointsAreSerializable()
+ private boolean checkInjectionPointsAreSerializable()
{
- // TODO CACHE THIS and rebuild on addBean
- // TODO: a bit crude, don't check *all* injectionpoints, only those listed
- // in the spec for passivation checks
+ boolean passivating = MetaDataCache.instance().getScopeModel(this.getScopeType()).isPassivating();
for (AnnotatedInjectionPoint<?, ?> injectionPoint : getInjectionPoints())
{
Annotation[] bindings = injectionPoint.getMetaAnnotationsAsArray(BindingType.class);
Bean<?> resolvedBean = manager.resolveByType(injectionPoint.getRawType(), bindings).iterator().next();
- if (MetaDataCache.instance().getScopeModel(this.getScopeType()).isPassivating())
+ if (passivating)
{
if (Dependent.class.equals(resolvedBean.getScopeType()) && !resolvedBean.isSerializable() && (((injectionPoint instanceof AnnotatedField) && !((AnnotatedField<?>) injectionPoint).isTransient()) || (injectionPoint instanceof AnnotatedParameter)) )
{
@@ -501,12 +498,12 @@
@Override
public boolean isSerializable()
{
- return _serializable;
+ return _serializable && checkInjectionPointsAreSerializable();
}
protected void initSerializable()
{
- _serializable = isPrimitive() || getTypes().contains(Serializable.class);
+ _serializable = Reflections.isSerializable(type);
}
/**
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-03-24 21:17:57 UTC (rev 2195)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-03-24 23:33:28 UTC (rev 2196)
@@ -337,9 +337,9 @@
}
@Override
- public boolean isSerializable()
+ protected void initSerializable()
{
- return checkInjectionPointsAreSerializable();
+ super._serializable = true;
}
public InternalEjbDescriptor<T> getEjbDescriptor()
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-24 21:17:57 UTC (rev 2195)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-24 23:33:28 UTC (rev 2196)
@@ -34,7 +34,6 @@
import org.jboss.webbeans.injection.ParameterInjectionPoint;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
-import org.jboss.webbeans.metadata.MetaDataCache;
import org.jboss.webbeans.util.Names;
/**
@@ -228,19 +227,8 @@
buffer.append("API types " + getTypes() + ", binding types " + getBindings());
return buffer.toString();
}
-
+
@Override
- public boolean isSerializable()
- {
- boolean passivatingScoped = MetaDataCache.instance().getScopeModel(scopeType).isPassivating();
- if (passivatingScoped)
- {
- return checkInjectionPointsAreSerializable();
- }
- return true;
- }
-
- @Override
public AbstractBean<?, ?> getSpecializedBean()
{
return specializedBean;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java 2009-03-24 21:17:57 UTC (rev 2195)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java 2009-03-24 23:33:28 UTC (rev 2196)
@@ -78,5 +78,4 @@
return id;
}
-
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-03-24 21:17:57 UTC (rev 2195)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-03-24 23:33:28 UTC (rev 2196)
@@ -330,7 +330,7 @@
throw new DefinitionException("Simple bean " + type + " cannot be a parameterized type");
}
boolean passivating = MetaDataCache.instance().getScopeModel(scopeType).isPassivating();
- if (passivating && !Reflections.isSerializable(type))
+ if (passivating && !_serializable)
{
throw new DefinitionException("Simple bean declaring a passivating scope must have a serializable implementation class " + toString());
}
@@ -509,25 +509,7 @@
return buffer.toString();
}
- /**
- * Indicates if the bean is serializable
- *
- * @return true If serializable, false otherwise
- */
@Override
- public boolean isSerializable()
- {
- if (isDependent())
- {
- return Reflections.isSerializable(getType());
- }
- else
- {
- return checkInjectionPointsAreSerializable();
- }
- }
-
- @Override
public SimpleBean<?> getSpecializedBean()
{
return specializedBean;
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-03-24 21:17:57 UTC (rev 2195)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-03-24 23:33:28 UTC (rev 2196)
@@ -556,26 +556,6 @@
}
/**
- * Gets the type hierarchy for a class
- *
- * A recursive function that adds the class to the set of type and then calls
- * itself with the suprerclass as paramater until the top of the hierarchy is
- * reached. For each steps, adds all interfaces of the class to the set.
- * Since the data structure is a set, duplications are eliminated
- *
- *
- * @deprecated see {@link HierarchyDiscovery}
- * @param clazz The class to examine
- * @return The set of classes and interfaces in the hierarchy
- * @see #getTypeHierachy(Class, Set)
- */
- @Deprecated
- public static Set<Class<?>> getTypeHierachy(Class<?> clazz)
- {
- return new HierarchyDiscovery<Class<?>>(clazz).getFlattenedTypes();
- }
-
- /**
* Checks the bindingType to make sure the annotation was declared properly
* as a binding type (annotated with @BindingType).
*
@@ -596,7 +576,7 @@
public static boolean isSerializable(Class<?> clazz)
{
- return getTypeHierachy(clazz).contains(Serializable.class) || clazz.isPrimitive();
+ return clazz.isPrimitive() || Serializable.class.isAssignableFrom(clazz);
}
}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2195 - ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-24 17:17:57 -0400 (Tue, 24 Mar 2009)
New Revision: 2195
Added:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/IntegerCollectionInjection.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/NoParameterizedCollectionInjection.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedCollectionInjection.java
Modified:
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducer.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java
Log:
WBRI-194
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/IntegerCollectionInjection.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/IntegerCollectionInjection.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/IntegerCollectionInjection.java 2009-03-24 21:17:57 UTC (rev 2195)
@@ -0,0 +1,45 @@
+package org.jboss.webbeans.test.unit.implementation.producer.field;
+
+import java.util.Collection;
+
+import javax.inject.Current;
+import javax.inject.Initializer;
+
+public class IntegerCollectionInjection
+{
+
+ private Collection<Integer> value;
+
+ @Current
+ private Collection<Integer> fieldInjection;
+
+ private Collection<Integer> setterInjection;
+
+ @Initializer
+ public void init(Collection<Integer> setterInjection)
+ {
+ this.setterInjection = setterInjection;
+ }
+
+ @Initializer
+ public IntegerCollectionInjection(Collection<Integer> com)
+ {
+ this.value = com;
+ }
+
+ public Collection<Integer> getValue()
+ {
+ return value;
+ }
+
+ public Collection<Integer> getFieldInjection()
+ {
+ return fieldInjection;
+ }
+
+ public Collection<Integer> getSetterInjection()
+ {
+ return setterInjection;
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/IntegerCollectionInjection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/NoParameterizedCollectionInjection.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/NoParameterizedCollectionInjection.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/NoParameterizedCollectionInjection.java 2009-03-24 21:17:57 UTC (rev 2195)
@@ -0,0 +1,45 @@
+package org.jboss.webbeans.test.unit.implementation.producer.field;
+
+import java.util.Collection;
+
+import javax.inject.Current;
+import javax.inject.Initializer;
+
+public class NoParameterizedCollectionInjection
+{
+
+ private Collection value;
+
+ @Current
+ private Collection fieldInjection;
+
+ private Collection setterInjection;
+
+ @Initializer
+ public void init(Collection setterInjection)
+ {
+ this.setterInjection = setterInjection;
+ }
+
+ @Initializer
+ public NoParameterizedCollectionInjection(Collection com)
+ {
+ this.value = com;
+ }
+
+ public Collection getValue()
+ {
+ return value;
+ }
+
+ public Collection getFieldInjection()
+ {
+ return fieldInjection;
+ }
+
+ public Collection getSetterInjection()
+ {
+ return setterInjection;
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/NoParameterizedCollectionInjection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedCollectionInjection.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedCollectionInjection.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedCollectionInjection.java 2009-03-24 21:17:57 UTC (rev 2195)
@@ -0,0 +1,45 @@
+package org.jboss.webbeans.test.unit.implementation.producer.field;
+
+import java.util.Collection;
+
+import javax.inject.Current;
+import javax.inject.Initializer;
+
+public class ParameterizedCollectionInjection
+{
+
+ private Collection<String> value;
+
+ @Current
+ private Collection<String> fieldInjection;
+
+ private Collection<String> setterInjection;
+
+ @Initializer
+ public void init(Collection<String> setterInjection)
+ {
+ this.setterInjection = setterInjection;
+ }
+
+ @Initializer
+ public ParameterizedCollectionInjection(Collection<String> com)
+ {
+ this.value = com;
+ }
+
+ public Collection<String> getValue()
+ {
+ return value;
+ }
+
+ public Collection<String> getFieldInjection()
+ {
+ return fieldInjection;
+ }
+
+ public Collection<String> getSetterInjection()
+ {
+ return setterInjection;
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedCollectionInjection.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducer.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducer.java 2009-03-24 21:17:22 UTC (rev 2194)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducer.java 2009-03-24 21:17:57 UTC (rev 2195)
@@ -1,5 +1,6 @@
package org.jboss.webbeans.test.unit.implementation.producer.field;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -9,9 +10,23 @@
{
@Produces
- public List<String> create()
+ public List<String> createStringList()
{
return Arrays.asList("aaa", "bbb");
}
+ @Produces
+ public List createList()
+ {
+ return Arrays.asList(1, 2, 3);
+ }
+
+ @Produces
+ public ArrayList<Integer> createIntegerList()
+ {
+ List<Integer> list = Arrays.asList(1, 2, 3, 4);
+ ArrayList<Integer> arrayList = new ArrayList<Integer>();
+ arrayList.addAll(list);
+ return arrayList;
+ }
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java 2009-03-24 21:17:22 UTC (rev 2194)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/field/ParameterizedProducerTest.java 2009-03-24 21:17:57 UTC (rev 2195)
@@ -1,5 +1,6 @@
package org.jboss.webbeans.test.unit.implementation.producer.field;
+import java.util.Collection;
import java.util.List;
import javax.inject.TypeLiteral;
@@ -13,9 +14,11 @@
{
@Test
- public void testInjectManagerProducer()
+ public void testParameterizedListInjection()
{
- assert manager.getInstanceByType(new TypeLiteral<List<String>>(){}).size() == 2;
+ assert manager.getInstanceByType(new TypeLiteral<List<String>>()
+ {
+ }).size() == 2;
ParameterizedListInjection item = manager.getInstanceByType(ParameterizedListInjection.class);
assert item.getFieldInjection().size() == 2;
@@ -23,4 +26,42 @@
assert item.getSetterInjection().size() == 2;
}
+
+ @Test
+ public void testParameterizedCollectionInjection()
+ {
+ assert manager.getInstanceByType(new TypeLiteral<Collection<String>>()
+ {
+ }).size() == 2;
+
+ ParameterizedCollectionInjection item = manager.getInstanceByType(ParameterizedCollectionInjection.class);
+ assert item.getFieldInjection().size() == 2;
+ assert item.getValue().size() == 2;
+ assert item.getSetterInjection().size() == 2;
+
+ }
+
+ @Test
+ public void testNoParameterizedCollectionInjection()
+ {
+ assert manager.getInstanceByType(Collection.class).size() == 3;
+
+ NoParameterizedCollectionInjection item = manager.getInstanceByType(NoParameterizedCollectionInjection.class);
+ assert item.getFieldInjection().size() == 3;
+ assert item.getValue().size() == 3;
+ assert item.getSetterInjection().size() == 3;
+
+ }
+
+ @Test
+ public void testIntegerCollectionInjection()
+ {
+ assert manager.getInstanceByType(new TypeLiteral<Collection<Integer>>(){}).size() == 4;
+
+ IntegerCollectionInjection item = manager.getInstanceByType(IntegerCollectionInjection.class);
+ assert item.getFieldInjection().size() == 4;
+ assert item.getValue().size() == 4;
+ assert item.getSetterInjection().size() == 4;
+
+ }
}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2194 - in ri/trunk/impl/src/main/java/org/jboss/webbeans: util and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-24 17:17:22 -0400 (Tue, 24 Mar 2009)
New Revision: 2194
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection/
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection/ParameterizedTypeImpl.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
Log:
WBRI-194
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-03-24 19:02:07 UTC (rev 2193)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/EventManager.java 2009-03-24 21:17:22 UTC (rev 2194)
@@ -18,6 +18,7 @@
package org.jboss.webbeans.event;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -30,8 +31,8 @@
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
+import org.jboss.webbeans.util.Reflections.HierarchyDiscovery;
import org.jboss.webbeans.util.collections.ForwardingMap;
/**
@@ -47,18 +48,18 @@
/**
* An event type -> observer list map
*/
- private class RegisteredObserversMap extends ForwardingMap<Class<?>, List<EventObserver<?>>>
+ private class RegisteredObserversMap extends ForwardingMap<Type, List<EventObserver<?>>>
{
// The map delegate
- private ConcurrentHashMap<Class<?>, List<EventObserver<?>>> delegate;
+ private ConcurrentHashMap<Type, List<EventObserver<?>>> delegate;
/**
* Constructor. Initializes the delegate
*/
public RegisteredObserversMap()
{
- delegate = new ConcurrentHashMap<Class<?>, List<EventObserver<?>>>();
+ delegate = new ConcurrentHashMap<Type, List<EventObserver<?>>>();
}
/**
@@ -67,7 +68,7 @@
* @return The delegate
*/
@Override
- protected Map<Class<?>, List<EventObserver<?>>> delegate()
+ protected Map<Type, List<EventObserver<?>>> delegate()
{
return delegate;
}
@@ -160,9 +161,10 @@
public <T> Set<Observer<T>> getObservers(T event, Annotation... bindings)
{
Set<Observer<T>> interestedObservers = new HashSet<Observer<T>>();
- for (Class<?> clazz : Reflections.getTypeHierachy(event.getClass()))
+ Set<Type> types = new HierarchyDiscovery<Type>(event.getClass()).getFlattenedTypes();
+ for (Type type : types)
{
- for (EventObserver<?> observer : registeredObservers.get(clazz))
+ for (EventObserver<?> observer : registeredObservers.get(type))
{
log.debug("Checking observer " + observer + " to see if it is interested in event [" + event + "]");
if (observer.isObserverInterested(bindings))
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-03-24 19:02:07 UTC (rev 2193)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-03-24 21:17:22 UTC (rev 2194)
@@ -28,6 +28,7 @@
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.lang.reflect.TypeVariable;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@@ -35,7 +36,9 @@
import javax.inject.BindingType;
import javax.inject.ExecutionException;
+import org.jboss.webbeans.util.reflection.ParameterizedTypeImpl;
+
/**
* Utility class for static reflection-type operations
*
@@ -96,13 +99,100 @@
@SuppressWarnings("unchecked")
private void discoverFromClass(Class<?> clazz)
{
- discoverTypes((T) clazz.getSuperclass());
- for (Class<?> c : clazz.getInterfaces())
+ discoverTypes((T) resolveType(type, clazz.getGenericSuperclass()));
+ for (Type c : clazz.getGenericInterfaces())
{
- discoverTypes((T) c);
+ discoverTypes((T) resolveType(type, c));
}
}
+ /**
+ * Gets the actual types by resolving TypeParameters.
+ *
+ * @param beanType
+ * @param type
+ * @return actual type
+ */
+ private Type resolveType(Type beanType, Type type)
+ {
+ if (type instanceof ParameterizedType)
+ {
+ if (beanType instanceof ParameterizedType)
+ {
+ return resolveParameterizedType((ParameterizedType) beanType, (ParameterizedType) type);
+ }
+ if (beanType instanceof Class)
+ {
+ return resolveType(((Class<?>) beanType).getGenericSuperclass(), (ParameterizedType) type);
+ }
+ }
+
+ if (type instanceof TypeVariable)
+ {
+ if (beanType instanceof ParameterizedType)
+ {
+ return resolveTypeParameter((ParameterizedType) beanType, (TypeVariable<?>) type);
+ }
+ if (beanType instanceof Class)
+ {
+ return resolveType(((Class<?>) beanType).getGenericSuperclass(), (TypeVariable<?>) type);
+ }
+ }
+ return type;
+ }
+
+ private Type resolveParameterizedType(ParameterizedType beanType, ParameterizedType parameterizedType)
+ {
+ Type rawType = parameterizedType.getRawType();
+ Type[] actualTypes = parameterizedType.getActualTypeArguments();
+
+ Type resolvedRawType = resolveType(beanType, rawType);
+ Type[] resolvedActualTypes = new Type[actualTypes.length];
+
+ for (int i = 0; i < actualTypes.length; i++)
+ {
+ resolvedActualTypes[i] = resolveType(beanType, actualTypes[i]);
+ }
+ // reconstruct ParameterizedType by types resolved TypeVariable.
+ return new ParameterizedTypeImpl(resolvedRawType, resolvedActualTypes, parameterizedType.getOwnerType());
+ }
+
+ private Type resolveTypeParameter(ParameterizedType beanType, TypeVariable<?> typeVariable)
+ {
+ // step1. raw type
+ Class<?> actualType = (Class<?>) beanType.getRawType();
+ TypeVariable<?>[] typeVariables = actualType.getTypeParameters();
+ Type[] actualTypes = beanType.getActualTypeArguments();
+ for (int i = 0; i < typeVariables.length; i++)
+ {
+ if (typeVariables[i].equals(typeVariable))
+ {
+ return resolveType(type, actualTypes[i]);
+ }
+ }
+
+ // step2. generic super class
+ Type genericSuperType = actualType.getGenericSuperclass();
+ Type type = resolveType(genericSuperType, typeVariable);
+ if (!(type instanceof TypeVariable<?>))
+ {
+ return type;
+ }
+
+ // step3. generic interfaces
+ for (Type interfaceType : actualType.getGenericInterfaces())
+ {
+ Type resolvedType = resolveType(interfaceType, typeVariable);
+ if (!(resolvedType instanceof TypeVariable<?>))
+ {
+ return resolvedType;
+ }
+ }
+
+ // don't resolve type variable
+ return typeVariable;
+ }
+
}
/**
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection/ParameterizedTypeImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection/ParameterizedTypeImpl.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection/ParameterizedTypeImpl.java 2009-03-24 21:17:22 UTC (rev 2194)
@@ -0,0 +1,93 @@
+package org.jboss.webbeans.util.reflection;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+
+public class ParameterizedTypeImpl implements ParameterizedType
+{
+ private final Type[] actualTypeArguments;
+ private final Type rawType;
+ private final Type ownerType;
+
+ public ParameterizedTypeImpl(Type rawType, Type[] actualTypeArguments, Type ownerType)
+ {
+ this.actualTypeArguments = actualTypeArguments;
+ this.rawType = rawType;
+ this.ownerType = ownerType;
+ }
+
+ public Type[] getActualTypeArguments()
+ {
+ return actualTypeArguments;
+ }
+
+ public Type getOwnerType()
+ {
+ return ownerType;
+ }
+
+ public Type getRawType()
+ {
+ return rawType;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + Arrays.hashCode(actualTypeArguments);
+ result = prime * result + ((ownerType == null) ? 0 : ownerType.hashCode());
+ result = prime * result + ((rawType == null) ? 0 : rawType.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (!(obj instanceof ParameterizedType))
+ return false;
+
+ final ParameterizedType other = (ParameterizedType) obj;
+ if (!Arrays.equals(actualTypeArguments, other.getActualTypeArguments()))
+ return false;
+ if (ownerType == null)
+ {
+ if (other.getOwnerType() != null)
+ return false;
+ }
+ else if (!ownerType.equals(other.getOwnerType()))
+ return false;
+ if (rawType == null)
+ {
+ if (other.getRawType() != null)
+ return false;
+ }
+ else if (!rawType.equals(other.getRawType()))
+ return false;
+ return true;
+ }
+
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+ sb.append(rawType);
+ if (actualTypeArguments.length > 0)
+ {
+ sb.append("<");
+ for (Type actualType : actualTypeArguments)
+ {
+ sb.append(actualType);
+ sb.append(",");
+ }
+ sb.delete(sb.length() - 1, sb.length());
+ sb.append(">");
+ }
+ return sb.toString();
+ }
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/reflection/ParameterizedTypeImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2193 - ri/trunk/jboss-as.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-24 15:02:07 -0400 (Tue, 24 Mar 2009)
New Revision: 2193
Modified:
ri/trunk/jboss-as/build.properties
Log:
Fixed broken build.properties file
Modified: ri/trunk/jboss-as/build.properties
===================================================================
--- ri/trunk/jboss-as/build.properties 2009-03-24 18:15:12 UTC (rev 2192)
+++ ri/trunk/jboss-as/build.properties 2009-03-24 19:02:07 UTC (rev 2193)
@@ -1,7 +1,5 @@
# Container a number of properties associated with installing Web Beans into JBoss AS and running the TCK in JBoss AS
-jboss.home=C:\JBoss\jboss-5.0.0\
-
-# recommended minimum JAVA_OPTS for running JBoss with the TCK
+#jboss.home=/Applications/jboss-5.0.1.GA
java.opts=-Xms128m -Xmx384m -XX:MaxPermSize=128m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
# time to allow before attempting to restart JBoss AS
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2192 - ri/trunk/impl/src/main/java/org/jboss/webbeans/mock and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-24 14:15:12 -0400 (Tue, 24 Mar 2009)
New Revision: 2192
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/ManagerTest.java
Log:
Minor fixes for broken tests.
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-03-24 15:48:21 UTC (rev 2191)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-03-24 18:15:12 UTC (rev 2192)
@@ -101,10 +101,13 @@
this.manager = new ManagerImpl(ServiceRegistries.unmodifiableServiceRegistry(getServices()));
try
{
- getServices().get(NamingContext.class).lookup(ManagerImpl.JNDI_KEY, Manager.class);
+ getServices().get(NamingContext.class).unbind(ManagerImpl.JNDI_KEY);
}
catch (ExecutionException e)
{
+ }
+ finally
+ {
getServices().get(NamingContext.class).bind(ManagerImpl.JNDI_KEY, getManager());
}
CurrentManager.setRootManager(manager);
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java 2009-03-24 15:48:21 UTC (rev 2191)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/mock/MockNamingContext.java 2009-03-24 18:15:12 UTC (rev 2192)
@@ -32,6 +32,14 @@
}
}
+ public void unbind(String key)
+ {
+ if (context != null)
+ {
+ super.unbind(key);
+ }
+ }
+
public <T> T lookup(String name, Class<? extends T> expectedType)
{
if (context != null)
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/ManagerTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/ManagerTest.java 2009-03-24 15:48:21 UTC (rev 2191)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/ManagerTest.java 2009-03-24 18:15:12 UTC (rev 2192)
@@ -13,7 +13,7 @@
@IntegrationTest
public class ManagerTest extends AbstractJSR299Test
{
- @Test(groups = { "broken", "manager", "ejb3", "integration" })
+ @Test(groups = { "manager", "ejb3", "integration" })
@SpecAssertion(section = "5.7.2", id = "b")
public void testManagerLookupInJndi() throws Exception
{
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2191 - ri/trunk/impl/src/main/java/org/jboss/webbeans.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-24 11:48:21 -0400 (Tue, 24 Mar 2009)
New Revision: 2191
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
Log:
WBRI-162
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-03-24 15:47:53 UTC (rev 2190)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-03-24 15:48:21 UTC (rev 2191)
@@ -71,10 +71,8 @@
import org.jboss.webbeans.injection.NonContextualInjector;
import org.jboss.webbeans.injection.resolution.ResolvableAnnotatedClass;
import org.jboss.webbeans.injection.resolution.Resolver;
-import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.manager.api.WebBeansManager;
import org.jboss.webbeans.metadata.MetaDataCache;
import org.jboss.webbeans.util.Beans;
@@ -244,7 +242,7 @@
@SuppressWarnings("unchecked")
public <T> Set<Observer<T>> resolveObservers(T event, Annotation... bindings)
{
- AnnotatedClass<T> element = AnnotatedClassImpl.of((Class<T>) event.getClass());
+ Class<?> clazz = event.getClass();
for (Annotation annotation : bindings)
{
if (!MetaDataCache.instance().getBindingTypeModel(annotation.annotationType()).isValid())
@@ -257,15 +255,15 @@
{
throw new DuplicateBindingTypeException("Duplicate binding types: " + bindings);
}
- for (Type type : element.getActualTypeArguments())
+ for (Type type : Reflections.getActualTypeArguments(clazz))
{
if (type instanceof WildcardType)
{
- throw new IllegalArgumentException("Cannot resolve an event type parameterized with a wildcard " + element);
+ throw new IllegalArgumentException("Cannot resolve an event type parameterized with a wildcard " + clazz);
}
if (type instanceof TypeVariable)
{
- throw new IllegalArgumentException("Cannot resolve an event type parameterized with a type parameter " + element);
+ throw new IllegalArgumentException("Cannot resolve an event type parameterized with a type parameter " + clazz);
}
}
return eventManager.getObservers(event, bindings);
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2190 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-24 11:47:53 -0400 (Tue, 24 Mar 2009)
New Revision: 2190
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
Log:
test needs to check for exception
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java 2009-03-24 14:54:54 UTC (rev 2189)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/EventTest.java 2009-03-24 15:47:53 UTC (rev 2190)
@@ -743,7 +743,7 @@
assert false;
}
- @Test(groups = { "events" })
+ @Test(groups = { "events" }, expectedExceptions=IllegalArgumentException.class)
@SpecAssertion(section = "7.7", id = "b")
public void testEventObjectContainsTypeVariablesWhenResolvingFails()
{
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2189 - ri/trunk/impl/src/main/java/org/jboss/webbeans/xml.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-03-24 10:54:54 -0400 (Tue, 24 Mar 2009)
New Revision: 2189
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
Log:
some changes with deployment types
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-24 14:49:27 UTC (rev 2188)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-24 14:54:54 UTC (rev 2189)
@@ -2,6 +2,7 @@
import java.io.IOException;
import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
@@ -19,6 +20,10 @@
import org.dom4j.QName;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.MethodSignature;
+import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
+import org.jboss.webbeans.introspector.jlr.MethodSignatureImpl;
import org.jboss.webbeans.resources.spi.ResourceLoadingException;
public class ParseXmlHelper
@@ -83,13 +88,18 @@
}
catch (ResourceLoadingException e)
{
+ //work with this when 'classesList.size() == 0'
}
+ catch (ClassCastException e)
+ {
+ throw new DefinitionException("<Deploy> child <" + element.getName() + "> must be a Java annotation type");
+ }
}
}
}
if (classesList.size() == 0)
- throw new DefinitionException("Could not find '" + className + "'");
+ throw new DefinitionException("Could not find '" + className + "' for bean <");
if (classesList.size() == 1)
return classesList.get(0);
@@ -197,7 +207,7 @@
public static boolean isMethod(Element element, AnnotatedClass<?> beanClass, AnnotatedClass<?> expectedType)
{
- //TODO
+ //TODO
return false;
}
@@ -241,14 +251,4 @@
packagesMap.put(prefix, packagesSet);
}
}
-
- /*private static URL loadFile(String urn, String fileName)
- {
- char separator = '/';
- String packageName = urn.replaceFirst(XmlConstants.URN_PREFIX, "");
- String path = packageName.replace('.', separator);
- String filePath = separator + path + separator + fileName;
- URL namespaceFile = ParseXmlHelper.class.getResource(filePath);
- return namespaceFile;
- }*/
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java 2009-03-24 14:49:27 UTC (rev 2188)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlConstants.java 2009-03-24 14:54:54 UTC (rev 2189)
@@ -7,8 +7,12 @@
public static final String DEPLOY = "Deploy";
public static final String INTERCEPTORS = "Interceptors";
+
+ public static final String INTERCEPTOR = "Interceptor";
public static final String DECORATORS = "Decorators";
+
+ public static final String DECORATOR = "Decorator";
public static final String BINDING_TYPE = "BindingType";
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-03-24 14:49:27 UTC (rev 2188)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/XmlParser.java 2009-03-24 14:54:54 UTC (rev 2189)
@@ -14,6 +14,7 @@
import javax.inject.DefinitionException;
import javax.inject.DeploymentException;
+import javax.inject.DeploymentType;
import org.dom4j.Document;
import org.dom4j.DocumentException;
@@ -177,8 +178,8 @@
{
Class<? extends Annotation> deploymentClass = ParseXmlHelper.loadAnnotationClass(child, Annotation.class, environment, packagesMap);
-// if(deploymentClass.getAnnotation(DeploymentType.class) == null)
-// throw new DefinitionException("<Deploy> child <" + element.getName() + "> must be a deployment type");
+ if(!deploymentClass.isAnnotationPresent(DeploymentType.class))
+ throw new DefinitionException("<Deploy> child <" + child.getName() + "> must be a deployment type");
deploymentClasses.add(deploymentClass);
}
@@ -187,7 +188,7 @@
}
public void checkProduces(Element beanElement, AnnotatedClass<?> beanClass)
- {
+ {//TODO
Iterator<?> childIterator = beanElement.elementIterator();
while(childIterator.hasNext())
{
@@ -211,7 +212,7 @@
if(ParseXmlHelper.isMethod(producesElement, beanClass, beanClass))
{}
- throw new DefinitionException("A producer doesn't declared in class file as method or field");
+// throw new DefinitionException("A producer doesn't declared in class file as method or field");
}
}
15 years, 9 months
[webbeans-commits] Webbeans SVN: r2188 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/xml and 10 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-24 10:49:27 -0400 (Tue, 24 Mar 2009)
New Revision: 2188
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/Cow.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/NamespaceAggregationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/AnotherDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/copy/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/copy/AnotherDeploymentType.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/MultipleTypesInAggregatedNamespacesTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/namespace
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/namespace
Removed:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xmlmetadata/
Log:
Example tests for 9.2
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/Cow.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/Cow.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/Cow.java 2009-03-24 14:49:27 UTC (rev 2188)
@@ -0,0 +1,9 @@
+package org.jboss.jsr299.tck.tests.xml.namespace.aggregation;
+
+import org.jboss.jsr299.tck.tests.xml.namespace.aggregation.foo.AnotherDeploymentType;
+
+@AnotherDeploymentType
+public class Cow
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/Cow.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/NamespaceAggregationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/NamespaceAggregationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/NamespaceAggregationTest.java 2009-03-24 14:49:27 UTC (rev 2188)
@@ -0,0 +1,35 @@
+package org.jboss.jsr299.tck.tests.xml.namespace.aggregation;
+
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.tests.xml.namespace.aggregation.foo.AnotherDeploymentType;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+@Resources({
+ @Resource(source="namespace", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/namespace")
+})
+(a)Classes({AnotherDeploymentType.class})
+@BeansXml("beans.xml")
+public class NamespaceAggregationTest extends AbstractJSR299Test
+{
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="9.2", id="a"),
+ @SpecAssertion(section="9.2", id="b"),
+ @SpecAssertion(section="9.2", id="c")
+ })
+ public void testNamespaceAggregation()
+ {
+ assert getCurrentManager().resolveByType(Cow.class).size() == 1;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/NamespaceAggregationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/AnotherDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/AnotherDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/AnotherDeploymentType.java 2009-03-24 14:49:27 UTC (rev 2188)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.xml.namespace.aggregation.foo;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.DeploymentType;
+
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+public @interface AnotherDeploymentType
+{
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/AnotherDeploymentType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/copy/AnotherDeploymentType.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/copy/AnotherDeploymentType.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/copy/AnotherDeploymentType.java 2009-03-24 14:49:27 UTC (rev 2188)
@@ -0,0 +1,21 @@
+package org.jboss.jsr299.tck.tests.xml.namespace.aggregation.foo.copy;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.DeploymentType;
+
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+@DeploymentType
+public @interface AnotherDeploymentType
+{
+
+}
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/foo/copy/AnotherDeploymentType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/MultipleTypesInAggregatedNamespacesTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/MultipleTypesInAggregatedNamespacesTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/MultipleTypesInAggregatedNamespacesTest.java 2009-03-24 14:49:27 UTC (rev 2188)
@@ -0,0 +1,37 @@
+package org.jboss.jsr299.tck.tests.xml.namespace.aggregation.multipleTypes;
+
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.jsr299.tck.tests.xml.namespace.aggregation.foo.AnotherDeploymentType;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+@Resources({
+ @Resource(source="namespace", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/namespace")
+})
+(a)Classes({AnotherDeploymentType.class, org.jboss.jsr299.tck.tests.xml.namespace.aggregation.foo.copy.AnotherDeploymentType.class})
+@BeansXml("beans.xml")
+(a)ExpectedDeploymentException(DefinitionException.class)
+public class MultipleTypesInAggregatedNamespacesTest extends AbstractJSR299Test
+{
+
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="9.2", id="e")
+ })
+ public void testNamespaceAggregation()
+ {
+ assert false;
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/MultipleTypesInAggregatedNamespacesTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/beans.xml 2009-03-24 14:49:27 UTC (rev 2188)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.namespace.aggregation">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:AnotherDeploymentType />
+ </Deploy>
+</Beans>
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/beans.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/beans.xml 2009-03-24 14:49:27 UTC (rev 2188)
@@ -0,0 +1,8 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.namespace.aggregation.multipleTypes">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:AnotherDeploymentType />
+ </Deploy>
+</Beans>
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/beans.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/namespace
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/namespace (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/multipleTypes/namespace 2009-03-24 14:49:27 UTC (rev 2188)
@@ -0,0 +1,3 @@
+org.jboss.jsr299.tck.tests.xml.namespace.aggregation
+org.jboss.jsr299.tck.tests.xml.namespace.aggregation.foo
+org.jboss.jsr299.tck.tests.xml.namespace.aggregation.foo.copy
\ No newline at end of file
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/namespace
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/namespace (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/aggregation/namespace 2009-03-24 14:49:27 UTC (rev 2188)
@@ -0,0 +1,2 @@
+org.jboss.jsr299.tck.tests.xml.namespace.aggregation
+org.jboss.jsr299.tck.tests.xml.namespace.aggregation.foo
\ No newline at end of file
15 years, 9 months