[webbeans-commits] Webbeans SVN: r2157 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-23 15:55:17 -0400 (Mon, 23 Mar 2009)
New Revision: 2157
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java
Log:
too many commas
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java 2009-03-23 19:52:41 UTC (rev 2156)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java 2009-03-23 19:55:17 UTC (rev 2157)
@@ -19,7 +19,7 @@
@IntegrationTest(runLocally=true)
@Resources({
@Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
- @Resource(destination="SimplePage.html", source="SimplePage.html"),
+ @Resource(destination="SimplePage.html", source="SimplePage.html")
})
public class SessionContextTest extends AbstractJSR299Test
{
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2156 - in ri/trunk/impl/src/main/java/org/jboss/webbeans: bootstrap and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-23 15:52:41 -0400 (Mon, 23 Mar 2009)
New Revision: 2156
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
Log:
stubs for disposal method propagation
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-23 19:52:20 UTC (rev 2155)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-23 19:52:41 UTC (rev 2156)
@@ -128,7 +128,7 @@
/**
* Initializes the remove method
*/
- protected void initDisposalMethod()
+ protected void initDisposalMethod(BeanDeployerEnvironment environment)
{
Set<AnnotatedMethod<?>> disposalMethods = manager.resolveDisposalMethods(getType(), getBindings().toArray(new Annotation[0]));
if (disposalMethods.size() == 1)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-23 19:52:20 UTC (rev 2155)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-23 19:52:41 UTC (rev 2156)
@@ -135,6 +135,7 @@
createProducerMethods(bean, annotatedClass);
createProducerFields(bean, annotatedClass);
createObserverMethods(bean, annotatedClass);
+ createDisposalMethods(bean, annotatedClass);
if (annotatedClass.isAnnotationPresent(Realizes.class))
{
@@ -153,6 +154,11 @@
}
}
+ private void createDisposalMethods(AbstractClassBean<?> declaringBean, AnnotatedClass<?> annotatedClass)
+ {
+
+ }
+
private <T> void createProducerMethod(AbstractClassBean<?> declaringBean, AnnotatedMethod<T> annotatedMethod)
{
ProducerMethodBean<T> bean = ProducerMethodBean.of(annotatedMethod, declaringBean, manager);
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-03-23 19:52:20 UTC (rev 2155)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-03-23 19:52:41 UTC (rev 2156)
@@ -26,11 +26,13 @@
private final Map<AnnotatedMethod<?>, ProducerMethodBean<?>> methodBeanMap;
private final Set<RIBean<?>> beans;
private final Set<ObserverImpl<?>> observers;
-
+ private final Set<AnnotatedMethod<?>> disposalMethods;
+
public BeanDeployerEnvironment()
{
this.classBeanMap = new HashMap<AnnotatedClass<?>, AbstractClassBean<?>>();
this.methodBeanMap = new HashMap<AnnotatedMethod<?>, ProducerMethodBean<?>>();
+ this.disposalMethods = new HashSet<AnnotatedMethod<?>>();
this.beans = new HashSet<RIBean<?>>();
this.observers = new HashSet<ObserverImpl<?>>();
}
@@ -70,4 +72,9 @@
return observers;
}
+ public Set<AnnotatedMethod<?>> getDisposalMethods()
+ {
+ return disposalMethods;
+ }
+
}
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2155 - extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/resources.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-23 15:52:20 -0400 (Mon, 23 Mar 2009)
New Revision: 2155
Modified:
extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/resources/NoNamingContext.java
Log:
fix foir spi change
Modified: extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/resources/NoNamingContext.java
===================================================================
--- extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/resources/NoNamingContext.java 2009-03-23 19:33:08 UTC (rev 2154)
+++ extensions/trunk/se/src/main/java/org/jboss/webbeans/environment/se/resources/NoNamingContext.java 2009-03-23 19:52:20 UTC (rev 2155)
@@ -39,4 +39,9 @@
return null;
}
+ public void unbind(String key)
+ {
+ // No-op
+ }
+
}
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2154 - ri/trunk/impl/src/main/java/org/jboss/webbeans/util.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-23 15:33:08 -0400 (Mon, 23 Mar 2009)
New Revision: 2154
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java
Log:
WBRI-193
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java 2009-03-23 19:15:42 UTC (rev 2153)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java 2009-03-23 19:33:08 UTC (rev 2154)
@@ -1,217 +1,221 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jboss.webbeans.util;
-
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-
-import javassist.util.proxy.ProxyFactory;
-
-/**
- * Utilties for working with Javassist proxies
- *
- * @author Nicklas Karlsson
- * @author Pete Muir
- *
- */
-public class Proxies
-{
-
- public static class TypeInfo
- {
-
- private static final Class<?>[] EMPTY_INTERFACES_ARRAY = new Class<?>[0];
-
- private final Set<Class<?>> interfaces;
- private final Set<Class<?>> classes;
-
- private TypeInfo()
- {
- super();
- this.interfaces = new LinkedHashSet<Class<?>>();
- this.classes = new LinkedHashSet<Class<?>>();
- }
-
- public Class<?> getSuperClass()
- {
- if (classes.isEmpty())
- {
- throw new AssertionError("TypeInfo not properly initialized");
- }
- Iterator<Class<?>> it = classes.iterator();
- Class<?> superclass = it.next();
- while (it.hasNext())
- {
- Class<?> clazz = it.next();
- if (superclass.isAssignableFrom(clazz))
- {
- superclass = clazz;
- }
- }
- return superclass;
- }
-
- private Class<?>[] getInterfaces()
- {
- return interfaces.toArray(EMPTY_INTERFACES_ARRAY);
- }
-
- public ProxyFactory createProxyFactory()
- {
- ProxyFactory proxyFactory = new ProxyFactory();
- proxyFactory.setSuperclass(getSuperClass());
- proxyFactory.setInterfaces(getInterfaces());
- return proxyFactory;
- }
-
- private void add(Type type)
- {
- if (type instanceof Class)
- {
- Class<?> clazz = (Class<?>) type;
- if (clazz.isInterface())
- {
- interfaces.add(clazz);
- }
- else
- {
- classes.add(clazz);
- }
- }
- else if (type instanceof ParameterizedType)
- {
- add(((ParameterizedType)type).getRawType());
- }
- else
- {
- throw new IllegalArgumentException("Cannot proxy non-Class Type " + type);
- }
- }
-
- public static TypeInfo ofTypes(Set<? extends Type> types)
- {
- TypeInfo typeInfo = new TypeInfo();
- for (Type type : types)
- {
- typeInfo.add(type);
- }
- return typeInfo;
- }
-
- public static TypeInfo ofClasses(Set<Class<?>> classes)
- {
- TypeInfo typeInfo = new TypeInfo();
- for (Class<?> type : classes)
- {
- typeInfo.add(type);
- }
- return typeInfo;
- }
-
- }
-
- /**
- * Get the proxy factory for the given set of types
- *
- * @param types The types to create the proxy factory for
- * @param classes Additional interfaces the proxy should implement
- * @return the proxy factory
- */
- public static ProxyFactory getProxyFactory(Set<Type> types)
- {
- return TypeInfo.ofTypes(types).createProxyFactory();
- }
-
- /**
- * Indicates if a class is proxyable
- *
- * @param type The class to test
- * @return True if proxyable, false otherwise
- */
- public static boolean isTypeProxyable(Type type)
- {
- if (type instanceof Class)
- {
- return isClassProxyable((Class<?>) type);
- }
- else if (type instanceof ParameterizedType)
- {
- Type rawType = ((ParameterizedType) type).getRawType();
- if (rawType instanceof Class)
- {
- return isClassProxyable((Class<?>) rawType);
- }
- }
- return false;
- }
-
-
- /**
- * Indicates if a set of types are all proxyable
- *
- * @param types The types to test
- * @return True if proxyable, false otherwise
- */
- public static boolean isTypesProxyable(Iterable<? extends Type> types)
- {
- for (Type apiType : types)
- {
- if (Object.class.equals(apiType))
- {
- continue;
- }
- if (!isTypeProxyable(apiType))
- {
- return false;
- }
- }
- return true;
- }
-
- private static boolean isClassProxyable(Class<?> clazz)
- {
- if (clazz.isInterface())
- {
- return true;
- }
- else if (Reflections.getConstructor(clazz) == null)
- {
- return false;
- }
- else if (Reflections.isTypeOrAnyMethodFinal(clazz))
- {
- return false;
- }
- else if (Reflections.isPrimitive(clazz))
- {
- return false;
- }
- else if (Reflections.isArrayType(clazz))
- {
- return false;
- }
- else
- {
- return true;
- }
- }
-
-
-}
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.util;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javassist.util.proxy.ProxyFactory;
+
+/**
+ * Utilties for working with Javassist proxies
+ *
+ * @author Nicklas Karlsson
+ * @author Pete Muir
+ *
+ */
+public class Proxies
+{
+
+ public static class TypeInfo
+ {
+
+ private static final Class<?>[] EMPTY_INTERFACES_ARRAY = new Class<?>[0];
+
+ private final Set<Class<?>> interfaces;
+ private final Set<Class<?>> classes;
+
+ private TypeInfo()
+ {
+ super();
+ this.interfaces = new LinkedHashSet<Class<?>>();
+ this.classes = new LinkedHashSet<Class<?>>();
+ }
+
+ public Class<?> getSuperClass()
+ {
+ if (classes.isEmpty())
+ {
+ throw new AssertionError("TypeInfo not properly initialized");
+ }
+ Iterator<Class<?>> it = classes.iterator();
+ Class<?> superclass = it.next();
+ while (it.hasNext())
+ {
+ Class<?> clazz = it.next();
+ if (superclass.isAssignableFrom(clazz))
+ {
+ superclass = clazz;
+ }
+ }
+ return superclass;
+ }
+
+ private Class<?>[] getInterfaces()
+ {
+ return interfaces.toArray(EMPTY_INTERFACES_ARRAY);
+ }
+
+ public ProxyFactory createProxyFactory()
+ {
+ ProxyFactory proxyFactory = new ProxyFactory();
+ Class<?> superClass = getSuperClass();
+ if(superClass != Object.class)
+ {
+ proxyFactory.setSuperclass(superClass);
+ }
+ proxyFactory.setInterfaces(getInterfaces());
+ return proxyFactory;
+ }
+
+ private void add(Type type)
+ {
+ if (type instanceof Class)
+ {
+ Class<?> clazz = (Class<?>) type;
+ if (clazz.isInterface())
+ {
+ interfaces.add(clazz);
+ }
+ else
+ {
+ classes.add(clazz);
+ }
+ }
+ else if (type instanceof ParameterizedType)
+ {
+ add(((ParameterizedType)type).getRawType());
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot proxy non-Class Type " + type);
+ }
+ }
+
+ public static TypeInfo ofTypes(Set<? extends Type> types)
+ {
+ TypeInfo typeInfo = new TypeInfo();
+ for (Type type : types)
+ {
+ typeInfo.add(type);
+ }
+ return typeInfo;
+ }
+
+ public static TypeInfo ofClasses(Set<Class<?>> classes)
+ {
+ TypeInfo typeInfo = new TypeInfo();
+ for (Class<?> type : classes)
+ {
+ typeInfo.add(type);
+ }
+ return typeInfo;
+ }
+
+ }
+
+ /**
+ * Get the proxy factory for the given set of types
+ *
+ * @param types The types to create the proxy factory for
+ * @param classes Additional interfaces the proxy should implement
+ * @return the proxy factory
+ */
+ public static ProxyFactory getProxyFactory(Set<Type> types)
+ {
+ return TypeInfo.ofTypes(types).createProxyFactory();
+ }
+
+ /**
+ * Indicates if a class is proxyable
+ *
+ * @param type The class to test
+ * @return True if proxyable, false otherwise
+ */
+ public static boolean isTypeProxyable(Type type)
+ {
+ if (type instanceof Class)
+ {
+ return isClassProxyable((Class<?>) type);
+ }
+ else if (type instanceof ParameterizedType)
+ {
+ Type rawType = ((ParameterizedType) type).getRawType();
+ if (rawType instanceof Class)
+ {
+ return isClassProxyable((Class<?>) rawType);
+ }
+ }
+ return false;
+ }
+
+
+ /**
+ * Indicates if a set of types are all proxyable
+ *
+ * @param types The types to test
+ * @return True if proxyable, false otherwise
+ */
+ public static boolean isTypesProxyable(Iterable<? extends Type> types)
+ {
+ for (Type apiType : types)
+ {
+ if (Object.class.equals(apiType))
+ {
+ continue;
+ }
+ if (!isTypeProxyable(apiType))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static boolean isClassProxyable(Class<?> clazz)
+ {
+ if (clazz.isInterface())
+ {
+ return true;
+ }
+ else if (Reflections.getConstructor(clazz) == null)
+ {
+ return false;
+ }
+ else if (Reflections.isTypeOrAnyMethodFinal(clazz))
+ {
+ return false;
+ }
+ else if (Reflections.isPrimitive(clazz))
+ {
+ return false;
+ }
+ else if (Reflections.isArrayType(clazz))
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+
+
+}
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2153 - ri/trunk/version-matrix.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-03-23 15:15:42 -0400 (Mon, 23 Mar 2009)
New Revision: 2153
Modified:
ri/trunk/version-matrix/pom.xml
Log:
jaxen for xsd
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-03-23 19:15:06 UTC (rev 2152)
+++ ri/trunk/version-matrix/pom.xml 2009-03-23 19:15:42 UTC (rev 2153)
@@ -116,6 +116,12 @@
</dependency>
<dependency>
+ <groupId>jaxen</groupId>
+ <artifactId>jaxen</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2152 - extensions/trunk/xsd.
by webbeans-commits@lists.jboss.org
Author: nickarls
Date: 2009-03-23 15:15:06 -0400 (Mon, 23 Mar 2009)
New Revision: 2152
Modified:
extensions/trunk/xsd/pom.xml
Log:
logger dep
Modified: extensions/trunk/xsd/pom.xml
===================================================================
--- extensions/trunk/xsd/pom.xml 2009-03-23 18:42:31 UTC (rev 2151)
+++ extensions/trunk/xsd/pom.xml 2009-03-23 19:15:06 UTC (rev 2152)
@@ -13,6 +13,11 @@
<dependency>
<groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.webbeans</groupId>
<artifactId>jsr299-api</artifactId>
</dependency>
@@ -34,12 +39,12 @@
<artifactId>log4j</artifactId>
</dependency>
-<!--
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
+ <version>1.1.1</version>
</dependency>
--->
+
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2151 - in ri/trunk/spi/src: main/java/org/jboss/webbeans/resources/spi/helpers and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-23 14:42:31 -0400 (Mon, 23 Mar 2009)
New Revision: 2151
Modified:
ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/NamingContext.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractNamingContext.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockNamingContext.java
Log:
Added some servlet session context tests, JNDI manager test (broken), and RI/SPI changes to support JNDI binding of Manager.
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/NamingContext.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/NamingContext.java 2009-03-23 18:42:20 UTC (rev 2150)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/NamingContext.java 2009-03-23 18:42:31 UTC (rev 2151)
@@ -50,4 +50,10 @@
*/
public void bind(String name, Object value);
+ /**
+ * Unbinds an entry from JNDI.
+ *
+ * @param key The key of the object in JNDI to unbind
+ */
+ public void unbind(String key);
}
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractNamingContext.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractNamingContext.java 2009-03-23 18:42:20 UTC (rev 2150)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/resources/spi/helpers/AbstractNamingContext.java 2009-03-23 18:42:31 UTC (rev 2151)
@@ -49,9 +49,18 @@
{
List<String> parts = splitIntoContexts(key);
Context context = getContext();
+ Context nextContext = null;
for (int i = 0; i < parts.size() - 1; i++)
{
- context = (Context) context.lookup(parts.get(i));
+ try
+ {
+ nextContext = (Context) context.lookup(parts.get(i));
+ }
+ catch (NamingException e)
+ {
+ nextContext = context.createSubcontext(parts.get(i));
+ }
+ context = nextContext;
}
context.bind(parts.get(parts.size() - 1), value);
}
@@ -62,6 +71,23 @@
}
/**
+ * Unbinds an entry from JNDI.
+ *
+ * @param key The key of the object in JNDI to unbind
+ */
+ public void unbind(String key)
+ {
+ try
+ {
+ getContext().unbind(key);
+ }
+ catch (NamingException e)
+ {
+ throw new ExecutionException("Cannot unbind " + key, e);
+ }
+ }
+
+ /**
* Lookup an item from JNDI
*
* @param name The key
Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockNamingContext.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockNamingContext.java 2009-03-23 18:42:20 UTC (rev 2150)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockNamingContext.java 2009-03-23 18:42:31 UTC (rev 2151)
@@ -16,5 +16,11 @@
// TODO Auto-generated method stub
return null;
}
+
+ public void unbind(String key)
+ {
+ // TODO Auto-generated method stub
+
+ }
}
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2150 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap and 6 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-03-23 14:42:20 -0400 (Mon, 23 Mar 2009)
New Revision: 2150
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/FilterTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/SimplePage.html
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/web.xml
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/ManagerTest.java
tck/trunk/impl/src/main/resources/tck-audit.xml
Log:
Added some servlet session context tests, JNDI manager test (broken), and RI/SPI changes to support JNDI binding of Manager.
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-23 18:27:55 UTC (rev 2149)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/ManagerImpl.java 2009-03-23 18:42:20 UTC (rev 2150)
@@ -95,7 +95,7 @@
private static final long serialVersionUID = 3021562879133838561L;
// The JNDI key to place the manager under
- public static final String JNDI_KEY = "java:comp/Manager";
+ public static final String JNDI_KEY = "java:app/Manager";
// The enabled deployment types from web-beans.xml
private transient List<Class<? extends Annotation>> enabledDeploymentTypes;
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-23 18:27:55 UTC (rev 2149)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-03-23 18:42:20 UTC (rev 2150)
@@ -20,6 +20,9 @@
import java.lang.annotation.Annotation;
import java.util.List;
+import javax.inject.ExecutionException;
+import javax.inject.manager.Manager;
+
import org.jboss.webbeans.BeanValidator;
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.ManagerImpl;
@@ -48,7 +51,7 @@
import org.jboss.webbeans.jsf.JSFApiAbstraction;
import org.jboss.webbeans.literal.DeployedLiteral;
import org.jboss.webbeans.literal.InitializedLiteral;
-import org.jboss.webbeans.log.LogProvider;
+import org.jboss.webbeans.log.Log;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.resources.DefaultNamingContext;
import org.jboss.webbeans.resources.DefaultResourceLoader;
@@ -70,7 +73,7 @@
{
// The log provider
- private static LogProvider log = Logging.getLogProvider(WebBeansBootstrap.class);
+ private static Log log = Logging.getLog(WebBeansBootstrap.class);
// The Web Beans manager
private ManagerImpl manager;
@@ -94,7 +97,14 @@
}
addImplementationServices();
this.manager = new ManagerImpl(ServiceRegistries.unmodifiableServiceRegistry(getServices()));
- getServices().get(NamingContext.class).bind(ManagerImpl.JNDI_KEY, getManager());
+ try
+ {
+ getServices().get(NamingContext.class).lookup(ManagerImpl.JNDI_KEY, Manager.class);
+ }
+ catch (ExecutionException e)
+ {
+ getServices().get(NamingContext.class).bind(ManagerImpl.JNDI_KEY, getManager());
+ }
CurrentManager.setRootManager(manager);
initializeContexts();
}
@@ -230,6 +240,7 @@
{
endApplication(getApplicationContext());
manager.cleanup();
+ getServices().get(NamingContext.class).unbind(ManagerImpl.JNDI_KEY);
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2009-03-23 18:27:55 UTC (rev 2149)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/NormalContextTest.java 2009-03-23 18:42:20 UTC (rev 2150)
@@ -102,19 +102,4 @@
destroyContext(sessionContext);
assert bean.isDestroyCalled();
}
-
-
-
-
- /**
- * There may be no more than one mapped instance per contextual type per
- * thread
- */
- @Test(groups = { "contexts", "stub", "underInvestigation" })
- @SpecAssertion(section = "8.2", id = "a")
- public void testOnlyOneMappedInstancePerContextualTypePerThread()
- {
- assert false;
- }
-
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/FilterTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/FilterTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/FilterTest.java 2009-03-23 18:42:20 UTC (rev 2150)
@@ -0,0 +1,58 @@
+package org.jboss.jsr299.tck.tests.context.session;
+
+import java.io.IOException;
+
+import javax.context.SessionScoped;
+import javax.inject.Current;
+import javax.inject.manager.Manager;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+
+public class FilterTest implements Filter
+{
+
+ @Current
+ private Manager jsr299Manager;
+
+ public void destroy()
+ {
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
+ {
+ if (!jsr299Manager.getContext(SessionScoped.class).isActive())
+ {
+ throw new ServletException("Session is not active");
+ }
+ else
+ {
+ chain.doFilter(request, response);
+ }
+ }
+
+ public void init(FilterConfig filterConfig) throws ServletException
+ {
+ //TODO Remove init code once injection works in servlet container
+ try
+ {
+ InitialContext ic = new InitialContext();
+ jsr299Manager = (Manager) ic.lookup("java:app/Manager");
+ if (jsr299Manager == null)
+ {
+ throw new ServletException("Failed to find the Manager in JNDI");
+ }
+ }
+ catch (NamingException e)
+ {
+ throw new ServletException("Error looking up manager", e);
+ }
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/FilterTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java 2009-03-23 18:42:20 UTC (rev 2150)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.jsr299.tck.tests.context.session;
+
+import java.io.IOException;
+
+import javax.context.SessionScoped;
+import javax.inject.Current;
+import javax.inject.manager.Manager;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Servlet used just to test context during service method.
+ *
+ * @author David Allen
+ *
+ */
+public class ServiceMethodServlet extends HttpServlet
+{
+
+ private static final long serialVersionUID = 1L;
+
+ @Current
+ private Manager jsr299Manager;
+
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ if (!jsr299Manager.getContext(SessionScoped.class).isActive())
+ {
+ throw new ServletException("Session is not active");
+ }
+ else
+ {
+ super.service(req, resp);
+ }
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ resp.setContentType("text/text");
+ resp.getWriter().println("It worked!");
+ }
+
+ @Override
+ public void init() throws ServletException
+ {
+ //TODO Remove init code once injection works in servlet container
+ try
+ {
+ InitialContext ic = new InitialContext();
+ jsr299Manager = (Manager) ic.lookup("java:app/Manager");
+ if (jsr299Manager == null)
+ {
+ throw new ServletException("Failed to find the Manager in JNDI");
+ }
+ }
+ catch (NamingException e)
+ {
+ throw new ServletException("Error looking up manager", e);
+ }
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException
+ {
+ init();
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java 2009-03-23 18:27:55 UTC (rev 2149)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/SessionContextTest.java 2009-03-23 18:42:20 UTC (rev 2150)
@@ -4,27 +4,47 @@
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.war.WarArtifactDescriptor;
import org.testng.annotations.Test;
+import com.gargoylesoftware.htmlunit.WebClient;
+
/**
*
* Spec version: PRD2
*/
@Artifact
-@IntegrationTest
+@IntegrationTest(runLocally=true)
+@Resources({
+ @Resource(destination=WarArtifactDescriptor.WEB_XML_DESTINATION, source="web.xml"),
+ @Resource(destination="SimplePage.html", source="SimplePage.html"),
+})
public class SessionContextTest extends AbstractJSR299Test
{
- @Test(groups = { "stub", "contexts", "servlet", "integration" })
+ @Test(groups = { "contexts", "servlet", "integration" })
@SpecAssertion(section = "8.5.2", id = "a")
- public void testSessionScopeActiveDuringServiceMethod()
+ public void testSessionScopeActiveDuringServiceMethod() throws Exception
{
- assert false;
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ webClient.getPage(getContextPath() + "serviceMethodTest");
}
+ @Test(groups = { "contexts", "servlet", "integration" })
+ @SpecAssertion(section = "8.5.2", id = "b")
+ public void testSessionScopeActiveDuringDoFilterMethod() throws Exception
+ {
+ WebClient webClient = new WebClient();
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ webClient.getPage(getContextPath() + "SimplePage.html");
+ }
+
@Test(groups = { "stub", "contexts", "servlet", "integration" })
@SpecAssertion(section = "8.5.2", id = "c")
- public void testSessionContextSharedBetweenServletRequestsInSameHttpSession()
+ public void testSessionContextSharedBetweenServletRequestsInSameHttpSession() throws Exception
{
assert false;
}
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-23 18:27:55 UTC (rev 2149)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/jndi/ManagerTest.java 2009-03-23 18:42:20 UTC (rev 2150)
@@ -1,15 +1,24 @@
package org.jboss.jsr299.tck.tests.lookup.manager.jndi;
+import javax.inject.manager.Manager;
+import javax.naming.InitialContext;
+
import org.hibernate.tck.annotations.SpecAssertion;
import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
import org.testng.annotations.Test;
+@Artifact
+@IntegrationTest
public class ManagerTest extends AbstractJSR299Test
{
- @Test(groups = { "stub", "manager", "ejb3", "integration" })
+ @Test(groups = { "broken", "manager", "ejb3", "integration" })
@SpecAssertion(section = "5.7.2", id = "b")
- public void testManagerLookupInJndi()
+ public void testManagerLookupInJndi() throws Exception
{
- assert false;
+ InitialContext ctx = new InitialContext();
+ Manager manager = (Manager) ctx.lookup("java:app/Manager");
+ assert manager != null;
}
}
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/SimplePage.html
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/SimplePage.html (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/SimplePage.html 2009-03-23 18:42:20 UTC (rev 2150)
@@ -0,0 +1,11 @@
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
+<head>
+</head>
+
+<body>
+</body>
+
+</html>
Property changes on: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/SimplePage.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/web.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/web.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/context/session/web.xml 2009-03-23 18:42:20 UTC (rev 2150)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+ <description>Test servlets used to test session contexts.</description>
+ <display-name>Session Context Tests</display-name>
+ <filter>
+ <display-name>Test Filter for Sessions</display-name>
+ <filter-name>filterTest</filter-name>
+ <filter-class>org.jboss.jsr299.tck.tests.context.session.FilterTest</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>filterTest</filter-name>
+ <url-pattern>/SimplePage.html</url-pattern>
+ </filter-mapping>
+ <listener>
+ <listener-class>org.jboss.testharness.impl.runner.servlet.HarnessServletListener</listener-class>
+ </listener>
+ <servlet>
+ <display-name>serviceMethod</display-name>
+ <servlet-name>service</servlet-name>
+ <servlet-class>org.jboss.jsr299.tck.tests.context.session.ServiceMethodServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>service</servlet-name>
+ <url-pattern>/serviceMethodTest</url-pattern>
+ </servlet-mapping>
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ </login-config>
+</web-app>
Modified: tck/trunk/impl/src/main/resources/tck-audit.xml
===================================================================
--- tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-23 18:27:55 UTC (rev 2149)
+++ tck/trunk/impl/src/main/resources/tck-audit.xml 2009-03-23 18:42:20 UTC (rev 2150)
@@ -524,7 +524,7 @@
<assertion id="b" testable="false">
<text>A bean may declare zero stereotypes</text>
- <note>I can't see how to test this</note>
+ <note>Not testable through API</note>
</assertion>
<assertion id="c">
@@ -4530,8 +4530,9 @@
</section>
<section id="8.2" title="Normal scopes and pseudo-scopes">
- <assertion id="a">
+ <assertion id="a" testable="false">
<text>There may be no more than one mapped instance of a context object per contextual type per thread</text>
+ <note>Not testable through API</note>
</assertion>
<assertion id="b" testable="false">
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2149 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bean/standard and 4 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-23 14:27:55 -0400 (Mon, 23 Mar 2009)
New Revision: 2149
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.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/bean/standard/AbstractStandardBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BootstrapOrderingBeanComparator.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/ordering/DeployerOrderingTest.java
Log:
WBRI-116, WBRI-157
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-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -36,6 +36,7 @@
import javax.inject.manager.Bean;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.context.DependentInstancesStore;
import org.jboss.webbeans.conversation.ConversationImpl;
import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
@@ -132,13 +133,13 @@
/**
* Initializes the bean and its metadata
*/
- public void initialize()
+ public void initialize(BeanDeployerEnvironment environment)
{
mergedStereotypes = new MergedStereotypes<T, E>(getAnnotatedItem().getMetaAnnotations(Stereotype.class));
if (isSpecializing())
{
preSpecialize();
- specialize();
+ specialize(environment);
postSpecialize();
}
initDefaultBindings();
@@ -348,7 +349,7 @@
}
- protected void specialize()
+ protected void specialize(BeanDeployerEnvironment environment)
{
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-03-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -34,6 +34,7 @@
import javax.inject.Production;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.injection.FieldInjectionPoint;
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.injection.ParameterInjectionPoint;
@@ -82,9 +83,9 @@
* Initializes the bean and its metadata
*/
@Override
- public void initialize()
+ public void initialize(BeanDeployerEnvironment environment)
{
- super.initialize();
+ super.initialize(environment);
checkScopeAllowed();
checkBeanImplementation();
initInitializerMethods();
@@ -288,7 +289,7 @@
* @return The annotated item
*/
@Override
- protected AnnotatedClass<T> getAnnotatedItem()
+ public AnnotatedClass<T> getAnnotatedItem()
{
return annotatedItem;
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-03-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -37,6 +37,7 @@
import javax.inject.manager.InjectionPoint;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.context.CreationalContextImpl;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.DependentStorageRequest;
@@ -174,9 +175,9 @@
* Initializes the bean and its metadata
*/
@Override
- public void initialize()
+ public void initialize(BeanDeployerEnvironment environment)
{
- super.initialize();
+ super.initialize(environment);
checkProducerReturnType();
}
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-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -38,6 +38,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bean.proxy.EnterpriseBeanInstance;
import org.jboss.webbeans.bean.proxy.EnterpriseBeanProxyMethodHandler;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.DependentStorageRequest;
import org.jboss.webbeans.ejb.InternalEjbDescriptor;
@@ -115,9 +116,9 @@
* Initializes the bean and its metadata
*/
@Override
- public void initialize()
+ public void initialize(BeanDeployerEnvironment environment)
{
- super.initialize();
+ super.initialize(environment);
initProxyClass();
initInjectionPoints();
checkEJBTypeAllowed();
@@ -195,10 +196,20 @@
}
@Override
- protected void specialize()
+ protected void specialize(BeanDeployerEnvironment environment)
{
- this.specializedBean = EnterpriseBean.of(getAnnotatedItem().getSuperclass(), manager);
- this.specializedBean.initialize();
+ if (!environment.getClassBeanMap().containsKey(getAnnotatedItem().getSuperclass()))
+ {
+ throw new IllegalStateException(toString() + " does not specialize a bean");
+ }
+ else if (!(environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass()) instanceof EnterpriseBean))
+ {
+ throw new IllegalStateException(toString() + " doesn't have a session bean as a superclass " + environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass()));
+ }
+ else
+ {
+ this.specializedBean = (EnterpriseBean<?>) environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass());
+ }
}
/**
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-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -28,6 +28,7 @@
import javax.inject.Disposes;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.injection.ParameterInjectionPoint;
import org.jboss.webbeans.introspector.AnnotatedMethod;
@@ -75,16 +76,24 @@
protected T produceInstance(CreationalContext<T> creationalContext)
{
- return method.invoke(getReceiver(creationalContext), manager, creationalContext, CreationException.class);
+ Object receiver = getReceiver(creationalContext);
+ if (receiver != null)
+ {
+ return method.invokeOnInstance(receiver, manager, creationalContext, CreationException.class);
+ }
+ else
+ {
+ return method.invoke(receiver, manager, creationalContext, CreationException.class);
+ }
}
/**
* Initializes the bean and its metadata
*/
@Override
- public void initialize()
+ public void initialize(BeanDeployerEnvironment environment)
{
- super.initialize();
+ super.initialize(environment);
checkProducerMethod();
//initDisposalMethod();
initInjectionPoints();
@@ -139,7 +148,7 @@
* @return The annotated item
*/
@Override
- protected AnnotatedMethod<T> getAnnotatedItem()
+ public AnnotatedMethod<T> getAnnotatedItem()
{
return method;
}
@@ -215,12 +224,14 @@
}
@Override
- protected void specialize()
+ protected void specialize(BeanDeployerEnvironment environment)
{
- SimpleBean<?> superClassBean = SimpleBean.of(declaringBean.getAnnotatedItem().getSuperclass(), manager);
- superClassBean.initialize();
- this.specializedBean = ProducerMethodBean.of(declaringBean.getAnnotatedItem().getSuperclass().getMethod(getAnnotatedItem().getAnnotatedMethod()), superClassBean, manager);
- this.specializedBean.initialize();
+ AnnotatedMethod<?> superClassMethod = declaringBean.getAnnotatedItem().getSuperclass().getMethod(getAnnotatedItem().getAnnotatedMethod());
+ if (!environment.getMethodBeanMap().containsKey(superClassMethod))
+ {
+ throw new IllegalStateException(toString() + " does not specialize a bean");
+ }
+ this.specializedBean = environment.getMethodBeanMap().get(superClassMethod);
}
}
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-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/RIBean.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -23,6 +23,7 @@
import javax.inject.manager.Bean;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
/**
@@ -55,7 +56,7 @@
public abstract Class<T> getType();
- public abstract void initialize();
+ public abstract void initialize(BeanDeployerEnvironment environment);
public abstract boolean isSpecializing();
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-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -28,6 +28,7 @@
import javax.inject.Initializer;
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.context.DependentStorageRequest;
import org.jboss.webbeans.ejb.EJBApiAbstraction;
@@ -283,9 +284,9 @@
* Initializes the bean and its metadata
*/
@Override
- public void initialize()
+ public void initialize(BeanDeployerEnvironment environment)
{
- super.initialize();
+ super.initialize(environment);
initConstructor();
checkType();
initInjectionPoints();
@@ -359,10 +360,20 @@
}
@Override
- protected void specialize()
+ protected void specialize(BeanDeployerEnvironment environment)
{
- this.specializedBean = SimpleBean.of(getAnnotatedItem().getSuperclass(), manager);
- this.specializedBean.initialize();
+ if (!environment.getClassBeanMap().containsKey(getAnnotatedItem().getSuperclass()))
+ {
+ throw new IllegalStateException(toString() + " does not specialize a bean");
+ }
+ else if (!(environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass()) instanceof SimpleBean))
+ {
+ throw new IllegalStateException(toString() + " doesn't have a simple bean as a superclass " + environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass()));
+ }
+ else
+ {
+ this.specializedBean = (SimpleBean<?>) environment.getClassBeanMap().get(getAnnotatedItem().getSuperclass());
+ }
}
/**
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java 2009-03-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/standard/AbstractStandardBean.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -11,6 +11,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.bean.RIBean;
+import org.jboss.webbeans.bootstrap.BeanDeployerEnvironment;
import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
import org.jboss.webbeans.literal.CurrentLiteral;
@@ -23,7 +24,7 @@
}
@Override
- public void initialize()
+ public void initialize(BeanDeployerEnvironment environment)
{
// No-op
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployer.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -26,7 +26,6 @@
import org.jboss.webbeans.event.ObserverImpl;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.WrappedAnnotatedField;
import org.jboss.webbeans.introspector.WrappedAnnotatedMethod;
@@ -53,15 +52,9 @@
this.classes = new HashSet<AnnotatedClass<?>>();
}
- public <T> BeanDeployer addBean(AnnotatedItem<T, ?> item, RIBean<T> bean)
- {
- this.beanDeployerEnvironment.addBean(item, bean);
- return this;
- }
-
public <T> BeanDeployer addBean(RIBean<T> bean)
{
- this.beanDeployerEnvironment.addBean(null, bean);
+ this.beanDeployerEnvironment.addBean(bean);
return this;
}
@@ -105,7 +98,7 @@
beans.addAll(beanDeployerEnvironment.getBeans());
for (RIBean<?> bean : beans)
{
- bean.initialize();
+ bean.initialize(beanDeployerEnvironment);
log.info("Bean: " + bean);
}
manager.setBeans(beans);
@@ -135,7 +128,7 @@
protected <T> void createBean(AbstractClassBean<T> bean, final AnnotatedClass<T> annotatedClass)
{
- addBean(annotatedClass, bean);
+ addBean(bean);
manager.getResolver().addInjectionPoints(bean.getInjectionPoints());
@@ -163,7 +156,7 @@
private <T> void createProducerMethod(AbstractClassBean<?> declaringBean, AnnotatedMethod<T> annotatedMethod)
{
ProducerMethodBean<T> bean = ProducerMethodBean.of(annotatedMethod, declaringBean, manager);
- addBean(annotatedMethod, bean);
+ addBean(bean);
manager.getResolver().addInjectionPoints(bean.getInjectionPoints());
}
@@ -188,7 +181,7 @@
private <T> void createProducerField(AbstractClassBean<?> declaringBean, AnnotatedField<T> field)
{
ProducerFieldBean<T> bean = ProducerFieldBean.of(field, declaringBean, manager);
- addBean(field, bean);
+ addBean(bean);
}
private void createProducerFields(AbstractClassBean<?> declaringBean, AnnotatedClass<?> annotatedClass)
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-03-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -1,57 +1,68 @@
package org.jboss.webbeans.bootstrap;
import java.lang.annotation.Annotation;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.Map.Entry;
+import org.jboss.webbeans.bean.AbstractClassBean;
+import org.jboss.webbeans.bean.NewBean;
+import org.jboss.webbeans.bean.ProducerMethodBean;
import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.event.ObserverImpl;
import org.jboss.webbeans.injection.resolution.ResolvableAnnotatedClass;
+import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
public class BeanDeployerEnvironment
{
private static final AnnotatedItem<?, ?> OTHER_BEANS_ANNOTATED_ITEM = ResolvableAnnotatedClass.of(BeanDeployerEnvironment.class, new Annotation[0]);
- private final Map<AnnotatedItem<?, ?>, Set<RIBean<?>>> beanMap;
+ private final Map<AnnotatedClass<?>, AbstractClassBean<?>> classBeanMap;
+ private final Map<AnnotatedMethod<?>, ProducerMethodBean<?>> methodBeanMap;
+ private final Set<RIBean<?>> beans;
private final Set<ObserverImpl<?>> observers;
public BeanDeployerEnvironment()
{
- this.beanMap = new HashMap<AnnotatedItem<?,?>, Set<RIBean<?>>>();
+ this.classBeanMap = new HashMap<AnnotatedClass<?>, AbstractClassBean<?>>();
+ this.methodBeanMap = new HashMap<AnnotatedMethod<?>, ProducerMethodBean<?>>();
+ this.beans = new HashSet<RIBean<?>>();
this.observers = new HashSet<ObserverImpl<?>>();
}
- public Map<AnnotatedItem<?, ?>, Set<RIBean<?>>> getBeanMap()
+ public Map<AnnotatedClass<?>, AbstractClassBean<?>> getClassBeanMap()
{
- return beanMap;
+ return Collections.unmodifiableMap(classBeanMap);
}
- public void addBean(AnnotatedItem<?, ?> key, RIBean<?> value)
+ public Map<AnnotatedMethod<?>, ProducerMethodBean<?>> getMethodBeanMap()
{
- if (key == null)
+ return Collections.unmodifiableMap(methodBeanMap);
+ }
+
+ public void addBean(RIBean<?> value)
+ {
+ if (value instanceof AbstractClassBean && !(value instanceof NewBean))
{
- key = OTHER_BEANS_ANNOTATED_ITEM;
+ AbstractClassBean<?> bean = (AbstractClassBean<?>) value;
+ classBeanMap.put(bean.getAnnotatedItem(), bean);
}
- if (!beanMap.containsKey(key))
+ else if (value instanceof ProducerMethodBean)
{
- beanMap.put(key, new HashSet<RIBean<?>>());
+ ProducerMethodBean<?> bean = (ProducerMethodBean<?>) value;
+ methodBeanMap.put(bean.getAnnotatedItem(), bean);
}
- beanMap.get(key).add(value);
+ beans.add(value);
}
public Set<RIBean<?>> getBeans()
{
- Set<RIBean<?>> beans = new HashSet<RIBean<?>>();
- for (Entry<AnnotatedItem<?, ?>, Set<RIBean<?>>> entry : beanMap.entrySet())
- {
- beans.addAll(entry.getValue());
- }
- return beans;
+ return Collections.unmodifiableSet(beans);
}
public Set<ObserverImpl<?>> getObservers()
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BootstrapOrderingBeanComparator.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BootstrapOrderingBeanComparator.java 2009-03-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BootstrapOrderingBeanComparator.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -36,6 +36,14 @@
// Place o1 before it's subclass o2
return -1;
}
+ else if (!(o1 instanceof NewBean) && o2 instanceof NewBean)
+ {
+ return -1;
+ }
+ else if (o1 instanceof NewBean && !(o2 instanceof NewBean))
+ {
+ return 1;
+ }
}
if (o1 instanceof AbstractProducerBean && o2 instanceof AbstractProducerBean)
@@ -65,23 +73,16 @@
return o1.getId().compareTo(o2.getId());
}
- if (o1.getType().getName().startsWith("org.jboss.webbeans") && !o2.getType().getName().startsWith("org.jboss.webbeans"))
- {
- return -1;
- }
- else if (!o1.getType().getName().startsWith("org.jboss.webbeans") && o2.getType().getName().startsWith("org.jboss.webbeans"))
- {
- return 1;
- }
+// if (o1.getType().getName().startsWith("org.jboss.webbeans") && !o2.getType().getName().startsWith("org.jboss.webbeans"))
+// {
+// return -1;
+// }
+// else if (!o1.getType().getName().startsWith("org.jboss.webbeans") && o2.getType().getName().startsWith("org.jboss.webbeans"))
+// {
+// return 1;
+// }
- if (!(o1 instanceof NewBean) && o2 instanceof NewBean)
- {
- return -1;
- }
- else if (o1 instanceof NewBean && !(o2 instanceof NewBean))
- {
- return 1;
- }
+
return o1.getId().compareTo(o2.getId());
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-03-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -179,8 +179,7 @@
public T invokeOnInstance(Object instance, Object...parameters) throws IllegalArgumentException, SecurityException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
{
- Method method = instance.getClass().getMethod(getName(), getParameterTypesAsArray());
- method.setAccessible(true);
+ Method method = Reflections.lookupMethod(getName(), getParameterTypesAsArray(), instance);
@SuppressWarnings("unchecked")
T result = (T) method.invoke(instance, parameters);
return result;
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-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Reflections.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -28,6 +28,7 @@
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
@@ -391,15 +392,52 @@
*
* @param method The method to look for
* @param instance The instance to start from
- * @return The method found, or an NoSuchMethodException if it is not found
+ * @return The method found
+ * @throws IllegalArgumentException if the method is not found
*/
public static Method lookupMethod(Method method, Object instance)
{
- for (Class<? extends Object> clazz = instance.getClass(); clazz != null; clazz = clazz.getSuperclass())
+ try
{
+ return lookupMethod(method.getName(), method.getParameterTypes(), instance);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new IllegalArgumentException(e);
+ }
+ }
+
+ /**
+ * Looks up a method in the type hierarchy of an instance
+ *
+ * @param method The method to look for
+ * @param instance The instance to start from
+ * @return the method
+ * @throws NoSuchMethodException if the method is not found
+ */
+ public static Method lookupMethod(String methodName, Class<?>[] parameterTypes, Object instance) throws NoSuchMethodException
+ {
+ return lookupMethod(methodName, parameterTypes, instance.getClass());
+ }
+
+ private static Method lookupMethod(String methodName, Class<?>[] parameterTypes, Class<?> c) throws NoSuchMethodException
+ {
+ for (Class<? extends Object> clazz = c; clazz != null; clazz = clazz.getSuperclass())
+ {
+ for (Class<?> intf : clazz.getInterfaces())
+ {
+ try
+ {
+ return lookupMethod(methodName, parameterTypes, intf);
+ }
+ catch (NoSuchMethodException e)
+ {
+ // Expected
+ }
+ }
try
{
- Method targetMethod = clazz.getDeclaredMethod(method.getName(), method.getParameterTypes());
+ Method targetMethod = clazz.getDeclaredMethod(methodName, parameterTypes);
if (!targetMethod.isAccessible())
{
targetMethod.setAccessible(true);
@@ -411,8 +449,10 @@
// Expected, nothing to see here.
}
}
- throw new IllegalArgumentException("Method " + method.getName() + " not implemented by instance");
+ throw new NoSuchMethodException("Method " + methodName + Arrays.asList(parameterTypes).toString().replace("[", "(").replace("]", ")") + " not implemented by instance " + c.getName());
}
+
+
/**
* Indicates if an instance is a Javassist proxy
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/ordering/DeployerOrderingTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/ordering/DeployerOrderingTest.java 2009-03-23 18:26:06 UTC (rev 2148)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/ordering/DeployerOrderingTest.java 2009-03-23 18:27:55 UTC (rev 2149)
@@ -128,7 +128,7 @@
}
}
- @Test(groups="bootstrap")
+ //@Test(groups="bootstrap")
public void testOrgJbossWebbeansBeforeUsers()
{
BeanDeployer beanDeployer = new BeanDeployer(manager);
@@ -189,15 +189,15 @@
int i = 0;
for (RIBean<?> bean : beans)
{
- if (bean.getType().equals(Spider.class))
+ if (bean.getType().equals(Spider.class) && !bean.getBindings().contains(new NewLiteral()))
{
indexOfSpider = i;
}
- if (bean.getType().equals(Tarantula.class))
+ if (bean.getType().equals(Tarantula.class) && !bean.getBindings().contains(new NewLiteral()))
{
indexOfTarantula = i;
}
- if (bean.getType().equals(DefangedTarantula.class))
+ if (bean.getType().equals(DefangedTarantula.class) && !bean.getBindings().contains(new NewLiteral()))
{
indexOfDefangedTarantula = i;
}
15 years, 10 months
[webbeans-commits] Webbeans SVN: r2148 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization: simple and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-03-23 14:26:06 -0400 (Mon, 23 Mar 2009)
New Revision: 2148
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/BuildingLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/OfficeLocal.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/SimpleBeanSpecializationTest.java
Log:
minor, fix test to be spec compliant
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/BuildingLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/BuildingLocal.java 2009-03-23 15:09:12 UTC (rev 2147)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/BuildingLocal.java 2009-03-23 18:26:06 UTC (rev 2148)
@@ -7,5 +7,5 @@
{
String getClassName();
-
+ public Waste getWaste();
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java 2009-03-23 15:09:12 UTC (rev 2147)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java 2009-03-23 18:26:06 UTC (rev 2148)
@@ -44,7 +44,7 @@
}
- @Test(groups="ri-broken")
+ @Test
@SpecAssertion(section="4.3.1", id = "g")
public void testProducerMethodOnSpecializedBeanCalledOnSpecializingBean() throws Exception
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/OfficeLocal.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/OfficeLocal.java 2009-03-23 15:09:12 UTC (rev 2147)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/OfficeLocal.java 2009-03-23 18:26:06 UTC (rev 2148)
@@ -1,5 +1,8 @@
package org.jboss.jsr299.tck.tests.inheritance.specialization.enterprise;
+import javax.ejb.Local;
+
+@Local
public interface OfficeLocal
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/SimpleBeanSpecializationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/SimpleBeanSpecializationTest.java 2009-03-23 15:09:12 UTC (rev 2147)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/simple/SimpleBeanSpecializationTest.java 2009-03-23 18:26:06 UTC (rev 2148)
@@ -3,6 +3,7 @@
import java.lang.annotation.Annotation;
import javax.inject.AnnotationLiteral;
+import javax.inject.manager.Bean;
import org.hibernate.tck.annotations.SpecAssertion;
import org.hibernate.tck.annotations.SpecAssertions;
@@ -30,9 +31,10 @@
public void testSpecializingBeanHasBindingsOfSpecializedAndSpecializingBean()
{
assert getCurrentManager().resolveByType(Farmer.class, LANDOWNER_LITERAL).size() == 1;
- assert getCurrentManager().resolveByType(Farmer.class, LANDOWNER_LITERAL).iterator().next().getTypes().contains(LazyFarmer.class);
- assert getCurrentManager().resolveByType(Farmer.class, LANDOWNER_LITERAL).iterator().next().getBindings().size() == 2;
- assert annotationSetMatches(getCurrentManager().resolveByType(Farmer.class, LANDOWNER_LITERAL).iterator().next().getBindings(), Landowner.class, Lazy.class);
+ Bean<?> bean = getCurrentManager().resolveByType(Farmer.class, LANDOWNER_LITERAL).iterator().next();
+ assert bean.getTypes().contains(LazyFarmer.class);
+ assert bean.getBindings().size() == 2;
+ assert annotationSetMatches(bean.getBindings(), Landowner.class, Lazy.class);
}
@Test
15 years, 10 months