Weld SVN: r6838 - in core/trunk: impl/src/main/java/org/jboss/weld/injection and 3 other directories.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2010-07-29 08:21:41 -0400 (Thu, 29 Jul 2010)
New Revision: 6838
Added:
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyMethodHandler.java
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyFactory.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
core/trunk/impl/src/main/java/org/jboss/weld/injection/ProxyClassConstructorInjectionPointWrapper.java
core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java
core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties
core/trunk/tests/src/main/java/org/jboss/weld/test/Utils.java
Log:
Changed proxy classes to no longer directly reference Weld implementation classes
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyFactory.java 2010-07-29 11:34:15 UTC (rev 6837)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyFactory.java 2010-07-29 12:21:41 UTC (rev 6838)
@@ -23,14 +23,11 @@
import java.util.Collections;
import javassist.CtClass;
-import javassist.CtConstructor;
import javassist.CtMethod;
-import javassist.CtNewConstructor;
import javassist.CtNewMethod;
import javassist.NotFoundException;
-import javax.decorator.Delegate;
-
+import org.jboss.interceptor.util.proxy.TargetInstanceProxy;
import org.jboss.weld.exceptions.WeldException;
import org.jboss.weld.injection.FieldInjectionPoint;
import org.jboss.weld.injection.ParameterInjectionPoint;
@@ -73,31 +70,25 @@
}
}
- @Override
- protected void addConstructors(CtClass proxyClassType)
+ private void addHandlerInitializerMethod(CtClass proxyClassType) throws Exception
{
- try
- {
- CtClass baseType = getClassPool().get(getBeanType().getName());
- for (CtConstructor constructor : baseType.getConstructors())
- {
- int delegateInjectionPosition = getDelegateInjectionPosition(constructor);
- if (delegateInjectionPosition >= 0)
- {
- proxyClassType.addConstructor(CtNewConstructor.make(constructor.getParameterTypes(), constructor.getExceptionTypes(), createDelegateInitializerCode(null, delegateInjectionPosition), proxyClassType));
- }
- else
- {
- proxyClassType.addConstructor(CtNewConstructor.copy(constructor, proxyClassType, null));
- }
- }
- }
- catch (Exception e)
- {
- throw new WeldException(e);
- }
+ CtClass objectClass = getClassPool().get(Object.class.getName());
+ proxyClassType.addMethod(CtNewMethod.make(Modifier.PRIVATE, CtClass.voidType, "_initMH", new CtClass[] { objectClass }, null, createMethodHandlerInitializerBody(proxyClassType), proxyClassType));
}
+ private String createMethodHandlerInitializerBody(CtClass proxyClassType)
+ {
+ StringBuilder bodyString = new StringBuilder();
+ bodyString.append("{ methodHandler = (javassist.util.proxy.MethodHandler) methodHandler.invoke($0, ");
+ bodyString.append(proxyClassType.getName());
+ bodyString.append(".class.getDeclaredMethod(\"");
+ bodyString.append("_initMH");
+ bodyString.append("\", new Class[]{Object.class}");
+ bodyString.append("), null, $args); }");
+ log.trace("Created MH initializer body for proxy: " + bodyString.toString());
+ return bodyString.toString();
+ }
+
@Override
protected void addMethodsFromClass(CtClass proxyClassType)
{
@@ -114,23 +105,27 @@
}
try
{
+ if (delegateParameterPosition >= 0)
+ {
+ addHandlerInitializerMethod(proxyClassType);
+ }
for (CtMethod method : proxyClassType.getMethods())
{
if (!method.getDeclaringClass().getName().equals("java.lang.Object") || method.getName().equals("toString"))
{
- log.trace("Adding method " + method.getLongName());
String methodBody = null;
if ((delegateParameterPosition >= 0) && (initializerMethod.equals(method.getName())))
{
methodBody = createDelegateInitializerCode(initializerMethod, delegateParameterPosition);
}
- else if (Modifier.isAbstract(method.getModifiers()))
+ if (Modifier.isAbstract(method.getModifiers()))
{
methodBody = createAbstractMethodCode(method);
}
if (methodBody != null)
{
+ log.trace("Adding method " + method.getLongName() + " " + methodBody);
proxyClassType.addMethod(CtNewMethod.make(method.getReturnType(), method.getName(), method.getParameterTypes(), method.getExceptionTypes(), methodBody, proxyClassType));
}
}
@@ -177,11 +172,12 @@
}
else
{
- // Use the associated bean instance to invoke the method
- bodyString.append("beanInstance.invoke(");
+ // Use the associated method handler to invoke the method
+ bodyString.append("methodHandler.invoke($0,");
if (Modifier.isPublic(delegateMethod.getModifiers()))
{
- bodyString.append("beanInstance.getInstanceType().getMethod(\"");
+ bodyString.append(getTargetClass());
+ bodyString.append(".getMethod(\"");
log.trace("Using getMethod in proxy for method " + method.getLongName());
}
else
@@ -193,12 +189,21 @@
bodyString.append(method.getName());
bodyString.append("\", ");
bodyString.append(getSignatureClasses(method));
- bodyString.append("), $args); }");
+ bodyString.append("), null, $args); }");
}
return bodyString.toString();
}
+ private String getTargetClass()
+ {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append("((Class)methodHandler.invoke($0,");
+ buffer.append(TargetInstanceProxy.class.getName());
+ buffer.append(".class.getMethod(\"getTargetClass\", null), null, null))");
+ return buffer.toString();
+ }
+
private String createDelegateInitializerCode(String initializerName, int delegateParameterPosition)
{
StringBuilder buffer = new StringBuilder();
@@ -209,30 +214,11 @@
buffer.append(initializerName);
}
buffer.append("($$);\n");
- buffer.append("beanInstance = new ");
- buffer.append(TargetBeanInstance.class.getName());
+ buffer.append("_initMH");
buffer.append("($");
buffer.append(delegateParameterPosition + 1);
buffer.append("); }");
return buffer.toString();
}
- private int getDelegateInjectionPosition(CtConstructor constructor)
- {
- int position = -1;
- Object[][] parameterAnnotations = constructor.getAvailableParameterAnnotations();
- for (int i = 0; i < parameterAnnotations.length; i++)
- {
- for (int j = 0; j < parameterAnnotations[i].length; j++)
- {
- if (parameterAnnotations[i][j] instanceof Delegate)
- {
- position = i;
- break;
- }
- }
- }
- return position;
- }
-
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java 2010-07-29 11:34:15 UTC (rev 6837)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java 2010-07-29 12:21:41 UTC (rev 6838)
@@ -41,6 +41,7 @@
import javassist.CtNewConstructor;
import javassist.CtNewMethod;
import javassist.NotFoundException;
+import javassist.util.proxy.ProxyObject;
import org.jboss.interceptor.proxy.LifecycleMixin;
import org.jboss.interceptor.util.proxy.TargetInstanceProxy;
@@ -176,7 +177,7 @@
{
throw new DefinitionException(PROXY_INSTANTIATION_BEAN_ACCESS_FAILED, e, this);
}
- ((Proxy) proxy).proxy_setInstance(beanInstance);
+ ((ProxyObject) proxy).setHandler(new ProxyMethodHandler(beanInstance));
return proxy;
}
@@ -234,7 +235,7 @@
*/
public static boolean isProxy(Object proxySuspect)
{
- return proxySuspect instanceof Proxy;
+ return proxySuspect instanceof ProxyObject;
}
/**
@@ -245,10 +246,10 @@
*/
public static <T> void setBeanInstance(T proxy, BeanInstance beanInstance)
{
- if (proxy instanceof Proxy)
+ if (proxy instanceof ProxyObject)
{
- Proxy proxyView = (Proxy) proxy;
- proxyView.proxy_setInstance(beanInstance);
+ ProxyObject proxyView = (ProxyObject) proxy;
+ proxyView.setHandler(new ProxyMethodHandler(beanInstance));
}
}
@@ -273,9 +274,9 @@
private Class<T> createProxyClass(String proxyClassName) throws Exception
{
ArraySet<Class<?>> specialInterfaces = new ArraySet<Class<?>>(3);
- specialInterfaces.add(Proxy.class);
specialInterfaces.add(LifecycleMixin.class);
specialInterfaces.add(TargetInstanceProxy.class);
+ specialInterfaces.add(ProxyObject.class);
// Remove special interfaces from main set (deserialization scenario)
additionalInterfaces.removeAll(specialInterfaces);
@@ -347,7 +348,7 @@
{
// The field representing the underlying instance or special method
// handling
- proxyClassType.addField(new CtField(classPool.get("org.jboss.weld.bean.proxy.BeanInstance"), "beanInstance", proxyClassType));
+ proxyClassType.addField(new CtField(classPool.get("javassist.util.proxy.MethodHandler"), "methodHandler", proxyClassType));
// Special field used during serialization of a proxy
proxyClassType.addField(new CtField(CtClass.booleanType, "firstSerializationPhaseComplete", proxyClassType), "false");
}
@@ -386,7 +387,7 @@
// replacement object and the subsequent call get the proxy object.
CtClass exception = classPool.get(ObjectStreamException.class.getName());
CtClass objectClass = classPool.get(Object.class.getName());
- String writeReplaceBody = "{ " + " if (firstSerializationPhaseComplete) {" + " firstSerializationPhaseComplete = false; " + " return $0; " + " } else {" + " firstSerializationPhaseComplete = true; " + " return new org.jboss.weld.bean.proxy.util.SerializableProxy($0);" + " } }";
+ String writeReplaceBody = createWriteReplaceBody(proxyClassType);
proxyClassType.addMethod(CtNewMethod.make(objectClass, "writeReplace", null, new CtClass[] { exception }, writeReplaceBody, proxyClassType));
// Also add a static method that can be used to deserialize a proxy
@@ -406,6 +407,22 @@
}
+ private String createWriteReplaceBody(CtClass proxyClassType)
+ {
+ StringBuilder bodyString = new StringBuilder();
+ bodyString.append("{\n");
+ bodyString.append(" if (firstSerializationPhaseComplete) {\n");
+ bodyString.append(" firstSerializationPhaseComplete = false;\n");
+ bodyString.append(" return $0;\n");
+ bodyString.append(" } else {\n");
+ bodyString.append(" firstSerializationPhaseComplete = true;\n");
+ bodyString.append(" return methodHandler.invoke($0,");
+ bodyString.append(proxyClassType.getName());
+ bodyString.append(".class.getMethod(\"writeReplace\", null), null, $args);\n");
+ bodyString.append(" }\n}");
+ return bodyString.toString();
+ }
+
protected void addMethodsFromClass(CtClass proxyClassType)
{
try
@@ -441,7 +458,7 @@
/**
* Creates the given method on the proxy class where the implementation
- * forwards the call directly to the bean instance.
+ * forwards the call directly to the method handler.
*
* @param method any Javassist method
* @return a string containing the method body code to be compiled
@@ -463,7 +480,7 @@
// Assume this is a void method
}
- bodyString.append("beanInstance.invoke(");
+ bodyString.append("methodHandler.invoke($0, ");
bodyString.append(method.getDeclaringClass().getName());
if (Modifier.isPublic(method.getModifiers()))
{
@@ -478,7 +495,7 @@
bodyString.append(method.getName());
bodyString.append("\", ");
bodyString.append(getSignatureClasses(method));
- bodyString.append("), $args); }");
+ bodyString.append("), null, $args); }");
return bodyString.toString();
}
@@ -530,10 +547,6 @@
{
try
{
- // Add public getter/setter pair for the instance locator
- proxyClassType.addMethod(CtNewMethod.make("public org.jboss.weld.bean.proxy.BeanInstance proxy_getInstance() { return beanInstance; }", proxyClassType));
- proxyClassType.addMethod(CtNewMethod.make("public void proxy_setInstance(org.jboss.weld.bean.proxy.BeanInstance beanInstance) { this.beanInstance = beanInstance; }", proxyClassType));
-
// Add special methods for interceptors
CtClass lifecycleMixinClass = classPool.get(LifecycleMixin.class.getName());
for (CtMethod method : lifecycleMixinClass.getDeclaredMethods())
@@ -544,8 +557,11 @@
CtClass targetInstanceProxyClass = classPool.get(TargetInstanceProxy.class.getName());
CtMethod getInstanceMethod = targetInstanceProxyClass.getDeclaredMethod("getTargetInstance");
CtMethod getInstanceClassMethod = targetInstanceProxyClass.getDeclaredMethod("getTargetClass");
- proxyClassType.addMethod(CtNewMethod.make(getInstanceMethod.getReturnType(), getInstanceMethod.getName(), getInstanceMethod.getParameterTypes(), getInstanceMethod.getExceptionTypes(), "{ return beanInstance.getInstance(); }", proxyClassType));
- proxyClassType.addMethod(CtNewMethod.make(getInstanceClassMethod.getReturnType(), getInstanceClassMethod.getName(), getInstanceClassMethod.getParameterTypes(), getInstanceClassMethod.getExceptionTypes(), "{ return beanInstance.getInstanceType(); }", proxyClassType));
+ proxyClassType.addMethod(CtNewMethod.make(getInstanceMethod.getReturnType(), getInstanceMethod.getName(), getInstanceMethod.getParameterTypes(), getInstanceMethod.getExceptionTypes(), createSpecialInterfaceBody(getInstanceMethod, TargetInstanceProxy.class), proxyClassType));
+ proxyClassType.addMethod(CtNewMethod.make(getInstanceClassMethod.getReturnType(), getInstanceClassMethod.getName(), getInstanceClassMethod.getParameterTypes(), getInstanceClassMethod.getExceptionTypes(), createSpecialInterfaceBody(getInstanceClassMethod, TargetInstanceProxy.class), proxyClassType));
+ CtClass proxyObjectClass = classPool.get(ProxyObject.class.getName());
+ CtMethod setMethodHandlerMethod = proxyObjectClass.getDeclaredMethod("setHandler");
+ proxyClassType.addMethod(CtNewMethod.make(setMethodHandlerMethod.getReturnType(), setMethodHandlerMethod.getName(), setMethodHandlerMethod.getParameterTypes(), setMethodHandlerMethod.getExceptionTypes(), "{ methodHandler = $1; }", proxyClassType));
}
catch (Exception e)
{
@@ -565,13 +581,26 @@
protected String createSpecialInterfaceBody(CtMethod method, Class<?> interfaceClazz) throws NotFoundException
{
StringBuilder bodyString = new StringBuilder();
- bodyString.append("{ beanInstance.invoke(");
+ bodyString.append("{\n");
+ try
+ {
+ if (method.getReturnType() != null)
+ {
+ bodyString.append("return ($r)");
+ }
+ }
+ catch (NotFoundException e)
+ {
+ // Assume this is a void method
+ }
+
+ bodyString.append("methodHandler.invoke($0, ");
bodyString.append(interfaceClazz.getName());
bodyString.append(".class.getDeclaredMethod(\"");
bodyString.append(method.getName());
bodyString.append("\", ");
bodyString.append(getSignatureClasses(method));
- bodyString.append("), $args); }");
+ bodyString.append("), null, $args); }");
return bodyString.toString();
}
Added: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyMethodHandler.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyMethodHandler.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyMethodHandler.java 2010-07-29 12:21:41 UTC (rev 6838)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, 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.weld.bean.proxy;
+
+import static org.jboss.weld.logging.Category.BEAN;
+import static org.jboss.weld.logging.LoggerFactory.loggerFactory;
+import static org.jboss.weld.logging.messages.BeanMessage.BEAN_INSTANCE_NOT_SET_ON_PROXY;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+
+import javassist.util.proxy.MethodHandler;
+
+import org.jboss.interceptor.util.proxy.TargetInstanceProxy;
+import org.jboss.weld.exceptions.WeldException;
+import org.jboss.weld.logging.messages.BeanMessage;
+import org.slf4j.cal10n.LocLogger;
+
+/**
+ * A general purpose MethodHandler for all proxies which routes calls to the
+ * {@link BeanInstance} associated with this proxy or handler.
+ *
+ * @author David Allen
+ *
+ */
+public class ProxyMethodHandler implements MethodHandler, Serializable
+{
+ // The log provider
+ protected static final LocLogger log = loggerFactory().getLogger(BEAN);
+
+ // The bean instance to forward calls to
+ private BeanInstance beanInstance;
+
+ public ProxyMethodHandler(BeanInstance beanInstance)
+ {
+ this.beanInstance = beanInstance;
+ }
+
+ /* (non-Javadoc)
+ * @see javassist.util.proxy.MethodHandler#invoke(java.lang.Object, java.lang.reflect.Method, java.lang.reflect.Method, java.lang.Object[])
+ */
+ public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable
+ {
+ log.trace("MethodHandler processing call to " + thisMethod + " for " + self.getClass());
+ if (thisMethod.getDeclaringClass().equals(TargetInstanceProxy.class))
+ {
+ if (beanInstance == null)
+ {
+ throw new WeldException(BEAN_INSTANCE_NOT_SET_ON_PROXY);
+ }
+ if (thisMethod.getName().equals("getTargetInstance"))
+ {
+ return beanInstance.getInstance();
+ }
+ else if (thisMethod.getName().equals("getTargetClass"))
+ {
+ return beanInstance.getInstanceType();
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else if (thisMethod.getName().equals("writeReplace"))
+ {
+ return new org.jboss.weld.bean.proxy.util.SerializableProxy(self);
+ }
+ else if (thisMethod.getName().equals("_initMH"))
+ {
+ log.trace("Setting new MethodHandler with bean instance for " + args[0] + " on " + self.getClass());
+ return new ProxyMethodHandler(new TargetBeanInstance(args[0]));
+ }
+ else
+ {
+ if (beanInstance == null)
+ {
+ throw new WeldException(BEAN_INSTANCE_NOT_SET_ON_PROXY);
+ }
+ return beanInstance.invoke(thisMethod, args);
+ }
+ }
+
+}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/injection/ProxyClassConstructorInjectionPointWrapper.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/injection/ProxyClassConstructorInjectionPointWrapper.java 2010-07-29 11:34:15 UTC (rev 6837)
+++ core/trunk/impl/src/main/java/org/jboss/weld/injection/ProxyClassConstructorInjectionPointWrapper.java 2010-07-29 12:21:41 UTC (rev 6838)
@@ -17,12 +17,18 @@
package org.jboss.weld.injection;
+import java.lang.annotation.Annotation;
import java.util.List;
import javax.decorator.Decorator;
+import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
+import org.jboss.weld.bean.proxy.BeanInstance;
+import org.jboss.weld.bean.proxy.DecoratorProxyFactory;
+import org.jboss.weld.bean.proxy.TargetBeanInstance;
import org.jboss.weld.introspector.WeldConstructor;
+import org.jboss.weld.manager.BeanManagerImpl;
/**
* A wrapper on a {@link ConstructorInjectionPoint}, to be used if a proxy subclass is instantiated instead of the
@@ -38,6 +44,7 @@
public class ProxyClassConstructorInjectionPointWrapper<T> extends ConstructorInjectionPoint<T>
{
private ConstructorInjectionPoint<T> originalConstructorInjectionPoint;
+ private Object decoratorDelegate = null;
public ProxyClassConstructorInjectionPointWrapper(Bean<T> declaringBean, WeldConstructor<T> weldConstructor, ConstructorInjectionPoint<T> originalConstructorInjectionPoint)
{
@@ -50,4 +57,29 @@
{
return originalConstructorInjectionPoint.getWeldParameters();
}
+
+ @Override
+ protected Object[] getParameterValues(List<ParameterInjectionPoint<?, T>> parameters, Object specialVal, Class<? extends Annotation> specialParam, BeanManagerImpl manager, CreationalContext<?> creationalContext)
+ {
+ Object[] parameterValues = super.getParameterValues(parameters, specialVal, specialParam, manager, creationalContext);
+ // Check if any of the injections are for a delegate
+ for (ParameterInjectionPoint<?, T> parameter : getWeldParameters())
+ {
+ if (parameter.isDelegate())
+ {
+ decoratorDelegate = parameterValues[parameter.getPosition()];
+ }
+ }
+ return parameterValues;
+ }
+
+ @Override
+ public T newInstance(BeanManagerImpl manager, CreationalContext<?> creationalContext)
+ {
+ // Once the instance is created, a method handler is required regardless of whether
+ // an actual bean instance is known yet.
+ T instance = super.newInstance(manager, creationalContext);
+ DecoratorProxyFactory.setBeanInstance(instance, decoratorDelegate == null ? null : new TargetBeanInstance(decoratorDelegate));
+ return instance;
+ }
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java 2010-07-29 11:34:15 UTC (rev 6837)
+++ core/trunk/impl/src/main/java/org/jboss/weld/logging/messages/BeanMessage.java 2010-07-29 12:21:41 UTC (rev 6838)
@@ -135,6 +135,7 @@
@MessageId("000097") PRODUCER_METHOD_WITH_TYPE_VARIABLE_RETURN_TYPE_MUST_BE_DEPENDENT,
@MessageId("000098") PRODUCER_METHOD_WITH_WILDCARD_RETURN_TYPE_MUST_BE_DEPENDENT,
@MessageId("000099") CANNOT_LOAD_CLASS,
- @MessageId("001500") PROXY_DESERIALIZATION_FAILURE;
+ @MessageId("001500") PROXY_DESERIALIZATION_FAILURE,
+ @MessageId("001501") BEAN_INSTANCE_NOT_SET_ON_PROXY;
}
Modified: core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties
===================================================================
--- core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties 2010-07-29 11:34:15 UTC (rev 6837)
+++ core/trunk/impl/src/main/resources/org/jboss/weld/messages/bean_en.properties 2010-07-29 12:21:41 UTC (rev 6838)
@@ -99,3 +99,4 @@
PRODUCER_METHOD_WITH_WILDCARD_RETURN_TYPE_MUST_BE_DEPENDENT=A producer method with a parameterized return type with a wildcard must be declared @Dependent scoped. Method {0}
CANNOT_LOAD_CLASS=Cannot load class {0} during deserialization of proxy
PROXY_DESERIALIZATION_FAILURE=Failed to deserialize proxy object
+BEAN_INSTANCE_NOT_SET_ON_PROXY=Method call requires a BeanInstance which has not been set for this proxy
Modified: core/trunk/tests/src/main/java/org/jboss/weld/test/Utils.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/test/Utils.java 2010-07-29 11:34:15 UTC (rev 6837)
+++ core/trunk/tests/src/main/java/org/jboss/weld/test/Utils.java 2010-07-29 12:21:41 UTC (rev 6838)
@@ -31,11 +31,12 @@
import java.util.List;
import java.util.Set;
+import javassist.util.proxy.ProxyObject;
+
import javax.el.ELContext;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.util.TypeLiteral;
-import org.jboss.weld.bean.proxy.Proxy;
import org.jboss.weld.exceptions.UnsatisfiedResolutionException;
import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.mock.el.EL;
@@ -172,6 +173,6 @@
public static boolean isProxy(Object proxy)
{
- return proxy instanceof Proxy;
+ return proxy instanceof ProxyObject;
}
}
14 years, 4 months
Weld SVN: r6837 - core/trunk/tests.
by weld-commits@lists.jboss.org
Author: aslak
Date: 2010-07-29 07:34:15 -0400 (Thu, 29 Jul 2010)
New Revision: 6837
Modified:
core/trunk/tests/pom.xml
Log:
WELD-493 Updated tests to use Servlet 3.0 API
Modified: core/trunk/tests/pom.xml
===================================================================
--- core/trunk/tests/pom.xml 2010-07-29 03:37:52 UTC (rev 6836)
+++ core/trunk/tests/pom.xml 2010-07-29 11:34:15 UTC (rev 6837)
@@ -63,8 +63,8 @@
</dependency>
<dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
+ <groupId>org.jboss.spec.javax.servlet</groupId>
+ <artifactId>jboss-servlet-api_3.0_spec</artifactId>
</dependency>
<dependency>
14 years, 4 months
Weld SVN: r6836 - archetypes/javaee6-webapp/trunk.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2010-07-28 23:37:52 -0400 (Wed, 28 Jul 2010)
New Revision: 6836
Modified:
archetypes/javaee6-webapp/trunk/pom.xml
Log:
updated Spec version
Modified: archetypes/javaee6-webapp/trunk/pom.xml
===================================================================
--- archetypes/javaee6-webapp/trunk/pom.xml 2010-07-29 03:24:03 UTC (rev 6835)
+++ archetypes/javaee6-webapp/trunk/pom.xml 2010-07-29 03:37:52 UTC (rev 6836)
@@ -22,7 +22,7 @@
<jboss.home>${env.JBOSS_HOME}</jboss.home>
<jboss.domain>default</jboss.domain>
<arquillian.version>1.0.0-SNAPSHOT</arquillian.version>
- <jboss-javaee6-spec.version>1.0.0.Beta5</jboss-javaee6-spec.version>
+ <jboss-javaee6-spec.version>1.0.0.Beta7</jboss-javaee6-spec.version>
</properties>
<repositories>
14 years, 4 months
Weld SVN: r6835 - archetypes/javaee6-webapp/trunk/src/main/webapp.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2010-07-28 23:24:03 -0400 (Wed, 28 Jul 2010)
New Revision: 6835
Modified:
archetypes/javaee6-webapp/trunk/src/main/webapp/index.xhtml
Log:
fixed error
Modified: archetypes/javaee6-webapp/trunk/src/main/webapp/index.xhtml
===================================================================
--- archetypes/javaee6-webapp/trunk/src/main/webapp/index.xhtml 2010-07-29 02:52:05 UTC (rev 6834)
+++ archetypes/javaee6-webapp/trunk/src/main/webapp/index.xhtml 2010-07-29 03:24:03 UTC (rev 6835)
@@ -69,7 +69,7 @@
</h:column>
<h:column>
<f:facet name="header">REST URL</f:facet>
- <a href="#{request.contextPath}/rest/members/#{_member.id}">/rest/members/#{_members.id}</a>
+ <a href="#{request.contextPath}/rest/members/#{_member.id}">/rest/members/#{_member.id}</a>
</h:column>
<f:facet name="footer">
REST URL for all members: <a href="#{request.contextPath}/rest/members">/rest/members</a>
14 years, 4 months
Weld SVN: r6834 - archetypes/jsf-weld-servlet-webapp/trunk.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2010-07-28 22:52:05 -0400 (Wed, 28 Jul 2010)
New Revision: 6834
Modified:
archetypes/jsf-weld-servlet-webapp/trunk/pom.xml
Log:
Added user suggestions
Modified: archetypes/jsf-weld-servlet-webapp/trunk/pom.xml
===================================================================
--- archetypes/jsf-weld-servlet-webapp/trunk/pom.xml 2010-07-28 23:44:31 UTC (rev 6833)
+++ archetypes/jsf-weld-servlet-webapp/trunk/pom.xml 2010-07-29 02:52:05 UTC (rev 6834)
@@ -105,7 +105,29 @@
<artifactId>weld-servlet</artifactId>
<scope>runtime</scope>
</dependency>
-
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- SB: Perhaps this is a means of enabling EL 2.0 in tomcat? -->
+ <!-- I will uncomment once I have an opportunity to test -->
+ <!--
+ <dependency>
+ <groupId>org.jboss.seam</groupId>
+ <artifactId>jboss-el</artifactId>
+ <version>2.0.0.GA</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+
<!--
<dependency>
<groupId>org.glassfish.web</groupId>
14 years, 4 months
[weld/extensions] 73ed46: check return type of producer
by noreply@github.com
Branch: refs/heads/master
Home: http://github.com/weld/extensions
Commit: 73ed468f5fa7d1b6eac1251247c670c0e5cf0545
http://github.com/weld/extensions/commit/73ed468f5fa7d1b6eac1251247c670c0...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
M impl/src/main/java/org/jboss/weld/extensions/bean/Beans.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanProducer.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericProducerBean.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericProducerField.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericProducerMethod.java
M impl/src/main/java/org/jboss/weld/extensions/util/Reflections.java
Log Message:
-----------
check return type of producer
Commit: 59b87aefe5ab32892929e529bb57cc792786925b
http://github.com/weld/extensions/commit/59b87aefe5ab32892929e529bb57cc79...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBean.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericConfiguration.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericProduct.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericProductLiteral.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/InjectGeneric.java
Log Message:
-----------
improve javadoc
Commit: 66fefbaf705486118e98c1cb86968dd590605438
http://github.com/weld/extensions/commit/66fefbaf705486118e98c1cb86968dd5...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/AbstactGenericBean.java
A impl/src/main/java/org/jboss/weld/extensions/bean/generic/AbstractGenericProducerBean.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java
R impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanProducer.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericManagedBean.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericObserverMethod.java
A impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericProducer.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericProducerBean.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericProducerField.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericProducerMethod.java
Log Message:
-----------
general tidy up
Commit: 81a387c6d5817ff7830cdd2dc58d0892399be6e1
http://github.com/weld/extensions/commit/81a387c6d5817ff7830cdd2dc58d0892...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/InjectGeneric.java
A impl/src/main/java/org/jboss/weld/extensions/bean/generic/InjectGenericLiteral.java
Log Message:
-----------
move InjectGenericLiteral out of InjectGeneric to prevent compilation problems
Commit: 374d384edb421cf11a1487af3c3c80ae42b26d02
http://github.com/weld/extensions/commit/374d384edb421cf11a1487af3c3c80ae...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java
Log Message:
-----------
remove a level of indirection
Commit: 3bf41dae6ee35130f94a40345c7c6ca2eafa6902
http://github.com/weld/extensions/commit/3bf41dae6ee35130f94a40345c7c6ca2...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
A impl/src/main/java/org/jboss/weld/extensions/util/collections/AbstractMapEntry.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/AbstractMultimap.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/AbstractMultiset.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/AbstractSetMultimap.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Collections2.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/ImmutableEntry.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Iterators.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Maps.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Multimap.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Multimaps.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Multiset.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Multisets.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Objects.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Platform.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Preconditions.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Serialization.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/SetMultimap.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Sets.java
A impl/src/main/java/org/jboss/weld/extensions/util/collections/Supplier.java
Log Message:
-----------
add a Multimap implementation
Commit: 080ebc2de6cc56656aefe91fad9ba8efc0f4aab4
http://github.com/weld/extensions/commit/080ebc2de6cc56656aefe91fad9ba8ef...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java
Log Message:
-----------
use multimap for generic beans
Commit: f1eb54655de60bf74ef414290d9ce0dee0b4dec4
http://github.com/weld/extensions/commit/f1eb54655de60bf74ef414290d9ce0de...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java
M impl/src/main/java/org/jboss/weld/extensions/util/AnnotationInspector.java
Log Message:
-----------
Refactor out getAnnotation to AnnotationInspector
Commit: 4f03ef53e562c9648af1b1d45187526f4ee8d5cb
http://github.com/weld/extensions/commit/4f03ef53e562c9648af1b1d45187526f...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java
Log Message:
-----------
defensively clean maps to aid GC
Commit: e7848203905bacb974dfe94a6fdd7fd4eda2571f
http://github.com/weld/extensions/commit/e7848203905bacb974dfe94a6fdd7fd4...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java
M impl/src/main/java/org/jboss/weld/extensions/defaultbean/DefaultBeanExtension.java
Log Message:
-----------
fix warning
Commit: 81c113fdbb4a4e2595b57300fa6b3b6447a7d152
http://github.com/weld/extensions/commit/81c113fdbb4a4e2595b57300fa6b3b64...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
M impl/src/main/java/org/jboss/weld/extensions/bean/generic/GenericBeanExtension.java
Log Message:
-----------
refactor out getQualifiers
Commit: f61c39991021e8e9e171194299830c7c162a0a6c
http://github.com/weld/extensions/commit/f61c39991021e8e9e171194299830c7c...
Author: Pete Muir <pmuir(a)bleepbleep.org.uk>
Date: 2010-07-28 (Wed, 28 Jul 2010)
Changed paths:
M impl/src/main/java/org/jboss/weld/extensions/defaultbean/DefaultBean.java
M impl/src/main/java/org/jboss/weld/extensions/defaultbean/DefaultBeanExtension.java
M impl/src/main/java/org/jboss/weld/extensions/el/ELContextProducer.java
A impl/src/main/java/org/jboss/weld/extensions/el/ELResolverImpl.java
M impl/src/main/java/org/jboss/weld/extensions/el/Expressions.java
A impl/src/main/java/org/jboss/weld/extensions/el/Resolver.java
Log Message:
-----------
Merge branch 'master' of github.com:weld/extensions
14 years, 4 months
Weld SVN: r6833 - in core/trunk/tests/src: test/java/org/jboss/weld/tests and 32 other directories.
by weld-commits@lists.jboss.org
Author: aslak
Date: 2010-07-28 19:44:31 -0400 (Wed, 28 Jul 2010)
New Revision: 6833
Removed:
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Cow.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Dummy.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Field.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Fox.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/NightTime.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Tame.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/child/
core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/
core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/
core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Child.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/decoration/
core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/
core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/
core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/
core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/
core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/
core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/
core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/annotation/
core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/serializability/
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/ee/
core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/
core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/extend/
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/interceptor/
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/multidelegate/
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/resolution/
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Animal.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Bird.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Castle.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Cat.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DAO.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Dog.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Feed.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Hat.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Result.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/proxyability/
core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Bar.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Updated.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/examples/
core/trunk/tests/src/test/java/org/jboss/weld/tests/exceptions/
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Cow.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Horse.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Rat.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Special.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Stable.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Woodland.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/injectionTarget/
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/interceptors/
core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/
core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/other/
core/trunk/tests/src/test/java/org/jboss/weld/tests/managed/newBean/
core/trunk/tests/src/test/java/org/jboss/weld/tests/nonContextual/
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Baz.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Qux.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Target.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Bar.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Baz.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Car.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Government.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Important.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Long.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Qux.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Short.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/circular/
core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/parameterized/
core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/enterprise/
core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/observer/
core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/weld477/
core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/weld56/
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Bar.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Baz.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/FooBase.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Special.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/resource/
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/named/
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/wbri279/
core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/wbri293/
core/trunk/tests/src/test/java/org/jboss/weld/tests/resources/
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Bar.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Special.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Temp.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempProducer.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Useless.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/
core/trunk/tests/src/test/java/org/jboss/weld/tests/session/newBean/
core/trunk/tests/src/test/java/org/jboss/weld/tests/specialization/
core/trunk/tests/src/test/java/org/jboss/weld/tests/stereotypes/
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/environments/servlet/
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/jsf/
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/method/
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/security/
core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/util/
core/trunk/tests/src/test/java/org/jboss/weld/tests/util/annotated/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/alternatives/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/builtinBeans/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/enterprise/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/extensions/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/proxy/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/resolution/
core/trunk/tests/src/test/resources/org/jboss/weld/tests/unit/
Modified:
core/trunk/tests/src/main/java/org/jboss/weld/mock/MockServletContext.java
Log:
WELD-493 Tests converted and moved to tests-arquillian
Modified: core/trunk/tests/src/main/java/org/jboss/weld/mock/MockServletContext.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/mock/MockServletContext.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/main/java/org/jboss/weld/mock/MockServletContext.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -25,17 +25,25 @@
import java.net.URL;
import java.util.Collections;
import java.util.Enumeration;
+import java.util.EventListener;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
+import javax.servlet.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.FilterRegistration.Dynamic;
+import javax.servlet.descriptor.JspConfigDescriptor;
/**
* Mock implementation of the servlet context for testing purposes. This implementation supports all
@@ -555,4 +563,142 @@
{
return "";
}
-}
+
+ public Dynamic addFilter(String arg0, String arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Dynamic addFilter(String arg0, Filter arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Dynamic addFilter(String arg0, Class<? extends Filter> arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void addListener(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public <T extends EventListener> void addListener(T arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addListener(Class<? extends EventListener> arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+ String arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+ Servlet arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+ Class<? extends Servlet> arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T extends Filter> T createFilter(Class<T> arg0)
+ throws ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T extends EventListener> T createListener(Class<T> arg0)
+ throws ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T extends Servlet> T createServlet(Class<T> arg0)
+ throws ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void declareRoles(String... arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public ClassLoader getClassLoader() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getEffectiveMajorVersion() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getEffectiveMinorVersion() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public FilterRegistration getFilterRegistration(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ServletRegistration getServletRegistration(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public SessionCookieConfig getSessionCookieConfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean setInitParameter(String arg0, String arg1) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void setSessionTrackingModes(Set<SessionTrackingMode> arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,347 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Member;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.spi.Context;
-import javax.enterprise.context.spi.Contextual;
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Reception;
-import javax.enterprise.event.TransactionPhase;
-import javax.enterprise.inject.UnsatisfiedResolutionException;
-import javax.enterprise.inject.spi.Annotated;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.ObserverMethod;
-import javax.enterprise.util.AnnotationLiteral;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.bean.ForwardingBean;
-import org.jboss.weld.literal.AnyLiteral;
-import org.jboss.weld.literal.DefaultLiteral;
-import org.jboss.weld.manager.BeanManagerImpl;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.jboss.weld.util.collections.Arrays2;
-import org.testng.annotations.Test;
-
-/**
- *
- * Spec version: 20090519
- *
- */
-@Artifact
-public class ActivitiesTest extends AbstractWeldTest
-{
-
- private static final Set<Annotation> DEFAULT_QUALIFIERS = Collections.<Annotation> singleton(DefaultLiteral.INSTANCE);
-
- private Bean<?> createDummyBean(BeanManager beanManager, final Type injectionPointType)
- {
- final Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
- final Set<Type> types = new HashSet<Type>();
- final Set<Annotation> bindings = new HashSet<Annotation>();
- bindings.add(new AnnotationLiteral<Tame>()
- {
- });
- types.add(Object.class);
- final Bean<?> bean = new Bean<Object>()
- {
-
- public Set<Annotation> getQualifiers()
- {
- return bindings;
- }
-
- public Set<InjectionPoint> getInjectionPoints()
- {
- return injectionPoints;
- }
-
- public String getName()
- {
- return null;
- }
-
- public Class<? extends Annotation> getScope()
- {
- return Dependent.class;
- }
-
- public Set<Type> getTypes()
- {
- return types;
- }
-
- public boolean isNullable()
- {
- return false;
- }
-
- public Object create(CreationalContext<Object> creationalContext)
- {
- return null;
- }
-
- public void destroy(Object instance, CreationalContext<Object> creationalContext)
- {
-
- }
-
- public Class<?> getBeanClass()
- {
- return Object.class;
- }
-
- public boolean isAlternative()
- {
- return false;
- }
-
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- return Collections.emptySet();
- }
-
- };
- InjectionPoint injectionPoint = new InjectionPoint()
- {
-
- public Bean<?> getBean()
- {
- return bean;
- }
-
- public Set<Annotation> getQualifiers()
- {
- return DEFAULT_QUALIFIERS;
- }
-
- public Member getMember()
- {
- return null;
- }
-
- public Type getType()
- {
- return injectionPointType;
- }
-
- public Annotated getAnnotated()
- {
- return null;
- }
-
- public boolean isDelegate()
- {
- return false;
- }
-
- public boolean isTransient()
- {
- return false;
- }
-
- };
- injectionPoints.add(injectionPoint);
- return bean;
- }
-
- private static class DummyContext implements Context
- {
-
- public <T> T get(Contextual<T> contextual)
- {
- return null;
- }
-
- public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
- {
- return null;
- }
-
- public Class<? extends Annotation> getScope()
- {
- return Dummy.class;
- }
-
- public boolean isActive()
- {
- return false;
- }
-
- }
-
- @Test
- public void testBeanBelongingToParentActivityBelongsToChildActivity()
- {
- assert getBeans(Cow.class).size() == 1;
- Contextual<?> bean = getBeans(Cow.class).iterator().next();
- BeanManager childActivity = getCurrentManager().createActivity();
- assert childActivity.getBeans(Cow.class).size() == 1;
- assert childActivity.getBeans(Cow.class).iterator().next().equals(bean);
- }
-
- @Test
- public void testBeanBelongingToParentActivityCanBeInjectedIntoChildActivityBean()
- {
- assert getBeans(Cow.class).size() == 1;
- Contextual<?> bean = getBeans(Cow.class).iterator().next();
- BeanManagerImpl childActivity = getCurrentManager().createActivity();
- Bean<?> dummyBean = createDummyBean(childActivity, Cow.class);
- childActivity.addBean(dummyBean);
- assert childActivity.getInjectableReference(dummyBean.getInjectionPoints().iterator().next(), childActivity.createCreationalContext(dummyBean)) != null;
- }
-
- @Test
- public void testObserverBelongingToParentActivityBelongsToChildActivity()
- {
- assert getCurrentManager().resolveObserverMethods(new NightTime()).size() == 1;
- ObserverMethod<?> observer = getCurrentManager().resolveObserverMethods(new NightTime()).iterator().next();
- BeanManager childActivity = getCurrentManager().createActivity();
- assert childActivity.resolveObserverMethods(new NightTime()).size() == 1;
- assert childActivity.resolveObserverMethods(new NightTime()).iterator().next().equals(observer);
- }
-
- @Test
- public void testObserverBelongingToParentFiresForChildActivity()
- {
- Fox.setObserved(false);
- BeanManager childActivity = getCurrentManager().createActivity();
- childActivity.fireEvent(new NightTime());
- assert Fox.isObserved();
- }
-
- @Test
- public void testContextObjectBelongingToParentBelongsToChild()
- {
- Context context = new DummyContext()
- {
-
- @Override
- public boolean isActive()
- {
- return true;
- }
-
- };
- getCurrentManager().addContext(context);
- BeanManager childActivity = getCurrentManager().createActivity();
- assert childActivity.getContext(Dummy.class) != null;
- }
-
- @Test
- public void testBeanBelongingToChildActivityCannotBeInjectedIntoParentActivityBean()
- {
- assert getBeans(Cow.class).size() == 1;
- BeanManagerImpl childActivity = getCurrentManager().createActivity();
- Bean<?> dummyBean = createDummyBean(childActivity, Cow.class);
- childActivity.addBean(dummyBean);
- assert getBeans(Object.class, new AnnotationLiteral<Tame>()
- {
- }).size() == 0;
- }
-
- @Test(expectedExceptions = UnsatisfiedResolutionException.class)
- public void testInstanceProcessedByParentActivity()
- {
- Context dummyContext = new DummyContext();
- getCurrentManager().addContext(dummyContext);
- assert getBeans(Cow.class).size() == 1;
- final Bean<Cow> bean = getBeans(Cow.class).iterator().next();
- BeanManagerImpl childActivity = getCurrentManager().createActivity();
- final Set<Annotation> bindingTypes = new HashSet<Annotation>();
- bindingTypes.add(new AnnotationLiteral<Tame>()
- {
- });
- childActivity.addBean(new ForwardingBean<Cow>()
- {
-
- @Override
- protected Bean<Cow> delegate()
- {
- return bean;
- }
-
- @Override
- public Set<Annotation> getQualifiers()
- {
- return bindingTypes;
- }
-
- @Override
- public Set<Class<? extends Annotation>> getStereotypes()
- {
- return Collections.emptySet();
- }
-
- });
- getReference(Field.class).get();
- }
-
- @Test
- public void testObserverBelongingToChildDoesNotFireForParentActivity()
- {
-
- BeanManagerImpl childActivity = getCurrentManager().createActivity();
- ObserverMethod<NightTime> observer = new ObserverMethod<NightTime>()
- {
-
- public void notify(NightTime event)
- {
- assert false;
- }
-
- public Class<?> getBeanClass()
- {
- return NightTime.class;
- }
-
- public Set<Annotation> getObservedQualifiers()
- {
- return Arrays2.asSet(AnyLiteral.INSTANCE, DefaultLiteral.INSTANCE);
- }
-
- public Type getObservedType()
- {
- return NightTime.class;
- }
-
- public Reception getReception()
- {
- return Reception.ALWAYS;
- }
-
- public TransactionPhase getTransactionPhase()
- {
- return TransactionPhase.IN_PROGRESS;
- }
-
- };
- // TODO Fix this test to use an observer method in a child activity
- childActivity.addObserver(observer);
- getCurrentManager().fireEvent(new NightTime());
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Cow.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Cow.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Cow.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
-
-class Cow
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Dummy.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Dummy.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Dummy.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
-
-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.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Scope;
-
-@Target( { TYPE, METHOD, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Scope
-@Inherited
-@interface Dummy {}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Field.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Field.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Field.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,32 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
-
-import javax.enterprise.inject.Instance;
-import javax.inject.Inject;
-
-class Field
-{
-
- @Inject @Tame Instance<Cow> instance;
-
- public Cow get()
- {
- return instance.get();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Fox.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Fox.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Fox.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
-
-import javax.enterprise.event.Observes;
-
-class Fox
-{
-
- private static boolean observed = false;
-
- public void observe(@Observes NightTime nighttime)
- {
- observed = true;
- }
-
- public static boolean isObserved()
- {
- return observed;
- }
-
- public static void setObserved(boolean observed)
- {
- Fox.observed = observed;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/NightTime.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/NightTime.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/NightTime.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
-
-class NightTime
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Tame.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Tame.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Tame.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-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.Qualifier;
-
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-@interface Tame
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.annotatedType;
-
-
-/**
- *
- * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class Bean
-{
- int field;
-
- public Bean(int i)
- {
-
- }
-
- public void method(int i)
- {
-
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Child.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Child.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Child.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.annotatedType;
-
-
-public class Child extends Parent
- {
- }
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.annotatedType;
-
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedType;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- * @author kkahn
- *
- */
-@Artifact
-public class DeclaringTypeTest extends AbstractWeldTest
-{
-
- @Test
- public void testInheritance()
- {
- AnnotatedType<Child> type = getCurrentManager().createAnnotatedType(Child.class);
- assert type.getConstructors().size() == 1;
- assert type.getFields().size() == 1;
- for (AnnotatedField<? super Child> field : type.getFields())
- {
- if (field.getJavaMember().getName().equals("parent"))
- {
- Assert.assertEquals(Parent.class, field.getJavaMember().getDeclaringClass()); // OK
- // -
- // Returns
- // Parent
- Assert.assertEquals(Parent.class, field.getDeclaringType().getJavaClass()); // FAIL
- // -
- // Returns
- // Child
- }
- else
- {
- Assert.fail("Unknown field " + field.getJavaMember());
- }
- }
-
- assert type.getMethods().size() == 1;
- for (AnnotatedMethod<? super Child> method : type.getMethods())
- {
- if (method.getJavaMember().getName().equals("parentMethod"))
- {
- Assert.assertEquals(Parent.class, method.getJavaMember().getDeclaringClass()); // OK
- // -
- // /Returns
- // Parent
- Assert.assertEquals(Parent.class, method.getDeclaringType().getJavaClass()); // FAIL
- // -
- // Returns
- // Child
- }
- else
- {
- Assert.fail("Unknown method " + method.getJavaMember());
- }
- }
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.annotatedType;
-
-import javax.enterprise.inject.spi.Annotated;
-import javax.enterprise.inject.spi.AnnotatedConstructor;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-import javax.enterprise.inject.spi.AnnotatedType;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-@Artifact
-public class ExampleTest extends AbstractWeldTest
-{
- @Test
- public void testAnnotatedCallableGetParameters() throws Exception
- {
- AnnotatedType<Bean> type = getCurrentManager().createAnnotatedType(Bean.class);
-
- assertNoAnnotations(type);
-
- Assert.assertEquals(1, type.getConstructors().size());
- for (AnnotatedConstructor<Bean> ctor : type.getConstructors())
- {
- assertNoAnnotations(ctor);
-
- for (AnnotatedParameter<Bean> param : ctor.getParameters())
- {
- assertNoAnnotations(param);
- }
- }
-
- Assert.assertEquals(1, type.getMethods().size());
- for (AnnotatedMethod<? super Bean> method : type.getMethods())
- {
- assertNoAnnotations(method);
-
- for (AnnotatedParameter<? super Bean> param : method.getParameters())
- {
- assertNoAnnotations(param);
- }
- }
-
- Assert.assertEquals(1, type.getFields().size());
- for (AnnotatedField<? super Bean> field : type.getFields())
- {
- assertNoAnnotations(field);
- }
- }
-
- private void assertNoAnnotations(Annotated annotated)
- {
- Assert.assertEquals(0, annotated.getAnnotations().size());
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,27 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.annotatedType;
-public class Parent
-{
- int parent;
-
- void parentMethod()
- {
-
- }
-}
-
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-package org.jboss.weld.tests.beanManager;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class BeanManagerTest extends AbstractWeldTest
-{
-
- @Test(expectedExceptions=IllegalArgumentException.class)
- public void testNullBeanArgumentToGetReference()
- {
- Bean<Foo> bean = getBean(Foo.class);
- CreationalContext<Foo> cc = getCurrentManager().createCreationalContext(bean);
- getCurrentManager().getReference(null, Foo.class, cc);
- }
-
- @Test(expectedExceptions=IllegalArgumentException.class)
- public void testNullBeanTypeArgumentToGetReference()
- {
- Bean<Foo> bean = getBean(Foo.class);
- CreationalContext<Foo> cc = getCurrentManager().createCreationalContext(bean);
- getCurrentManager().getReference(bean, null, cc);
- }
-
- @Test(expectedExceptions=IllegalArgumentException.class)
- public void testNullCreationalContextArgumentToGetReference()
- {
- Bean<Foo> bean = getBean(Foo.class);
- CreationalContext<Foo> cc = getCurrentManager().createCreationalContext(bean);
- getCurrentManager().getReference(bean, Foo.class, null);
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/Foo.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,6 +0,0 @@
-package org.jboss.weld.tests.beanManager;
-
-public class Foo
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,150 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
-
-import static org.jboss.weld.tests.builtinBeans.Checker.checkBeanManager;
-import static org.jboss.weld.tests.builtinBeans.Checker.checkEquality;
-import static org.jboss.weld.tests.builtinBeans.Checker.checkEvent;
-import static org.jboss.weld.tests.builtinBeans.Checker.checkInjectionPoint;
-import static org.jboss.weld.tests.builtinBeans.Checker.checkInstance;
-import static org.jboss.weld.tests.builtinBeans.Checker.checkPrincipal;
-import static org.jboss.weld.tests.builtinBeans.Checker.checkUserTransaction;
-import static org.jboss.weld.tests.builtinBeans.Checker.checkValidator;
-import static org.jboss.weld.tests.builtinBeans.Checker.checkValidatorFactory;
-
-import java.security.Principal;
-
-import javax.enterprise.event.Event;
-import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.transaction.UserTransaction;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.jboss.weld.test.Utils;
-import org.testng.annotations.Test;
-
-@Artifact
-public class BuiltInBeanPassivationCapableTest extends AbstractWeldTest
-{
-
- @Test
- public void testDefaultValidatorBean() throws Throwable
- {
- Validator validator = getReference(Validator.class);
- Validator validator1 = Utils.deserialize(Utils.serialize(validator));
- assert checkValidator(validator1);
- }
-
- @Test
- public void testDefaultValidatorFactoryBean() throws Throwable
- {
- ValidatorFactory validatorFactory = getReference(ValidatorFactory.class);
- ValidatorFactory validatorFactory1 = Utils.deserialize(Utils.serialize(validatorFactory));
- assert checkValidatorFactory(validatorFactory1);
- }
-
- @Test(groups="incontainer-broken")
- public void testPrincipal() throws Throwable
- {
- Principal principal = getReference(Principal.class);
- Principal principal1 = Utils.deserialize(Utils.serialize(principal));
- assert checkPrincipal(principal1);
- }
-
- @Test
- public void testUserTransactionBean() throws Throwable
- {
- UserTransaction userTransaction = getReference(UserTransaction.class);
- UserTransaction userTransaction1 = Utils.deserialize(Utils.serialize(userTransaction));
- assert checkUserTransaction(userTransaction1);
- }
-
- @Test
- public void testBeanManagerBean() throws Throwable
- {
- BeanManager beanManager = getReference(BeanManager.class);
- BeanManager beanManager1 = Utils.deserialize(Utils.serialize(beanManager));
- assert checkBeanManager(beanManager1);
- assert checkEquality(beanManager, beanManager1);
- }
-
- @Test
- public void testInstance() throws Throwable
- {
- Instance<Cow> instance = getReference(Consumer.class).getCow();
- Instance<Cow> instance1 = Utils.deserialize(Utils.serialize(instance));
- assert checkInstance(instance1);
- assert checkEquality(instance, instance1);
- }
-
- @Test
- public void testEvent() throws Throwable
- {
- Event<Cow> event = getReference(Consumer.class).getEvent();
- CowEventObserver observer = getReference(CowEventObserver.class);
- Event<Cow> event1 = Utils.deserialize(Utils.serialize(event));
- assert checkEvent(event1, observer);
- assert checkEquality(event, event1);
- }
-
- @Test
- public void testFieldInjectionPoint() throws Throwable
- {
- Dog.reset();
- getReference(FieldInjectionPointConsumer.class).ping();
- InjectionPoint injectionPoint = Dog.getInjectionPoint();
- InjectionPoint injectionPoint1 = Utils.deserialize(Utils.serialize(injectionPoint));
- assert checkInjectionPoint(injectionPoint1, FieldInjectionPointConsumer.class);
- assert checkEquality(injectionPoint, injectionPoint1);
- }
-
- @Test
- public void testConstructorInjectionPoint() throws Throwable
- {
- Dog.reset();
- getReference(ConstructorInjectionPointConsumer.class).ping();
- InjectionPoint injectionPoint = Dog.getInjectionPoint();
- InjectionPoint injectionPoint1 = Utils.deserialize(Utils.serialize(injectionPoint));
- assert checkInjectionPoint(injectionPoint1, ConstructorInjectionPointConsumer.class);
- assert checkEquality(injectionPoint, injectionPoint1);
- }
-
- @Test
- public void testMethodInjectionPoint() throws Throwable
- {
- Dog.reset();
- getReference(MethodInjectionPointConsumer.class).ping();
- InjectionPoint injectionPoint = Dog.getInjectionPoint();
- InjectionPoint injectionPoint1 = Utils.deserialize(Utils.serialize(injectionPoint));
- assert checkInjectionPoint(injectionPoint1, MethodInjectionPointConsumer.class);
- assert checkEquality(injectionPoint, injectionPoint1);
- }
-
- @Test
- public void testAllOnBean() throws Throwable
- {
- Consumer consumer = getReference(Consumer.class);
- consumer.check();
- Consumer consumer1 = Utils.deserialize(Utils.serialize(consumer));
- consumer1.check();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,138 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
-
-import java.security.Principal;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Event;
-import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.transaction.SystemException;
-import javax.transaction.UserTransaction;
-import javax.validation.ValidationException;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-
-public class Checker
-{
-
- public static boolean checkPrincipal(Principal principal)
- {
- principal.getName();
- return true;
- }
-
- public static boolean checkBeanManager(BeanManager beanManager)
- {
- return beanManager != null && beanManager.isScope(ApplicationScoped.class);
- }
-
- public static boolean checkUserTransaction(UserTransaction userTransaction)
- {
- try
- {
- if (userTransaction != null)
- {
- userTransaction.getStatus();
- return true;
- }
- }
- catch (SystemException e)
- {
- throw new RuntimeException(e);
- }
- return false;
- }
-
- public static boolean checkValidator(Validator validator)
- {
- try
- {
- if (validator != null)
- {
- validator.unwrap(String.class);
- }
- }
- catch (ValidationException e)
- {
- return true;
- }
- return false;
- }
-
- public static boolean checkValidatorFactory(ValidatorFactory validatorFactory)
- {
- try
- {
- if (validatorFactory != null)
- {
- validatorFactory.unwrap(String.class);
- }
- }
- catch (ValidationException e)
- {
- return true;
- }
- return false;
- }
-
- public static boolean checkInstance(Instance<Cow> cow)
- {
- if (cow != null && cow.get() != null)
- {
- return cow.get().getName().equals("Daisy");
- }
- else
- {
- return false;
- }
- }
-
- public static boolean checkEvent(Event<Cow> cowEvent, CowEventObserver observer)
- {
- observer.reset();
- if (cowEvent != null)
- {
- cowEvent.fire(new Cow());
- return observer.isObserved();
- }
- else
- {
- return false;
- }
- }
-
- public static boolean checkInjectionPoint(InjectionPoint injectionPoint, Class<?> injectedClass)
- {
- if (injectionPoint != null)
- {
- return injectedClass.equals(injectionPoint.getBean().getBeanClass());
- }
- else
- {
- return false;
- }
- }
-
- public static boolean checkEquality(Object object1, Object object2)
- {
- return object1.equals(object2) && object1.hashCode() == object2.hashCode();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.inject.Inject;
-
-@SessionScoped
-public class ConstructorInjectionPointConsumer implements Serializable
-{
-
- public ConstructorInjectionPointConsumer() {}
-
- @Inject
- public ConstructorInjectionPointConsumer(Dog dog) {}
-
- public void ping() {}
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
-
-import java.io.Serializable;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.event.Event;
-import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Inject;
-import javax.transaction.UserTransaction;
-import javax.validation.Validator;
-import javax.validation.ValidatorFactory;
-
-@SessionScoped
-public class Consumer implements Serializable
-{
-
- @Inject Validator validator;
- @Inject ValidatorFactory validatorFactory;
- // Not working incontainer as there is no principal
- //@Inject Principal principal;
- @Inject UserTransaction userTransaction;
- @Inject BeanManager beanManager;
- @Inject Instance<Cow> cow;
- @Inject Event<Cow> event;
- @Inject CowEventObserver observer;
-
- @PostConstruct
- public void postConstruct()
- {
- cow.get().setName("Daisy");
- }
-
- public Instance<Cow> getCow()
- {
- return cow;
- }
-
- public Event<Cow> getEvent()
- {
- return event;
- }
-
- public void check()
- {
- assert Checker.checkBeanManager(beanManager);
-
- // Not working incontainer as there is no principal
- //assert Checker.checkPrincipal(principal);
- assert Checker.checkUserTransaction(userTransaction);
- assert Checker.checkValidator(validator);
- assert Checker.checkValidatorFactory(validatorFactory);
- assert Checker.checkInstance(cow);
- assert Checker.checkEvent(event, observer);
- }
-
-
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
-
-import javax.enterprise.context.RequestScoped;
-
-@RequestScoped
-public class Cow
-{
-
- private String name;
-
- public String getName()
- {
- return name;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Observes;
-
-@ApplicationScoped
-public class CowEventObserver implements Serializable
-{
-
- private boolean observed;
-
- public void observeEvent(@Observes Cow cow)
- {
- this.observed = true;
- }
-
- public boolean isObserved()
- {
- return observed;
- }
-
- public void reset()
- {
- this.observed = false;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
-
-import java.io.Serializable;
-
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Inject;
-
-public class Dog implements Serializable
-{
-
- private static InjectionPoint injectionPoint;
-
- @Inject
- public Dog(InjectionPoint injectionPoint)
- {
- Dog.injectionPoint = injectionPoint;
- }
-
- public static void reset()
- {
- Dog.injectionPoint = null;
- }
-
- public static InjectionPoint getInjectionPoint()
- {
- return injectionPoint;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,32 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.inject.Inject;
-
-@SessionScoped
-public class FieldInjectionPointConsumer implements Serializable
-{
-
- @Inject Dog dogField;
-
- public void ping() {}
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.inject.Inject;
-
-@SessionScoped
-public class MethodInjectionPointConsumer implements Serializable
-{
-
- @Inject
- public void setDog(Dog dog) {}
-
- public void ping() {}
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-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.Qualifier;
-
-@Qualifier
-@Retention(RUNTIME)
-@Target( { TYPE, METHOD, FIELD, PARAMETER })
-@Documented
-@interface Produced
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
-
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.enterprise.context.ApplicationScoped;
-
-@ApplicationScoped
-public class ApplicationScopedObject
-{
- private AtomicInteger counter = new AtomicInteger();
-
- public void increment()
- {
- counter.incrementAndGet();
- }
- public int getValue()
- {
- return counter.get();
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
-
-import java.util.concurrent.CountDownLatch;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class ApplicationScopedTest extends AbstractWeldTest
-{
-
- @Test
- public void testConcurrentInitilized() throws InterruptedException
- {
- final CountDownLatch latch = new CountDownLatch(10);
- final ApplicationScopedObject applictionScopedObject = getReference(ApplicationScopedObject.class);
- for (int i = 0; i < 10; i++)
- {
- new Thread(new Runnable()
- {
- public void run()
- {
- try
- {
- applictionScopedObject.increment();
- }
- finally
- {
- latch.countDown();
- }
- }
- }).start();
- }
- latch.await();
- int value = applictionScopedObject.getValue();
- assert value == 10;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,147 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
-
-import javax.enterprise.context.ContextNotActiveException;
-import javax.enterprise.context.Conversation;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.Container;
-import org.jboss.weld.context.ContextLifecycle;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class ContextTest extends AbstractWeldTest
-{
-
- @Test(description = "WELD-348")
- public void testCallToConversationWithContextNotActive()
- {
- boolean alreadyActive = false;
- try
- {
- alreadyActive = Container.instance().services().get(ContextLifecycle.class).isConversationActive();
- if (alreadyActive)
- {
- Container.instance().services().get(ContextLifecycle.class).getConversationContext().setActive(false);
- }
- try
- {
- getReference(Conversation.class).getId();
- assert false;
- }
- catch (ContextNotActiveException e)
- {
- // Expected
- }
- catch (Exception e)
- {
- assert false;
- }
- try
- {
- getReference(Conversation.class).getTimeout();
- assert false;
- }
- catch (ContextNotActiveException e)
- {
- // Expected
- }
- catch (Exception e)
- {
- assert false;
- }
- try
- {
- getReference(Conversation.class).begin();
- assert false;
- }
- catch (ContextNotActiveException e)
- {
- // Expected
- }
- catch (Exception e)
- {
- assert false;
- }
- try
- {
- getReference(Conversation.class).begin("foo");
- assert false;
- }
- catch (ContextNotActiveException e)
- {
- // Expected
- }
- catch (Exception e)
- {
- assert false;
- }
- try
- {
- getReference(Conversation.class).end();
- assert false;
- }
- catch (ContextNotActiveException e)
- {
- // Expected
- }
- catch (Exception e)
- {
- assert false;
- }
- try
- {
- getReference(Conversation.class).isTransient();
- assert false;
- }
- catch (ContextNotActiveException e)
- {
- // Expected
- }
- catch (Exception e)
- {
- assert false;
- }
- try
- {
- getReference(Conversation.class).setTimeout(0);
- assert false;
- }
- catch (ContextNotActiveException e)
- {
- // Expected
- }
- catch (Exception e)
- {
- assert false;
- }
- }
- finally
- {
- if (alreadyActive)
- {
- Container.instance().services().get(ContextLifecycle.class).getConversationContext().setActive(true);
- }
- }
-
- }
-
-
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Produces;
-
-public class ParameterizedTypeScoped
-{
-
- @RequestScoped
- @Produces
- public List<String> create()
- {
- return Arrays.asList("iemon", "houjitya");
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
-
-import java.util.List;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class ParameterizedTypeScopedTest extends AbstractWeldTest
-{
-
- @Test
- public void testStringList()
- {
- List<String> str = getReference(StringHolder.class).getStrings();
- assert str.size() == 2;
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.context.ConversationScoped;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.context.SessionScoped;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.metadata.cache.MetaAnnotationStore;
-import org.testng.annotations.Test;
-
-@Artifact
-public class PassivatingContextTest extends org.jboss.weld.test.AbstractWeldTest
-{
-
- /**
- * The built-in session and conversation scopes are passivating. No other
- * built-in scope is passivating.
- */
- @Test(groups = { "contexts", "passivation" })
- public void testIsSessionScopePassivating()
- {
- assert getCurrentManager().getServices().get(MetaAnnotationStore.class).getScopeModel(SessionScoped.class).isPassivating();
- }
-
- /**
- * The built-in session and conversation scopes are passivating. No other
- * built-in scope is passivating.
- */
- @Test(groups = { "contexts", "passivation" })
- public void testIsConversationScopePassivating()
- {
- assert getCurrentManager().getServices().get(MetaAnnotationStore.class).getScopeModel(ConversationScoped.class).isPassivating();
- }
-
- /**
- * The built-in session and conversation scopes are passivating. No other
- * built-in scope is passivating.
- */
- @Test(groups = { "contexts", "passivation" })
- public void testIsApplicationScopeNonPassivating()
- {
- assert !getCurrentManager().getServices().get(MetaAnnotationStore.class).getScopeModel(ApplicationScoped.class).isPassivating();
- }
-
- /**
- * The built-in session and conversation scopes are passivating. No other
- * built-in scope is passivating.
- */
- @Test(groups = { "contexts", "passivation" })
- public void testIsRequestScopeNonPassivating()
- {
- assert !getCurrentManager().getServices().get(MetaAnnotationStore.class).getScopeModel(RequestScoped.class).isPassivating();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-
-public class StringHolder
-{
-
- @Inject
- private List<String> strings;
-
- public List<String> getStrings()
- {
- return strings;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators;
-
-/**
- *
- * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public interface SimpleBean
-{
- int echo1(int i);
-
- int echo2(int i);
-
- int echo3(int i);
-
- int echo4(int i);
-
- boolean isInvoked();
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators;
-
-/**
- *
- * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class SimpleBeanImpl implements SimpleBean
-{
-
- private boolean invoked = false;
-
- public int echo1(int i)
- {
- invoked = true;
- return i;
- }
-
- public int echo2(int i)
- {
- invoked = true;
- return i;
- }
-
- public int echo3(int i)
- {
- invoked = true;
- return i;
- }
-
- public int echo4(int i)
- {
- invoked = true;
- return i;
- }
-
- public boolean isInvoked()
- {
- return invoked;
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- *
- * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-@Decorator
-public abstract class SimpleDecorator1 implements SimpleBean
-{
- @Inject @Delegate
- SimpleBean delegate;
-
- public static boolean echo1;
- public static boolean echo3;
-
- public static void reset()
- {
- echo1 = false;
- echo3 = false;
- }
-
- public int echo1(int i)
- {
- echo1 = true;
- return delegate.echo1(i);
- }
-
- public int echo3(int i)
- {
- echo3 = true;
- return delegate.echo3(i);
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- *
- * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-@Decorator
-public abstract class SimpleDecorator2 implements SimpleBean
-{
- @Inject @Delegate
- SimpleBean delegate;
-
- public static boolean echo2;
- public static boolean echo3;
-
- public static void reset()
- {
- echo2 = false;
- echo3 = false;
- }
-
- public int echo2(int i)
- {
- echo2 = true;
- return delegate.echo2(i);
- }
-
- public int echo3(int i)
- {
- echo3 = true;
- return delegate.echo3(i);
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- *
- * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-@Artifact
-@BeansXml("beans.xml")
-public class SimpleDecoratorTest extends AbstractWeldTest
-{
- @Test
- public void testSimpleDecorator()
- {
- SimpleBean simpleBean = getReference(SimpleBean.class);
-
- resetDecorators();
- assert simpleBean.echo1(1) == 1;
- assertDecorators(true, false, false);
- assert simpleBean.isInvoked();
-
- resetDecorators();
- assert simpleBean.echo2(2) == 2;
- assertDecorators(false, true, false);
- assert simpleBean.isInvoked();
-
- //Only SimpleDecorator1 gets invoked, although I think SimpleDecorator2 should get invoked too
- resetDecorators();
- assert simpleBean.echo3(3) == 3;
- assertDecorators(false, false, true);
-
- assert simpleBean.isInvoked();
-
- resetDecorators();
- assert simpleBean.echo4(4) == 4;
- assertDecorators(false, false, false);
-
- assert simpleBean.isInvoked();
- }
-
- private void resetDecorators()
- {
- SimpleDecorator1.reset();
- SimpleDecorator2.reset();
- }
-
- private void assertDecorators(boolean echo1, boolean echo2, boolean echo3)
- {
- assert SimpleDecorator1.echo1 == echo1;
- assert SimpleDecorator1.echo3 == echo3;
- assert SimpleDecorator2.echo2 == echo2;
- assert SimpleDecorator2.echo3 == echo3;
- }
-}
-
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-public class AbstractDecoratorTestHelper
-{
- static void resetAll()
- {
- WindowImpl.drawn = false;
- WindowImpl.moved = false;
- FrameWithFieldInjectedDelegate.drawn = false;
- FrameWithFieldInjectedDelegateAndAbstractMethod.moved = false;
- FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.moved = false;
- FrameWithConstructorInjectedDelegate.drawn = false;
- FrameWithConstructorInjectedDelegateAndAbstractMethod.moved = false;
- FrameWithInitializerMethodInjectedDelegate.drawn = false;
- FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.moved = false;
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Decorator
-public abstract class FrameWithConstructorInjectedDelegate implements Window
-{
-
- static boolean drawn;
-
- Window window;
-
- @Inject
- FrameWithConstructorInjectedDelegate(@Delegate Window window)
- {
- this.window = window;
- }
-
- public void draw()
- {
- drawn = true;
- window.draw();
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Decorator
-public abstract class FrameWithConstructorInjectedDelegateAndAbstractMethod implements Window
-{
-
- Window window;
-
- static boolean moved = false;
-
- @Inject
- FrameWithConstructorInjectedDelegateAndAbstractMethod(@Delegate Window window)
- {
- this.window = window;
- }
-
- public abstract void draw();
-
- public void move()
- {
- moved = true;
- draw();
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Decorator
-public abstract class FrameWithFieldInjectedDelegate implements Window
-{
-
- static boolean drawn;
-
- @Inject @Delegate
- Window window;
-
- public void draw()
- {
- drawn = true;
- window.draw();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Decorator
-public abstract class FrameWithFieldInjectedDelegateAndAbstractMethod implements Window
-{
-
- static boolean moved;
-
- @Inject @Delegate
- Window window;
-
- public abstract void draw();
-
- public void move()
- {
- moved = true;
- window.move();
- }
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Decorator
-public abstract class FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod implements Window
-{
-
- static boolean moved;
-
- @Inject @Delegate
- Window window;
-
- public abstract void draw();
-
- public void move()
- {
- moved = true;
- draw();
- }
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Decorator
-public abstract class FrameWithInitializerMethodInjectedDelegate implements Window
-{
-
- static boolean drawn;
-
- private Window window;
-
- @Inject
- void initWindow(@Delegate Window window){
- this.window = window;
- }
-
- public void draw() {
- drawn = true;
- window.draw();
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Decorator
-public abstract class FrameWithInitializerMethodInjectedDelegateAndAbstractMethod implements Window
-{
-
- static boolean moved;
-
- private Window window;
-
- @Inject
- void initWindow(@Delegate Window window)
- {
- this.window = window;
- }
-
- public abstract void draw();
-
- public void move()
- {
- moved = true;
- window.move();
- }
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Artifact
-@BeansXml("beans-simple.xml")
-public class SimpleAbstractDecoratorTest extends AbstractWeldTest
-{
- @Test
- public void testAbstractDecoratorApplied()
- {
-
- resetAll();
-
- Window window = getReference(WindowImpl.class);
- window.draw();
- assert WindowImpl.drawn;
- assert FrameWithFieldInjectedDelegate.drawn;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Artifact
-@BeansXml("beans-withAbstractMethodAndInitializerMethod.xml")
-public class SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest extends AbstractWeldTest
-{
- @Test
- public void testAbstractDecoratorApplied()
- {
-
- Window window = getReference(WindowImpl.class);
-
- resetAll();
- window.draw();
- assert WindowImpl.drawn;
- assert FrameWithFieldInjectedDelegate.drawn;
- assert !FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.moved;
-
- resetAll();
- window.move();
- assert WindowImpl.moved;
- assert !FrameWithFieldInjectedDelegate.drawn;
- assert FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.moved;
-
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Artifact
-@BeansXml("beans-withAbstractMethod.xml")
-public class SimpleAbstractDecoratorWithAbstractMethodTest extends AbstractWeldTest
-{
- @Test
- public void testAbstractDecoratorApplied()
- {
-
- Window window = getReference(WindowImpl.class);
-
- resetAll();
- window.draw();
- assert WindowImpl.drawn;
- assert FrameWithFieldInjectedDelegate.drawn;
- assert !FrameWithFieldInjectedDelegateAndAbstractMethod.moved;
-
- resetAll();
- window.move();
- assert WindowImpl.moved;
- assert !FrameWithFieldInjectedDelegate.drawn;
- assert FrameWithFieldInjectedDelegateAndAbstractMethod.moved;
-
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Artifact
-@BeansXml("beans-withCallToItself.xml")
-public class SimpleAbstractDecoratorWithCallToItselfTest extends AbstractWeldTest
-{
- @Test
- public void testAbstractDecoratorApplied()
- {
-
- Window window = getReference(WindowImpl.class);
-
- resetAll();
- window.move();
- assert WindowImpl.drawn;
- assert FrameWithFieldInjectedDelegate.drawn;
- assert FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.moved;
-
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.*;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Artifact
-@BeansXml("beans-withConstructor.xml")
-public class SimpleAbstractDecoratorWithConstructorTest extends AbstractWeldTest
-{
- @Test
- public void testAbstractDecoratorApplied()
- {
-
- resetAll();
-
- Window window = getReference(WindowImpl.class);
- window.draw();
- assert WindowImpl.drawn;
- assert FrameWithConstructorInjectedDelegate.drawn;
-
- resetAll();
- window.move();
- assert !WindowImpl.moved;
- assert WindowImpl.drawn;
- assert FrameWithConstructorInjectedDelegate.drawn;
- assert FrameWithConstructorInjectedDelegateAndAbstractMethod.moved;
-
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
- */
-@Artifact
-@BeansXml("beans-withInitializerMethod.xml")
-public class SimpleAbstractDecoratorWithInitializerMethodTest extends AbstractWeldTest
-{
- @Test
- public void testAbstractDecoratorApplied()
- {
-
- resetAll();
-
- Window window = getReference(WindowImpl.class);
- window.draw();
- assert WindowImpl.drawn;
- assert FrameWithInitializerMethodInjectedDelegate.drawn;
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-/**
- * @author Marius Bogoevici
- */
-public interface Window
-{
- void draw();
-
- void move();
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
-
-/**
- *
- * @author Marius Bogoevici
- */
-public class WindowImpl implements Window
-{
- static boolean drawn;
-
- static boolean moved;
-
- public void draw()
- {
- drawn = true;
- }
-
- public void move()
- {
- moved = true;
- }
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
-
-/**
- * @author Marius Bogoevici
- */
-public interface Decorated<T>
-{
- T decoratedEcho(T parameter);
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
-
-/**
- * @author Marius Bogoevici
- */
-public class GenericBean<T> implements Decorated<T>, NotDecorated<T>
-{
- static boolean decoratedInvoked;
- static boolean notDecoratedInvoked;
-
- public T notDecoratedEcho(T parameter)
- {
- notDecoratedInvoked = true;
- return parameter;
- }
-
- public T decoratedEcho(T parameter)
- {
- decoratedInvoked = true;
- return parameter;
- }
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
-
-/**
- * @author Marius Bogoevici
- */
-public interface NotDecorated<T>
-{
- T notDecoratedEcho(T parameter);
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- * @author Marius Bogoevici
- */
-@Decorator
-public class PartialDecorator<T> implements Decorated<T>
-{
-
- @Inject @Delegate GenericBean<T> delegate;
-
- static boolean decoratedInvoked = false;
-
- static boolean notDecoratedInvoked = false;
-
- public T decoratedEcho(T parameter)
- {
- decoratedInvoked = true;
- return delegate.decoratedEcho(parameter);
- }
-
- /**
- * Should not be invoked
- */
- public T notDecoratedEcho(T parameter)
- {
- notDecoratedInvoked = true;
- return delegate.notDecoratedEcho(parameter);
- }
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- * @author Marius Bogoevici
- */
-@Artifact
-@BeansXml("beans.xml")
-public class PartialDecoratorTest extends AbstractWeldTest
-{
-
- @Test
- public void testDecoratorDoesNotDecorateOutsideDecoratedTypes()
- {
- TestBean testBean = getReference(TestBean.class);
- testBean.invoke();
-
- assert PartialDecorator.decoratedInvoked;
- assert !PartialDecorator.notDecoratedInvoked;
- assert StringPartialDecorator.invoked;
- assert GenericBean.decoratedInvoked;
- assert GenericBean.notDecoratedInvoked;
- }
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- * @author Marius Bogoevici
- */
-@Decorator
-public class StringPartialDecorator implements Decorated<String>
-{
- @Inject
- @Delegate
- GenericBean<String> delegate;
-
- static boolean invoked = false;
-
- public String decoratedEcho(String parameter)
- {
- invoked = true;
- return delegate.decoratedEcho(parameter);
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
-
-import javax.enterprise.context.Dependent;
-import javax.inject.Inject;
-
-/**
- * @author Marius Bogoevici
- */
-public class TestBean
-{
- @Inject @Dependent GenericBean<String> genericBean;
-
- public void invoke()
- {
- genericBean.decoratedEcho("hello");
- genericBean.notDecoratedEcho("hello");
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-public interface AbstractDAO<E>
-{
- public boolean save(E entity);
-
- public boolean isSaved();
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-
-public abstract class AbstractDAOImpl<E>
-{
-
- private boolean saved;
-
- public boolean save(E entity)
- {
- this.saved = true;
- return true;
- }
-
- public boolean isSaved()
- {
- return saved;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Animal.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Animal.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Animal.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-public interface Animal
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Bird.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Bird.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Bird.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,27 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Remote;
-
-@Remote
-public interface Bird
-{
-
- public void observe(Feed feed);
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-public class BowlerHatException extends RuntimeException
-{
-
- public BowlerHatException()
- {
- super();
- }
-
- public BowlerHatException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public BowlerHatException(String message)
- {
- super(message);
- }
-
- public BowlerHatException(Throwable cause)
- {
- super(cause);
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Stateful;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Observes;
-
-@Stateful
-@RequestScoped
-public class Capercaillie implements Scottish, Bird
-{
-
- private Feed feed;
-
- public void observe(@Observes Feed feed)
- {
- this.feed = feed;
- }
-
- public Feed getFeed()
- {
- return feed;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Castle.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Castle.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Castle.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Stateless;
-
-@Stateless
-public class Castle
-{
-
- private boolean pinged;
-
- public boolean isPinged()
- {
- return pinged;
- }
-
- public void ping()
- {
- this.pinged = true;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Cat.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Cat.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Cat.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Stateful;
-
-/**
- * @author pmuir
- *
- */
-@Stateful
-public class Cat implements CatLocal
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Local;
-
-/**
- * @author pmuir
- *
- */
-@Local
-public interface CatLocal
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DAO.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DAO.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DAO.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target({FIELD, METHOD, TYPE, PARAMETER})
-public @interface DAO
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Dog.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Dog.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Dog.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Local;
-
-@Local
-public interface Dog extends Animal
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Stateless;
-
-
-@Stateless
-public class DogBean implements Dog
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.InjectionTarget;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.weld.bean.SessionBean;
-import org.jboss.weld.ejb.InternalEjbDescriptor;
-import org.jboss.weld.ejb.spi.EjbDescriptor;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- * @author pmuir
- *
- */
-@Artifact
-(a)Packaging(PackagingType.EAR)
-public class EjbDescriptorLookupTest extends AbstractWeldTest
-{
-
- @Test
- public void testCorrectSubType()
- {
- EjbDescriptor<CatLocal> descriptor = getCurrentManager().getEjbDescriptor("Cat");
- assert descriptor.getClass().equals(InternalEjbDescriptor.class);
- Bean<CatLocal> bean = getCurrentManager().getBean(descriptor);
- assert bean != null;
- assert bean instanceof SessionBean;
- assert bean.getBeanClass().equals(Cat.class);
- InjectionTarget<CatLocal> it = getCurrentManager().createInjectionTarget(descriptor);
- assert it != null;
- assert it.getInjectionPoints().equals(bean.getInjectionPoints());
- assert it.produce(getCurrentManager().createCreationalContext(bean)) instanceof CatLocal;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.enterprise.inject.spi.Bean;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.jboss.weld.test.Utils;
-import org.testng.annotations.Test;
-
-@Artifact
-(a)Packaging(PackagingType.EAR)
-public class EnterpriseBeanDefinitionTest extends AbstractWeldTest
-{
-
- @Test(description="WELD-305")
- public void testSuperInterfacesAreBeanTypes()
- {
- Bean<?> bean = getBean(Dog.class);
- assert Utils.typeSetMatches(bean.getTypes(), Object.class, Dog.class, Animal.class);
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,111 +0,0 @@
-/*
-
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.EJBException;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.ear.EjbJarXml;
-import org.jboss.weld.bean.SessionBean;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.jboss.weld.test.Utils;
-import org.testng.annotations.Test;
-
-@Artifact
-@IntegrationTest
-(a)Packaging(PackagingType.EAR)
-@EjbJarXml("ejb-jar.xml")
-public class EnterpriseBeanTest extends AbstractWeldTest
-{
-
- @Test(description="WBRI-179")
- public void testSFSBWithOnlyRemoteInterfacesDeploys()
- {
-
- }
-
- @Test(description="WELD-326")
- public void testInvocationExceptionIsUnwrapped()
- {
- try
- {
- getReference(Fedora.class).causeRuntimeException();
- }
- catch (Throwable t)
- {
- if (t instanceof EJBException && t.getCause() instanceof BowlerHatException)
- {
- return;
- }
- }
- assert false : "Expected a BowlerHatException to be thrown";
- }
-
- @Test(description="WBRI-275")
- public void testSLSBBusinessMethodThrowsRuntimeException()
- {
- try
- {
- getReference(Fedora.class).causeRuntimeException();
- }
- catch (Throwable t)
- {
- if (Utils.isExceptionInHierarchy(t, BowlerHatException.class))
- {
- return;
- }
- }
- assert false : "Expected a BowlerHatException to be in the cause stack";
- }
-
- @Test(description="WELD-364", groups = "broken")
- public void testEJBRemoteInterfacesOkForObservers()
- {
- Feed feed = new Feed();
- getCurrentManager().fireEvent(feed);
- assert getReference(Scottish.class).getFeed().equals(feed);
- }
-
- @Test(description = "WELD-381")
- public void testGenericEJBWorks()
- {
- assert getReference(ResultClient.class).lookupPete().getUsername().equals("pete");
- }
-
- @Test(description = "WELD-80", groups = "broken")
- public void testPassivationOfEjbs()
- {
- HelloAction action = getReference(HelloAction.class);
- action.executeRequest();
- assert action.getHello().equals("hello");
- assert action.getGoodBye().equals("goodbye");
- }
-
- @Test(description = "Simple test for no-interface views", groups="broken")
- public void testNoInterfaceView()
- {
- Castle castle = getReference(Castle.class);
- castle.ping();
- assert castle.isPinged();
- assert getBean(Castle.class) instanceof SessionBean<?>;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Local;
-
-@Local
-public interface Fedora
-{
-
- public void causeRuntimeException();
-
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,30 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Stateless;
-
-@Stateless
-public class FedoraImpl implements Fedora
-{
-
- public void causeRuntimeException()
- {
- throw new BowlerHatException();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Feed.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Feed.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Feed.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-public class Feed
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Hat.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Hat.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Hat.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Stateful;
-
-@Stateful
-public class Hat implements HatRemote
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Remote;
-
-@Remote
-public interface HatRemote
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.inject.Inject;
-
-public class HelloAction
-{
-
- public static long sleepDuration = 1000 * 2;
-
- @Inject
- private IHelloBean helloBean;
-
- private String hello;
- private String goodBye;
-
- public void executeRequest()
- {
- hello = helloBean.sayHello();
- try
- {
- Thread.sleep(sleepDuration);
- }
- catch (InterruptedException e)
- {
- System.out.println("Caught Interruption.");
- }
- goodBye = helloBean.sayGoodbye();
- }
-
- public String getHello()
- {
- return hello;
- }
-
- public String getGoodBye()
- {
- return goodBye;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.annotation.Resource;
-import javax.ejb.Remove;
-import javax.ejb.Stateful;
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.jboss.ejb3.annotation.CacheConfig;
-
-@Stateful
-@SessionScoped
-@CacheConfig(idleTimeoutSeconds=1)
-public class HelloBean implements IHelloBean
-{
- @Resource(mappedName = "java:comp/BeanManager")
- private BeanManager beanManager;
-
- public String sayHello()
- {
- return "hello";
- }
-
- public String sayGoodbye()
- {
- return beanManager.getELResolver() != null ? "goodbye" : "error";
- }
-
- @Remove
- public void remove()
- {
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Local;
-
-@Local
-public interface IHelloBean
-{
-
- public abstract String sayHello();
-
- public abstract String sayGoodbye();
-
- public abstract void remove();
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Result.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Result.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Result.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-public class Result
-{
-
- private final String username;
-
- public Result(String username)
- {
- this.username = username;
- }
-
- public String getUsername()
- {
- return username;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.inject.Inject;
-
-public class ResultClient
-{
-
- @Inject @DAO ResultDAO result;
-
- public Result lookupPete()
- {
- return result.findByUser("pete");
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,27 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Local;
-
-@Local
-public interface ResultDAO extends AbstractDAO<Result>
-{
-
- public Result findByUser(String username);
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Stateless;
-
-@DAO
-@Stateless
-public class ResultDAOImpl extends AbstractDAOImpl<Result> implements ResultDAO
-{
- public Result findByUser(String username)
- {
- return new Result(username);
- }
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,27 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
-
-import javax.ejb.Local;
-
-@Local
-public interface Scottish
-{
-
- public Feed getFeed();
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Bar.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Bar.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
-
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.event.Event;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.util.AnnotationLiteral;
-import javax.inject.Inject;
-
-@RequestScoped
-public class Bar
-{
-
- @Inject Event<String> event;
-
- @Inject @Updated Event<String> updatedEvent;
-
- @Inject BeanManager manager;
-
- private boolean unqualifiedObserved;
- private boolean updatedObserved;
-
- public void fireWithNoQualifiers()
- {
- event.fire("");
- }
-
- public void fireWithUpdatedQualifierViaSelect()
- {
- event.select(new AnnotationLiteral<Updated>() {}).fire("");
- }
-
- public void fireWithNoQualifiersViaManager()
- {
- manager.fireEvent("");
- }
-
- public void fireWithUpdatedQualifierViaManager()
- {
- manager.fireEvent("", new AnnotationLiteral<Updated>() {});
- }
-
- public void fireWithUpdatedQualifierViaAnnotation()
- {
- updatedEvent.fire("");
- }
-
- public void reset()
- {
- unqualifiedObserved = false;
- updatedObserved = false;
- }
-
- public void onEvent(@Observes String event)
- {
- unqualifiedObserved = true;
- }
-
- private void onUpdatedEvent(@Observes @Updated String event)
- {
- updatedObserved = true;
- }
-
- public boolean isUnqualifiedObserved()
- {
- return unqualifiedObserved;
- }
-
- public boolean isUpdatedObserved()
- {
- return updatedObserved;
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class EventQualifierTest extends AbstractWeldTest
-{
-
- @Test(description="WELD-226")
- public void testDefaultQualifierNotRequired()
- {
- Bar bar = getReference(Bar.class);
- bar.fireWithNoQualifiers();
- assert bar.isUnqualifiedObserved();
- assert !bar.isUpdatedObserved();
- bar.reset();
- bar.fireWithNoQualifiersViaManager();
- assert bar.isUnqualifiedObserved();
- assert !bar.isUpdatedObserved();
- bar.reset();
- bar.fireWithUpdatedQualifierViaAnnotation();
- assert bar.isUnqualifiedObserved();
- assert bar.isUpdatedObserved();
- bar.reset();
- bar.fireWithUpdatedQualifierViaManager();
- assert bar.isUpdatedObserved();
- assert bar.isUnqualifiedObserved();
- bar.reset();
- bar.fireWithUpdatedQualifierViaSelect();
- assert bar.isUnqualifiedObserved();
- assert bar.isUpdatedObserved();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Foo.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
-
-public class Foo
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,32 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.event.Event;
-import javax.enterprise.inject.Any;
-
-@SessionScoped
-public class NormalScopedBean implements Serializable
-{
-
- @Any Event<Foo> event;
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,152 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
-
-import javax.enterprise.event.Event;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.Any;
-import javax.enterprise.util.AnnotationLiteral;
-import javax.inject.Inject;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.manager.BeanManagerImpl;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class SimpleEventTest extends AbstractWeldTest
-{
- private static boolean RECEIVE_1_OBSERVED;
- private static boolean RECEIVE_2_OBSERVED;
- private static boolean RECEIVE_3_OBSERVED;
-
- private static void initFlags() {
- RECEIVE_1_OBSERVED = false;
- RECEIVE_2_OBSERVED = false;
- RECEIVE_3_OBSERVED = false;
- }
-
- @Test
- public void testFireEventOnManager()
- {
- BeanManagerImpl manager = getCurrentManager();
-
- initFlags();
-
- manager.fireEvent("Fired using Manager Interface with AnnotationLiteral.", new AnnotationLiteral<Updated>(){});
-
- assert RECEIVE_1_OBSERVED == true;
- assert RECEIVE_2_OBSERVED == true;
- assert RECEIVE_3_OBSERVED == true;
-
- initFlags();
-
- manager.fireEvent("Fired using Manager Interface.");
-
- assert RECEIVE_1_OBSERVED == false; // not called
- assert RECEIVE_2_OBSERVED == true;
- assert RECEIVE_3_OBSERVED == true;
- }
-
- @Test
- public void testFireEventOnEvent()
- {
- App app = getReference(App.class);
-
- initFlags();
-
- app.fireEventByBindingDeclaredAtInjectionPoint();
-
- assert RECEIVE_1_OBSERVED == true;
- assert RECEIVE_2_OBSERVED == true;
- assert RECEIVE_3_OBSERVED == true;
-
- initFlags();
-
- app.fireEventByAnnotationLiteral();
-
- assert RECEIVE_1_OBSERVED == true;
- assert RECEIVE_2_OBSERVED == true;
- assert RECEIVE_3_OBSERVED == true;
-
- initFlags();
-
- app.fireEventViaAny();
-
- assert RECEIVE_2_OBSERVED == true;
- assert RECEIVE_1_OBSERVED == false; // not called
- assert RECEIVE_3_OBSERVED == true;
-
- initFlags();
-
- app.fireEventViaWithNoQualifier();
-
- assert RECEIVE_1_OBSERVED == false; // not called
- assert RECEIVE_2_OBSERVED == true;
- assert RECEIVE_3_OBSERVED == true;
- }
-
- public static class App
- {
- @Inject @Any
- Event<String> event1;
-
- @Inject @Updated
- Event<String> event2;
-
- @Inject
- Event<String> event4;
-
- public void fireEventByAnnotationLiteral()
- {
- event1.select(new AnnotationLiteral<Updated>(){}).fire("Fired using Event Interface with AnnotationLiteral.");
- }
-
- public void fireEventByBindingDeclaredAtInjectionPoint()
- {
- event2.fire("Fired using Event Interface with Binding Declared.");
- }
-
- public void fireEventViaAny()
- {
- event1.fire("Fired using Event Interface");
- }
-
- public void fireEventViaWithNoQualifier()
- {
- event4.fire("Fired using Event Interface with no qualifier");
- }
- }
-
- public static class Receiver
- {
- public void receive1(@Observes @Updated String s)
- {
- RECEIVE_1_OBSERVED = true;
- }
-
- public void receive2(@Any @Observes String s)
- {
- RECEIVE_2_OBSERVED = true;
- }
-
- public void receive3(@Observes String s)
- {
- RECEIVE_3_OBSERVED = true;
- }
- }
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Updated.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Updated.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Updated.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-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.Qualifier;
-
-@Qualifier
-@Retention(RUNTIME)
-@Target( { TYPE, METHOD, FIELD, PARAMETER })
-@Documented
-@interface Updated
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,27 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-public class Capercaillie
-{
-
- public Capercaillie(String name)
- {
- // TODO Auto-generated constructor stub
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Cow.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Cow.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Cow.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-import javax.ejb.Stateless;
-
-@Stateless
-public class Cow implements CowLocal
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,25 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-import javax.ejb.Local;
-
-@Local
-public interface CowLocal
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,295 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.AfterDeploymentValidation;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import javax.enterprise.inject.spi.ProcessBean;
-import javax.enterprise.inject.spi.ProcessInjectionTarget;
-import javax.enterprise.inject.spi.ProcessManagedBean;
-import javax.enterprise.inject.spi.ProcessObserverMethod;
-import javax.enterprise.inject.spi.ProcessProducer;
-import javax.enterprise.inject.spi.ProcessProducerField;
-import javax.enterprise.inject.spi.ProcessProducerMethod;
-import javax.enterprise.inject.spi.ProcessSessionBean;
-
-public class ExtensionObserver implements Extension
-{
-
- private boolean allBeforeBeanDiscovery;
- private boolean allAfterBeanDiscovery;
- private boolean allAfterDeploymentValidation;
- private boolean allProcessBean;
- private boolean allProcessInjectionTarget;
- private boolean allProcessManagedBean;
- private boolean allProcessObserverMethod;
- private boolean allProcessProducer;
- private boolean allProcessProducerField;
- private boolean allProcessProducerMethod;
- private boolean allProcessSessionBean;
- private boolean allProcessAnnnotatedType;
-
- private boolean beforeBeanDiscovery;
- private boolean afterBeanDiscovery;
- private boolean afterDeploymentValidation;
- private boolean processBean;
- private boolean processInjectionTarget;
- private boolean processManagedBean;
- private boolean processObserverMethod;
- private boolean processProducer;
- private boolean processProducerField;
- private boolean processProducerMethod;
- private boolean processSessionBean;
- private boolean processAnnotatedType;
-
- public void observeAll(@Observes Object event)
- {
- if (event instanceof BeforeBeanDiscovery)
- {
- allBeforeBeanDiscovery = true;
- }
- if (event instanceof AfterBeanDiscovery)
- {
- allAfterBeanDiscovery = true;
- }
- if (event instanceof AfterDeploymentValidation)
- {
- allAfterDeploymentValidation = true;
- }
- if (event instanceof ProcessBean<?> && !(event instanceof ProcessProducerField<?, ?> || event instanceof ProcessProducerMethod<?, ?> || event instanceof ProcessManagedBean<?> || event instanceof ProcessSessionBean<?>))
- {
- allProcessBean = true;
- }
- if (event instanceof ProcessInjectionTarget<?>)
- {
- allProcessInjectionTarget = true;
- }
- if (event instanceof ProcessManagedBean<?>)
- {
- allProcessManagedBean = true;
- }
- if (event instanceof ProcessObserverMethod<?, ?>)
- {
- allProcessObserverMethod = true;
- }
- if (event instanceof ProcessProducer<?, ?>)
- {
- allProcessProducer = true;
- }
- if (event instanceof ProcessProducerField<?, ?>)
- {
- allProcessProducerField = true;
- }
- if (event instanceof ProcessProducerMethod<?, ?>)
- {
- allProcessProducerMethod = true;
- }
- if (event instanceof ProcessSessionBean<?>)
- {
- allProcessSessionBean = true;
- }
- if (event instanceof ProcessAnnotatedType<?>)
- {
- allProcessAnnnotatedType = true;
- }
- }
-
- public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery event)
- {
- beforeBeanDiscovery = true;
- }
-
- public void observeAfterBeanDiscovery(@Observes AfterBeanDiscovery event)
- {
- afterBeanDiscovery = true;
- }
-
- public void observeAfterDeploymentValidation(@Observes AfterDeploymentValidation event)
- {
- afterDeploymentValidation = true;
- }
-
- public void observeProcessBean(@Observes ProcessBean<?> event)
- {
- processBean = true;
- }
-
- public void observeProcessInjectionTarget(@Observes ProcessInjectionTarget<?> event)
- {
- processInjectionTarget = true;
- }
-
- public void observeProcessProducer(@Observes ProcessProducer<?, ?> event)
- {
- processProducer = true;
- }
-
- public void observeProcessProducerMethod(@Observes ProcessProducerMethod<?, ?> event)
- {
- processProducerMethod = true;
- }
-
- public void observeProcessProducerField(@Observes ProcessProducerField<?, ?> event)
- {
- processProducerField = true;
- }
-
- public void observeProcessObserverMethod(@Observes ProcessObserverMethod<?, ?> event)
- {
- processObserverMethod = true;
- }
-
- public void observeProcessManagedBean(@Observes ProcessManagedBean<?> event)
- {
- processManagedBean = true;
- }
-
- public void observeProcessSessionBean(@Observes ProcessSessionBean<?> event)
- {
- processSessionBean = true;
- }
-
- public void observeProcessAnnotatedType(@Observes ProcessAnnotatedType<?> event)
- {
- processAnnotatedType = true;
- }
-
- public boolean isAllBeforeBeanDiscovery()
- {
- return allBeforeBeanDiscovery;
- }
-
- public boolean isAllAfterBeanDiscovery()
- {
- return allAfterBeanDiscovery;
- }
-
- public boolean isAllAfterDeploymentValidation()
- {
- return allAfterDeploymentValidation;
- }
-
- public boolean isAllProcessBean()
- {
- return allProcessBean;
- }
-
- public boolean isAllProcessInjectionTarget()
- {
- return allProcessInjectionTarget;
- }
-
- public boolean isAllProcessManagedBean()
- {
- return allProcessManagedBean;
- }
-
- public boolean isAllProcessObserverMethod()
- {
- return allProcessObserverMethod;
- }
-
- public boolean isAllProcessProducer()
- {
- return allProcessProducer;
- }
-
- public boolean isAllProcessProducerField()
- {
- return allProcessProducerField;
- }
-
- public boolean isAllProcessProducerMethod()
- {
- return allProcessProducerMethod;
- }
-
- public boolean isAllProcessSessionBean()
- {
- return allProcessSessionBean;
- }
-
- public boolean isAllProcessAnnnotatedType()
- {
- return allProcessAnnnotatedType;
- }
-
- public boolean isBeforeBeanDiscovery()
- {
- return beforeBeanDiscovery;
- }
-
- public boolean isAfterBeanDiscovery()
- {
- return afterBeanDiscovery;
- }
-
- public boolean isAfterDeploymentValidation()
- {
- return afterDeploymentValidation;
- }
-
- public boolean isProcessBean()
- {
- return processBean;
- }
-
- public boolean isProcessInjectionTarget()
- {
- return processInjectionTarget;
- }
-
- public boolean isProcessManagedBean()
- {
- return processManagedBean;
- }
-
- public boolean isProcessObserverMethod()
- {
- return processObserverMethod;
- }
-
- public boolean isProcessProducer()
- {
- return processProducer;
- }
-
- public boolean isProcessProducerField()
- {
- return processProducerField;
- }
-
- public boolean isProcessProducerMethod()
- {
- return processProducerMethod;
- }
-
- public boolean isProcessSessionBean()
- {
- return processSessionBean;
- }
-
- public boolean isProcessAnnotatedType()
- {
- return processAnnotatedType;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.jsr299.Extension;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-@IntegrationTest
-(a)Packaging(PackagingType.EAR)
-@Extension("javax.enterprise.inject.spi.Extension")
-public class ExtensionTest extends AbstractWeldTest
-{
-
- @Test(description="WELD-234")
- public void testExtensionInjectableAsBean()
- {
- assert getReference(SimpleExtension.class).isObservedBeforeBeanDiscovery();
- }
-
- @Test(description="WELD-243")
- public void testContainerEventsOnlySentToExtensionBeans()
- {
- ExtensionObserver extensionObserver = getReference(ExtensionObserver.class);
- OtherObserver otherObserver = getReference(OtherObserver.class);
-
- assert extensionObserver.isBeforeBeanDiscovery();
- assert extensionObserver.isAllBeforeBeanDiscovery();
- assert !otherObserver.isBeforeBeanDiscovery();
- assert !otherObserver.isAllBeforeBeanDiscovery();
-
- assert extensionObserver.isAfterBeanDiscovery();
- assert extensionObserver.isAllAfterBeanDiscovery();
- assert !otherObserver.isAfterBeanDiscovery();
- assert !otherObserver.isAllAfterBeanDiscovery();
-
- assert extensionObserver.isProcessAnnotatedType();
- assert extensionObserver.isAllProcessAnnnotatedType();
- assert !otherObserver.isProcessAnnotatedType();
- assert !otherObserver.isAllProcessAnnotatedType();
-
- assert extensionObserver.isProcessBean();
- assert extensionObserver.isAllProcessBean();
- assert !otherObserver.isProcessBean();
- assert !otherObserver.isAllProcessBean();
-
- assert extensionObserver.isProcessInjectionTarget();
- assert extensionObserver.isAllProcessInjectionTarget();
- assert !otherObserver.isProcessInjectionTarget();
- assert !otherObserver.isAllProcessInjectionTarget();
-
- assert extensionObserver.isProcessManagedBean();
- assert extensionObserver.isAllProcessManagedBean();
- assert !otherObserver.isProcessManagedBean();
- assert !otherObserver.isAllProcessManagedBean();
-
- assert extensionObserver.isProcessObserverMethod();
- assert extensionObserver.isAllProcessObserverMethod();
- assert !otherObserver.isProcessObserverMethod();
- assert !otherObserver.isAllProcessObserverMethod();
-
- assert extensionObserver.isProcessProducer();
- assert extensionObserver.isAllProcessProducer();
- assert !otherObserver.isProcessProducer();
- assert !otherObserver.isAllProcessProducer();
-
- assert extensionObserver.isProcessProducerField();
- assert extensionObserver.isAllProcessProducerField();
- assert !otherObserver.isProcessProducerField();
- assert !otherObserver.isAllProcessProducerField();
-
- assert extensionObserver.isProcessProducerMethod();
- assert extensionObserver.isAllProcessProducerField();
- assert !otherObserver.isProcessProducerMethod();
- assert !otherObserver.isAllProcessProducerMethod();
-
- assert extensionObserver.isProcessSessionBean();
- assert extensionObserver.isAllProcessSessionBean();
- assert !otherObserver.isProcessSessionBean();
- assert !otherObserver.isAllProcessSessionBean();
-
- assert extensionObserver.isAfterDeploymentValidation();
- assert extensionObserver.isAllAfterDeploymentValidation();
- assert !otherObserver.isAfterDeploymentValidation();
- assert !otherObserver.isAllAfterDeploymentValidation();
-
- }
-
- @Test
- public void testInjectionTargetWrapped()
- {
- getReference(Capercaillie.class);
- assert Woodland.isPostConstructCalled();
- assert WoodlandExtension.isInjectCalled();
- assert WoodlandExtension.isPostConstructCalled();
- assert WoodlandExtension.isPreDestroyCalled();
- assert WoodlandExtension.isProduceCalled();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Foo.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-import javax.inject.Inject;
-
-public class Foo
-{
-
- @Inject SimpleExtension simpleExtension;
-
- public SimpleExtension getSimpleExtension()
- {
- return simpleExtension;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Horse.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Horse.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Horse.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-public class Horse
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,296 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.AfterDeploymentValidation;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import javax.enterprise.inject.spi.ProcessBean;
-import javax.enterprise.inject.spi.ProcessInjectionTarget;
-import javax.enterprise.inject.spi.ProcessManagedBean;
-import javax.enterprise.inject.spi.ProcessObserverMethod;
-import javax.enterprise.inject.spi.ProcessProducer;
-import javax.enterprise.inject.spi.ProcessProducerField;
-import javax.enterprise.inject.spi.ProcessProducerMethod;
-import javax.enterprise.inject.spi.ProcessSessionBean;
-
-@ApplicationScoped
-public class OtherObserver
-{
-
- private boolean allBeforeBeanDiscovery;
- private boolean allAfterBeanDiscovery;
- private boolean allAfterDeploymentValidation;
- private boolean allProcessBean;
- private boolean allProcessInjectionTarget;
- private boolean allProcessManagedBean;
- private boolean allProcessObserverMethod;
- private boolean allProcessProducer;
- private boolean allProcessProducerField;
- private boolean allProcessProducerMethod;
- private boolean allProcessSession;
- private boolean allProcessAnnotatedType;
-
- private boolean beforeBeanDiscovery;
- private boolean afterBeanDiscovery;
- private boolean afterDeploymentValidation;
- private boolean processBean;
- private boolean processInjectionTarget;
- private boolean processManagedBean;
- private boolean processObserverMethod;
- private boolean processProducer;
- private boolean processProducerField;
- private boolean processProducerMethod;
- private boolean processSessionBean;
- private boolean processAnnotatedType;
-
- public void observeAll(@Observes Object event)
- {
- if (event instanceof BeforeBeanDiscovery)
- {
- allBeforeBeanDiscovery = true;
- }
- if (event instanceof AfterBeanDiscovery)
- {
- allAfterBeanDiscovery = true;
- }
- if (event instanceof AfterDeploymentValidation)
- {
- allAfterDeploymentValidation = true;
- }
- if (event instanceof ProcessBean<?> && !(event instanceof ProcessProducerField<?, ?> || event instanceof ProcessProducerMethod<?, ?> || event instanceof ProcessManagedBean<?> || event instanceof ProcessSessionBean<?>))
- {
- allProcessBean = true;
- }
- if (event instanceof ProcessInjectionTarget<?>)
- {
- allProcessInjectionTarget = true;
- }
- if (event instanceof ProcessManagedBean<?>)
- {
- allProcessManagedBean = true;
- }
- if (event instanceof ProcessObserverMethod<?, ?>)
- {
- allProcessObserverMethod = true;
- }
- if (event instanceof ProcessProducer<?, ?>)
- {
- allProcessProducer = true;
- }
- if (event instanceof ProcessProducerField<?, ?>)
- {
- allProcessProducerField = true;
- }
- if (event instanceof ProcessProducerMethod<?, ?>)
- {
- allProcessProducerMethod = true;
- }
- if (event instanceof ProcessSessionBean<?>)
- {
- allProcessSession = true;
- }
- if (event instanceof ProcessAnnotatedType<?>)
- {
- allProcessAnnotatedType = true;
- }
- }
-
- public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery event)
- {
- beforeBeanDiscovery = true;
- }
-
- public void observeAfterBeanDiscovery(@Observes AfterBeanDiscovery event)
- {
- afterBeanDiscovery = true;
- }
-
- public void observeAfterDeploymentValidation(@Observes AfterDeploymentValidation event)
- {
- afterDeploymentValidation = true;
- }
-
- public void observeProcessBean(@Observes ProcessBean<?> event)
- {
- processBean = true;
- }
-
- public void observeProcessInjectionTarget(@Observes ProcessInjectionTarget<?> event)
- {
- processInjectionTarget = true;
- }
-
- public void observeProcessProducer(@Observes ProcessProducer<?, ?> event)
- {
- processProducer = true;
- }
-
- public void observeProcessProducerMethod(@Observes ProcessProducerMethod<?, ?> event)
- {
- processProducerMethod = true;
- }
-
- public void observeProcessProducerField(@Observes ProcessProducerField<?, ?> event)
- {
- processProducerField = true;
- }
-
- public void observeProcessObserverMethod(@Observes ProcessObserverMethod<?, ?> event)
- {
- processObserverMethod = true;
- }
-
- public void observeProcessManagedBean(@Observes ProcessManagedBean<?> event)
- {
- processManagedBean = true;
- }
-
- public void observeProcessSessionBean(@Observes ProcessSessionBean<?> event)
- {
- processSessionBean = true;
- }
-
- public void observeProcessAnnotatedType(@Observes ProcessAnnotatedType<?> event)
- {
- processAnnotatedType = true;
- }
-
- public boolean isAllBeforeBeanDiscovery()
- {
- return allBeforeBeanDiscovery;
- }
-
- public boolean isAllAfterBeanDiscovery()
- {
- return allAfterBeanDiscovery;
- }
-
- public boolean isAllAfterDeploymentValidation()
- {
- return allAfterDeploymentValidation;
- }
-
- public boolean isAllProcessBean()
- {
- return allProcessBean;
- }
-
- public boolean isAllProcessInjectionTarget()
- {
- return allProcessInjectionTarget;
- }
-
- public boolean isAllProcessManagedBean()
- {
- return allProcessManagedBean;
- }
-
- public boolean isAllProcessObserverMethod()
- {
- return allProcessObserverMethod;
- }
-
- public boolean isAllProcessProducer()
- {
- return allProcessProducer;
- }
-
- public boolean isAllProcessProducerField()
- {
- return allProcessProducerField;
- }
-
- public boolean isAllProcessProducerMethod()
- {
- return allProcessProducerMethod;
- }
-
- public boolean isAllProcessSessionBean()
- {
- return allProcessSession;
- }
-
- public boolean isAllProcessAnnotatedType()
- {
- return allProcessAnnotatedType;
- }
-
- public boolean isBeforeBeanDiscovery()
- {
- return beforeBeanDiscovery;
- }
-
- public boolean isAfterBeanDiscovery()
- {
- return afterBeanDiscovery;
- }
-
- public boolean isAfterDeploymentValidation()
- {
- return afterDeploymentValidation;
- }
-
- public boolean isProcessBean()
- {
- return processBean;
- }
-
- public boolean isProcessInjectionTarget()
- {
- return processInjectionTarget;
- }
-
- public boolean isProcessManagedBean()
- {
- return processManagedBean;
- }
-
- public boolean isProcessObserverMethod()
- {
- return processObserverMethod;
- }
-
- public boolean isProcessProducer()
- {
- return processProducer;
- }
-
- public boolean isProcessProducerField()
- {
- return processProducerField;
- }
-
- public boolean isProcessProducerMethod()
- {
- return processProducerMethod;
- }
-
- public boolean isProcessSessionBean()
- {
- return processSessionBean;
- }
-
- public boolean isProcessAnnotatedType()
- {
- return processAnnotatedType;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Rat.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Rat.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Rat.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-public class Rat
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import javax.enterprise.inject.spi.BeforeShutdown;
-import javax.enterprise.inject.spi.Extension;
-
-
-public class SimpleExtension implements Extension
-{
-
- private static boolean observedBeforeBeanDiscovery;
-
- public void observe(@Observes BeforeBeanDiscovery event)
- {
- observedBeforeBeanDiscovery = true;
- }
-
- public static boolean isObservedBeforeBeanDiscovery()
- {
- return observedBeforeBeanDiscovery;
- }
-
- public void observeBeforeShutdown(@Observes BeforeShutdown beforeShutdown, BeanManager beanManager)
- {
- assert beanManager != null;
- assert beanManager.getELResolver() != null;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Special.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Special.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Special.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target({FIELD, METHOD, TYPE, PARAMETER})
-public @interface Special
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Stable.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Stable.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Stable.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-import javax.enterprise.inject.Produces;
-
-public class Stable
-{
-
- @Produces @Special Rat rat = new Rat();
-
- @Produces @Special Horse produce()
- {
- return new Horse();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Woodland.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Woodland.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Woodland.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.inject.Produces;
-
-public class Woodland
-{
-
- private static boolean postConstructCalled;
-
- @Produces
- private Capercaillie capercaillie = new Capercaillie("bob");
-
- @PostConstruct
- public void postConstruct()
- {
- postConstructCalled = true;
- }
-
- public static boolean isPostConstructCalled()
- {
- return postConstructCalled;
- }
-
- public static void reset()
- {
- postConstructCalled = false;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,115 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
-
-import java.util.Set;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.BeforeShutdown;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.enterprise.inject.spi.InjectionTarget;
-import javax.enterprise.inject.spi.ProcessInjectionTarget;
-
-public class WoodlandExtension implements Extension
-{
-
- private static boolean injectCalled;
- private static boolean postConstructCalled;
- private static boolean preDestroyCalled;
- private static boolean produceCalled;
-
- public void cleanup(@Observes BeforeShutdown shutdown)
- {
- reset();
- Woodland.reset();
- }
-
- public void enhanceWoodland(final @Observes ProcessInjectionTarget<Woodland> processWoodland)
- {
- final InjectionTarget<Woodland> it = processWoodland.getInjectionTarget();
- processWoodland.setInjectionTarget(new InjectionTarget<Woodland>()
- {
-
- public void inject(Woodland instance, CreationalContext<Woodland> ctx)
- {
- injectCalled = true;
- it.inject(instance, ctx);
- }
-
- public void postConstruct(Woodland instance)
- {
- postConstructCalled = true;
- it.postConstruct(instance);
- }
-
- public void preDestroy(Woodland instance)
- {
- preDestroyCalled = true;
- it.preDestroy(instance);
- }
-
- public void dispose(Woodland instance)
- {
- // No-op for class bean
-
- }
-
- public Set<InjectionPoint> getInjectionPoints()
- {
- return it.getInjectionPoints();
- }
-
- public Woodland produce(CreationalContext<Woodland> ctx)
- {
- produceCalled = true;
- return it.produce(ctx);
- }
-
- });
- }
-
- public static void reset()
- {
- injectCalled = false;
- postConstructCalled = false;
- preDestroyCalled = false;
- preDestroyCalled = false;
- }
-
- public static boolean isInjectCalled()
- {
- return injectCalled;
- }
-
- public static boolean isPostConstructCalled()
- {
- return postConstructCalled;
- }
-
- public static boolean isPreDestroyCalled()
- {
- return preDestroyCalled;
- }
-
- public static boolean isProduceCalled()
- {
- return produceCalled;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,563 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AnnotatedCallable;
-import javax.enterprise.inject.spi.AnnotatedConstructor;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.BeforeBeanDiscovery;
-import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import javax.inject.Inject;
-
-import org.jboss.weld.tests.extensions.annotatedType.EcoFriendlyWashingMachine.EcoFriendlyWashingMachineLiteral;
-import org.jboss.weld.util.collections.Arrays2;
-
-public class AnnotatedTypeExtension implements Extension
-{
-
- public void addTumbleDryer(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
- {
-
- final Set<AnnotatedConstructor<TumbleDryer>> constructors = new HashSet<AnnotatedConstructor<TumbleDryer>>();
- final Set<AnnotatedField<? super TumbleDryer>> fields = new HashSet<AnnotatedField<? super TumbleDryer>>();
- final Set<AnnotatedMethod<? super TumbleDryer>> methods = new HashSet<AnnotatedMethod<? super TumbleDryer>>();
-
- final AnnotatedType<TumbleDryer> tumbleDryer = new AnnotatedType<TumbleDryer>()
- {
-
- public Set<AnnotatedConstructor<TumbleDryer>> getConstructors()
- {
- return constructors;
- }
-
- public Set<AnnotatedField<? super TumbleDryer>> getFields()
- {
- return fields;
- }
-
- public Set<AnnotatedMethod<? super TumbleDryer>> getMethods()
- {
- return methods;
- }
-
- // Now the easy stuff
-
- public Class<TumbleDryer> getJavaClass()
- {
- return TumbleDryer.class;
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- // Class has no annotations
- return null;
- }
-
- public Set<Annotation> getAnnotations()
- {
- return Collections.emptySet();
- }
-
- public Type getBaseType()
- {
- return TumbleDryer.class;
- }
-
- public Set<Type> getTypeClosure()
- {
- return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- // Class has no annotations
- return false;
- }
-
- };
-
- AnnotatedField<TumbleDryer> plug = new AnnotatedField<TumbleDryer>()
- {
-
- public Field getJavaMember()
- {
- try
- {
- return TumbleDryer.class.getDeclaredField("plug");
- }
- catch (NoSuchFieldException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public boolean isStatic()
- {
- return false;
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- if (annotationType.equals(Inject.class))
- {
- return annotationType.cast(InjectLiteral.INSTANCE);
- }
- else if (annotationType.equals(Special.class))
- {
- return annotationType.cast(SpecialLiteral.INSTANCE);
- }
- else
- {
- return null;
- }
- }
-
- public Set<Annotation> getAnnotations()
- {
- return Arrays2.asSet(InjectLiteral.INSTANCE, SpecialLiteral.INSTANCE);
- }
-
- public Type getBaseType()
- {
- return Plug.class;
- }
-
- public Set<Type> getTypeClosure()
- {
- return Arrays2.<Type>asSet(Plug.class, Object.class);
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- if (annotationType.equals(Inject.class) || annotationType.equals(Special.class))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- public AnnotatedType<TumbleDryer> getDeclaringType()
- {
- return tumbleDryer;
- }
- };
- fields.add(plug);
-
-
- final List<AnnotatedParameter<TumbleDryer>> runningTimeParameters = new ArrayList<AnnotatedParameter<TumbleDryer>>();
- final AnnotatedMethod<TumbleDryer> runningTimeMethod = new AnnotatedMethod<TumbleDryer>()
- {
-
- public Method getJavaMember()
- {
- try
- {
- return TumbleDryer.class.getDeclaredMethod("setRunningTime", RunningTime.class);
- }
- catch (NoSuchMethodException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public List<AnnotatedParameter<TumbleDryer>> getParameters()
- {
- return runningTimeParameters;
- }
-
- public AnnotatedType<TumbleDryer> getDeclaringType()
- {
- return tumbleDryer;
- }
-
- public boolean isStatic()
- {
- return false;
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- if (annotationType.equals(Inject.class))
- {
- return annotationType.cast(InjectLiteral.INSTANCE);
- }
- else
- {
- return null;
- }
- }
-
- public Set<Annotation> getAnnotations()
- {
- return Collections.<Annotation>singleton(InjectLiteral.INSTANCE);
- }
-
- public Type getBaseType()
- {
- return TumbleDryer.class;
- }
-
- public Set<Type> getTypeClosure()
- {
- return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- if (annotationType.equals(Inject.class))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
-
- };
- methods.add(runningTimeMethod);
-
- final AnnotatedParameter<TumbleDryer> runningTimeParameter = new AnnotatedParameter<TumbleDryer>()
- {
-
- public AnnotatedCallable<TumbleDryer> getDeclaringCallable()
- {
- return runningTimeMethod;
- }
-
- public int getPosition()
- {
- return 0;
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- if (annotationType.equals(Special.class))
- {
- return annotationType.cast(SpecialLiteral.INSTANCE);
- }
- else
- {
- return null;
- }
- }
-
- public Set<Annotation> getAnnotations()
- {
- return Collections.<Annotation>singleton(SpecialLiteral.INSTANCE);
- }
-
- public Type getBaseType()
- {
- return RunningTime.class;
- }
-
- public Set<Type> getTypeClosure()
- {
- return Collections.<Type>singleton(RunningTime.class);
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- if (annotationType.equals(Special.class))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- };
- runningTimeParameters.add(runningTimeParameter);
-
- final List<AnnotatedParameter<TumbleDryer>> clothesParameters = new ArrayList<AnnotatedParameter<TumbleDryer>>();
- final AnnotatedConstructor<TumbleDryer> clothesConstructor = new AnnotatedConstructor<TumbleDryer>()
- {
-
- public Constructor<TumbleDryer> getJavaMember()
- {
- try
- {
- return TumbleDryer.class.getDeclaredConstructor(Clothes.class);
- }
- catch (NoSuchMethodException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public List<AnnotatedParameter<TumbleDryer>> getParameters()
- {
- return clothesParameters;
- }
-
- public AnnotatedType<TumbleDryer> getDeclaringType()
- {
- return tumbleDryer;
- }
-
- public boolean isStatic()
- {
- return false;
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- if (annotationType.equals(Inject.class))
- {
- return annotationType.cast(InjectLiteral.INSTANCE);
- }
- else
- {
- return null;
- }
- }
-
- public Set<Annotation> getAnnotations()
- {
- return Collections.<Annotation>singleton(InjectLiteral.INSTANCE);
- }
-
- public Type getBaseType()
- {
- return TumbleDryer.class;
- }
-
- public Set<Type> getTypeClosure()
- {
- return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- if (annotationType.equals(Inject.class))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- };
- constructors.add(clothesConstructor);
-
- AnnotatedParameter<TumbleDryer> clothesParameter = new AnnotatedParameter<TumbleDryer>()
- {
-
- public AnnotatedCallable<TumbleDryer> getDeclaringCallable()
- {
- return clothesConstructor;
- }
-
- public int getPosition()
- {
- return 0;
- }
-
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- if (annotationType.equals(Special.class))
- {
- return annotationType.cast(SpecialLiteral.INSTANCE);
- }
- else
- {
- return null;
- }
- }
-
- public Set<Annotation> getAnnotations()
- {
- return Collections.<Annotation>singleton(SpecialLiteral.INSTANCE);
- }
-
- public Type getBaseType()
- {
- return Clothes.class;
- }
-
- public Set<Type> getTypeClosure()
- {
- return Arrays2.<Type>asSet(Clothes.class, Object.class);
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- if (annotationType.equals(Special.class))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- };
- clothesParameters.add(clothesParameter);
-
- beforeBeanDiscovery.addAnnotatedType(tumbleDryer);
- }
-
- /**
- * Adds an eco friendly wasing machine
- * @param beforeBeanDiscovery
- */
- public void addWashingMachine(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
- {
- final Set<AnnotatedConstructor<WashingMachine>> constructors = new HashSet<AnnotatedConstructor<WashingMachine>>();
- final AnnotatedType<WashingMachine> type = new AnnotatedType<WashingMachine>()
- {
-
- public Set<AnnotatedConstructor<WashingMachine>> getConstructors()
- {
- return constructors;
- }
-
- public Set<AnnotatedField<? super WashingMachine>> getFields()
- {
- return Collections.emptySet();
- }
-
- public Class<WashingMachine> getJavaClass()
- {
- return WashingMachine.class;
- }
-
- public Set<AnnotatedMethod<? super WashingMachine>> getMethods()
- {
- return Collections.emptySet();
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- if(annotationType == EcoFriendlyWashingMachine.class)
- {
- return annotationType.cast(EcoFriendlyWashingMachineLiteral.INSTANCE);
- }
- return null;
- }
-
- public Set<Annotation> getAnnotations()
- {
- return Collections.<Annotation>singleton(EcoFriendlyWashingMachineLiteral.INSTANCE);
- }
-
- public Type getBaseType()
- {
- return WashingMachine.class;
- }
-
- public Set<Type> getTypeClosure()
- {
- return Arrays2.<Type>asSet(WashingMachine.class, Object.class);
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- return annotationType == EcoFriendlyWashingMachine.class;
- }
-
- };
-
- final AnnotatedConstructor<WashingMachine> constructor = new AnnotatedConstructor<WashingMachine>()
- {
-
- public Constructor<WashingMachine> getJavaMember()
- {
- try
- {
- return WashingMachine.class.getDeclaredConstructor();
- }
- catch (NoSuchMethodException e)
- {
- throw new RuntimeException(e);
- }
- }
-
- public List<AnnotatedParameter<WashingMachine>> getParameters()
- {
- return Collections.emptyList();
- }
-
- public AnnotatedType<WashingMachine> getDeclaringType()
- {
- return type;
- }
-
- public boolean isStatic()
- {
- return false;
- }
-
- public <T extends Annotation> T getAnnotation(Class<T> annotationType)
- {
- return null;
- }
-
- public Set<Annotation> getAnnotations()
- {
- return Collections.emptySet();
- }
-
- public Type getBaseType()
- {
- return WashingMachine.class;
- }
-
- public Set<Type> getTypeClosure()
- {
- return Arrays2.<Type>asSet(WashingMachine.class, Object.class);
- }
-
- public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
- {
- return false;
- }
- };
- constructors.add(constructor);
-
- beforeBeanDiscovery.addAnnotatedType(type);
- }
-
- public void vetoOriginalTumbleDryer(@Observes ProcessAnnotatedType<TumbleDryer> event)
- {
- event.veto();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,157 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Set;
-
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.spi.AnnotatedConstructor;
-import javax.enterprise.inject.spi.AnnotatedField;
-import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedParameter;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.jsr299.Extension;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.jboss.weld.test.Utils;
-import org.jboss.weld.tests.extensions.annotatedType.EcoFriendlyWashingMachine.EcoFriendlyWashingMachineLiteral;
-import org.testng.annotations.Test;
-
-@Artifact
-@IntegrationTest
-@Extension("javax.enterprise.inject.spi.Extension")
-public class AnnotatedTypeExtensionTest extends AbstractWeldTest
-{
-
- @Test
- public void testMultipleBeansOfSameType()
- {
- Laundry laundry = getReference(Laundry.class);
- assert laundry.ecoFriendlyWashingMachine != null;
- assert laundry.fastWashingMachine != null;
- }
-
- @Test(description = "WELD-371")
- public void testAnnotationsAreOverridden()
- {
- Bean<WashingMachine> bean = getBean(WashingMachine.class, EcoFriendlyWashingMachineLiteral.INSTANCE);
- assert Utils.annotationSetMatches(bean.getQualifiers(), Any.class, EcoFriendlyWashingMachine.class);
-
- // Verify overriding the class structure works
- Clothes.reset();
- TumbleDryer tumbleDryer = getReference(TumbleDryer.class);
- Bean<TumbleDryer> tumbleDryerBean = getBean(TumbleDryer.class);
- assert tumbleDryer != null;
-
- assert !containsConstructor(tumbleDryerBean.getInjectionPoints(), SerialNumber.class);
- assert containsConstructor(tumbleDryerBean.getInjectionPoints(), Clothes.class);
- assert tumbleDryer.getSerialNumber() == null;
- assert tumbleDryer.getClothes() != null;
- assert !Clothes.getInjectionPoint().getAnnotated().isAnnotationPresent(Original.class);
- AnnotatedConstructor<?> clothesConstructor = getConstructor(tumbleDryerBean.getInjectionPoints(), Clothes.class);
- assert clothesConstructor.getParameters().get(0).isAnnotationPresent(Special.class);
- assert !clothesConstructor.getParameters().get(0).isAnnotationPresent(Original.class);
-
- assert containsField(tumbleDryerBean.getInjectionPoints(), "plug");
- assert !containsField(tumbleDryerBean.getInjectionPoints(), "coins");
- assert tumbleDryer.getPlug() != null;
- assert tumbleDryer.getCoins() == null;
-
- assert containsMethod(tumbleDryerBean.getInjectionPoints(), "setRunningTime", RunningTime.class);
- assert !containsMethod(tumbleDryerBean.getInjectionPoints(), "setHotAir", HotAir.class);
- assert tumbleDryer.getRunningTime() != null;
- assert tumbleDryer.getHotAir() == null;
- AnnotatedMethod<?> runningTimeMethod = getMethod(tumbleDryerBean.getInjectionPoints(), "setRunningTime", RunningTime.class);
- assert runningTimeMethod.getParameters().get(0).isAnnotationPresent(Special.class);
- assert !runningTimeMethod.getParameters().get(0).isAnnotationPresent(Original.class);
- }
-
- private static boolean containsField(Set<InjectionPoint> injectionPoints, String name)
- {
- for (InjectionPoint ip : injectionPoints)
- {
- if (ip.getAnnotated() instanceof AnnotatedField<?>)
- {
- AnnotatedField<?> field = (AnnotatedField<?>) ip.getAnnotated();
- if (field.getJavaMember().getName().equals(name))
- {
- return true;
- }
- }
- }
- return false;
- }
-
- private static boolean containsConstructor(Set<InjectionPoint> injectionPoints, Class<?>... parameters)
- {
- return getConstructor(injectionPoints, parameters) != null;
- }
-
- private static AnnotatedConstructor<?> getConstructor(Set<InjectionPoint> injectionPoints, Class<?>... parameters)
- {
- for (InjectionPoint ip : injectionPoints)
- {
- if (ip.getAnnotated() instanceof AnnotatedParameter<?>)
- {
- AnnotatedParameter<?> param = (AnnotatedParameter<?>) ip.getAnnotated();
- if (param.getDeclaringCallable() instanceof AnnotatedConstructor<?>)
- {
- Class<?>[] parameterTypes = ((Constructor<?>) param.getDeclaringCallable().getJavaMember()).getParameterTypes();
- if (Arrays.equals(parameters, parameterTypes))
- {
- return (AnnotatedConstructor<?>) param.getDeclaringCallable();
- }
- }
- }
- }
- return null;
- }
-
- private static boolean containsMethod(Set<InjectionPoint> injectionPoints, String name, Class<?>... parameters)
- {
- return getMethod(injectionPoints, name, parameters) != null;
- }
-
- private static AnnotatedMethod<?> getMethod(Set<InjectionPoint> injectionPoints, String name, Class<?>... parameters)
- {
- for (InjectionPoint ip : injectionPoints)
- {
- if (ip.getAnnotated() instanceof AnnotatedParameter<?>)
- {
- AnnotatedParameter<?> param = (AnnotatedParameter<?>) ip.getAnnotated();
- if (param.getDeclaringCallable() instanceof AnnotatedMethod<?>)
- {
- Class<?>[] parameterTypes = ((Method) param.getDeclaringCallable().getJavaMember()).getParameterTypes();
- String methodName = param.getDeclaringCallable().getJavaMember().getName();
- if (Arrays.equals(parameters, parameterTypes) && methodName.equals(name))
- {
- return (AnnotatedMethod<?>) param.getDeclaringCallable();
- }
- }
- }
- }
- return null;
- }
-
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Inject;
-
-@Special
-public class Clothes
-{
-
- private static InjectionPoint injectionPoint;
-
- @Inject
- public void setInjectionPoint(InjectionPoint injectionPoint)
- {
- Clothes.injectionPoint = injectionPoint;
- }
-
- public static void reset()
- {
- injectionPoint = null;
- }
-
- public static InjectionPoint getInjectionPoint()
- {
- return injectionPoint;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-public class Coins
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-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.enterprise.util.AnnotationLiteral;
-import javax.inject.Qualifier;
-
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-public @interface EcoFriendlyWashingMachine
-{
-
- @SuppressWarnings("serial")
- public static class EcoFriendlyWashingMachineLiteral extends AnnotationLiteral<EcoFriendlyWashingMachine> implements EcoFriendlyWashingMachine
- {
-
- public static final EcoFriendlyWashingMachine INSTANCE = new EcoFriendlyWashingMachineLiteral();
-
- private EcoFriendlyWashingMachineLiteral() {}
-
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-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.Qualifier;
-
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-public @interface FastWashingMachine
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-public class HotAir
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-import javax.enterprise.util.AnnotationLiteral;
-import javax.inject.Inject;
-
-public class InjectLiteral extends AnnotationLiteral<Inject> implements Inject
-{
-
- public static final Inject INSTANCE = new InjectLiteral();
-
- private InjectLiteral() {}
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-import javax.inject.Inject;
-
-public class Laundry
-{
- @Inject @FastWashingMachine
- public WashingMachine fastWashingMachine;
-
- @Inject @EcoFriendlyWashingMachine
- public WashingMachine ecoFriendlyWashingMachine;
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-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.Qualifier;
-
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-public @interface Original
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,23 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-@Special
-public class Plug
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,23 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-@Special
-public class RunningTime
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-public class SerialNumber
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-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.Qualifier;
-
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-public @interface Special
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-import javax.enterprise.util.AnnotationLiteral;
-
-public class SpecialLiteral extends AnnotationLiteral<Special> implements Special
-{
-
- public static final Special INSTANCE = new SpecialLiteral();
-
- private SpecialLiteral() {}
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,93 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-import javax.inject.Inject;
-
-
-public class TumbleDryer
-{
-
-
- private Plug plug;
-
- @Inject @Original
- private Coins coins;
-
- private final Clothes clothers;
-
- private RunningTime runningTime;
-
- private final SerialNumber serialNumber;
-
- private HotAir hotAir;
-
- public TumbleDryer(@Original Clothes clothes)
- {
- this.clothers = clothes;
- this.serialNumber = null;
- }
-
- @Inject
- public TumbleDryer(SerialNumber serialNumber)
- {
- this.serialNumber = serialNumber;
- this.clothers = null;
- }
-
- public void setRunningTime(@Original RunningTime runningTime)
- {
- this.runningTime = runningTime;
- }
-
- @Inject
- public void setHotAir(HotAir hotAir)
- {
- this.hotAir = hotAir;
- }
-
- public Plug getPlug()
- {
- return plug;
- }
-
- public Clothes getClothes()
- {
- return clothers;
- }
-
- public HotAir getHotAir()
- {
- return hotAir;
- }
-
- public RunningTime getRunningTime()
- {
- return runningTime;
- }
-
- public SerialNumber getSerialNumber()
- {
- return serialNumber;
- }
-
- public Coins getCoins()
- {
- return coins;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,23 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
-
-@FastWashingMachine
-public class WashingMachine
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-public class Cow
-{
-
- private final String name;
-
- public Cow(String name)
- {
- this.name = name;
- }
-
- public String getName()
- {
- return name;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.jboss.weld.injection.FieldInjectionPoint;
-
-public class CowShed
-{
-
- @Produces
- public Cow get(InjectionPoint ip)
- {
- assert ip instanceof FieldInjectionPoint<?, ?>;
- FieldInjectionPoint<?, ?> fip = (FieldInjectionPoint<?, ?>) ip;
- assert fip.getDeclaringType().getJavaClass().equals(Field.class);
- return new Cow("daisy");
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-@Named
-@SessionScoped
-public class DoubleConsumer implements Serializable
-{
-
- private static final long serialVersionUID = 6619645042310126425L;
-
- @Inject
- private double maxNumber;
-
- public DoubleConsumer()
- {
- }
-
- public void ping()
- {
-
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import java.io.Serializable;
-import java.util.Timer;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Produces;
-import javax.inject.Inject;
-
-@ApplicationScoped
-public class DoubleGenerator implements Serializable
-{
-
- private static final long serialVersionUID = -7213673465118041882L;
-
- @Inject Timer timer;
-
- @Produces
- double getDouble()
- {
- timer.cancel();
- return 11.1;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, 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.weld.tests.injectionPoint;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target({FIELD, METHOD, TYPE, PARAMETER})
-public @interface ExtraSpecial
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, 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.weld.tests.injectionPoint;
-
-import javax.enterprise.util.AnnotationLiteral;
-
-public class ExtraSpecialLiteral extends AnnotationLiteral<ExtraSpecial> implements ExtraSpecial
-{
- public static final ExtraSpecial INSTANCE = new ExtraSpecialLiteral();
-
- private ExtraSpecialLiteral() {
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import javax.inject.Inject;
-
-public class Field
-{
-
- @Inject Cow cow;
-
- public Cow getCow()
- {
- return cow;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-public class GrassyField extends Field
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import java.lang.reflect.ParameterizedType;
-
-import javax.enterprise.inject.IllegalProductException;
-import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.jboss.weld.test.Utils;
-import org.testng.annotations.Test;
-
-@Artifact
-public class InjectionPointTest extends AbstractWeldTest
-{
-
- @Test(description="WELD-239")
- public void testCorrectInjectionPointUsed()
- {
- getReference(IntConsumer.class).ping();
-
- try
- {
- getReference(DoubleConsumer.class).ping();
- }
- catch (IllegalProductException e)
- {
- assert e.getMessage().contains("Injection Point: field org.jboss.weld.tests.injectionPoint.DoubleGenerator.timer");
- }
- }
-
- @Test(description="WELD-316")
- public void testFieldInjectionPointSerializability() throws Throwable
- {
- getReference(StringConsumer.class).ping();
- InjectionPoint ip = StringGenerator.getInjectionPoint();
- assert ip != null;
- assert ip.getMember().getName().equals("str");
- InjectionPoint ip1 = Utils.deserialize(Utils.serialize(ip));
- assert ip1.getMember().getName().equals("str");
- }
-
- @Test
- public void testGetDeclaringType()
- {
- assert getReference(GrassyField.class).getCow().getName().equals("daisy");
- }
-
- @Test(description = "WELD-438")
- public void testInjectionPointWhenInstanceGetIsUsed() throws Exception
- {
- Pig pig = getReference(PigSty.class).getPig();
- assert pig != null;
- assert pig.getInjectionPoint().getBean() != null;
- assert pig.getInjectionPoint().getBean().getBeanClass().equals(PigSty.class);
- assert pig.getInjectionPoint().getMember().equals(PigSty.class.getDeclaredField("pig"));
- assert pig.getInjectionPoint().getAnnotated() != null;
- assert pig.getInjectionPoint().getAnnotated().getBaseType() instanceof ParameterizedType;
- ParameterizedType parameterizedType = ((ParameterizedType) pig.getInjectionPoint().getAnnotated().getBaseType());
- assert parameterizedType.getRawType().equals(Instance.class);
- assert parameterizedType.getActualTypeArguments().length == 1;
- assert parameterizedType.getActualTypeArguments()[0].equals(Pig.class);
- assert pig.getInjectionPoint().getAnnotated().isAnnotationPresent(Special.class);
- assert !pig.getInjectionPoint().getAnnotated().isAnnotationPresent(ExtraSpecial.class);
- assert Utils.annotationSetMatches(pig.injectionPoint.getQualifiers(), Special.class, ExtraSpecial.class);
- assert Pig.class.equals(pig.getInjectionPoint().getType());
-
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-import javax.inject.Inject;
-import javax.inject.Named;
-
-@Named
-@SessionScoped
-public class IntConsumer implements Serializable
-{
-
- private static final long serialVersionUID = 6619645042310126425L;
-
- @Inject
- private int maxNumber;
-
- public IntConsumer()
- {
- }
-
- public void ping()
- {
-
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import java.io.Serializable;
-import java.util.Timer;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.Produces;
-import javax.inject.Inject;
-
-@ApplicationScoped
-public class IntGenerator implements Serializable
-{
-
- private static final long serialVersionUID = -7213673465118041882L;
-
- @Inject
- private Instance<Timer> timerInstance;
-
- @Produces
- int getInt()
- {
- // This has no purpose other than to invoke a method on the proxy so that the proxy instance
- // is retrieved via the producer method
- timerInstance.get().cancel();
- return 100;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Inject;
-
-@Special @ExtraSpecial
-public class Pig
-{
-
- @Inject InjectionPoint injectionPoint;
-
- public InjectionPoint getInjectionPoint()
- {
- return injectionPoint;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and/or its affiliates, 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.weld.tests.injectionPoint;
-
-import javax.enterprise.inject.Instance;
-import javax.inject.Inject;
-
-public class PigSty
-{
- @Inject @Special Instance<Pig> pig;
-
- public Pig getPig()
- {
- return pig.select(ExtraSpecialLiteral.INSTANCE).get();
- }
-
-}
-
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target({FIELD, METHOD, TYPE, PARAMETER})
-public @interface Special
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import javax.inject.Inject;
-
-public class StringConsumer
-{
-
- @Inject String str;
-
- public void ping() {}
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-public class StringGenerator
-{
-
- private static InjectionPoint injectionPoint;
-
- public static InjectionPoint getInjectionPoint()
- {
- return injectionPoint;
- }
-
- public static void reset()
- {
- injectionPoint = null;
- }
-
- @Produces String getString(InjectionPoint ip)
- {
- injectionPoint = ip;
- return "";
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
-
-import java.io.Serializable;
-import java.util.Timer;
-
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Produces;
-
-public class TimerManager implements Serializable
-{
-
- private static final long serialVersionUID = 5156835887786174326L;
-
- @Produces
- @RequestScoped
- public Timer getTimer()
- {
- return new Timer();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Baz.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Baz.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Baz.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,13 +0,0 @@
-package org.jboss.weld.tests.producer.field;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import javax.inject.Qualifier;
-
-(a)Retention(RetentionPolicy.RUNTIME)
-@Qualifier
-public @interface Baz
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
-
-import java.util.Collection;
-
-import javax.inject.Inject;
-
-public class IntegerCollectionInjection
-{
-
- private Collection<Integer> value;
-
- @Inject
- private Collection<Integer> fieldInjection;
-
- private Collection<Integer> setterInjection;
-
- @Inject
- public void init(Collection<Integer> setterInjection)
- {
- this.setterInjection = setterInjection;
- }
-
- @Inject
- 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;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
-
-import java.util.List;
-
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.Instance;
-import javax.inject.Inject;
-
-public class ListInstance
-{
- @Inject @Any
- Instance<List> instance;
-
- public Instance<List> get()
- {
- return instance;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
-
-import java.util.List;
-
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.Instance;
-import javax.inject.Inject;
-
-public class ListStringInstance
-{
- @Inject @Any Instance<List<String>> instance;
-
- public List<String> get()
- {
- return instance.get();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
-
-import java.util.Collection;
-
-import javax.inject.Inject;
-
-public class ParameterizedCollectionInjection
-{
-
- private Collection<String> value;
-
- @Inject
- private Collection<String> fieldInjection;
-
- private Collection<String> setterInjection;
-
- @Inject
- public void init(Collection<String> setterInjection)
- {
- this.setterInjection = setterInjection;
- }
-
- @Inject
- 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;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
-
-import java.util.List;
-
-import javax.inject.Inject;
-
-public class ParameterizedListInjection
-{
-
- private List<String> value;
-
- @Inject
- private List<String> fieldInjection;
-
- private List<String> setterInjection;
-
- @Inject
- public void init(List<String> setterInjection)
- {
- this.setterInjection = setterInjection;
- }
-
- @Inject
- public ParameterizedListInjection(List<String> com)
- {
- this.value = com;
- }
-
- public java.util.List<String> getValue()
- {
- return value;
- }
-
- public List<String> getFieldInjection()
- {
- return fieldInjection;
- }
-
- public List<String> getSetterInjection()
- {
- return setterInjection;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.enterprise.inject.Produces;
-
-public class ParameterizedProducer
-{
-
- @Produces
- public List<String> createStringList()
- {
- return Arrays.asList("aaa", "bbb");
- }
-
- @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;
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class ParameterizedProducerTest extends AbstractWeldTest
-{
-
- @Test
- public void testParameterizedListInjection()
- {
- List<String> strings = getReference(Target.class).getStringList();
- assert strings.size() == 2;
-
- ParameterizedListInjection item = getReference(ParameterizedListInjection.class);
- assert item.getFieldInjection().size() == 2;
- assert item.getValue().size() == 2;
- assert item.getSetterInjection().size() == 2;
-
- }
-
- @Test
- public void testParameterizedCollectionInjection()
- {
- Collection<String> strings = getReference(Target.class).getStrings();
- assert strings.size() == 2;
-
- ParameterizedCollectionInjection item = getReference(ParameterizedCollectionInjection.class);
- assert item.getFieldInjection().size() == 2;
- assert item.getValue().size() == 2;
- assert item.getSetterInjection().size() == 2;
-
- }
-
- @Test
- public void testIntegerCollectionInjection()
- {
- Collection<Integer> integers = getReference(Target.class).getIntegers();
- assert integers.size() == 4;
-
- IntegerCollectionInjection item = getReference(IntegerCollectionInjection.class);
- assert item.getFieldInjection().size() == 4;
- assert item.getValue().size() == 4;
- assert item.getSetterInjection().size() == 4;
-
- }
-
- @Test
- public void testInstanceList()
- {
- ListInstance listInstance = getReference(ListInstance.class);
- assert listInstance.get().isAmbiguous();
- }
-
- @Test
- public void testTypeParameterInstance()
- {
- ListStringInstance listInstance = getReference(ListStringInstance.class);
- assert listInstance.get().size() == 2;
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, 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.weld.tests.producer.field;
-
-import javax.enterprise.util.AnnotationLiteral;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- * Simple test which invokes a method directly on a normal scoped producer
- * bean to ensure that it's proxy is for that bean and not the product
- * of a producer method.
- *
- * @author David Allen
- *
- */
-@Artifact
-public class ProducerBeanInvocationTest extends AbstractWeldTest
-{
- @Test
- // WELD-546
- public void test()
- {
- Qux bar = getReference(Qux.class);
- assert bar.getBar().equals("qux");
- QuxProducer producer = getReference(QuxProducer.class);
- assert producer.ping();
- Qux bazBar = getReference(Qux.class, new AnnotationLiteral<Baz>(){});
- assert bazBar.getBar().equals("baz");
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Qux.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Qux.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Qux.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,26 +0,0 @@
-package org.jboss.weld.tests.producer.field;
-
-import javax.enterprise.context.RequestScoped;
-
-@RequestScoped
-public class Qux
-{
-
- private final String name;
-
- public Qux(String name)
- {
- this.name = name;
- }
-
- public Qux()
- {
- this("qux");
- }
-
- public String getBar()
- {
- return name;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,18 +0,0 @@
-package org.jboss.weld.tests.producer.field;
-
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Produces;
-
-@RequestScoped
-public class QuxProducer
-{
-
- @Produces @Baz @RequestScoped
- private Qux bar = new Qux("baz");
-
- public boolean ping()
- {
- return true;
- };
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Target.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Target.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Target.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
-
-import java.util.Collection;
-import java.util.List;
-
-import javax.inject.Inject;
-
-public class Target
-{
-
- @Inject private Collection<String> strings;
-
- @Inject private Collection<Integer> integers;
-
- @Inject private List<String> stringList;
-
- public Collection<String> getStrings()
- {
- return strings;
- }
-
- public Collection<Integer> getIntegers()
- {
- return integers;
- }
-
- public List<String> getStringList()
- {
- return stringList;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Bar.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Bar.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-public class Bar
-{
-
- public Bar(String blah)
- {
-
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,32 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Inject;
-
-@RequestScoped
-public class BarConsumer
-{
- @Inject
- private Bar bar;
-
- public Bar getBar()
- {
- return bar;
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import java.lang.reflect.Member;
-
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.Default;
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.InjectionPoint;
-
-/**
- * Class with a producer method and disposal method both containing InjectionPoint
- * parameters.
- *
- * @author David Allen
- *
- */
-public class BarProducer
-{
- private static Bar disposedBar;
- private static Member disposedInjection;
- private static Member producedInjection;
-
- @Produces
- public Bar getBar(InjectionPoint injectionPoint)
- {
- producedInjection = injectionPoint.getMember();
- return new Bar("blah");
- }
-
- public void dispose(@Disposes @Any Bar bar, InjectionPoint injectionPoint)
- {
- disposedBar = bar;
- disposedInjection = injectionPoint.getMember();
- }
-
- public static Bar getDisposedBar()
- {
- return disposedBar;
- }
-
- public static Member getDisposedInjection()
- {
- return disposedInjection;
- }
-
- public static Member getProducedInjection()
- {
- return producedInjection;
- }
-
- public static void reset()
- {
- disposedBar = null;
- disposedInjection = null;
- producedInjection = null;
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Baz.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Baz.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Baz.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,13 +0,0 @@
-package org.jboss.weld.tests.producer.method;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-import javax.inject.Qualifier;
-
-(a)Retention(RetentionPolicy.RUNTIME)
-@Qualifier
-public @interface Baz
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Car.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Car.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Car.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import java.io.Serializable;
-
-public class Car implements Serializable
-{
-
- private static final long serialVersionUID = 1L;
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,30 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import javax.enterprise.inject.Produces;
-
-public class CarFactory
-{
-
- @Produces @Important
- public Car produceGovernmentCar()
- {
- return null;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class DisposalMethodInjectionPointTest extends AbstractWeldTest
-{
- @Test(groups = { "broken" })
- // WELD-358
- public void test()
- {
- BarProducer.reset();
- Bean<BarConsumer> barConsumerBean = getBean(BarConsumer.class);
- CreationalContext<BarConsumer> ctx = getCurrentManager().createCreationalContext(barConsumerBean);
- BarConsumer barConsumer = barConsumerBean.create(ctx);
- assert BarProducer.getProducedInjection().getName().equals("bar");
- Bar bar = barConsumer.getBar();
- barConsumerBean.destroy(barConsumer, ctx);
- assert BarProducer.getDisposedBar() == bar;
- assert BarProducer.getDisposedInjection().getName().equals("bar");
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class DisposalMethodOnOtherBeanNotResolvedTest extends AbstractWeldTest
-{
- @Test
- public void test()
- {
- FooDisposer.reset();
- FooProducer.reset();
- Bean<Foo> bean = getBean(Foo.class);
- CreationalContext<Foo> ctx = getCurrentManager().createCreationalContext(bean);
- Foo instance = bean.create(ctx);
- assert instance.getBlah().equals("foo!");
- bean.destroy(instance, ctx);
- assert !FooDisposer.isDisposed();
- assert FooProducer.isDisposed();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Foo.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-/**
- * @author pmuir
- *
- */
-public class Foo
-{
-
- private final String blah;
-
- public Foo(String blah)
- {
- this.blah = blah;
- }
-
- /**
- * @return the blah
- */
- public String getBlah()
- {
- return blah;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import javax.enterprise.inject.Any;
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.Produces;
-
-/**
- * @author pmuir
- *
- */
-public class FooDisposer
-{
-
- private static boolean disposed;
-
- public static void reset()
- {
- disposed = false;
- }
-
- void disposeFoo(@Disposes @Any Foo foo)
- {
- disposed = true;
- }
-
- /**
- * @return the disposed
- */
- public static boolean isDisposed()
- {
- return disposed;
- }
-
- @Produces @Important
- public Foo getFoo()
- {
- return new Foo("bar!");
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import javax.enterprise.inject.Disposes;
-import javax.enterprise.inject.Produces;
-
-/**
- * @author pmuir
- *
- */
-public class FooProducer
-{
-
- @Produces Foo getFoo()
- {
- return new Foo("foo!");
- }
-
- private static boolean disposed;
-
- public static void reset()
- {
- disposed = false;
- }
-
- public void disposeFoo(@Disposes Foo foo)
- {
- disposed = true;
- }
-
- /**
- * @return the disposed
- */
- public static boolean isDisposed()
- {
- return disposed;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Government.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Government.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Government.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.SessionScoped;
-
-@SessionScoped
-public class Government implements Serializable
-{
-
- private static final long serialVersionUID = 1L;
-
- @Important Car governmentCar;
-
- public void destabilize()
- {
-
- }
-
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Important.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Important.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Important.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * @author Dan Allen
- */
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-@Inherited
-public @interface Important {
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import javax.inject.Inject;
-
-public class IntInjection
-{
-
- int value;
-
- @Inject public IntInjection(Integer integer)
- {
- this.value = integer;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-public class JmsTemplate
-{
-
- private final int receiveTimeout;
-
- public JmsTemplate(int receiveTimeout)
- {
- this.receiveTimeout = receiveTimeout;
- }
-
- public int getReceiveTimeout()
- {
- return receiveTimeout;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import javax.enterprise.inject.Produces;
-import javax.inject.Named;
-
-public class JmsTemplateConfigurationProducer
-{
-
- public static final int LONG_RECEIVE_TIMEOUT = 3 * 3600;
- public static final int SHORT_RECEIVE_TIMEOUT = 100;
-
- @Produces @Long
- private int longReceiveTimeout = LONG_RECEIVE_TIMEOUT;
-
- @Produces @Short
- private int shortReceiveTimeout = SHORT_RECEIVE_TIMEOUT;
-
- @Produces
- @Named
- public JmsTemplate getErrorQueueTemplate(@Long int receiveTimeout)
- {
- return new JmsTemplate(receiveTimeout);
- }
-
- @Produces
- @Named
- public JmsTemplate getLogQueueTemplate(@Short int receiveTimeout)
- {
- return new JmsTemplate(receiveTimeout);
- }
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Long.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Long.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Long.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * @author Dan Allen
- */
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-@Inherited
-public @interface Long {
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.InjectionPoint;
-import javax.inject.Inject;
-
-class ManagerProducer
-{
-
- @Inject BeanManager beanManager;
-
- private static boolean injectionPointInjected;
-
- public static boolean isInjectionPointInjected()
- {
- return injectionPointInjected;
- }
-
- public static void setInjectionPointInjected(boolean injectionPointInjected)
- {
- ManagerProducer.injectionPointInjected = injectionPointInjected;
- }
-
- @Produces
- Integer create(InjectionPoint point)
- {
- injectionPointInjected = point != null;
- return 10;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class ManagerProducerTest extends AbstractWeldTest
-{
- @Test(description="WBRI-183")
- public void testInjectManagerProducer()
- {
- ManagerProducer.setInjectionPointInjected(false);
- getReference(IntInjection.class);
- assert ManagerProducer.isInjectionPointInjected();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import javax.enterprise.inject.Produces;
-import javax.inject.Named;
-
-public class NamedProducer
-{
- @Named("itoen")
- @Produces
- public String[] createName()
- {
- return new String[] { "oh", "otya" };
- }
-
- @Named("iemon")
- @Produces
- public String[] createName2()
- {
- return new String[] { "fukujyuen", "iemon", "otya" };
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.Bean;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class NamedProducerTest extends AbstractWeldTest
-{
-
- @Test
- public void testNamedProducer()
- {
- Bean<?> iemonBean = getCurrentManager().resolve(getCurrentManager().getBeans("iemon"));
- String[] iemon = (String[]) getCurrentManager().getReference(iemonBean, Object.class, getCurrentManager().createCreationalContext(iemonBean));
- assert iemon.length == 3;
- Bean<?> itoenBean = getCurrentManager().resolve(getCurrentManager().getBeans("itoen"));
- String[] itoen = (String[]) getCurrentManager().getReference(itoenBean, Object.class, getCurrentManager().createCreationalContext(itoenBean));
- assert itoen.length == 2;
- }
-
- @Test
- public void testDefaultNamedProducerMethod()
- {
- Set<Bean<?>> beans = getCurrentManager().getBeans(JmsTemplate.class);
- assert beans.size() == 2;
- List<String> beanNames = new ArrayList<String>(Arrays.asList("errorQueueTemplate", "logQueueTemplate"));
- for (Bean<?> b : beans)
- {
- beanNames.remove(b.getName());
- }
- assert beanNames.isEmpty();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import java.util.Date;
-
-import javax.enterprise.inject.Produces;
-import javax.inject.Named;
-
-/**
- * @author Dan Allen
- */
-public class NamedProducerWithBinding {
- public @Produces @Important @Named Date getDate() {
- return new Date();
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import static org.testng.Assert.assertNotNull;
-
-import java.util.Date;
-
-import javax.enterprise.inject.spi.Bean;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- * @author Dan Allen
- */
-@Artifact(addCurrentPackage = true)
-public class NamedProducerWithBindingTest extends AbstractWeldTest
-{
- @Test
- public void testGetNamedProducerWithBinding()
- {
- Bean<?> bean = getCurrentManager().resolve(getCurrentManager().getBeans("date"));
- Date date = (Date) getCurrentManager().getReference(bean, Object.class, getCurrentManager().createCreationalContext(bean));
- assertNotNull(date);
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class NullProducerTest extends AbstractWeldTest
-{
-
- @Test(description="WBRI-276")
- public void testProducerMethodReturnsNull()
- {
- getReference(Government.class).destabilize();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat, Inc. and/or its affiliates, 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.weld.tests.producer.method;
-
-import javax.enterprise.util.AnnotationLiteral;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-/**
- * Simple test which invokes a method directly on a normal scoped producer
- * bean to ensure that it's proxy is for that bean and not the product
- * of a producer method.
- *
- * @author David Allen
- *
- */
-@Artifact
-public class ProducerBeanInvocationTest extends AbstractWeldTest
-{
- @Test
- // WELD-546
- public void test()
- {
- Qux bar = getReference(Qux.class);
- assert bar.getBar().equals("qux");
- QuxProducer producer = getReference(QuxProducer.class);
- assert producer.ping();
- Qux bazBar = getReference(Qux.class, new AnnotationLiteral<Baz>(){});
- assert bazBar.getBar().equals("baz");
- }
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Qux.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Qux.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Qux.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,26 +0,0 @@
-package org.jboss.weld.tests.producer.method;
-
-import javax.enterprise.context.RequestScoped;
-
-@RequestScoped
-public class Qux
-{
-
- private final String name;
-
- public Qux(String name)
- {
- this.name = name;
- }
-
- public Qux()
- {
- this("qux");
- }
-
- public String getBar()
- {
- return name;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,21 +0,0 @@
-package org.jboss.weld.tests.producer.method;
-
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.Produces;
-
-@RequestScoped
-public class QuxProducer
-{
-
- @Produces @Baz @RequestScoped
- public Qux getQux()
- {
- return new Qux("baz");
- }
-
- public boolean ping()
- {
- return true;
- };
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Short.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Short.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Short.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-/**
- * @author Dan Allen
- */
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-@Inherited
-public @interface Short {
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/Foo.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.proxy;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.RequestScoped;
-import javax.inject.Named;
-
-@Named
-@RequestScoped
-class Foo implements Serializable
-{
-
- public String getMsg()
- {
- return "Hi";
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.proxy;
-
-import javax.enterprise.inject.spi.Bean;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class ProxyTest extends AbstractWeldTest
-{
-
- @Test(description="WBRI-122")
- public void testImplementationClassImplementsSerializable()
- {
- Bean<?> bean = getCurrentManager().resolve(getCurrentManager().getBeans("foo"));
- assert getCurrentManager().getReference(bean, Object.class, getCurrentManager().createCreationalContext(bean)) != null;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Bar.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Bar.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
-
-public class Bar
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Baz.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Baz.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Baz.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,22 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
-
-public class Baz
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Foo.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,27 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
-
-public class Foo extends FooBase<Bar>
-{
-
- public String getName()
- {
- return "foo";
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/FooBase.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/FooBase.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/FooBase.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,27 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
-
-public class FooBase<T>
-{
-
- public String getName()
- {
- return "foobase";
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,30 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
-
-import javax.enterprise.inject.Produces;
-
-public class FooProducer
-{
-
- @Produces @Special
- public FooBase<Baz> produce()
- {
- return new FooBase<Baz>();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
-
-import javax.inject.Inject;
-
-public class LookupFoo
-{
-
- @Inject Foo foo;
-
- @Inject @Special FooBase<Baz> foobaz;
-
- public Foo getFoo()
- {
- return foo;
- }
-
- public FooBase<Baz> getFoobaz()
- {
- return foobaz;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
-
-import java.util.List;
-
-import javax.enterprise.inject.Instance;
-import javax.enterprise.util.TypeLiteral;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.literal.DefaultLiteral;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class LookupInstanceTest extends AbstractWeldTest
-{
-
-
- @Test
- public void testLookupInstance() throws Exception
- {
- assert getReference(new TypeLiteral<Instance<List<?>>>(){}.getRawType(), DefaultLiteral.INSTANCE) == null;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Special.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Special.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Special.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target({FIELD, METHOD, TYPE, PARAMETER})
-public @interface Special
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class Weld256Test extends AbstractWeldTest
-{
-
- @Test
- public void testParameterizedInjection()
- {
- LookupFoo lookupFoo = getReference(LookupFoo.class);
- assert lookupFoo.getFoo().getName().equals("foo");
- assert lookupFoo.getFoobaz().getName().equals("foobase");
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import javax.annotation.PostConstruct;
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-
-@ApplicationScoped
-class Bar
-{
-
- public static boolean success;
-
- @Inject Foo foo;
-
- public Bar()
- {
- success = false;
- }
-
- @PostConstruct
- public void postConstruct()
- {
- if (foo.getName().equals("foo"))
- {
- success = true;
- }
- }
-
- public String getName()
- {
- return "bar";
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class CircularDependencyTest extends AbstractWeldTest
-{
-
- @Test
- public void testCircularInjectionOnTwoSimpleDependentBeans() throws Exception
- {
- getReference(Foo.class).getName();
- assert Foo.success;
- assert Bar.success;
- }
-
- @Test
- public void testDependentProducerMethodDeclaredOnDependentBeanWhichInjectsProducedBean() throws Exception
- {
- getReference(DependentSelfConsumingDependentProducer.class).ping();
- }
-
- @Test
- public void testDependentSelfConsumingProducer() throws Exception
- {
- getReference(Violation.class).ping();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-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.Qualifier;
-
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-@interface DependentLooping
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import javax.enterprise.inject.Produces;
-
-class DependentLoopingProducer
-{
-
- @Produces @DependentLooping
- public Violation produceViolation(@DependentLooping Violation violation) {
- return new Violation();
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import javax.enterprise.inject.Produces;
-
-class DependentSelfConsumingDependentProducer
-{
- @SelfConsumingDependent Violation violation;
-
- @Produces @SelfConsumingDependent
- public Violation produceViolation() {
- return new Violation();
- }
-
- public void ping() {
-
- }
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import javax.inject.Inject;
-
-class Farm
-{
-
- @Inject
- public Farm(Farm farm)
- {
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,32 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import javax.inject.Inject;
-
-class Fish
-{
-
- private Water water;
-
- @Inject
- public Fish(Water water)
- {
- this.water = water;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import javax.annotation.PostConstruct;
-import javax.inject.Inject;
-
-class Foo
-{
-
- public static boolean success;
-
- @Inject Bar bar;
-
- public Foo()
- {
- success = false;
- }
-
- @PostConstruct
- public void postConstruct()
- {
- if (bar.getName().equals("bar"))
- {
- success = true;
- }
- }
-
- public String getName()
- {
- return "foo";
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-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.Qualifier;
-
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-@interface NormalLooping
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Produces;
-
-@ApplicationScoped
-class NormalLoopingProducer
-{
-
- @Produces @ApplicationScoped @NormalLooping
- public Violation produceViolation(@NormalLooping Violation violation) {
- return new Violation();
- }
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-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.Qualifier;
-
-@Target( { TYPE, METHOD, PARAMETER, FIELD })
-@Retention(RUNTIME)
-@Documented
-@Qualifier
-@interface SelfConsumingDependent
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import java.io.Serializable;
-
-class Violation implements Serializable
-{
-
- public void ping()
- {
-
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,28 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
-
-import javax.inject.Inject;
-
-class Water
-{
- @Inject
- public Water(Fish fish)
- {
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Bar.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Bar.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,24 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
-
-import javax.enterprise.context.Dependent;
-
-@Dependent
-class Bar extends Foo
-{
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Foo.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,24 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
-
-import javax.enterprise.context.RequestScoped;
-
-@RequestScoped
-class Foo
-{
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
-
-import java.lang.annotation.Annotation;
-
-import javax.enterprise.context.Dependent;
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.util.AnnotationLiteral;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.Container;
-import org.jboss.weld.context.ContextLifecycle;
-import org.jboss.weld.context.beanstore.HashMapBeanStore;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-public class ScopeTest extends AbstractWeldTest
-{
-
- private static Annotation USELESS_LITERAL = new AnnotationLiteral<Useless>() {};
- private static Annotation SPECIAL_LITERAL = new AnnotationLiteral<Special>() {};
-
- @Test(description="WELD-322")
- public void testScopeDeclaredOnSubclassOverridesScopeOnSuperClass()
- {
- assert getCurrentManager().resolve(getCurrentManager().getBeans(Bar.class)).getScope().equals(Dependent.class);
- }
- @Test(description="WELD-311")
- public void testScopeOfProducerMethod()
- {
- Bean<Temp> specialTempBean = getBean(Temp.class, SPECIAL_LITERAL);
- Bean<Temp> uselessTempBean = getBean(Temp.class, USELESS_LITERAL);
- assert specialTempBean.getScope().equals(RequestScoped.class);
- assert uselessTempBean.getScope().equals(RequestScoped.class);
- assert getReference(specialTempBean).getNumber() == 10;
- assert getReference(uselessTempBean).getNumber() == 11;
-
- TempConsumer tempConsumer = getReference(TempConsumer.class);
- tempConsumer.getSpecialTemp().setNumber(101);
- tempConsumer.getUselessTemp().setNumber(102);
-
- assert tempConsumer.getSpecialTemp().getNumber() == 101;
- assert tempConsumer.getUselessTemp().getNumber() == 102;
- assert getReference(specialTempBean).getNumber() == 101;
- assert getReference(uselessTempBean).getNumber() == 102;
-
- newRequest();
-
- assert tempConsumer.getSpecialTemp().getNumber() == 10;
- assert tempConsumer.getUselessTemp().getNumber() == 11;
- assert getReference(specialTempBean).getNumber() == 10;
- assert getReference(uselessTempBean).getNumber() == 11;
- }
-
- private void newRequest()
- {
- ContextLifecycle lifecycle = Container.instance().services().get(ContextLifecycle.class);
- lifecycle.endRequest("test", lifecycle.getRequestContext().getBeanStore());
- lifecycle.restoreSession("test", new HashMapBeanStore());
- lifecycle.beginRequest("test", new HashMapBeanStore());
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Special.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Special.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Special.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target({FIELD, METHOD, TYPE, PARAMETER})
-public @interface Special
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Temp.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Temp.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Temp.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
-
-public class Temp
-{
-
- private int number;
-
- public Temp(int number)
- {
- this.number = number;
- }
-
- public Temp()
- {
- number = 0;
- }
-
- public int getNumber()
- {
- return number;
- }
-
- public void setNumber(int number)
- {
- this.number = number;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-
-@ApplicationScoped
-public class TempConsumer
-{
-
- @Inject @Special Temp specialTemp;
- @Inject @Useless Temp uselessTemp;
-
- public Temp getSpecialTemp()
- {
- return specialTemp;
- }
-
- public Temp getUselessTemp()
- {
- return uselessTemp;
- }
-
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempProducer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempProducer.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
-
-import java.io.Serializable;
-
-import javax.enterprise.context.RequestScoped;
-import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Produces;
-import javax.inject.Named;
-
-@Named
-@SessionScoped
-public class TempProducer implements Serializable
-{
-
- @Produces
- @RequestScoped
- @Special
- public Temp getTemp()
- {
- return new Temp(10);
- }
-
- @Produces
- @RequestScoped
- @Useless
- Temp t = new Temp(11);
-
-}
\ No newline at end of file
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Useless.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Useless.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Useless.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.inject.Qualifier;
-
-@Qualifier
-(a)Retention(RetentionPolicy.RUNTIME)
-@Target({FIELD, METHOD, TYPE, PARAMETER})
-public @interface Useless
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,26 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
-
-/**
- * @author pmuir
- *
- */
-public class Bar
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
-
-import org.jboss.weld.injection.spi.InjectionContext;
-import org.jboss.weld.injection.spi.InjectionServices;
-
-/**
- * @author pmuir
- *
- */
-public class CheckableInjectionServices implements InjectionServices
-{
-
- private boolean before = false;
- private boolean after = false;
- private boolean injectedAfter = false;
- private boolean injectionTargetCorrect = false;
-
- public <T> void aroundInject(InjectionContext<T> injectionContext)
- {
- before = true;
- if (injectionContext.getTarget() instanceof Foo)
- {
- ((Foo) injectionContext.getTarget()).message = "hi!";
- if (injectionContext.getInjectionTarget().getInjectionPoints().size() == 1)
- {
- injectionTargetCorrect = injectionContext.getInjectionTarget().getInjectionPoints().iterator().next().getType().equals(Bar.class);
- }
- }
- injectionContext.proceed();
- after = true;
- if (injectionContext.getTarget() instanceof Foo)
- {
- Foo foo = (Foo) injectionContext.getTarget();
- injectedAfter = foo.getBar() instanceof Bar && foo.getMessage().equals("hi!");
- }
- }
-
- public void reset()
- {
- before = false;
- after = false;
- injectedAfter = false;
- injectionTargetCorrect = false;
- }
-
- public boolean isBefore()
- {
- return before;
- }
-
- public boolean isAfter()
- {
- return after;
- }
-
- public boolean isInjectedAfter()
- {
- return injectedAfter;
- }
-
- public boolean isInjectionTargetCorrect()
- {
- return injectionTargetCorrect;
- }
-
- public void cleanup() {}
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
-
-import org.jboss.weld.Container;
-import org.jboss.weld.ContainerState;
-import org.jboss.weld.mock.MockServletLifecycle;
-import org.jboss.weld.mock.TestContainer;
-import org.testng.annotations.Test;
-
-public class ContainerStatusTest
-{
-
- @Test
- public void testStatus()
- {
- TestContainer container = new TestContainer(new MockServletLifecycle());
- assert !Container.available();
- container.getLifecycle().initialize();
- assert !Container.available();
- assert Container.instance().getState().equals(ContainerState.STARTING);
- container.getLifecycle().getBootstrap().startInitialization();
- assert !Container.available();
- assert Container.instance().getState().equals(ContainerState.STARTING);
- container.getLifecycle().getBootstrap().deployBeans();
- assert Container.available();
- assert Container.instance().getState().equals(ContainerState.INITIALIZED);
- container.getLifecycle().getBootstrap().validateBeans().endInitialization();
- assert Container.available();
- assert Container.instance().getState().equals(ContainerState.VALIDATED);
- container.stopContainer();
- assert !Container.available();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
-
-import org.jboss.weld.bootstrap.WeldBootstrap;
-import org.jboss.weld.bootstrap.api.Bootstrap;
-import org.jboss.weld.bootstrap.api.Environments;
-import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
-import org.testng.annotations.Test;
-
-public class DiscoverFailsBootstrapTest
-{
-
- @Test(groups="bootstrap", expectedExceptions=IllegalArgumentException.class)
- public void testDiscoverFails()
- {
- Bootstrap bootstrap = new WeldBootstrap();
- bootstrap.startContainer(Environments.SE, null, new ConcurrentHashMapBeanStore());
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
-
-import javax.inject.Inject;
-
-/**
- * @author pmuir
- *
- */
-public class Foo
-{
-
- @Inject
- private Bar bar;
-
- public String message;
-
- /**
- * @return the bar
- */
- public Bar getBar()
- {
- return bar;
- }
-
- /**
- * @return the message
- */
- public String getMessage()
- {
- return message;
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
-
-import java.util.Arrays;
-
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.jboss.weld.injection.spi.InjectionServices;
-import org.jboss.weld.mock.MockEELifecycle;
-import org.jboss.weld.mock.TestContainer;
-import org.testng.annotations.Test;
-
-public class InjectionServicesTest
-{
-
- @Test
- public void testInjectionOfTarget()
- {
- TestContainer container = new TestContainer(new MockEELifecycle(), Arrays.asList(Foo.class, Bar.class), null);
- CheckableInjectionServices ijs = new CheckableInjectionServices();
- container.getLifecycle().getWar().getServices().add(InjectionServices.class, ijs);
- container.startContainer();
- container.ensureRequestActive();
-
- BeanManager manager = container.getBeanManager();
-
- Bean<? extends Object> bean = manager.resolve(manager.getBeans(Foo.class));
- ijs.reset();
- Foo foo = (Foo) manager.getReference(bean, Foo.class, manager.createCreationalContext(bean));
-
- assert ijs.isBefore();
- assert ijs.isAfter();
- assert ijs.isInjectedAfter();
- assert ijs.isInjectionTargetCorrect();
-
- assert foo.getBar() != null;
- assert foo.getMessage().equals("hi!");
-
-
- container.stopContainer();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,71 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.jboss.weld.mock.MockEELifecycle;
-import org.jboss.weld.mock.TestContainer;
-import org.testng.annotations.Test;
-
-/**
- * @author kkhan
- *
- */
-public class PreinstantiateBeanManagerTest
-{
-
- @Test
- public void test()
- {
- //Start the container, but do not deploy weld yet
- List<Class<?>> classes = new ArrayList<Class<?>>();
- classes.add(WeldBean.class);
- TestContainer container = new TestContainer(new MockEELifecycle(), classes, null);
- container.getLifecycle().initialize();
-
- BeanManager bootstrapManager = container.getBeanManager();
- assert bootstrapManager != null;
-
- //Check the bean is null since it is not there yet
- Set<Bean<?>> beans = bootstrapManager.getBeans(WeldBean.class);
- assert beans == null || beans.size() == 0;
-
-
- //Start the application
- container.getLifecycle().beginApplication();
- container.ensureRequestActive();
-
- //Check the manager is the same as before
- BeanManager manager = container.getBeanManager();
- assert manager != null;
- assert bootstrapManager == manager;
-
- //Check we can get the bean
- Bean<? extends Object> bean = manager.resolve(manager.getBeans(WeldBean.class));
- WeldBean weldBean = (WeldBean) manager.getReference(bean, WeldBean.class, manager.createCreationalContext(bean));
- assert weldBean != null;
-
- container.stopContainer();
- }
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,27 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
-
-/**
- *
- * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class WeldBean
-{
-
-}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java 2010-07-28 22:23:21 UTC (rev 6832)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java 2010-07-28 23:44:31 UTC (rev 6833)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
-
-import java.util.Arrays;
-
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-
-import org.jboss.weld.mock.MockEELifecycle;
-import org.jboss.weld.mock.TestContainer;
-import org.testng.annotations.Test;
-
-/**
- * @author pmuir
- *
- */
-public class WeldStartupTest
-{
-
- @Test
- public void test()
- {
- TestContainer container = new TestContainer(new MockEELifecycle(), Arrays.asList(Foo.class, Bar.class), null);
- container.startContainer();
- container.ensureRequestActive();
-
- BeanManager manager = container.getBeanManager();
-
- Bean<? extends Object> bean = manager.resolve(manager.getBeans(Foo.class));
- Foo foo = (Foo) manager.getReference(bean, Foo.class, manager.createCreationalContext(bean));
-
- assert foo != null;
- assert foo.getBar() != null;
-
- container.stopContainer();
- }
-
-}
14 years, 4 months
Weld SVN: r6832 - in core/trunk/tests-arquillian/src: main/java/org and 118 other directories.
by weld-commits@lists.jboss.org
Author: aslak
Date: 2010-07-28 18:23:21 -0400 (Wed, 28 Jul 2010)
New Revision: 6832
Added:
core/trunk/tests-arquillian/src/main/java/org/
core/trunk/tests-arquillian/src/main/java/org/jboss/
core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/
core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/api/
core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/api/BeanArchive.java
core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/
core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeanArchiveImpl.java
core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeansXml.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockDeployment.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEELifecycle.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjBServices.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbDescriptor.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbInjectionServices.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockHttpSession.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockJpaServices.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockLifecycle.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceLoader.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceServices.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockSecurityServices.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletContext.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletServices.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockTransactionServices.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidationServices.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidator.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/TestContainer.java
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/el/
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/test/
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/test/Utils.java
core/trunk/tests-arquillian/src/main/resources/META-INF/
core/trunk/tests-arquillian/src/main/resources/META-INF/services/
core/trunk/tests-arquillian/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.BeanArchive
core/trunk/tests-arquillian/src/test/java/org/
core/trunk/tests-arquillian/src/test/java/org/jboss/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTestRunner.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTests.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/CategoryArchiveAppender.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/IntegrationSuite.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/MyTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/NormalSuite.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Cow.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Dummy.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Field.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Fox.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/NightTime.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Tame.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/TestAlternative.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Child.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/Foo.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/annotation/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Broken.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/ExcludeFromNormalSuite.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Integration.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Animal.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Bird.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Castle.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Cat.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DAO.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Dog.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Feed.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Hat.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Result.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Bar.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Foo.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Updated.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Cow.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Foo.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Horse.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Rat.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Special.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Stable.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Woodland.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/injectionTarget/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/other/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Baz.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Qux.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Target.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Bar.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Baz.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Car.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Foo.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Government.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Important.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Long.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Qux.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Short.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/Foo.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Bar.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Baz.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Foo.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooBase.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Special.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Bar.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Foo.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Special.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Temp.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempProducer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Useless.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/jsf/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated/
core/trunk/tests-arquillian/src/test/resources/META-INF/
core/trunk/tests-arquillian/src/test/resources/META-INF/services/
core/trunk/tests-arquillian/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
core/trunk/tests-arquillian/src/test/resources/arquillian.xml
core/trunk/tests-arquillian/src/test/resources/org/
core/trunk/tests-arquillian/src/test/resources/org/jboss/
core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/
core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/
core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/
core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom/
core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit/
Removed:
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Test.java
Modified:
core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/EventCurrentActivityTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InactiveScopeTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InjectedManagerCurrentActivityTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/JndiManagerCurrentActivityTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScopeTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Producer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/AnnotatedTypeDecoratorTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/BootstrapTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/BootstrapTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/BootstrapTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/BootstrapTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/BootstrapTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/BootstrapTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/annotation/ManagerAnnotationTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceConsumer.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducerFieldPassivationCapableTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendDecoratorTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/InterceptorAndDecoratorTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceDecorator.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceInterceptor.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/TestMultiDelegate.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/BasicDecoratorResolutionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Complex.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Simple.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/EnterpriseBeanLifecycleTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/ExampleTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/MockExampleTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/ExceptionHandlingTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeSessionBeanTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtensionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/injectionTarget/InjectionTargetTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtensionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/NewSimpleBeanTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ExampleTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ServletListenerTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/CircularInjectionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/ObserverInjectionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/ProxyTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/ResourceCircularDependencyTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/Weld279Test.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/ContextualReferenceTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/ResourceTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/NewEnterpriseBeanTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/SpecializationTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/StereotypesTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/BeansXmlTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletLifecycleTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/jsf/JsfApiAbstractionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/WeldClassTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/WeldMethodTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/ReflectionTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/SecurityTest.java
core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/AnnotatedTypesTest.java
Log:
WELD-493 Restore Converted Arquillian Test Suite
Added: core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/api/BeanArchive.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/api/BeanArchive.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/api/BeanArchive.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+package org.jboss.shrinkwrap.api;
+
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+public interface BeanArchive extends JavaArchive
+{
+
+ /**
+ * Adds Decorators to the beans.xml.
+ * @param classes
+ * @return
+ */
+ BeanArchive decorate(Class<?>... classes);
+
+ /**
+ * Adds Interceptors to the beans.xml.
+ *
+ * @param classes
+ * @return
+ */
+ BeanArchive intercept(Class<?>... classes);
+
+ /**
+ * Adds Alternatives to the beans.xml.
+ *
+ * @param classes
+ * @return
+ */
+ BeanArchive alternate(Class<?>... classes);
+
+ /**
+ * Adds a Stereotype Alternative to beans.xml.
+ *
+ * @param classes
+ * @return
+ */
+ BeanArchive stereotype(Class<?>... classes);
+}
\ No newline at end of file
Added: core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeanArchiveImpl.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeanArchiveImpl.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeanArchiveImpl.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,137 @@
+package org.jboss.shrinkwrap.impl;
+
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePath;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.impl.base.path.BasicPath;
+import org.jboss.shrinkwrap.impl.base.spec.JavaArchiveImpl;
+
+public class BeanArchiveImpl extends JavaArchiveImpl implements BeanArchive
+{
+ //-------------------------------------------------------------------------------------||
+ // Class Members ----------------------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /**
+ * Path to the manifests inside of the Archive.
+ */
+ private static final ArchivePath PATH_MANIFEST = new BasicPath("META-INF");
+
+ /**
+ * Path to the resources inside of the Archive.
+ */
+ private static final ArchivePath PATH_RESOURCE = new BasicPath("/");
+
+ /**
+ * Path to the classes inside of the Archive.
+ */
+ private static final ArchivePath PATH_CLASSES = new BasicPath("/");
+
+ /**
+ * Beans XML object
+ */
+ private BeansXml descriptor;
+
+ public BeanArchiveImpl(final Archive<?> delegate)
+ {
+ super(delegate);
+
+ // add beans.xml descriptor
+ descriptor = new BeansXml();
+ addManifestResource(descriptor, ArchivePaths.create("beans.xml"));
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations -----------------------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see org.jboss.declarchive.impl.base.ContainerBase#getManinfestPath()
+ */
+ @Override
+ protected ArchivePath getManifestPath()
+ {
+ return PATH_MANIFEST;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.shrinkwrap.impl.base.container.ContainerBase#getClassesPath()
+ */
+ @Override
+ protected ArchivePath getClassesPath()
+ {
+ return PATH_CLASSES;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.declarchive.impl.base.ContainerBase#getResourcePath()
+ */
+ @Override
+ protected ArchivePath getResourcePath()
+ {
+ return PATH_RESOURCE;
+ }
+
+ /**
+ * Libraries are not supported by JavaArchive.
+ *
+ * @throws UnsupportedOperationException Libraries are not supported by JavaArchive
+ */
+ @Override
+ public ArchivePath getLibraryPath()
+ {
+ throw new UnsupportedOperationException("JavaArchive spec does not support Libraries");
+ }
+
+ //-------------------------------------------------------------------------------------||
+ // Required Implementations - BeanArchive ---------------------------------------------||
+ //-------------------------------------------------------------------------------------||
+
+ /* (non-Javadoc)
+ * @see org.jboss.shrinkwrap.api.BeanArchive#decorate(java.lang.Class<?>[])
+ */
+ public BeanArchive decorate(Class<?>... classes)
+ {
+ descriptor.decorators(classes);
+ addClasses(classes);
+ return covarientReturn();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shrinkwrap.api.BeanArchive#intercept(java.lang.Class<?>[])
+ */
+ public BeanArchive intercept(Class<?>... classes)
+ {
+ descriptor.interceptors(classes);
+ addClasses(classes);
+ return covarientReturn();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shrinkwrap.api.BeanArchive#alternate(java.lang.Class<?>[])
+ */
+ public BeanArchive alternate(Class<?>... classes)
+ {
+ descriptor.alternatives(classes);
+ addClasses(classes);
+ return covarientReturn();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.shrinkwrap.api.BeanArchive#stereotype(java.lang.Class<?>[])
+ */
+ public BeanArchive stereotype(Class<?>... classes)
+ {
+ descriptor.stereotype(classes);
+ addClasses(classes);
+ return covarientReturn();
+ }
+
+ @Override
+ protected BeanArchive covarientReturn()
+ {
+ return (BeanArchive)super.covarientReturn();
+ }
+}
\ No newline at end of file
Added: core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeansXml.java
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeansXml.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/shrinkwrap/impl/BeansXml.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,88 @@
+package org.jboss.shrinkwrap.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.shrinkwrap.api.asset.Asset;
+
+class BeansXml implements Asset
+{
+ private List<Class<?>> alternatives = new ArrayList<Class<?>>();
+ private List<Class<?>> interceptors = new ArrayList<Class<?>>();
+ private List<Class<?>> decorators = new ArrayList<Class<?>>();
+ private List<Class<?>> stereotypes = new ArrayList<Class<?>>();
+
+ BeansXml() {
+
+ }
+
+ public BeansXml alternatives(Class<?>... alternatives)
+ {
+ this.alternatives.addAll(Arrays.asList(alternatives));
+ return this;
+ }
+
+ public BeansXml interceptors(Class<?>... interceptors)
+ {
+ this.interceptors.addAll(Arrays.asList(interceptors));
+ return this;
+ }
+
+ public BeansXml decorators(Class<?>... decorators)
+ {
+ this.decorators.addAll(Arrays.asList(decorators));
+ return this;
+ }
+
+ public BeansXml stereotype(Class<?>... stereotypes)
+ {
+ this.stereotypes.addAll(Arrays.asList(stereotypes));
+ return this;
+ }
+
+ public InputStream openStream()
+ {
+ StringBuilder xml = new StringBuilder();
+ xml.append("<beans>\n");
+ appendAlternatives(alternatives, stereotypes, xml);
+ appendSection("interceptors", "class", interceptors, xml);
+ appendSection("decorators", "class", decorators, xml);
+ xml.append("</beans>");
+
+ return new ByteArrayInputStream(xml.toString().getBytes());
+ }
+
+ private void appendAlternatives(List<Class<?>> alternatives, List<Class<?>> stereotypes, StringBuilder xml)
+ {
+ if(alternatives.size() > 0 || stereotypes.size() > 0)
+ {
+ xml.append("<").append("alternatives").append(">\n");
+ appendClasses("class", alternatives, xml);
+ appendClasses("stereotype", stereotypes, xml);
+ xml.append("</").append("alternatives").append(">\n");
+ }
+ }
+
+ private void appendSection(String name, String subName, List<Class<?>> classes, StringBuilder xml)
+ {
+ if(classes.size() > 0)
+ {
+ xml.append("<").append(name).append(">\n");
+ appendClasses(subName, classes, xml);
+ xml.append("</").append(name).append(">\n");
+ }
+ }
+
+ private void appendClasses(String name, List<Class<?>> classes, StringBuilder xml)
+ {
+ for(Class<?> clazz : classes)
+ {
+ xml.append("<").append(name).append(">")
+ .append(clazz.getName())
+ .append("</").append(name).append(">\n");
+ }
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/AbstractMockDeployment.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+
+public abstract class AbstractMockDeployment implements Deployment
+{
+
+ private final List<BeanDeploymentArchive> beanDeploymentArchives;
+ private final ServiceRegistry services;
+
+ public AbstractMockDeployment(BeanDeploymentArchive... beanDeploymentArchives)
+ {
+ this.services = new SimpleServiceRegistry();
+ this.beanDeploymentArchives = new ArrayList<BeanDeploymentArchive>(Arrays.asList(beanDeploymentArchives));
+ }
+
+ public List<BeanDeploymentArchive> getBeanDeploymentArchives()
+ {
+ return beanDeploymentArchives;
+ }
+
+ public ServiceRegistry getServices()
+ {
+ return services;
+ }
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockBeanDeploymentArchive.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,145 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.ejb.EnterpriseBean;
+import javax.ejb.MessageDriven;
+import javax.ejb.Singleton;
+import javax.ejb.Stateful;
+import javax.ejb.Stateless;
+
+import org.jboss.weld.bootstrap.api.ServiceRegistry;
+import org.jboss.weld.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockBeanDeploymentArchive implements BeanDeploymentArchive
+{
+
+
+ private Collection<Class<?>> beanClasses;
+ private Collection<URL> beansXmlFiles;
+ private List<EjbDescriptor<?>> ejbs;
+ private final ServiceRegistry services;
+ private final Collection<BeanDeploymentArchive> bdas;
+ private final String id;
+
+ public MockBeanDeploymentArchive()
+ {
+ this("test");
+ }
+
+ public MockBeanDeploymentArchive(String id, Class<?> ... classes)
+ {
+ this.services = new SimpleServiceRegistry();
+ this.beanClasses = Arrays.asList(classes);
+ this.beansXmlFiles = new HashSet<URL>();
+ this.bdas = new HashSet<BeanDeploymentArchive>();
+ this.id = id;
+ }
+
+ public Collection<Class<?>> getBeanClasses()
+ {
+ return beanClasses;
+ }
+
+ public void setBeanClasses(Collection<Class<?>> beanClasses)
+ {
+ this.beanClasses = beanClasses;
+ ejbs = new ArrayList<EjbDescriptor<?>>();
+ for (Class<?> ejbClass : discoverEjbs(getBeanClasses()))
+ {
+ ejbs.add(MockEjbDescriptor.of(ejbClass));
+ }
+ }
+
+ public Collection<URL> getBeansXml()
+ {
+ return beansXmlFiles;
+ }
+
+ public void setBeansXmlFiles(Collection<URL> beansXmlFiles)
+ {
+ this.beansXmlFiles = beansXmlFiles;
+ }
+
+ public Collection<BeanDeploymentArchive> getBeanDeploymentArchives()
+ {
+ return bdas;
+ }
+
+ public Collection<EjbDescriptor<?>> getEjbs()
+ {
+ return ejbs;
+ }
+
+ protected static Iterable<Class<?>> discoverEjbs(Iterable<Class<?>> webBeanClasses)
+ {
+ Set<Class<?>> ejbs = new HashSet<Class<?>>();
+ for (Class<?> clazz : webBeanClasses)
+ {
+ if (clazz.isAnnotationPresent(Stateless.class) || clazz.isAnnotationPresent(Stateful.class) || clazz.isAnnotationPresent(MessageDriven.class) || clazz.isAnnotationPresent(Singleton.class) || EnterpriseBean.class.isAssignableFrom(clazz))
+ {
+ ejbs.add(clazz);
+ }
+ }
+ return ejbs;
+ }
+
+ public ServiceRegistry getServices()
+ {
+ return services;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof MockBeanDeploymentArchive)
+ {
+ MockBeanDeploymentArchive that = (MockBeanDeploymentArchive) obj;
+ return this.getId().equals(that.getId());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getId().hashCode();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockDeployment.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockDeployment.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockDeployment.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockDeployment.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+
+public class MockDeployment extends AbstractMockDeployment
+{
+
+ private final BeanDeploymentArchive archive;
+
+ public MockDeployment(BeanDeploymentArchive beanDeploymentArchive)
+ {
+ this.archive = beanDeploymentArchive;
+ getBeanDeploymentArchives().add(archive);
+ }
+
+ public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
+ {
+ return archive;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEELifecycle.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockEELifecycle.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEELifecycle.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEELifecycle.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import org.jboss.weld.bootstrap.api.Environment;
+import org.jboss.weld.bootstrap.api.Environments;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+import org.jboss.weld.injection.spi.JpaInjectionServices;
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
+import org.jboss.weld.security.spi.SecurityServices;
+import org.jboss.weld.transaction.spi.TransactionServices;
+import org.jboss.weld.validation.spi.ValidationServices;
+
+public class MockEELifecycle extends MockServletLifecycle
+{
+
+ private static final TransactionServices MOCK_TRANSACTION_SERVICES = new MockTransactionServices();
+
+ public MockEELifecycle()
+ {
+ super();
+ getDeployment().getServices().add(TransactionServices.class, MOCK_TRANSACTION_SERVICES);
+ getDeployment().getServices().add(SecurityServices.class, new MockSecurityServices());
+ getDeployment().getServices().add(ValidationServices.class, new MockValidationServices());
+ getDeployment().getServices().add(EjbServices.class, new MockEjBServices());
+ getWar().getServices().add(EjbInjectionServices.class, new MockEjbInjectionServices());
+ getWar().getServices().add(JpaInjectionServices.class, new MockJpaServices(getDeployment()));
+ getWar().getServices().add(ResourceInjectionServices.class, new MockResourceServices());
+ }
+
+ @Override
+ public Environment getEnvironment()
+ {
+ return Environments.EE_INJECT;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjBServices.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockEjBServices.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjBServices.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjBServices.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import org.jboss.weld.ejb.api.SessionObjectReference;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbServices;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+
+public class MockEjBServices implements EjbServices
+{
+
+
+
+ public SessionObjectReference resolveEjb(EjbDescriptor<?> ejbDescriptor)
+ {
+ return new SessionObjectReference()
+ {
+
+ private static final long serialVersionUID = 1L;
+
+ public <S> S getBusinessObject(Class<S> businessInterfaceType)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void remove()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ public boolean isRemoved()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ };
+ }
+
+ public void registerInterceptors(EjbDescriptor<?> ejbDescriptor, InterceptorBindings interceptorBindings)
+ {
+ // do nothing
+ }
+
+ public void cleanup() {}
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbDescriptor.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockEjbDescriptor.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbDescriptor.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbDescriptor.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,201 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+import javax.ejb.Local;
+import javax.ejb.MessageDriven;
+import javax.ejb.Remove;
+import javax.ejb.Singleton;
+import javax.ejb.Stateful;
+import javax.ejb.Stateless;
+
+import org.jboss.weld.ejb.spi.BusinessInterfaceDescriptor;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+
+public class MockEjbDescriptor<T> implements EjbDescriptor<T>
+{
+ private final Class<T> beanClass;
+ private final String ejbName;
+ private final List<BusinessInterfaceDescriptor<?>> localInterfaces;
+ private final HashSet<Method> removeMethods;
+
+ public static <T> MockEjbDescriptor<T> of(Class<T> type)
+ {
+ return new MockEjbDescriptor<T>(type);
+ }
+
+ private MockEjbDescriptor(final Class<T> type)
+ {
+ this.beanClass = type;
+ this.ejbName = type.getSimpleName();
+ this.localInterfaces = new ArrayList<BusinessInterfaceDescriptor<?>>();
+
+ Local localAnnotation = type.getAnnotation(Local.class);
+ if (localAnnotation != null)
+ {
+ for (final Class<?> clazz : localAnnotation.value())
+ {
+ localInterfaces.add(createBusinessInterfaceDescriptor(clazz));
+ }
+ }
+
+ for (final Class<?> clazz : type.getInterfaces())
+ {
+ if (clazz.isAnnotationPresent(Local.class))
+ {
+ localInterfaces.add(createBusinessInterfaceDescriptor(clazz));
+ }
+ }
+ // cope with EJB 3.1 style no-interface views
+ if (localInterfaces.size() == 0)
+ {
+ localInterfaces.add(createBusinessInterfaceDescriptor(type));
+ }
+ this.removeMethods = new HashSet<Method>();
+ for (final Method method : type.getMethods())
+ {
+ if (method.isAnnotationPresent(Remove.class))
+ {
+ removeMethods.add(method);
+ }
+ }
+ }
+
+ private BusinessInterfaceDescriptor<Object> createBusinessInterfaceDescriptor(final Class<?> clazz)
+ {
+ return new BusinessInterfaceDescriptor<Object>()
+ {
+
+ @SuppressWarnings("unchecked")
+ public Class<Object> getInterface()
+ {
+ return (Class<Object>) clazz;
+ }
+
+ public String getJndiName()
+ {
+ return clazz.getSimpleName() + "/local";
+ }
+
+ };
+ }
+
+ public String getEjbName()
+ {
+ return ejbName;
+ }
+
+ public Collection<BusinessInterfaceDescriptor<?>> getLocalBusinessInterfaces()
+ {
+ return localInterfaces;
+ }
+
+ public Iterable<BusinessInterfaceDescriptor<?>> getRemoteBusinessInterfaces()
+ {
+ return Collections.emptyList();
+ }
+
+ public Collection<Method> getRemoveMethods()
+ {
+
+ return removeMethods;
+ }
+
+ public Class<T> getBeanClass()
+ {
+ return beanClass;
+ }
+
+ public boolean isMessageDriven()
+ {
+ return beanClass.isAnnotationPresent(MessageDriven.class);
+ }
+
+ public boolean isSingleton()
+ {
+ return beanClass.isAnnotationPresent(Singleton.class);
+ }
+
+ public boolean isStateful()
+ {
+ return beanClass.isAnnotationPresent(Stateful.class);
+ }
+
+ public boolean isStateless()
+ {
+ return beanClass.isAnnotationPresent(Stateless.class);
+ }
+
+ public String getLocalJndiName()
+ {
+ return beanClass.getSimpleName() + "/local";
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getEjbName());
+ if (isStateful())
+ {
+ builder.append(" (SFSB)");
+ }
+ if (isStateless())
+ {
+ builder.append(" (SLSB)");
+ }
+ if (isSingleton())
+ {
+ builder.append(" (Singleton)");
+ }
+ if (isMessageDriven())
+ {
+ builder.append(" (MDB)");
+ }
+ builder.append("remove methods; " + removeMethods + "; ");
+ builder.append("; BeanClass: " + getBeanClass() + "; Local Business Interfaces: " + getLocalBusinessInterfaces());
+ return builder.toString();
+ }
+
+// @Override
+// public boolean equals(Object other)
+// {
+// if (other instanceof EjbDescriptor)
+// {
+// EjbDescriptor<T> that = (EjbDescriptor<T>) other;
+// return this.getBeanClass().equals(that.getBeanClass());
+// }
+// else
+// {
+// return false;
+// }
+// }
+//
+// @Override
+// public int hashCode()
+// {
+// return getEjbName().hashCode();
+// }
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbInjectionServices.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockEjbInjectionServices.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbInjectionServices.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockEjbInjectionServices.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.weld.injection.spi.EjbInjectionServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockEjbInjectionServices implements EjbInjectionServices
+{
+
+ public Object resolveEjb(InjectionPoint injectionPoint)
+ {
+ return null;
+ }
+
+ public void cleanup() {}
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockHttpSession.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockHttpSession.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockHttpSession.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockHttpSession.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,177 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionContext;
+
+/**
+ * A mock implementation of the HttpSession interface for tests.
+ *
+ * @author Dan Allen
+ */
+public class MockHttpSession implements HttpSession
+{
+ private String id;
+
+ private ServletContext servletContext;
+
+ private Map<String, Object> attributes = new HashMap<String, Object>();
+
+ private boolean invalid = false;
+
+ private int maxInactiveInterval = 60;
+
+ private int lastAccessedTime = -1;
+
+ public MockHttpSession() {}
+
+ public MockHttpSession(String id)
+ {
+ this.id = id;
+ }
+
+ public MockHttpSession(String id, ServletContext servletContext)
+ {
+ this(id);
+ this.servletContext = servletContext;
+ }
+
+ public Object getAttribute(String name)
+ {
+ return attributes.get(name);
+ }
+
+ public Enumeration<String> getAttributeNames()
+ {
+ final Iterator<String> nameIterator = attributes.keySet().iterator();
+ return new Enumeration<String>()
+ {
+
+ public boolean hasMoreElements()
+ {
+ return nameIterator.hasNext();
+ }
+
+ public String nextElement()
+ {
+ return nameIterator.next();
+ }
+ };
+ }
+
+ public long getCreationTime()
+ {
+ return 0;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public long getLastAccessedTime()
+ {
+ return lastAccessedTime;
+ }
+
+ public int getMaxInactiveInterval()
+ {
+ return maxInactiveInterval;
+ }
+
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
+
+ @SuppressWarnings("deprecation")
+ public HttpSessionContext getSessionContext()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ public Object getValue(String name)
+ {
+ return getAttribute(name);
+ }
+
+ public String[] getValueNames()
+ {
+ return attributes.keySet().toArray(new String[0]);
+ }
+
+ public void invalidate()
+ {
+ attributes.clear();
+ invalid = true;
+ }
+
+ public boolean isNew()
+ {
+ return false;
+ }
+
+ public void putValue(String name, Object value)
+ {
+ setAttribute(name, value);
+ }
+
+ public void removeAttribute(String name)
+ {
+ attributes.remove(name);
+ }
+
+ public void removeValue(String name)
+ {
+ removeAttribute(name);
+ }
+
+ public void setAttribute(String name, Object value)
+ {
+ if (value == null)
+ {
+ removeAttribute(name);
+ }
+ else
+ {
+ attributes.put(name, value);
+ }
+ }
+
+ public void setMaxInactiveInterval(int seconds)
+ {
+ maxInactiveInterval = seconds;
+ }
+
+ public boolean isInvalid()
+ {
+ return invalid;
+ }
+
+ public void access()
+ {
+ lastAccessedTime = (int) System.currentTimeMillis();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockJpaServices.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockJpaServices.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockJpaServices.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockJpaServices.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.persistence.Entity;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.injection.spi.JpaInjectionServices;
+
+public class MockJpaServices implements JpaInjectionServices
+{
+
+ private final Deployment deployment;
+
+ public MockJpaServices(Deployment deployment)
+ {
+ this.deployment = deployment;
+ }
+
+ public EntityManager resolvePersistenceContext(InjectionPoint injectionPoint)
+ {
+ return null;
+ }
+
+ public EntityManagerFactory resolvePersistenceUnit(InjectionPoint injectionPoint)
+ {
+ return null;
+ }
+
+ public Collection<Class<?>> discoverEntities()
+ {
+ Set<Class<?>> classes = new HashSet<Class<?>>();
+ for (BeanDeploymentArchive archive : deployment.getBeanDeploymentArchives())
+ {
+ discoverEntities(archive, classes);
+ }
+ return classes;
+ }
+
+ private void discoverEntities(BeanDeploymentArchive archive, Set<Class<?>> classes)
+ {
+ for (Class<?> clazz : archive.getBeanClasses())
+ {
+ if (clazz.isAnnotationPresent(Entity.class))
+ {
+ classes.add(clazz);
+ }
+ }
+ for (BeanDeploymentArchive child : archive.getBeanDeploymentArchives())
+ {
+ discoverEntities(child, classes);
+ }
+ }
+
+ public void cleanup() {}
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockLifecycle.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockLifecycle.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockLifecycle.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockLifecycle.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import org.jboss.weld.bootstrap.api.Lifecycle;
+
+public interface MockLifecycle extends Lifecycle
+{
+
+ public abstract void initialize();
+
+ public abstract void beginApplication();
+
+ public abstract void endApplication();
+
+ public abstract void resetContexts();
+
+ public abstract void beginRequest();
+
+ public abstract void endRequest();
+
+ public abstract void beginSession();
+
+ public abstract void endSession();
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceLoader.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockResourceLoader.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceLoader.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceLoader.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.resources.spi.ResourceLoadingException;
+import org.jboss.weld.util.collections.EnumerationList;
+
+public class MockResourceLoader implements ResourceLoader
+{
+
+ public Class<?> classForName(String name)
+ {
+ try
+ {
+ return Thread.currentThread().getContextClassLoader().loadClass(name);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new ResourceLoadingException(e);
+ }
+ }
+
+ public URL getResource(String name)
+ {
+ return Thread.currentThread().getContextClassLoader().getResource(name);
+ }
+
+ public Collection<URL> getResources(String name)
+ {
+ try
+ {
+ return new EnumerationList<URL>(Thread.currentThread().getContextClassLoader().getResources(name));
+ }
+ catch (IOException e)
+ {
+ throw new ResourceLoadingException(e);
+ }
+ }
+
+ public void cleanup() {}
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceServices.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockResourceServices.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceServices.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockResourceServices.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.weld.injection.spi.ResourceInjectionServices;
+
+/**
+ * @author Pete Muir
+ *
+ */
+public class MockResourceServices implements ResourceInjectionServices
+{
+
+ public Object resolveResource(InjectionPoint injectionPoint)
+ {
+ return null;
+ }
+
+ public Object resolveResource(String jndiName, String mappedName)
+ {
+ return null;
+ }
+
+ public void cleanup() {}
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockSecurityServices.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockSecurityServices.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockSecurityServices.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockSecurityServices.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import java.security.Principal;
+
+import org.jboss.weld.security.spi.SecurityServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockSecurityServices implements SecurityServices
+{
+
+ public Principal getPrincipal()
+ {
+ return new Principal()
+ {
+
+ public String getName()
+ {
+ return null;
+ }
+ };
+ }
+
+ public void cleanup() {}
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletContext.java (from rev 6828, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockServletContext.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletContext.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletContext.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,704 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterRegistration;
+import javax.servlet.RequestDispatcher;
+import javax.servlet.Servlet;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.SessionCookieConfig;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.FilterRegistration.Dynamic;
+import javax.servlet.descriptor.JspConfigDescriptor;
+
+/**
+ * Mock implementation of the servlet context for testing purposes. This implementation supports all
+ * of the standard context methods except that request dispatching just indicates what is being
+ * dispatched to, rather than doing the actual dispatch.
+ * <p>
+ * The context can be configured with a path parameter that should point to an absolute directory
+ * location that represents the place where the contents of the WAR bundle are located. Setting this
+ * value allows all of the resource location functionality to work as in a fully functioning web
+ * application. This value is not set then not resource location functionality will work and instead
+ * null will always be returned.
+ *
+ * Adapted from Apache Wicket
+ *
+ * @author Chris Turner (Wicket)
+ */
+public class MockServletContext implements ServletContext
+{
+ private final Map<String, Object> attributes = new HashMap<String, Object>();
+
+ private final Map<String, String> initParameters = new HashMap<String, String>();
+
+ /** Map of mime types */
+ private final Map<String, String> mimeTypes = new HashMap<String, String>();
+
+ private File webappRoot;
+
+ /**
+ * Create the mock object. As part of the creation, the context sets the root directory where
+ * web application content is stored. This must be an ABSOLUTE directory relative to where the
+ * tests are being executed. For example: <code>System.getProperty("user.dir") +
+ * "/src/webapp"</code>
+ *
+ * @param application
+ * The application that this context is for
+ * @param path
+ * The path to the root of the web application
+ */
+ public MockServletContext(final String path)
+ {
+ webappRoot = null;
+ if (path != null)
+ {
+ webappRoot = new File(path);
+ if (!webappRoot.exists() || !webappRoot.isDirectory())
+ {
+ //log.warn("WARNING: The webapp root directory is invalid: " + path);
+ webappRoot = null;
+ }
+ }
+
+ // assume we're running in maven or an eclipse project created by maven,
+ // so the sessions directory will be created inside the target directory,
+ // and will be cleaned up with a mvn clean
+
+ File file = new File("target/work/");
+ file.mkdirs();
+ attributes.put("javax.servlet.context.tempdir", file);
+
+ mimeTypes.put("html", "text/html");
+ mimeTypes.put("htm", "text/html");
+ mimeTypes.put("css", "text/css");
+ mimeTypes.put("xml", "text/xml");
+ mimeTypes.put("js", "text/plain");
+ mimeTypes.put("gif", "image/gif");
+ mimeTypes.put("jpg", "image/jpeg");
+ mimeTypes.put("png", "image/png");
+ }
+
+ /**
+ * Add an init parameter.
+ *
+ * @param name
+ * The parameter name
+ * @param value
+ * The parameter value
+ */
+ public void addInitParameter(final String name, final String value)
+ {
+ initParameters.put(name, value);
+ }
+
+ // Configuration methods
+
+ /**
+ * Add a new recognized mime type.
+ *
+ * @param fileExtension
+ * The file extension (e.g. "jpg")
+ * @param mimeType
+ * The mime type (e.g. "image/jpeg")
+ */
+ public void addMimeType(final String fileExtension, final String mimeType)
+ {
+ mimeTypes.put(fileExtension, mimeType);
+ }
+
+ /**
+ * Get an attribute with the given name.
+ *
+ * @param name
+ * The attribute name
+ * @return The value, or null
+ */
+ public Object getAttribute(final String name)
+ {
+ return attributes.get(name);
+ }
+
+ /**
+ * Get all of the attribute names.
+ *
+ * @return The attribute names
+ */
+ public Enumeration<String> getAttributeNames()
+ {
+ return Collections.enumeration(attributes.keySet());
+ }
+
+ // ServletContext interface methods
+
+ /**
+ * Get the context for the given URL path
+ *
+ * @param name
+ * The url path
+ * @return Always returns this
+ */
+ public ServletContext getContext(String name)
+ {
+ return this;
+ }
+
+ /**
+ * Get the init parameter with the given name.
+ *
+ * @param name
+ * The name
+ * @return The parameter, or null if no such parameter
+ */
+ public String getInitParameter(final String name)
+ {
+ return initParameters.get(name);
+ }
+
+ /**
+ * Get the name of all of the init parameters.
+ *
+ * @return The init parameter names
+ */
+ public Enumeration<String> getInitParameterNames()
+ {
+ return Collections.enumeration(initParameters.keySet());
+ }
+
+ /**
+ * @return Always 2
+ */
+ public int getMajorVersion()
+ {
+ return 2;
+ }
+
+ /**
+ * Get the mime type for the given file. Uses a hardcoded map of mime types set at
+ * Initialization time.
+ *
+ * @param name
+ * The name to get the mime type for
+ * @return The mime type
+ */
+ public String getMimeType(final String name)
+ {
+ int index = name.lastIndexOf('.');
+ if (index == -1 || index == (name.length() - 1))
+ {
+ return null;
+ }
+ else
+ {
+ return mimeTypes.get(name.substring(index + 1));
+ }
+ }
+
+ /**
+ * @return Always 3
+ */
+ public int getMinorVersion()
+ {
+ return 3;
+ }
+
+ /**
+ * Wicket does not use the RequestDispatcher, so this implementation just returns a dummy value.
+ *
+ * @param name
+ * The name of the servlet or JSP
+ * @return The dispatcher
+ */
+ public RequestDispatcher getNamedDispatcher(final String name)
+ {
+ return getRequestDispatcher(name);
+ }
+
+ /**
+ * Get the real file path of the given resource name.
+ *
+ * @param name
+ * The name
+ * @return The real path or null
+ */
+ public String getRealPath(String name)
+ {
+ if (webappRoot == null)
+ {
+ return null;
+ }
+
+ if (name.startsWith("/"))
+ {
+ name = name.substring(1);
+ }
+
+ File f = new File(webappRoot, name);
+ if (!f.exists())
+ {
+ return null;
+ }
+ else
+ {
+ return f.getPath();
+ }
+ }
+
+ /**
+ * Wicket does not use the RequestDispatcher, so this implementation just returns a dummy value.
+ *
+ * @param name
+ * The name of the resource to get the dispatcher for
+ * @return The dispatcher
+ */
+ public RequestDispatcher getRequestDispatcher(final String name)
+ {
+ return new RequestDispatcher()
+ {
+ public void forward(ServletRequest servletRequest, ServletResponse servletResponse)
+ throws IOException
+ {
+ servletResponse.getWriter().write("FORWARD TO RESOURCE: " + name);
+ }
+
+ public void include(ServletRequest servletRequest, ServletResponse servletResponse)
+ throws IOException
+ {
+ servletResponse.getWriter().write("INCLUDE OF RESOURCE: " + name);
+ }
+ };
+ }
+
+ /**
+ * Get the URL for a particular resource that is relative to the web app root directory.
+ *
+ * @param name
+ * The name of the resource to get
+ * @return The resource, or null if resource not found
+ * @throws MalformedURLException
+ * If the URL is invalid
+ */
+ public URL getResource(String name) throws MalformedURLException
+ {
+ if (webappRoot == null)
+ {
+ return null;
+ }
+
+ if (name.startsWith("/"))
+ {
+ name = name.substring(1);
+ }
+
+ File f = new File(webappRoot, name);
+ if (!f.exists())
+ {
+ return null;
+ }
+ else
+ {
+ return f.toURI().toURL();
+ }
+ }
+
+ /**
+ * Get an input stream for a particular resource that is relative to the web app root directory.
+ *
+ * @param name
+ * The name of the resource to get
+ * @return The input stream for the resource, or null of resource is not found
+ */
+ public InputStream getResourceAsStream(String name)
+ {
+ if (webappRoot == null)
+ {
+ return null;
+ }
+
+ if (name.startsWith("/"))
+ {
+ name = name.substring(1);
+ }
+
+ File f = new File(webappRoot, name);
+ if (!f.exists())
+ {
+ return null;
+ }
+ else
+ {
+ try
+ {
+ return new FileInputStream(f);
+ }
+ catch (FileNotFoundException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ }
+
+ /**
+ * Get the resource paths starting from the web app root directory and then relative to the the
+ * given name.
+ *
+ * @param name
+ * The starting name
+ * @return The set of resource paths at this location
+ */
+ public Set<String> getResourcePaths(String name)
+ {
+ if (webappRoot == null)
+ {
+ return new HashSet<String>();
+ }
+
+ if (name.startsWith("/"))
+ {
+ name = name.substring(1);
+ }
+ if (name.endsWith("/"))
+ {
+ name = name.substring(0, name.length() - 1);
+ }
+ String[] elements = null;
+ if (name.trim().length() == 0)
+ {
+ elements = new String[0];
+ }
+ else
+ {
+ elements = name.split("/");
+ }
+
+ File current = webappRoot;
+ for (int i = 0; i < elements.length; i++)
+ {
+ File[] files = current.listFiles();
+ boolean match = false;
+ for (int f = 0; f < files.length; f++)
+ {
+ if (files[f].getName().equals(elements[i]) && files[f].isDirectory())
+ {
+ current = files[f];
+ match = true;
+ break;
+ }
+ }
+ if (!match)
+ {
+ return null;
+ }
+ }
+
+ File[] files = current.listFiles();
+ Set<String> result = new HashSet<String>();
+ int stripLength = webappRoot.getPath().length();
+ for (int f = 0; f < files.length; f++)
+ {
+ String s = files[f].getPath().substring(stripLength).replace('\\', '/');
+ if (files[f].isDirectory())
+ {
+ s = s + "/";
+ }
+ result.add(s);
+ }
+ return result;
+ }
+
+ /**
+ * Get the server info.
+ *
+ * @return The server info
+ */
+ public String getServerInfo()
+ {
+ return "Wicket Mock Test Environment v1.0";
+ }
+
+ /**
+ * NOT USED - Servlet Spec requires that this always returns null.
+ *
+ * @param name
+ * Not used
+ * @return null
+ * @throws ServletException
+ * Not used
+ */
+ public Servlet getServlet(String name) throws ServletException
+ {
+ return null;
+ }
+
+ /**
+ * Return the name of the servlet context.
+ *
+ * @return The name
+ */
+ public String getServletContextName()
+ {
+ return "Mock";
+ }
+
+ /**
+ * NOT USED - Servlet spec requires that this always returns null.
+ *
+ * @return null
+ */
+ public Enumeration<String> getServletNames()
+ {
+ return null;
+ }
+
+ /**
+ * NOT USED - Servlet spec requires that this always returns null.
+ *
+ * @return null
+ */
+ public Enumeration<Servlet> getServlets()
+ {
+ return null;
+ }
+
+ /**
+ * As part of testing we always log to the console.
+ *
+ * @param e
+ * The exception to log
+ * @param msg
+ * The message to log
+ */
+ public void log(Exception e, String msg)
+ {
+ //log.error(msg, e);
+ }
+
+ /**
+ * As part of testing we always log to the console.
+ *
+ * @param msg
+ * The message to log
+ */
+ public void log(String msg)
+ {
+ //log.info(msg);
+ }
+
+ /**
+ * As part of testing we always log to the console.
+ *
+ * @param msg
+ * The message to log
+ * @param cause
+ * The cause exception
+ */
+ public void log(String msg, Throwable cause)
+ {
+ //log.error(msg, cause);
+ }
+
+ /**
+ * Remove an attribute with the given name.
+ *
+ * @param name
+ * The name
+ */
+ public void removeAttribute(final String name)
+ {
+ attributes.remove(name);
+ }
+
+ /**
+ * Set an attribute.
+ *
+ * @param name
+ * The name of the attribute
+ * @param o
+ * The value
+ */
+ public void setAttribute(final String name, final Object o)
+ {
+ attributes.put(name, o);
+ }
+
+ /**
+ * @return context path
+ */
+ public String getContextPath()
+ {
+ return "";
+ }
+
+ public Dynamic addFilter(String arg0, String arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Dynamic addFilter(String arg0, Filter arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Dynamic addFilter(String arg0, Class<? extends Filter> arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void addListener(String arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public <T extends EventListener> void addListener(T arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void addListener(Class<? extends EventListener> arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+ String arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+ Servlet arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0,
+ Class<? extends Servlet> arg1) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T extends Filter> T createFilter(Class<T> arg0)
+ throws ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T extends EventListener> T createListener(Class<T> arg0)
+ throws ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T extends Servlet> T createServlet(Class<T> arg0)
+ throws ServletException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void declareRoles(String... arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public ClassLoader getClassLoader() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Set<SessionTrackingMode> getDefaultSessionTrackingModes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public int getEffectiveMajorVersion() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public int getEffectiveMinorVersion() {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ public Set<SessionTrackingMode> getEffectiveSessionTrackingModes() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public FilterRegistration getFilterRegistration(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Map<String, ? extends FilterRegistration> getFilterRegistrations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public JspConfigDescriptor getJspConfigDescriptor() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ServletRegistration getServletRegistration(String arg0) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Map<String, ? extends ServletRegistration> getServletRegistrations() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public SessionCookieConfig getSessionCookieConfig() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean setInitParameter(String arg0, String arg1) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void setSessionTrackingModes(Set<SessionTrackingMode> arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletLifecycle.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,183 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import org.jboss.weld.bootstrap.WeldBootstrap;
+import org.jboss.weld.bootstrap.api.Environment;
+import org.jboss.weld.bootstrap.api.Environments;
+import org.jboss.weld.bootstrap.api.Lifecycle;
+import org.jboss.weld.bootstrap.api.helpers.ForwardingLifecycle;
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.api.BeanStore;
+import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.jboss.weld.resources.spi.ResourceLoader;
+import org.jboss.weld.servlet.api.ServletServices;
+
+public class MockServletLifecycle extends ForwardingLifecycle implements MockLifecycle
+{
+ private static final ResourceLoader MOCK_RESOURCE_LOADER = new MockResourceLoader();
+
+ private final WeldBootstrap bootstrap;
+ private final Deployment deployment;
+ private final MockBeanDeploymentArchive war;
+ private final BeanStore applicationBeanStore;
+ private final BeanStore sessionBeanStore;
+ private final BeanStore requestBeanStore;
+
+ private Lifecycle lifecycle;
+
+ public MockServletLifecycle()
+ {
+ this(new MockBeanDeploymentArchive());
+ }
+
+ private MockServletLifecycle(MockBeanDeploymentArchive war)
+ {
+ this(new MockDeployment(war), war);
+ }
+
+ public MockServletLifecycle(Deployment deployment, MockBeanDeploymentArchive war)
+ {
+ this.deployment = deployment;
+ this.war = war;
+ if (deployment == null)
+ {
+ throw new IllegalStateException("No WebBeanDiscovery is available");
+ }
+ this.bootstrap = new WeldBootstrap();
+ this.deployment.getServices().add(ResourceLoader.class, MOCK_RESOURCE_LOADER);
+ this.deployment.getServices().add(ServletServices.class, new MockServletServices(war));
+ this.applicationBeanStore = new ConcurrentHashMapBeanStore();
+ this.sessionBeanStore = new ConcurrentHashMapBeanStore();
+ this.requestBeanStore = new ConcurrentHashMapBeanStore();
+ }
+
+ protected BeanStore getSessionBeanStore()
+ {
+ return sessionBeanStore;
+ }
+
+ protected BeanStore getRequestBeanStore()
+ {
+ return requestBeanStore;
+ }
+
+ protected BeanStore getApplicationBeanStore()
+ {
+ return applicationBeanStore;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.weld.mock.MockLifecycle#initialize()
+ */
+ public void initialize()
+ {
+ try
+ {
+ bootstrap.startContainer(getEnvironment(), getDeployment(), getApplicationBeanStore());
+ }
+ finally
+ {
+ lifecycle = deployment.getServices().get(ContextLifecycle.class);
+ }
+ }
+
+ @Override
+ protected Lifecycle delegate()
+ {
+ return lifecycle;
+ }
+
+ protected Deployment getDeployment()
+ {
+ return deployment;
+ }
+
+ public WeldBootstrap getBootstrap()
+ {
+ return bootstrap;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.weld.mock.MockLifecycle#beginApplication()
+ */
+ public void beginApplication()
+ {
+ bootstrap.startInitialization().deployBeans().validateBeans().endInitialization();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.weld.mock.MockLifecycle#endApplication()
+ */
+ @Override
+ public void endApplication()
+ {
+ bootstrap.shutdown();
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.weld.mock.MockLifecycle#resetContexts()
+ */
+ public void resetContexts()
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.weld.mock.MockLifecycle#beginRequest()
+ */
+ public void beginRequest()
+ {
+ super.beginRequest("Mock", getRequestBeanStore());
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.weld.mock.MockLifecycle#endRequest()
+ */
+ public void endRequest()
+ {
+ super.endRequest("Mock", getRequestBeanStore());
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.weld.mock.MockLifecycle#beginSession()
+ */
+ public void beginSession()
+ {
+ super.restoreSession("Mock", getSessionBeanStore());
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.weld.mock.MockLifecycle#endSession()
+ */
+ public void endSession()
+ {
+ // TODO Conversation handling breaks this :-(
+ //super.endSession("Mock", sessionBeanStore);
+ }
+
+ protected Environment getEnvironment()
+ {
+ return Environments.SERVLET;
+ }
+
+ public MockBeanDeploymentArchive getWar()
+ {
+ return war;
+ }
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletServices.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockServletServices.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletServices.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockServletServices.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import javax.servlet.ServletContext;
+
+import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.weld.servlet.api.ServletServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockServletServices implements ServletServices
+{
+
+ private final BeanDeploymentArchive beanDeploymentArchive;
+
+ public MockServletServices(BeanDeploymentArchive beanDeploymentArchive)
+ {
+ this.beanDeploymentArchive = beanDeploymentArchive;
+ }
+
+ public BeanDeploymentArchive getBeanDeploymentArchive(ServletContext ctx)
+ {
+ if (ctx instanceof MockServletContext)
+ {
+ return beanDeploymentArchive;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public void cleanup() {}
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockTransactionServices.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockTransactionServices.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockTransactionServices.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockTransactionServices.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.Synchronization;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+
+import org.jboss.weld.transaction.spi.TransactionServices;
+
+/**
+ * A mock version of TransactionServices for RI unit tests. Since
+ * no JTA transaction can be active for these unit tests, all
+ * methods here are empty.
+ *
+ * @author David Allen
+ *
+ */
+public class MockTransactionServices implements TransactionServices
+{
+
+ public boolean isTransactionActive()
+ {
+ return false;
+ }
+
+ public void registerSynchronization(Synchronization synchronizedObserver)
+ {
+ }
+
+ public UserTransaction getUserTransaction()
+ {
+ return new UserTransaction()
+ {
+
+ public void setTransactionTimeout(int arg0) throws SystemException
+ {
+
+ }
+
+ public void setRollbackOnly() throws IllegalStateException, SystemException
+ {
+
+ }
+
+ public void rollback() throws IllegalStateException, SecurityException, SystemException
+ {
+
+ }
+
+ public int getStatus() throws SystemException
+ {
+ return 0;
+ }
+
+ public void commit() throws RollbackException, HeuristicMixedException, HeuristicRollbackException, SecurityException, IllegalStateException, SystemException
+ {
+
+ }
+
+ public void begin() throws NotSupportedException, SystemException
+ {
+
+ }
+ };
+ }
+
+ public void cleanup() {}
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidationServices.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockValidationServices.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidationServices.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidationServices.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import javax.validation.ConstraintValidatorFactory;
+import javax.validation.MessageInterpolator;
+import javax.validation.TraversableResolver;
+import javax.validation.ValidationException;
+import javax.validation.Validator;
+import javax.validation.ValidatorContext;
+import javax.validation.ValidatorFactory;
+
+import org.jboss.weld.validation.spi.ValidationServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class MockValidationServices implements ValidationServices
+{
+
+ public ValidatorFactory getDefaultValidatorFactory()
+ {
+ return new ValidatorFactory()
+ {
+
+ public ValidatorContext usingContext()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> T unwrap(Class<T> type)
+ {
+ if (type.equals(ValidatorFactory.class))
+ {
+ return type.cast(this);
+ }
+ else
+ {
+ throw new ValidationException();
+ }
+ }
+
+ public Validator getValidator()
+ {
+ return new MockValidator();
+ }
+
+ public TraversableResolver getTraversableResolver()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public MessageInterpolator getMessageInterpolator()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public ConstraintValidatorFactory getConstraintValidatorFactory()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ };
+ }
+
+ public void cleanup() {}
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidator.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/MockValidator.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidator.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/MockValidator.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import java.util.Set;
+
+import javax.validation.ConstraintViolation;
+import javax.validation.ValidationException;
+import javax.validation.Validator;
+import javax.validation.metadata.BeanDescriptor;
+
+public class MockValidator implements Validator
+{
+
+ public BeanDescriptor getConstraintsForClass(Class<?> clazz)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> T unwrap(Class<T> type)
+ {
+ if (type.equals(Validator.class))
+ {
+ return type.cast(this);
+ }
+ else
+ {
+ throw new ValidationException();
+ }
+ }
+
+ public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, Class<?>... groups)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value, Class<?>... groups)
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+}
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/TestContainer.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/TestContainer.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/TestContainer.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/TestContainer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.mock;
+
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.jboss.weld.bootstrap.spi.Deployment;
+import org.jboss.weld.context.ConversationContext;
+import org.jboss.weld.manager.BeanManagerImpl;
+
+/**
+ * Control of the container, used for tests. Wraps up common operations.
+ *
+ * If you require more control over the container bootstrap lifecycle you should
+ * use the {@link #getLifecycle()} method. For example:
+ *
+ * <code>TestContainer container = new TestContainer(...);
+ * container.getLifecycle().initialize();
+ * container.getLifecycle().getBootstrap().startInitialization();
+ * container.getLifecycle().getBootstrap().deployBeans();
+ * container.getLifecycle().getBootstrap().validateBeans();
+ * container.getLifecycle().getBootstrap().endInitialization();
+ * container.getLifecycle().stopContainer();</code>
+ *
+ * Note that we can easily mix fine-grained calls to bootstrap, and coarse grained calls to {@link TestContainer}.
+ *
+ * @author pmuir
+ *
+ */
+public class TestContainer
+{
+
+ private final MockServletLifecycle lifecycle;
+
+ /**
+ * Create a container, specifying the classes and beans.xml to deploy
+ *
+ * @param lifecycle
+ * @param classes
+ * @param beansXml
+ */
+ public TestContainer(MockServletLifecycle lifecycle, Collection<Class<?>> classes, Collection<URL> beansXml)
+ {
+ this(lifecycle);
+ configureArchive(classes, beansXml);
+ }
+
+ public TestContainer(MockServletLifecycle lifecycle)
+ {
+ this.lifecycle = lifecycle;
+ }
+
+ public TestContainer(MockServletLifecycle lifecycle, Class<?>[] classes, URL[] beansXml)
+ {
+ this(lifecycle, classes == null ? null : Arrays.asList(classes), beansXml == null ? null : Arrays.asList(beansXml));
+ }
+
+ public TestContainer(MockServletLifecycle lifecycle, Class<?>... classes)
+ {
+ this(lifecycle, classes == null ? null : Arrays.asList(classes), null);
+ }
+
+ /**
+ * Starts the container and begins the application
+ */
+ public TestContainer startContainer()
+ {
+ getLifecycle().initialize();
+ getLifecycle().beginApplication();
+ return this;
+ }
+
+ /**
+ * Configure's the archive with the classes and beans.xml
+ */
+ protected TestContainer configureArchive(Collection<Class<?>> classes, Collection<URL> beansXml)
+ {
+ MockBeanDeploymentArchive archive = lifecycle.getWar();
+ archive.setBeanClasses(classes);
+ if (beansXml != null)
+ {
+ archive.setBeansXmlFiles(beansXml);
+ }
+ return this;
+ }
+
+ /**
+ * Get the context lifecycle, allowing fine control over the contexts' state
+ *
+ * @return
+ */
+ public MockServletLifecycle getLifecycle()
+ {
+ return lifecycle;
+ }
+
+ public BeanManagerImpl getBeanManager()
+ {
+ return getLifecycle().getBootstrap().getManager(getLifecycle().getWar());
+ }
+
+ public Deployment getDeployment()
+ {
+ return getLifecycle().getDeployment();
+ }
+
+ /**
+ * Utility method which ensures a request is active and available for use
+ *
+ */
+ public TestContainer ensureRequestActive()
+ {
+ if (!getLifecycle().isSessionActive())
+ {
+ getLifecycle().beginSession();
+ }
+ if (!getLifecycle().isConversationActive())
+ {
+ ((ConversationContext) getLifecycle().getConversationContext()).setActive(true);
+ }
+ if (!getLifecycle().isRequestActive())
+ {
+ getLifecycle().beginRequest();
+ }
+ return this;
+ }
+
+ /**
+ * Clean up the container, ending any active contexts
+ *
+ */
+ public TestContainer stopContainer()
+ {
+ if (getLifecycle().isRequestActive())
+ {
+ getLifecycle().endRequest();
+ }
+ if (getLifecycle().isConversationActive())
+ {
+ ((ConversationContext) getLifecycle().getConversationContext()).setActive(false);
+ }
+ if (getLifecycle().isSessionActive())
+ {
+ getLifecycle().endSession();
+ }
+ if (getLifecycle().isApplicationActive())
+ {
+ getLifecycle().endApplication();
+ }
+ return this;
+ }
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/cluster)
Modified: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java
===================================================================
--- core/trunk/tests/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java 2010-07-28 18:04:45 UTC (rev 6827)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/cluster/AbstractClusterTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -35,8 +35,8 @@
import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.mock.TestContainer;
import org.jboss.weld.serialization.spi.ProxyServices;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
public class AbstractClusterTest
{
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/mock/el (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/mock/el)
Copied: core/trunk/tests-arquillian/src/main/java/org/jboss/weld/test/Utils.java (from rev 6827, core/trunk/tests/src/main/java/org/jboss/weld/test/Utils.java)
===================================================================
--- core/trunk/tests-arquillian/src/main/java/org/jboss/weld/test/Utils.java (rev 0)
+++ core/trunk/tests-arquillian/src/main/java/org/jboss/weld/test/Utils.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,177 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.test;
+
+import static org.jboss.weld.logging.messages.BeanManagerMessage.UNRESOLVABLE_TYPE;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+import javax.el.ELContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.TypeLiteral;
+
+import org.jboss.weld.bean.proxy.Proxy;
+import org.jboss.weld.exceptions.UnsatisfiedResolutionException;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.mock.el.EL;
+import org.jboss.weld.util.collections.EnumerationList;
+
+
+public class Utils
+{
+
+ /**
+ * Checks if all annotations are in a given set of annotations
+ *
+ * @param annotations The annotation set
+ * @param annotationTypes The annotations to match
+ * @return True if match, false otherwise
+ */
+ public static boolean annotationSetMatches(Set<? extends Annotation> annotations, Class<? extends Annotation>... annotationTypes)
+ {
+ List<Class<? extends Annotation>> annotationTypeList = new ArrayList<Class<? extends Annotation>>();
+ annotationTypeList.addAll(Arrays.asList(annotationTypes));
+ for (Annotation annotation : annotations)
+ {
+ if (annotationTypeList.contains(annotation.annotationType()))
+ {
+ annotationTypeList.remove(annotation.annotationType());
+ }
+ else
+ {
+ return false;
+ }
+ }
+ return annotationTypeList.size() == 0;
+ }
+
+ public static boolean typeSetMatches(Set<Type> types, Type... requiredTypes)
+ {
+ List<Type> typeList = Arrays.asList(requiredTypes);
+ return requiredTypes.length == types.size() && types.containsAll(typeList);
+ }
+
+ public static Iterable<URL> getResources(Class<?> clazz, String name)
+ {
+ if (name.startsWith("/"))
+ {
+ name = name.substring(1);
+ }
+ else
+ {
+ name = clazz.getPackage().getName().replace(".", "/") + "/" + name;
+ }
+ try
+ {
+ return new EnumerationList<URL>(clazz.getClassLoader().getResources(name));
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error loading resource from classloader" + name, e);
+ }
+ }
+
+ public static byte[] serialize(Object instance) throws IOException
+ {
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(bytes);
+ out.writeObject(instance);
+ return bytes.toByteArray();
+ }
+
+ public static <T> T deserialize(byte[] bytes) throws IOException, ClassNotFoundException
+ {
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
+ return (T) in.readObject();
+ }
+
+ public static boolean isExceptionInHierarchy(Throwable exception, Class<? extends Throwable> expectedException )
+ {
+ while (exception != null)
+ {
+ if (exception.getClass().equals(expectedException))
+ {
+ return true;
+ }
+ exception = exception.getCause();
+ }
+ return false;
+ }
+
+ public static <T> Bean<T> getBean(BeanManagerImpl beanManager, Type beanType, Annotation... bindings)
+ {
+ Set<Bean<?>> beans = beanManager.getBeans(beanType, bindings);
+ Bean<?> bean = beanManager.resolve(beans);
+ if (bean == null)
+ {
+ throw new UnsatisfiedResolutionException(UNRESOLVABLE_TYPE, beanType, Arrays.toString(bindings));
+ }
+
+ @SuppressWarnings("unchecked")
+ Bean<T> typedBean = (Bean<T>) bean;
+
+ return typedBean;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> Set<Bean<T>> getBeans(BeanManagerImpl beanManager, Class<T> type, Annotation... bindings)
+ {
+ return (Set) beanManager.getBeans(type, bindings);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> Set<Bean<T>> getBeans(BeanManagerImpl beanManager, TypeLiteral<T> type, Annotation... bindings)
+ {
+ return (Set) beanManager.getBeans(type.getType(), bindings);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T getReference(BeanManagerImpl beanManager, Class<T> beanType, Annotation... bindings)
+ {
+ Bean<?> bean = getBean(beanManager, beanType, bindings);
+ return (T) beanManager.getReference(bean, beanType, beanManager.createCreationalContext(bean));
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T getReference(BeanManagerImpl beanManager, Bean<T> bean)
+ {
+ return (T) beanManager.getReference(bean, bean.getBeanClass(), beanManager.createCreationalContext(bean));
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T evaluateValueExpression(BeanManagerImpl beanManager, String expression, Class<T> expectedType)
+ {
+ ELContext elContext = EL.createELContext(beanManager.getCurrent());
+ return (T) EL.EXPRESSION_FACTORY.createValueExpression(elContext, expression, expectedType).getValue(elContext);
+ }
+
+ public static boolean isProxy(Object proxy)
+ {
+ return proxy instanceof Proxy;
+ }
+}
Added: core/trunk/tests-arquillian/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.BeanArchive
===================================================================
--- core/trunk/tests-arquillian/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.BeanArchive (rev 0)
+++ core/trunk/tests-arquillian/src/main/resources/META-INF/services/org.jboss.shrinkwrap.api.BeanArchive 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,2 @@
+implementingClassName=org.jboss.shrinkwrap.impl.BeanArchiveImpl
+extension=.jar
\ No newline at end of file
Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTestRunner.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTestRunner.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTestRunner.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,62 @@
+package org.jboss.weld.tests;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.jboss.shrinkwrap.impl.base.URLPackageScanner;
+import org.jboss.weld.tests.annotatedType.ExampleTest;
+import org.junit.runners.Suite;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.RunnerBuilder;
+
+public class AllTestRunner extends Suite
+{
+ public AllTestRunner(Class<?> superClass, RunnerBuilder builder) throws InitializationError
+ {
+ super(builder, superClass, getAllClasses());
+ }
+
+ private static Class<?>[] getAllClasses()
+ {
+ final List<Class<?>> classes = new ArrayList<Class<?>>();
+ final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ URLPackageScanner.newInstance(
+ true,
+ classLoader,
+ new URLPackageScanner.Callback()
+ {
+ public void classFound(String className)
+ {
+ if(!className.endsWith("Test"))
+ {
+ return;
+ }
+ if(className.substring(className.lastIndexOf('.') +1).length() <= 4)
+ {
+ return;
+ }
+ try
+ {
+ classes.add(classLoader.loadClass(className));
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ },
+ AllTestRunner.class.getPackage()).scanPackage();
+ //ExampleTest.class.getPackage()).scanPackage();
+
+ Collections.sort(classes, new Comparator<Class<?>>()
+ {
+ public int compare(Class<?> o1, Class<?> o2)
+ {
+ return o1.getPackage().getName().compareTo(o2.getPackage().getName());
+ }
+ });
+ return classes.toArray(new Class<?>[]{});
+ }
+}
Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTests.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTests.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/AllTests.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.weld.tests;
+
+import org.junit.runner.RunWith;
+
+/**
+ * Dummy test class to scan classpath for all Tests.
+ *
+ * @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+(a)RunWith(AllTestRunner.class)
+public class AllTests
+{
+
+}
Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/CategoryArchiveAppender.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/CategoryArchiveAppender.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/CategoryArchiveAppender.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.weld.tests;
+
+import org.jboss.arquillian.spi.AuxiliaryArchiveAppender;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.tests.category.Integration;
+
+/**
+ * CategoryArchiveAppender
+ *
+ * @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class CategoryArchiveAppender implements AuxiliaryArchiveAppender
+{
+
+ /* (non-Javadoc)
+ * @see org.jboss.arquillian.spi.AuxiliaryArchiveAppender#createAuxiliaryArchive()
+ */
+ public Archive<?> createAuxiliaryArchive()
+ {
+ return ShrinkWrap.create(JavaArchive.class, "weld-core-test-categories.jar")
+ .addPackage(Integration.class.getPackage());
+ }
+}
Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/IntegrationSuite.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/IntegrationSuite.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/IntegrationSuite.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.weld.tests;
+
+import org.jboss.weld.tests.category.Broken;
+import org.junit.experimental.categories.Categories;
+import org.junit.experimental.categories.Categories.ExcludeCategory;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * IntegrationSuite
+ *
+ * @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+(a)RunWith(Categories.class)
+//(a)IncludeCategory(Integration.class) // this will exclude un marked tests as well.
+(a)ExcludeCategory(Broken.class)
+(a)SuiteClasses(AllTests.class)
+public class IntegrationSuite
+{
+
+}
Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/MyTest.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/MyTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/MyTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+package org.jboss.weld.tests;
+
+import org.jboss.weld.tests.category.Broken;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+public class MyTest
+{
+ @Test
+ @Category(Integration.class)
+ public void integration()
+ {
+ System.out.println("integration");
+ }
+
+ @Test
+ @Category(Broken.class)
+ public void broken()
+ {
+ System.out.println("broken");
+ }
+
+ @Test
+ public void unmarked()
+ {
+ System.out.println("unmarked");
+ }
+
+ @Test
+ @Category({Integration.class, Broken.class})
+ public void brokenintegration()
+ {
+ System.out.println("brokenintegration");
+ }
+}
Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/NormalSuite.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/NormalSuite.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/NormalSuite.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.weld.tests;
+
+import org.jboss.weld.tests.category.ExcludeFromNormalSuite;
+import org.junit.experimental.categories.Categories;
+import org.junit.experimental.categories.Categories.ExcludeCategory;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * IntegrationSuite
+ *
+ * @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+(a)RunWith(Categories.class)
+(a)ExcludeCategory(ExcludeFromNormalSuite.class)
+(a)SuiteClasses(AllTests.class)
+public class NormalSuite
+{
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/ActivitiesTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,365 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.Contextual;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Reception;
+import javax.enterprise.event.TransactionPhase;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.ObserverMethod;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.bean.ForwardingBean;
+import org.jboss.weld.literal.AnyLiteral;
+import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.util.collections.Arrays2;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * Spec version: 20090519
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class ActivitiesTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ActivitiesTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ private static final Set<Annotation> DEFAULT_QUALIFIERS = Collections.<Annotation> singleton(DefaultLiteral.INSTANCE);
+
+ private Bean<?> createDummyBean(BeanManager beanManager, final Type injectionPointType)
+ {
+ final Set<InjectionPoint> injectionPoints = new HashSet<InjectionPoint>();
+ final Set<Type> types = new HashSet<Type>();
+ final Set<Annotation> bindings = new HashSet<Annotation>();
+ bindings.add(new AnnotationLiteral<Tame>()
+ {
+ });
+ types.add(Object.class);
+ final Bean<?> bean = new Bean<Object>()
+ {
+
+ public Set<Annotation> getQualifiers()
+ {
+ return bindings;
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return injectionPoints;
+ }
+
+ public String getName()
+ {
+ return null;
+ }
+
+ public Class<? extends Annotation> getScope()
+ {
+ return Dependent.class;
+ }
+
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ public boolean isNullable()
+ {
+ return false;
+ }
+
+ public Object create(CreationalContext<Object> creationalContext)
+ {
+ return null;
+ }
+
+ public void destroy(Object instance, CreationalContext<Object> creationalContext)
+ {
+
+ }
+
+ public Class<?> getBeanClass()
+ {
+ return Object.class;
+ }
+
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+ };
+ InjectionPoint injectionPoint = new InjectionPoint()
+ {
+
+ public Bean<?> getBean()
+ {
+ return bean;
+ }
+
+ public Set<Annotation> getQualifiers()
+ {
+ return DEFAULT_QUALIFIERS;
+ }
+
+ public Member getMember()
+ {
+ return null;
+ }
+
+ public Type getType()
+ {
+ return injectionPointType;
+ }
+
+ public Annotated getAnnotated()
+ {
+ return null;
+ }
+
+ public boolean isDelegate()
+ {
+ return false;
+ }
+
+ public boolean isTransient()
+ {
+ return false;
+ }
+
+ };
+ injectionPoints.add(injectionPoint);
+ return bean;
+ }
+
+ private static class DummyContext implements Context
+ {
+
+ public <T> T get(Contextual<T> contextual)
+ {
+ return null;
+ }
+
+ public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext)
+ {
+ return null;
+ }
+
+ public Class<? extends Annotation> getScope()
+ {
+ return Dummy.class;
+ }
+
+ public boolean isActive()
+ {
+ return false;
+ }
+
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
+ public void testBeanBelongingToParentActivityBelongsToChildActivity()
+ {
+ Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+ Contextual<?> bean = beanManager.getBeans(Cow.class).iterator().next();
+ BeanManager childActivity = beanManager.createActivity();
+ Assert.assertEquals(1, childActivity.getBeans(Cow.class).size());
+ Assert.assertEquals(bean, childActivity.getBeans(Cow.class).iterator().next());
+ }
+
+ @Test
+ public void testBeanBelongingToParentActivityCanBeInjectedIntoChildActivityBean()
+ {
+ Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+ BeanManagerImpl childActivity = beanManager.createActivity();
+ Bean<?> dummyBean = createDummyBean(childActivity, Cow.class);
+ childActivity.addBean(dummyBean);
+ Assert.assertNotNull(
+ childActivity.getInjectableReference(
+ dummyBean.getInjectionPoints().iterator().next(),
+ childActivity.createCreationalContext(dummyBean)));
+ }
+
+ @Test
+ public void testObserverBelongingToParentActivityBelongsToChildActivity()
+ {
+ Assert.assertEquals(1, beanManager.resolveObserverMethods(new NightTime()).size());
+ ObserverMethod<?> observer = beanManager.resolveObserverMethods(new NightTime()).iterator().next();
+ BeanManager childActivity = beanManager.createActivity();
+ Assert.assertEquals(1, childActivity.resolveObserverMethods(new NightTime()).size());
+ Assert.assertEquals(observer, childActivity.resolveObserverMethods(new NightTime()).iterator().next());
+ }
+
+ @Test
+ public void testObserverBelongingToParentFiresForChildActivity()
+ {
+ Fox.setObserved(false);
+ BeanManager childActivity = beanManager.createActivity();
+ childActivity.fireEvent(new NightTime());
+ Assert.assertTrue(Fox.isObserved());
+ }
+
+ @Test
+ public void testContextObjectBelongingToParentBelongsToChild()
+ {
+ Context context = new DummyContext()
+ {
+
+ @Override
+ public boolean isActive()
+ {
+ return true;
+ }
+
+ };
+ beanManager.addContext(context);
+ BeanManager childActivity = beanManager.createActivity();
+ Assert.assertNotNull(childActivity.getContext(Dummy.class));
+ }
+
+ @Test
+ public void testBeanBelongingToChildActivityCannotBeInjectedIntoParentActivityBean()
+ {
+ Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+ BeanManagerImpl childActivity = beanManager.createActivity();
+ Bean<?> dummyBean = createDummyBean(childActivity, Cow.class);
+ childActivity.addBean(dummyBean);
+ Assert.assertEquals(0, beanManager.getBeans(Object.class, new AnnotationLiteral<Tame>()
+ {
+ }).size());
+ }
+
+ @Test(expected = UnsatisfiedResolutionException.class)
+ public void testInstanceProcessedByParentActivity()
+ {
+ Context dummyContext = new DummyContext();
+ beanManager.addContext(dummyContext);
+ Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+ final Bean<Cow> bean = (Bean<Cow>)beanManager.getBeans(Cow.class).iterator().next();
+ BeanManagerImpl childActivity = beanManager.createActivity();
+ final Set<Annotation> bindingTypes = new HashSet<Annotation>();
+ bindingTypes.add(new AnnotationLiteral<Tame>()
+ {
+ });
+ childActivity.addBean(new ForwardingBean<Cow>()
+ {
+
+ @Override
+ protected Bean<Cow> delegate()
+ {
+ return bean;
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return bindingTypes;
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+ });
+ Utils.getReference(beanManager, Field.class).get();
+ }
+
+ @Test
+ public void testObserverBelongingToChildDoesNotFireForParentActivity()
+ {
+ BeanManagerImpl childActivity = beanManager.createActivity();
+ ObserverMethod<NightTime> observer = new ObserverMethod<NightTime>()
+ {
+
+ public void notify(NightTime event)
+ {
+ assert false;
+ }
+
+ public Class<?> getBeanClass()
+ {
+ return NightTime.class;
+ }
+
+ public Set<Annotation> getObservedQualifiers()
+ {
+ return Arrays2.asSet(AnyLiteral.INSTANCE, DefaultLiteral.INSTANCE);
+ }
+
+ public Type getObservedType()
+ {
+ return NightTime.class;
+ }
+
+ public Reception getReception()
+ {
+ return Reception.ALWAYS;
+ }
+
+ public TransactionPhase getTransactionPhase()
+ {
+ return TransactionPhase.IN_PROGRESS;
+ }
+
+ };
+ // TODO Fix this test to use an observer method in a child activity
+ childActivity.addObserver(observer);
+ beanManager.fireEvent(new NightTime());
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Cow.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Cow.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Cow.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Cow.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
+
+class Cow
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Dummy.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Dummy.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Dummy.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Dummy.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
+
+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.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Scope;
+
+@Target( { TYPE, METHOD, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Scope
+@Inherited
+@interface Dummy {}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Field.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Field.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Field.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Field.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+class Field
+{
+
+ @Inject @Tame Instance<Cow> instance;
+
+ public Cow get()
+ {
+ return instance.get();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Fox.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Fox.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Fox.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Fox.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
+
+import javax.enterprise.event.Observes;
+
+class Fox
+{
+
+ private static boolean observed = false;
+
+ public void observe(@Observes NightTime nighttime)
+ {
+ observed = true;
+ }
+
+ public static boolean isObserved()
+ {
+ return observed;
+ }
+
+ public static void setObserved(boolean observed)
+ {
+ Fox.observed = observed;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/NightTime.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/NightTime.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/NightTime.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/NightTime.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
+
+class NightTime
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Tame.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/Tame.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Tame.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/Tame.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.activities;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+@interface Tame
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/child)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/child/SameBeanTypeInChildActivityTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -29,21 +29,35 @@
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.weld.literal.DefaultLiteral;
import org.jboss.weld.manager.BeanManagerImpl;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
/**
*
* Spec version: 20090519
*
*/
-@Artifact
-public class SameBeanTypeInChildActivityTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class SameBeanTypeInChildActivityTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(SameBeanTypeInChildActivityTest.class.getPackage());
+ }
+
private static final Set<Annotation> DEFAULT_QUALIFIERS = Collections.<Annotation>singleton(DefaultLiteral.INSTANCE);
private Bean<?> createDummyBean(BeanManager beanManager)
@@ -115,18 +129,23 @@
return bean;
}
- @Test(groups = { "broken" }, expectedExceptions = { InjectionException.class })
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test(expected = InjectionException.class)
+ @Category(Broken.class)
public void testSameBeanTypeInChildAsParentInjection()
{
- BeanManagerImpl childActivity = getCurrentManager().createActivity();
+ BeanManagerImpl childActivity = beanManager.createActivity();
Bean<?> anotherMyBean = createDummyBean(childActivity);
childActivity.addBean(anotherMyBean);
}
- @Test(groups = { "broken" }, expectedExceptions = { InjectionException.class })
+ @Test(expected = InjectionException.class)
+ @Category(Broken.class)
public void testSameBeanTypeInChildAsIndirectParentInjection()
{
- BeanManagerImpl childActivity = getCurrentManager().createActivity();
+ BeanManagerImpl childActivity = beanManager.createActivity();
BeanManagerImpl grandChildActivity = childActivity.createActivity();
Bean<?> anotherMyBean = createDummyBean(grandChildActivity);
grandChildActivity.addBean(anotherMyBean);
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/ELCurrentActivityTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -30,25 +30,41 @@
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.weld.manager.BeanManagerImpl;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.mock.el.EL;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import com.sun.el.ExpressionFactoryImpl;
+
/**
*
* Spec version: 20090519
*
*/
-@Artifact
-public class ELCurrentActivityTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class ELCurrentActivityTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ELCurrentActivityTest.class.getPackage())
+ .addClasses(Utils.class, EL.class)
+ .addPackages(true, ExpressionFactoryImpl.class.getPackage());
+ }
-
private static class DummyContext implements Context
{
-
private boolean active = true;
public <T> T get(Contextual<T> contextual)
@@ -160,16 +176,19 @@
}
+ @Inject
+ private BeanManagerImpl beanManager;
+
@Test
public void testELEvaluationProcessedByCurrentActivty()
{
Context dummyContext = new DummyContext();
- getCurrentManager().addContext(dummyContext);
- assert getBeans(Cow.class).size() == 1;
- BeanManagerImpl childActivity = getCurrentManager().createActivity();
+ beanManager.addContext(dummyContext);
+ Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+ BeanManagerImpl childActivity = beanManager.createActivity();
childActivity.addBean(new Daisy(childActivity));
childActivity.setCurrent(dummyContext.getScope());
- assert evaluateValueExpression("#{daisy}", Cow.class) != null;
+ Assert.assertNotNull(Utils.evaluateValueExpression(beanManager, "#{daisy}", Cow.class));
}
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/EventCurrentActivityTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/EventCurrentActivityTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/EventCurrentActivityTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -26,21 +26,37 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.event.Reception;
import javax.enterprise.event.TransactionPhase;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.weld.literal.AnyLiteral;
import org.jboss.weld.manager.BeanManagerImpl;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
/**
*
* Spec version: 20090519
*
*/
-@Artifact
-public class EventCurrentActivityTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class EventCurrentActivityTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(EventCurrentActivityTest.class.getPackage())
+ .addClasses(Utils.class);
+ }
private static class DummyContext implements Context
{
@@ -67,13 +83,16 @@
}
-
- @Test(groups = "broken")
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
+ @Category(Broken.class)
public void testEventProcessedByCurrentActivity()
{
DummyContext dummyContext = new DummyContext();
- getCurrentManager().addContext(dummyContext);
- BeanManagerImpl childActivity = getCurrentManager().createActivity();
+ beanManager.addContext(dummyContext);
+ BeanManagerImpl childActivity = beanManager.createActivity();
TestableObserverMethod<NightTime> observer = new TestableObserverMethod<NightTime>()
{
@@ -117,7 +136,7 @@
};
childActivity.addObserver(observer);
childActivity.setCurrent(dummyContext.getScope());
- getReference(Dusk.class).ping();
- assert observer.isObserved();
+ Utils.getReference(beanManager, Dusk.class).ping();
+ Assert.assertTrue(observer.isObserved());
}
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InactiveScopeTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/InactiveScopeTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InactiveScopeTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -22,22 +22,33 @@
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.manager.api.WeldManager;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
*
* Spec version: 20090519
*
*/
-@Artifact
-public class InactiveScopeTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class InactiveScopeTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(InactiveScopeTest.class.getPackage());
+ }
-
private static class DummyContext implements Context
{
@@ -70,13 +81,16 @@
}
- @Test(expectedExceptions=ContextNotActiveException.class)
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test(expected = ContextNotActiveException.class)
public void testInactiveScope()
{
DummyContext dummyContext = new DummyContext();
dummyContext.setActive(false);
- getCurrentManager().addContext(dummyContext);
- WeldManager childActivity = getCurrentManager().createActivity();
+ beanManager.addContext(dummyContext);
+ WeldManager childActivity = beanManager.createActivity();
childActivity.setCurrent(dummyContext.getScope());
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InjectedManagerCurrentActivityTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/InjectedManagerCurrentActivityTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InjectedManagerCurrentActivityTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,20 +21,35 @@
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.manager.api.WeldManager;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
*
* Spec version: 20090519
*
*/
-@Artifact
-public class InjectedManagerCurrentActivityTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class InjectedManagerCurrentActivityTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(InjectedManagerCurrentActivityTest.class.getPackage())
+ .addClass(Utils.class);
+ }
private static class DummyContext implements Context
{
@@ -68,15 +83,18 @@
}
+ @Inject
+ private BeanManagerImpl beanManager;
+
@Test
public void testInjectedManagerIsCurrentActivity()
{
Context dummyContext = new DummyContext();
- getCurrentManager().addContext(dummyContext);
- assert getBeans(Cow.class).size() == 1;
- WeldManager childActivity = getCurrentManager().createActivity();
+ beanManager.addContext(dummyContext);
+ Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+ WeldManager childActivity = beanManager.createActivity();
childActivity.setCurrent(dummyContext.getScope());
- assert getReference(Horse.class).getManager().equals(childActivity);
+ Assert.assertEquals(childActivity, Utils.getReference(beanManager, Horse.class).getManager());
}
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/InstanceCurrentActivityTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -30,24 +30,37 @@
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.weld.manager.BeanManagerImpl;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
*
* Spec version: 20090519
*
*/
-@Artifact
-public class InstanceCurrentActivityTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class InstanceCurrentActivityTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(InstanceCurrentActivityTest.class.getPackage())
+ .addClass(Utils.class);
+ }
public static class TameLiteral extends AnnotationLiteral<Tame> implements Tame {}
-
private static class DummyContext implements Context
{
@@ -168,16 +181,19 @@
}
+ @Inject
+ private BeanManagerImpl beanManager;
+
@Test
public void testInstanceProcessedByCurrentActivity()
{
Context dummyContext = new DummyContext();
- getCurrentManager().addContext(dummyContext);
- assert getBeans(Cow.class).size() == 1;
- BeanManagerImpl childActivity = getCurrentManager().createActivity();
+ beanManager.addContext(dummyContext);
+ Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+ BeanManagerImpl childActivity = beanManager.createActivity();
childActivity.addBean(new Daisy(childActivity));
childActivity.setCurrent(dummyContext.getScope());
- assert getReference(Field.class).get() != null;
+ Assert.assertNotNull(Utils.getReference(beanManager, Field.class).get());
}
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/JndiManagerCurrentActivityTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/JndiManagerCurrentActivityTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/JndiManagerCurrentActivityTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,22 +21,38 @@
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.manager.api.WeldManager;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
/**
*
* Spec version: 20090519
*
*/
-@Artifact
-@IntegrationTest
-public class JndiManagerCurrentActivityTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class JndiManagerCurrentActivityTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(JndiManagerCurrentActivityTest.class.getPackage())
+ .addClass(Utils.class);
+ }
private static class DummyContext implements Context
{
@@ -70,15 +86,17 @@
}
+ @Inject
+ private BeanManagerImpl beanManager;
+
@Test
public void testJndiManagerIsCurrentActivity()
{
Context dummyContext = new DummyContext();
- getCurrentManager().addContext(dummyContext);
- assert getBeans(Cow.class).size() == 1;
- WeldManager childActivity = getCurrentManager().createActivity();
+ beanManager.addContext(dummyContext);
+ Assert.assertEquals(1, beanManager.getBeans(Cow.class).size());
+ WeldManager childActivity = beanManager.createActivity();
childActivity.setCurrent(dummyContext.getScope());
- assert getReference(Donkey.class).getManager().equals(childActivity);
+ Assert.assertEquals(childActivity, Utils.getReference(beanManager, Donkey.class).getManager());
}
-
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScopeTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScopeTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/activities/current/NonNormalScopeTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,15 +21,29 @@
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
import org.jboss.weld.manager.api.WeldManager;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.test.Utils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class NonNormalScopeTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class NonNormalScopeTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(NonNormalScopeTest.class.getPackage())
+ .addClass(Utils.class);
+ }
private static class DummyContext implements Context
{
@@ -74,12 +88,15 @@
}
- @Test(expectedExceptions=IllegalArgumentException.class)
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test(expected = IllegalArgumentException.class)
public void testNonNormalScope()
{
Context dummyContext = new NonNormalContext();
- getCurrentManager().addContext(dummyContext);
- WeldManager childActivity = getCurrentManager().createActivity();
+ beanManager.addContext(dummyContext);
+ WeldManager childActivity = beanManager.createActivity();
childActivity.setCurrent(dummyContext.getScope());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Alternatives2Test.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,18 +16,29 @@
*/
package org.jboss.weld.tests.alternatives;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-@Artifact
-public class Alternatives2Test extends AbstractWeldTest
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class Alternatives2Test
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(Alternatives2Test.class.getPackage());
+ }
@Test
- public void testAlternativesOnProducers()
+ public void testAlternativesOnProducers(Consumer consumer)
{
- assert getReference(Consumer.class).getFoo().getName().equals("Normal");
+ Assert.assertEquals("Normal", consumer.getFoo().getName());
}
-
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/AlternativesTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,20 +16,30 @@
*/
package org.jboss.weld.tests.alternatives;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-@BeansXml("beans.xml")
-public class AlternativesTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class AlternativesTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .stereotype(TestAlternative.class)
+ .addPackage(Alternatives2Test.class.getPackage());
+ }
@Test
- public void testAlternativesOnProducers()
+ public void testAlternativesOnProducers(Consumer consumer)
{
- assert getReference(Consumer.class).getFoo().getName().equals("Test");
+ Assert.assertEquals("Test", consumer.getFoo().getName());
}
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Producer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Producer.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Producer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,7 +21,7 @@
public class Producer
{
- @Produces @Test
+ @Produces @TestAlternative
public Foo getFoo()
{
return new Foo("Test");
Deleted: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Test.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/alternatives/Test.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/Test.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc., 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.weld.tests.alternatives;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import javax.enterprise.inject.Alternative;
-import javax.enterprise.inject.Stereotype;
-
-@Stereotype
-@Alternative
-(a)Retention(RetentionPolicy.RUNTIME)
-(a)Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
-public @interface Test {}
\ No newline at end of file
Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/TestAlternative.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/TestAlternative.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/alternatives/TestAlternative.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.alternatives;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.enterprise.inject.Alternative;
+import javax.enterprise.inject.Stereotype;
+
+@Stereotype
+@Alternative
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD})
+public @interface TestAlternative {}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Bean.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.annotatedType;
+
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class Bean
+{
+ int field;
+
+ public Bean(int i)
+ {
+
+ }
+
+ public void method(int i)
+ {
+
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Child.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Child.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Child.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Child.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.annotatedType;
+
+
+public class Child extends Parent
+ {
+ }
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/DeclaringTypeTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.annotatedType;
+
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author kkahn
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class DeclaringTypeTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(DeclaringTypeTest.class.getPackage());
+ }
+
+ @Inject
+ private BeanManager beanManager;
+
+ @Test
+ public void testInheritance()
+ {
+ AnnotatedType<Child> type = beanManager.createAnnotatedType(Child.class);
+ Assert.assertEquals(1, type.getConstructors().size());
+ Assert.assertEquals(1, type.getFields().size());
+ for (AnnotatedField<? super Child> field : type.getFields())
+ {
+ if (field.getJavaMember().getName().equals("parent"))
+ {
+ Assert.assertEquals(Parent.class, field.getJavaMember().getDeclaringClass()); // OK - Returns Parent
+ Assert.assertEquals(Parent.class, field.getDeclaringType().getJavaClass()); // FAIL - Returns Child
+ }
+ else
+ {
+ Assert.fail("Unknown field " + field.getJavaMember());
+ }
+ }
+
+ Assert.assertEquals(1, type.getMethods().size());
+ for (AnnotatedMethod<? super Child> method : type.getMethods())
+ {
+ if (method.getJavaMember().getName().equals("parentMethod"))
+ {
+ Assert.assertEquals(Parent.class, method.getJavaMember().getDeclaringClass()); // OK - Returns Parent
+ Assert.assertEquals(Parent.class, method.getDeclaringType().getJavaClass()); // FAIL - Returns Child
+ }
+ else
+ {
+ Assert.fail("Unknown method " + method.getJavaMember());
+ }
+ }
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/ExampleTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.annotatedType;
+
+import javax.enterprise.inject.spi.Annotated;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+(a)RunWith(Arquillian.class)
+public class ExampleTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ExampleTest.class.getPackage());
+ }
+
+ @Inject
+ private BeanManager beanManager;
+
+ @Test
+ public void testAnnotatedCallableGetParameters() throws Exception
+ {
+ AnnotatedType<Bean> type = beanManager.createAnnotatedType(Bean.class);
+
+ assertNoAnnotations(type);
+
+ Assert.assertEquals(1, type.getConstructors().size());
+ for (AnnotatedConstructor<Bean> ctor : type.getConstructors())
+ {
+ assertNoAnnotations(ctor);
+
+ for (AnnotatedParameter<Bean> param : ctor.getParameters())
+ {
+ assertNoAnnotations(param);
+ }
+ }
+
+ Assert.assertEquals(1, type.getMethods().size());
+ for (AnnotatedMethod<? super Bean> method : type.getMethods())
+ {
+ assertNoAnnotations(method);
+
+ for (AnnotatedParameter<? super Bean> param : method.getParameters())
+ {
+ assertNoAnnotations(param);
+ }
+ }
+
+ Assert.assertEquals(1, type.getFields().size());
+ for (AnnotatedField<? super Bean> field : type.getFields())
+ {
+ assertNoAnnotations(field);
+ }
+ }
+
+ private void assertNoAnnotations(Annotated annotated)
+ {
+ Assert.assertEquals(0, annotated.getAnnotations().size());
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/Parent.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.annotatedType;
+public class Parent
+{
+ int parent;
+
+ void parentMethod()
+ {
+
+ }
+}
+
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/decoration)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/AnnotatedTypeDecoratorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/annotatedType/decoration/AnnotatedTypeDecoratorTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/annotatedType/decoration/AnnotatedTypeDecoratorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,10 +16,6 @@
*/
package org.jboss.weld.tests.annotatedType.decoration;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Annotated;
import javax.enterprise.inject.spi.AnnotatedField;
@@ -28,48 +24,63 @@
import javax.enterprise.inject.spi.InjectionTarget;
import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
*
* @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
* @version $Revision: 1.1 $
*/
-@Artifact
-public class AnnotatedTypeDecoratorTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class AnnotatedTypeDecoratorTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(AnnotatedTypeDecoratorTest.class.getPackage());
+ }
+
+ @Inject
+ private BeanManager beanManager;
+
@Test
public void testAnnotationDecorator() throws Exception
{
NotAnnotated.reset();
- AnnotatedType<NotAnnotated> type = getCurrentManager().createAnnotatedType(NotAnnotated.class);
+ AnnotatedType<NotAnnotated> type = beanManager.createAnnotatedType(NotAnnotated.class);
checkAnnotations(type, new NoAnnotationsChecker());
type = new MockAnnotatedType<NotAnnotated>(type);
checkAnnotations(type, new MockAnnotationsChecker());
- NonContextual<NotAnnotated> nonContextual = new NonContextual<NotAnnotated>(getCurrentManager(), type);
+ NonContextual<NotAnnotated> nonContextual = new NonContextual<NotAnnotated>(beanManager, type);
NotAnnotated instance = nonContextual.create();
- assertNotNull(instance);
+ Assert.assertNotNull(instance);
nonContextual.postConstruct(instance);
- assertNotNull(instance.getFromField());
- assertNotNull(NotAnnotated.getFromConstructor());
- assertNotNull(NotAnnotated.getFromInitializer());
+ Assert.assertNotNull(instance.getFromField());
+ Assert.assertNotNull(NotAnnotated.getFromConstructor());
+ Assert.assertNotNull(NotAnnotated.getFromInitializer());
}
private void checkAnnotations(AnnotatedType<NotAnnotated> type, TypeChecker checker)
{
checker.assertAnnotations(type);
- assertEquals(1, type.getConstructors().size());
+ Assert.assertEquals(1, type.getConstructors().size());
checker.assertAnnotations(type.getConstructors().iterator().next());
checker.assertAnnotations(type.getConstructors().iterator().next().getParameters().get(0));
- assertEquals(3, type.getFields().size());
+ Assert.assertEquals(3, type.getFields().size());
for (AnnotatedField<? super NotAnnotated> field : type.getFields())
{
if (field.getJavaMember().getName().equals("fromField"))
@@ -78,10 +89,10 @@
}
else
{
- assertEquals(0, field.getAnnotations().size());
+ Assert.assertEquals(0, field.getAnnotations().size());
}
}
- assertEquals(5, type.getMethods().size());
+ Assert.assertEquals(5, type.getMethods().size());
checker.assertAnnotations(type.getMethods().iterator().next());
}
@@ -98,7 +109,7 @@
public void assertAnnotations(Annotated annotated)
{
- assertEquals(0, annotated.getAnnotations().size());
+ Assert.assertEquals(0, annotated.getAnnotations().size());
}
}
@@ -109,13 +120,13 @@
{
if (annotated instanceof MockAnnotatedCallable)
{
- assertEquals(1, annotated.getAnnotations().size());
- assertTrue(annotated.isAnnotationPresent(Inject.class));
+ Assert.assertEquals(1, annotated.getAnnotations().size());
+ Assert.assertTrue(annotated.isAnnotationPresent(Inject.class));
}
else if (annotated instanceof MockAnnotatedField<?>)
{
- assertEquals(1, annotated.getAnnotations().size());
- assertTrue(annotated.isAnnotationPresent(Inject.class));
+ Assert.assertEquals(1, annotated.getAnnotations().size());
+ Assert.assertTrue(annotated.isAnnotationPresent(Inject.class));
}
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/BootstrapTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/BootstrapTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/multiple/BootstrapTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,21 +21,37 @@
import java.util.Map;
import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.weld.bean.ManagedBean;
import org.jboss.weld.bean.RIBean;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class BootstrapTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class BootstrapTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(BootstrapTest.class.getPackage());
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
- @Test(groups="bootstrap")
+ @Test
public void testMultipleSimpleBean()
{
- List<Bean<?>> beans = getCurrentManager().getBeans();
+ List<Bean<?>> beans = beanManager.getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
@@ -44,15 +60,15 @@
classes.put(((RIBean<?>) bean).getType(), bean);
}
}
- assert classes.containsKey(Tuna.class);
- assert classes.containsKey(Salmon.class);
- assert classes.containsKey(SeaBass.class);
- assert classes.containsKey(Sole.class);
+ Assert.assertTrue(classes.containsKey(Tuna.class));
+ Assert.assertTrue(classes.containsKey(Salmon.class));
+ Assert.assertTrue(classes.containsKey(SeaBass.class));
+ Assert.assertTrue(classes.containsKey(Sole.class));
- assert classes.get(Tuna.class) instanceof ManagedBean;
- assert classes.get(Salmon.class) instanceof ManagedBean;
- assert classes.get(SeaBass.class) instanceof ManagedBean;
- assert classes.get(Sole.class) instanceof ManagedBean;
+ Assert.assertTrue(classes.get(Tuna.class) instanceof ManagedBean);
+ Assert.assertTrue(classes.get(Salmon.class) instanceof ManagedBean);
+ Assert.assertTrue(classes.get(SeaBass.class) instanceof ManagedBean);
+ Assert.assertTrue(classes.get(Sole.class) instanceof ManagedBean);
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/BootstrapTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/BootstrapTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/managed/single/BootstrapTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,20 +21,36 @@
import java.util.Map;
import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.weld.bean.RIBean;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class BootstrapTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class BootstrapTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(BootstrapTest.class.getPackage());
+ }
- @Test(groups="bootstrap")
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
public void testSingleSimpleBean()
{
- List<Bean<?>> beans = getCurrentManager().getBeans();
+ List<Bean<?>> beans = beanManager.getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
@@ -43,7 +59,7 @@
classes.put(((RIBean<?>) bean).getType(), bean);
}
}
- assert classes.containsKey(Tuna.class);
+ Assert.assertTrue(classes.containsKey(Tuna.class));
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/mixed)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/BootstrapTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/BootstrapTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/mixed/BootstrapTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,25 +21,44 @@
import java.util.Map;
import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.weld.bean.ManagedBean;
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.bean.SessionBean;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-(a)Packaging(PackagingType.EAR)
-public class BootstrapTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class BootstrapTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(JavaArchive.class)
+ .addPackage(BootstrapTest.class.getPackage())
+ .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+ );
+ }
- @Test(groups="bootstrap")
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
public void testMultipleEnterpriseAndSimpleBean()
{
- List<Bean<?>> beans = getCurrentManager().getBeans();
+ List<Bean<?>> beans = beanManager.getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
@@ -48,23 +67,23 @@
classes.put(((RIBean<?>) bean).getType(), bean);
}
}
- assert classes.containsKey(Hound.class);
- assert classes.containsKey(Elephant.class);
- assert classes.containsKey(Panther.class);
- assert classes.containsKey(Tiger.class);
- assert classes.containsKey(Tuna.class);
- assert classes.containsKey(Salmon.class);
- assert classes.containsKey(SeaBass.class);
- assert classes.containsKey(Sole.class);
+ Assert.assertTrue(classes.containsKey(Hound.class));
+ Assert.assertTrue(classes.containsKey(Elephant.class));
+ Assert.assertTrue(classes.containsKey(Panther.class));
+ Assert.assertTrue(classes.containsKey(Tiger.class));
+ Assert.assertTrue(classes.containsKey(Tuna.class));
+ Assert.assertTrue(classes.containsKey(Salmon.class));
+ Assert.assertTrue(classes.containsKey(SeaBass.class));
+ Assert.assertTrue(classes.containsKey(Sole.class));
- assert classes.get(Hound.class) instanceof SessionBean;
- assert classes.get(Elephant.class) instanceof SessionBean;
- assert classes.get(Panther.class) instanceof SessionBean;
- assert classes.get(Tiger.class) instanceof SessionBean;
- assert classes.get(Tuna.class) instanceof ManagedBean;
- assert classes.get(Salmon.class) instanceof ManagedBean;
- assert classes.get(SeaBass.class) instanceof ManagedBean;
- assert classes.get(Sole.class) instanceof ManagedBean;
+ Assert.assertTrue(classes.get(Hound.class) instanceof SessionBean);
+ Assert.assertTrue(classes.get(Elephant.class) instanceof SessionBean);
+ Assert.assertTrue(classes.get(Panther.class) instanceof SessionBean);
+ Assert.assertTrue(classes.get(Tiger.class) instanceof SessionBean);
+ Assert.assertTrue(classes.get(Tuna.class) instanceof ManagedBean);
+ Assert.assertTrue(classes.get(Salmon.class) instanceof ManagedBean);
+ Assert.assertTrue(classes.get(SeaBass.class) instanceof ManagedBean);
+ Assert.assertTrue(classes.get(Sole.class) instanceof ManagedBean);
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/BootstrapTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/BootstrapTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/producers/singleProducerMethod/BootstrapTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,26 +21,45 @@
import java.util.Map;
import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.weld.bean.ManagedBean;
import org.jboss.weld.bean.ProducerMethod;
import org.jboss.weld.bean.RIBean;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-(a)Packaging(PackagingType.EAR)
-public class BootstrapTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class BootstrapTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(JavaArchive.class)
+ .addPackage(BootstrapTest.class.getPackage())
+ .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+ );
+ }
- @Test(groups="bootstrap")
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
public void testProducerMethodBean()
{
//deployBeans(TarantulaProducer.class);
- List<Bean<?>> beans = getCurrentManager().getBeans();
+ List<Bean<?>> beans = beanManager.getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
@@ -49,11 +68,11 @@
classes.put(((RIBean<?>) bean).getType(), bean);
}
}
- assert classes.containsKey(TarantulaProducer.class);
- assert classes.containsKey(Tarantula.class);
+ Assert.assertTrue(classes.containsKey(TarantulaProducer.class));
+ Assert.assertTrue(classes.containsKey(Tarantula.class));
- assert classes.get(TarantulaProducer.class) instanceof ManagedBean<?>;
- assert classes.get(Tarantula.class) instanceof ProducerMethod<?, ?>;
+ Assert.assertTrue(classes.get(TarantulaProducer.class) instanceof ManagedBean<?>);
+ Assert.assertTrue(classes.get(Tarantula.class) instanceof ProducerMethod<?, ?>);
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/BootstrapTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/BootstrapTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/multiple/BootstrapTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,24 +21,43 @@
import java.util.Map;
import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.weld.bean.RIBean;
import org.jboss.weld.bean.SessionBean;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-(a)Packaging(PackagingType.EAR)
-public class BootstrapTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class BootstrapTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(JavaArchive.class)
+ .addPackage(BootstrapTest.class.getPackage())
+ .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+ );
+ }
- @Test(groups="bootstrap")
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
public void testMultipleEnterpriseBean()
{
- List<Bean<?>> beans = getCurrentManager().getBeans();
+ List<Bean<?>> beans = beanManager.getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
@@ -47,15 +66,15 @@
classes.put(((RIBean<?>) bean).getType(), bean);
}
}
- assert classes.containsKey(Hound.class);
- assert classes.containsKey(Elephant.class);
- assert classes.containsKey(Panther.class);
- assert classes.containsKey(Tiger.class);
+ Assert.assertTrue(classes.containsKey(Hound.class));
+ Assert.assertTrue(classes.containsKey(Elephant.class));
+ Assert.assertTrue(classes.containsKey(Panther.class));
+ Assert.assertTrue(classes.containsKey(Tiger.class));
- assert classes.get(Hound.class) instanceof SessionBean;
- assert classes.get(Elephant.class) instanceof SessionBean;
- assert classes.get(Panther.class) instanceof SessionBean;
- assert classes.get(Tiger.class) instanceof SessionBean;
+ Assert.assertTrue(classes.get(Hound.class) instanceof SessionBean);
+ Assert.assertTrue(classes.get(Elephant.class) instanceof SessionBean);
+ Assert.assertTrue(classes.get(Panther.class) instanceof SessionBean);
+ Assert.assertTrue(classes.get(Tiger.class) instanceof SessionBean);
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/session/single)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/BootstrapTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/BootstrapTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanDeployment/session/single/BootstrapTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,23 +21,40 @@
import java.util.Map;
import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
import org.jboss.weld.bean.RIBean;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-(a)Packaging(PackagingType.EAR)
-public class BootstrapTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class BootstrapTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(BeanArchive.class)
+ .addPackage(BootstrapTest.class.getPackage())
+ );
+ }
- @Test(groups="bootstrap")
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
public void testSingleEnterpriseBean()
{
- List<Bean<?>> beans = getCurrentManager().getBeans();
+ List<Bean<?>> beans = beanManager.getBeans();
Map<Class<?>, Bean<?>> classes = new HashMap<Class<?>, Bean<?>>();
for (Bean<?> bean : beans)
{
@@ -46,7 +63,7 @@
classes.put(((RIBean<?>) bean).getType(), bean);
}
}
- assert classes.containsKey(Hound.class);
+ Assert.assertTrue(classes.containsKey(Hound.class));
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/BeanManagerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,53 @@
+package org.jboss.weld.tests.beanManager;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class BeanManagerTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(BeanManagerTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test(expected=IllegalArgumentException.class)
+ public void testNullBeanArgumentToGetReference()
+ {
+ Bean<Foo> bean = Utils.getBean(beanManager, Foo.class);
+ CreationalContext<Foo> cc = beanManager.createCreationalContext(bean);
+ beanManager.getReference(null, Foo.class, cc);
+ }
+
+ @Test(expected=IllegalArgumentException.class)
+ public void testNullBeanTypeArgumentToGetReference()
+ {
+ Bean<Foo> bean = Utils.getBean(beanManager, Foo.class);
+ CreationalContext<Foo> cc = beanManager.createCreationalContext(bean);
+ beanManager.getReference(bean, null, cc);
+ }
+
+ @Test(expected=IllegalArgumentException.class)
+ public void testNullCreationalContextArgumentToGetReference()
+ {
+ Bean<Foo> bean = Utils.getBean(beanManager, Foo.class);
+ beanManager.getReference(bean, Foo.class, null);
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/Foo.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/Foo.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/Foo.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,6 @@
+package org.jboss.weld.tests.beanManager;
+
+public class Foo
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/annotation (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/annotation)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/annotation/ManagerAnnotationTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/annotation/ManagerAnnotationTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/annotation/ManagerAnnotationTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,50 +16,83 @@
*/
package org.jboss.weld.tests.beanManager.annotation;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
import javax.persistence.PersistenceContext;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class ManagerAnnotationTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class ManagerAnnotationTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class);
+ }
+
+ @Inject
+ private BeanManager beanManager;
- @Test(description="WELD-299")
+ /*
+ * description="WELD-299"
+ */
+ @Test
public void testIsQualifier() throws Exception
{
- assert !getCurrentManager().isQualifier(PersistenceContext.class);
+ Assert.assertFalse(beanManager.isQualifier(PersistenceContext.class));
}
- @Test(description="WELD-299")
+ /*
+ * description="WELD-299"
+ */
+ @Test
public void testIsInterceptorBinding() throws Exception
{
- assert !getCurrentManager().isInterceptorBinding(PersistenceContext.class);
+ Assert.assertFalse(beanManager.isInterceptorBinding(PersistenceContext.class));
}
- @Test(description="WELD-299")
+ /*
+ * description="WELD-299"
+ */
+ @Test
public void testIsNormalScope() throws Exception
{
- assert !getCurrentManager().isNormalScope(PersistenceContext.class);
+ Assert.assertFalse(beanManager.isNormalScope(PersistenceContext.class));
}
- @Test(description="WELD-299")
+ /*
+ * description="WELD-299"
+ */
+ @Test
public void testIsPassivatingScope() throws Exception
{
- assert !getCurrentManager().isPassivatingScope(PersistenceContext.class);
+ Assert.assertFalse(beanManager.isPassivatingScope(PersistenceContext.class));
}
- @Test(description="WELD-299")
+ /*
+ * description="WELD-299"
+ */
+ @Test
public void testIsScope() throws Exception
{
- assert !getCurrentManager().isScope(PersistenceContext.class);
+ Assert.assertFalse(beanManager.isScope(PersistenceContext.class));
}
- @Test(description="WELD-299")
+ /*
+ * description="WELD-299"
+ */
+ @Test
public void testIsStereotype() throws Exception
{
- assert !getCurrentManager().isStereotype(PersistenceContext.class);
+ Assert.assertFalse(beanManager.isStereotype(PersistenceContext.class));
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/serializability)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/beanManager/serializability/ManagerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -26,19 +26,32 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.weld.literal.DefaultLiteral;
import org.jboss.weld.manager.BeanManagerImpl;
-import org.jboss.weld.test.AbstractWeldTest;
import org.jboss.weld.test.Utils;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-@Packaging
-public class ManagerTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class ManagerTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(WebArchive.class, "test.war")
+ .addPackage(ManagerTest.class.getPackage())
+ .addClass(Utils.class)
+ .addWebResource(EmptyAsset.INSTANCE, "beans.xml");
+ }
private static final Set<Annotation> DEFAULT_QUALIFIERS = Collections.<Annotation>singleton(DefaultLiteral.INSTANCE);
@@ -46,7 +59,6 @@
private static class DummyBean implements Bean<Dummy>
{
-
private static final Set<Type> TYPES = new HashSet<Type>();
static
@@ -111,32 +123,36 @@
}
}
+
+ @Inject
+ private BeanManagerImpl beanManager;
@Test
public void testRootManagerSerializability() throws Exception
{
- String rootManagerId = getCurrentManager().getId();
- BeanManagerImpl deserializedRootManager = (BeanManagerImpl) Utils.deserialize(Utils.serialize(getCurrentManager()));
- assert deserializedRootManager.getId().equals(rootManagerId);
- assert getCurrentManager().getBeans(Foo.class).size() == 1;
- assert deserializedRootManager.getBeans(Foo.class).size() == 1;
- assert getCurrentManager().getBeans(Foo.class).iterator().next().equals(deserializedRootManager.getBeans(Foo.class).iterator().next());
+ String rootManagerId = beanManager.getId();
+ BeanManagerImpl deserializedRootManager = (BeanManagerImpl) Utils.deserialize(Utils.serialize(beanManager));
+ Assert.assertEquals(rootManagerId, deserializedRootManager.getId());
+ Assert.assertEquals(1, beanManager.getBeans(Foo.class).size());
+ Assert.assertEquals(1, deserializedRootManager.getBeans(Foo.class).size());
+ Assert.assertEquals(
+ deserializedRootManager.getBeans(Foo.class).iterator().next(),
+ beanManager.getBeans(Foo.class).iterator().next());
}
@Test
public void testChildManagerSerializability() throws Exception
{
- BeanManagerImpl childManager = getCurrentManager().createActivity();
+ BeanManagerImpl childManager = beanManager.createActivity();
Bean<?> dummyBean = new DummyBean();
childManager.addBean(dummyBean);
String childManagerId = childManager.getId();
BeanManagerImpl deserializedChildManager = (BeanManagerImpl) Utils.deserialize(Utils.serialize(childManager));
- assert deserializedChildManager.getId().equals(childManagerId);
- assert childManager.getBeans(Dummy.class).size() == 1;
- assert deserializedChildManager.getBeans(Dummy.class).size() == 1;
- assert childManager.getBeans(Dummy.class).iterator().next().equals(deserializedChildManager.getBeans(Dummy.class).iterator().next());
+ Assert.assertEquals(childManagerId, deserializedChildManager.getId());
+ Assert.assertEquals(1, childManager.getBeans(Dummy.class).size());
+ Assert.assertEquals(1, deserializedChildManager.getBeans(Dummy.class).size());
+ Assert.assertEquals(
+ deserializedChildManager.getBeans(Dummy.class).iterator().next(),
+ childManager.getBeans(Dummy.class).iterator().next());
}
-
-
-
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/BuiltInBeanPassivationCapableTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
+
+import static org.jboss.weld.tests.builtinBeans.Checker.checkBeanManager;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkEquality;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkEvent;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkInjectionPoint;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkInstance;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkPrincipal;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkUserTransaction;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkValidator;
+import static org.jboss.weld.tests.builtinBeans.Checker.checkValidatorFactory;
+
+import java.security.Principal;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.transaction.UserTransaction;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class BuiltInBeanPassivationCapableTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(BuiltInBeanPassivationCapableTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ @Test
+ public void testDefaultValidatorBean(Validator validator) throws Throwable
+ {
+ Validator validator1 = Utils.deserialize(Utils.serialize(validator));
+ Assert.assertTrue(checkValidator(validator1));
+ }
+
+ @Test
+ public void testDefaultValidatorFactoryBean(ValidatorFactory validatorFactory) throws Throwable
+ {
+ ValidatorFactory validatorFactory1 = Utils.deserialize(Utils.serialize(validatorFactory));
+ Assert.assertTrue(checkValidatorFactory(validatorFactory1));
+ }
+
+ @Test
+ @Category({Integration.class, Broken.class})
+ public void testPrincipal(Principal principal) throws Throwable
+ {
+ Principal principal1 = Utils.deserialize(Utils.serialize(principal));
+ Assert.assertTrue(checkPrincipal(principal1));
+ }
+
+ @Test
+ public void testUserTransactionBean(UserTransaction userTransaction) throws Throwable
+ {
+ UserTransaction userTransaction1 = Utils.deserialize(Utils.serialize(userTransaction));
+ Assert.assertTrue(checkUserTransaction(userTransaction1));
+ }
+
+ @Test
+ public void testBeanManagerBean(BeanManager beanManager) throws Throwable
+ {
+ BeanManager beanManager1 = Utils.deserialize(Utils.serialize(beanManager));
+ Assert.assertTrue(checkBeanManager(beanManager1));
+ Assert.assertTrue(checkEquality(beanManager, beanManager1));
+ }
+
+ @Test
+ public void testInstance(Consumer consumer) throws Throwable
+ {
+ Instance<Cow> instance = consumer.getCow();
+ Instance<Cow> instance1 = Utils.deserialize(Utils.serialize(instance));
+ Assert.assertTrue(checkInstance(instance1));
+ Assert.assertTrue(checkEquality(instance, instance1));
+ }
+
+ @Test
+ public void testEvent(Consumer consumer, CowEventObserver observer) throws Throwable
+ {
+ Event<Cow> event = consumer.getEvent();
+ Event<Cow> event1 = Utils.deserialize(Utils.serialize(event));
+ Assert.assertTrue(checkEvent(event1, observer));
+ Assert.assertTrue(checkEquality(event, event1));
+ }
+
+ @Test
+ public void testFieldInjectionPoint(FieldInjectionPointConsumer consumer) throws Throwable
+ {
+ Dog.reset();
+ consumer.ping();
+ InjectionPoint injectionPoint = Dog.getInjectionPoint();
+ InjectionPoint injectionPoint1 = Utils.deserialize(Utils.serialize(injectionPoint));
+ Assert.assertTrue(checkInjectionPoint(injectionPoint1, FieldInjectionPointConsumer.class));
+ Assert.assertTrue(checkEquality(injectionPoint, injectionPoint1));
+ }
+
+ @Test
+ public void testConstructorInjectionPoint(ConstructorInjectionPointConsumer consumer) throws Throwable
+ {
+ Dog.reset();
+ consumer.ping();
+ InjectionPoint injectionPoint = Dog.getInjectionPoint();
+ InjectionPoint injectionPoint1 = Utils.deserialize(Utils.serialize(injectionPoint));
+ Assert.assertTrue(checkInjectionPoint(injectionPoint1, ConstructorInjectionPointConsumer.class));
+ Assert.assertTrue(checkEquality(injectionPoint, injectionPoint1));
+ }
+
+ @Test
+ public void testMethodInjectionPoint(MethodInjectionPointConsumer consumer) throws Throwable
+ {
+ Dog.reset();
+ consumer.ping();
+ InjectionPoint injectionPoint = Dog.getInjectionPoint();
+ InjectionPoint injectionPoint1 = Utils.deserialize(Utils.serialize(injectionPoint));
+ Assert.assertTrue(checkInjectionPoint(injectionPoint1, MethodInjectionPointConsumer.class));
+ Assert.assertTrue(checkEquality(injectionPoint, injectionPoint1));
+ }
+
+ @Test
+ public void testAllOnBean(Consumer consumer) throws Throwable
+ {
+ consumer.check();
+ Consumer consumer1 = Utils.deserialize(Utils.serialize(consumer));
+ consumer1.check();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Checker.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,138 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
+
+import java.security.Principal;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.transaction.SystemException;
+import javax.transaction.UserTransaction;
+import javax.validation.ValidationException;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+public class Checker
+{
+
+ public static boolean checkPrincipal(Principal principal)
+ {
+ principal.getName();
+ return true;
+ }
+
+ public static boolean checkBeanManager(BeanManager beanManager)
+ {
+ return beanManager != null && beanManager.isScope(ApplicationScoped.class);
+ }
+
+ public static boolean checkUserTransaction(UserTransaction userTransaction)
+ {
+ try
+ {
+ if (userTransaction != null)
+ {
+ userTransaction.getStatus();
+ return true;
+ }
+ }
+ catch (SystemException e)
+ {
+ throw new RuntimeException(e);
+ }
+ return false;
+ }
+
+ public static boolean checkValidator(Validator validator)
+ {
+ try
+ {
+ if (validator != null)
+ {
+ validator.unwrap(String.class);
+ }
+ }
+ catch (ValidationException e)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean checkValidatorFactory(ValidatorFactory validatorFactory)
+ {
+ try
+ {
+ if (validatorFactory != null)
+ {
+ validatorFactory.unwrap(String.class);
+ }
+ }
+ catch (ValidationException e)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean checkInstance(Instance<Cow> cow)
+ {
+ if (cow != null && cow.get() != null)
+ {
+ return "Daisy".equals(cow.get().getName());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public static boolean checkEvent(Event<Cow> cowEvent, CowEventObserver observer)
+ {
+ observer.reset();
+ if (cowEvent != null)
+ {
+ cowEvent.fire(new Cow());
+ return observer.isObserved();
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public static boolean checkInjectionPoint(InjectionPoint injectionPoint, Class<?> injectedClass)
+ {
+ if (injectionPoint != null)
+ {
+ return injectedClass.equals(injectionPoint.getBean().getBeanClass());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public static boolean checkEquality(Object object1, Object object2)
+ {
+ return object1.equals(object2) && object1.hashCode() == object2.hashCode();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ConstructorInjectionPointConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+@SessionScoped
+public class ConstructorInjectionPointConsumer implements Serializable
+{
+
+ public ConstructorInjectionPointConsumer() {}
+
+ @Inject
+ public ConstructorInjectionPointConsumer(Dog dog) {}
+
+ public void ping() {}
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Consumer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+import javax.transaction.UserTransaction;
+import javax.validation.Validator;
+import javax.validation.ValidatorFactory;
+
+@SessionScoped
+public class Consumer implements Serializable
+{
+
+ @Inject Validator validator;
+ @Inject ValidatorFactory validatorFactory;
+ // Not working incontainer as there is no principal
+ //@Inject Principal principal;
+ @Inject UserTransaction userTransaction;
+ @Inject BeanManager beanManager;
+ @Inject Instance<Cow> cow;
+ @Inject Event<Cow> event;
+ @Inject CowEventObserver observer;
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ cow.get().setName("Daisy");
+ }
+
+ public Instance<Cow> getCow()
+ {
+ return cow;
+ }
+
+ public Event<Cow> getEvent()
+ {
+ return event;
+ }
+
+ public void check()
+ {
+ assert Checker.checkBeanManager(beanManager);
+
+ // Not working incontainer as there is no principal
+ //assert Checker.checkPrincipal(principal);
+ assert Checker.checkUserTransaction(userTransaction);
+ assert Checker.checkValidator(validator);
+ assert Checker.checkValidatorFactory(validatorFactory);
+ assert Checker.checkInstance(cow);
+ assert Checker.checkEvent(event, observer);
+ }
+
+
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Cow.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+public class Cow
+{
+
+ private String name;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/CowEventObserver.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+
+@ApplicationScoped
+public class CowEventObserver implements Serializable
+{
+
+ private boolean observed;
+
+ public void observeEvent(@Observes Cow cow)
+ {
+ this.observed = true;
+ }
+
+ public boolean isObserved()
+ {
+ return observed;
+ }
+
+ public void reset()
+ {
+ this.observed = false;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Dog.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+public class Dog implements Serializable
+{
+
+ private static InjectionPoint injectionPoint;
+
+ @Inject
+ public Dog(InjectionPoint injectionPoint)
+ {
+ Dog.injectionPoint = injectionPoint;
+ }
+
+ public static void reset()
+ {
+ Dog.injectionPoint = null;
+ }
+
+ public static InjectionPoint getInjectionPoint()
+ {
+ return injectionPoint;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/FieldInjectionPointConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+@SessionScoped
+public class FieldInjectionPointConsumer implements Serializable
+{
+
+ @Inject Dog dogField;
+
+ public void ping() {}
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/MethodInjectionPointConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+@SessionScoped
+public class MethodInjectionPointConsumer implements Serializable
+{
+
+ @Inject
+ public void setDog(Dog dog) {}
+
+ public void ping() {}
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/Produced.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.builtinBeans;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.Qualifier;
+
+@Qualifier
+@Retention(RUNTIME)
+@Target( { TYPE, METHOD, FIELD, PARAMETER })
+@Documented
+@interface Produced
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/ee)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceConsumer.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceConsumer.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -29,6 +29,8 @@
import javax.persistence.EntityManagerFactory;
import javax.transaction.UserTransaction;
+import org.junit.Assert;
+
@SessionScoped
public class EEResourceConsumer implements Serializable
{
@@ -40,10 +42,10 @@
public void check()
{
- assert checkUserTransaction(userTransaction);
- assert checkEntityManager(entityManager);
- assert checkEntityManagerFactory(entityManagerFactory);
- assert checkRemoteEjb(horse);
+ Assert.assertTrue(checkUserTransaction(userTransaction));
+ Assert.assertTrue(checkEntityManager(entityManager));
+ Assert.assertTrue(checkEntityManagerFactory(entityManagerFactory));
+ Assert.assertTrue(checkRemoteEjb(horse));
}
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducerFieldPassivationCapableTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducerFieldPassivationCapableTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/ee/EEResourceProducerFieldPassivationCapableTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,67 +21,74 @@
import static org.jboss.weld.tests.builtinBeans.ee.Checker.checkRemoteEjb;
import static org.jboss.weld.tests.builtinBeans.ee.Checker.checkUserTransaction;
-import java.lang.annotation.Annotation;
-
-import javax.enterprise.util.AnnotationLiteral;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.transaction.UserTransaction;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.Resource;
-import org.jboss.weld.test.AbstractWeldTest;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.weld.test.Utils;
-import org.testng.annotations.Test;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
-@Artifact
-@IntegrationTest
-(a)Packaging(PackagingType.EAR)
-@Resource(source = "persistence.xml", destination = "META-INF/persistence.xml")
-public class EEResourceProducerFieldPassivationCapableTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class EEResourceProducerFieldPassivationCapableTest
{
-
- private static final Annotation PRODUCED = new AnnotationLiteral<Produced>() {};
-
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(JavaArchive.class)
+ .addPackage(EEResourceProducerFieldPassivationCapableTest.class.getPackage())
+ .addClass(Utils.class)
+ .addManifestResource(
+ EEResourceProducerFieldPassivationCapableTest.class.getPackage(),
+ "persistence.xml", "persistence.xml")
+ .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+ );
+ }
+
@Test
- public void testResource() throws Throwable
+ public void testResource(@Produced UserTransaction userTransaction) throws Throwable
{
- UserTransaction userTransaction = getReference(UserTransaction.class, PRODUCED);
UserTransaction userTransaction1 = Utils.deserialize(Utils.serialize(userTransaction));
- assert checkUserTransaction(userTransaction1);
+ Assert.assertTrue(checkUserTransaction(userTransaction1));
}
@Test
- public void testEntityManager() throws Throwable
+ public void testEntityManager(@Produced EntityManager entityManager) throws Throwable
{
- EntityManager entityManager = getReference(EntityManager.class, PRODUCED);
EntityManager entityManager1 = Utils.deserialize(Utils.serialize(entityManager));
- assert checkEntityManager(entityManager1);
+ Assert.assertTrue(checkEntityManager(entityManager1));
}
@Test
- public void testEntityManagerFactory() throws Throwable
+ public void testEntityManagerFactory(@Produced EntityManagerFactory entityManagerFactory) throws Throwable
{
- EntityManagerFactory entityManagerFactory = getReference(EntityManagerFactory.class, PRODUCED);
EntityManagerFactory entityManagerFactory1 = Utils.deserialize(Utils.serialize(entityManagerFactory));
- assert checkEntityManagerFactory(entityManagerFactory1);
+ Assert.assertTrue(checkEntityManagerFactory(entityManagerFactory1));
}
@Test
- public void testRemoteEjb() throws Throwable
+ public void testRemoteEjb(@Produced HorseRemote horse) throws Throwable
{
- HorseRemote horse = getReference(HorseRemote.class, PRODUCED);
HorseRemote horse1 = Utils.deserialize(Utils.serialize(horse));
- assert checkRemoteEjb(horse1);
+ Assert.assertTrue(checkRemoteEjb(horse1));
}
@Test
- public void testAllOnBean() throws Throwable
+ public void testAllOnBean(EEResourceConsumer consumer) throws Throwable
{
- EEResourceConsumer consumer = getReference(EEResourceConsumer.class);
consumer.check();
EEResourceConsumer consumer1 = Utils.deserialize(Utils.serialize(consumer));
consumer1.check();
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471 (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/builtinBeans/weld471/InstanceTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,14 +16,28 @@
*/
package org.jboss.weld.tests.builtinBeans.weld471;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class InstanceTest extends AbstractWeldTest {
+(a)RunWith(Arquillian.class)
+public class InstanceTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(InstanceTest.class.getPackage());
+ }
@Test
- public void testNewInstance() {
+ public void testNewInstance(Bar bar)
+ {
+ Assert.assertNotNull(bar);
}
}
Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Broken.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Broken.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Broken.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.weld.tests.category;
+
+
+/**
+ * Marker Interface for JUnit Category marking Broken tests
+ *
+ * @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public interface Broken extends ExcludeFromNormalSuite
+{
+
+}
Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/ExcludeFromNormalSuite.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/ExcludeFromNormalSuite.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/ExcludeFromNormalSuite.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.weld.tests.category;
+
+/**
+ * Maker interface to work around JUnits single Category pr suite limitation
+ *
+ * @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public interface ExcludeFromNormalSuite
+{
+
+}
Added: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Integration.java
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Integration.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/category/Integration.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.weld.tests.category;
+
+/**
+ * Marker Interface for JUnit Category marking tests that need a full container to run
+ *
+ * @author <a href="mailto:aslak@redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public interface Integration extends ExcludeFromNormalSuite
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedObject.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import javax.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class ApplicationScopedObject
+{
+ private AtomicInteger counter = new AtomicInteger();
+
+ public void increment()
+ {
+ counter.incrementAndGet();
+ }
+ public int getValue()
+ {
+ return counter.get();
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ApplicationScopedTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
+
+import java.util.concurrent.CountDownLatch;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ApplicationScopedTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ApplicationScopedTest.class.getPackage());
+ }
+
+ @Test
+ public void testConcurrentInitilized(final ApplicationScopedObject applicationScopedObject) throws InterruptedException
+ {
+ final CountDownLatch latch = new CountDownLatch(10);
+ for (int i = 0; i < 10; i++)
+ {
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ applicationScopedObject.increment();
+ }
+ finally
+ {
+ latch.countDown();
+ }
+ }
+ }).start();
+ }
+ latch.await();
+ int value = applicationScopedObject.getValue();
+ assert value == 10;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ContextTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
+
+import javax.enterprise.context.ContextNotActiveException;
+import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ContextTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ContextTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ /*
+ * description = "WELD-348"
+ */
+ @Test
+ public void testCallToConversationWithContextNotActive()
+ {
+ boolean alreadyActive = false;
+ try
+ {
+ alreadyActive = Container.instance().services().get(ContextLifecycle.class).isConversationActive();
+ if (alreadyActive)
+ {
+ Container.instance().services().get(ContextLifecycle.class).getConversationContext().setActive(false);
+ }
+ try
+ {
+ Utils.getReference(beanManager, Conversation.class).getId();
+ Assert.fail();
+ }
+ catch (ContextNotActiveException e)
+ {
+ // Expected
+ }
+ catch (Exception e)
+ {
+ Assert.fail();
+ }
+ try
+ {
+ Utils.getReference(beanManager, Conversation.class).getTimeout();
+ Assert.fail();
+ }
+ catch (ContextNotActiveException e)
+ {
+ // Expected
+ }
+ catch (Exception e)
+ {
+ Assert.fail();
+ }
+ try
+ {
+ Utils.getReference(beanManager, Conversation.class).begin();
+ Assert.fail();
+ }
+ catch (ContextNotActiveException e)
+ {
+ // Expected
+ }
+ catch (Exception e)
+ {
+ Assert.fail();
+ }
+ try
+ {
+ Utils.getReference(beanManager, Conversation.class).begin("foo");
+ Assert.fail();
+ }
+ catch (ContextNotActiveException e)
+ {
+ // Expected
+ }
+ catch (Exception e)
+ {
+ Assert.fail();
+ }
+ try
+ {
+ Utils.getReference(beanManager, Conversation.class).end();
+ Assert.fail();
+ }
+ catch (ContextNotActiveException e)
+ {
+ // Expected
+ }
+ catch (Exception e)
+ {
+ Assert.fail();
+ }
+ try
+ {
+ Utils.getReference(beanManager, Conversation.class).isTransient();
+ Assert.fail();
+ }
+ catch (ContextNotActiveException e)
+ {
+ // Expected
+ }
+ catch (Exception e)
+ {
+ Assert.fail();
+ }
+ try
+ {
+ Utils.getReference(beanManager, Conversation.class).setTimeout(0);
+ assert false;
+ }
+ catch (ContextNotActiveException e)
+ {
+ // Expected
+ }
+ catch (Exception e)
+ {
+ Assert.fail();
+ }
+ }
+ finally
+ {
+ if (alreadyActive)
+ {
+ Container.instance().services().get(ContextLifecycle.class).getConversationContext().setActive(true);
+ }
+ }
+
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScoped.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
+
+import java.util.Arrays;
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+public class ParameterizedTypeScoped
+{
+
+ @RequestScoped
+ @Produces
+ public List<String> create()
+ {
+ return Arrays.asList("iemon", "houjitya");
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/ParameterizedTypeScopedTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
+
+import java.util.List;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ParameterizedTypeScopedTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ParameterizedTypeScopedTest.class.getPackage());
+ }
+
+ @Test
+ public void testStringList(StringHolder holder)
+ {
+ List<String> str = holder.getStrings();
+ Assert.assertEquals(2, str.size());
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/PassivatingContextTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.ConversationScoped;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.metadata.cache.MetaAnnotationStore;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class PassivatingContextTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(PassivatingContextTest.class.getPackage());
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test
+ public void testIsSessionScopePassivating()
+ {
+ Assert.assertTrue(beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(SessionScoped.class).isPassivating());
+ }
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test
+ public void testIsConversationScopePassivating()
+ {
+ Assert.assertTrue(beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(ConversationScoped.class).isPassivating());
+ }
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test
+ public void testIsApplicationScopeNonPassivating()
+ {
+ Assert.assertFalse(beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(ApplicationScoped.class).isPassivating());
+ }
+
+ /**
+ * The built-in session and conversation scopes are passivating. No other
+ * built-in scope is passivating.
+ */
+ @Test
+ public void testIsRequestScopeNonPassivating()
+ {
+ Assert.assertFalse(beanManager.getServices().get(MetaAnnotationStore.class).getScopeModel(RequestScoped.class).isPassivating());
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/contexts/StringHolder.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.contexts;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+
+public class StringHolder
+{
+
+ @Inject
+ private List<String> strings;
+
+ public List<String> getStrings()
+ {
+ return strings;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBean.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public interface SimpleBean
+{
+ int echo1(int i);
+
+ int echo2(int i);
+
+ int echo3(int i);
+
+ int echo4(int i);
+
+ boolean isInvoked();
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleBeanImpl.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleBeanImpl implements SimpleBean
+{
+
+ private boolean invoked = false;
+
+ public int echo1(int i)
+ {
+ invoked = true;
+ return i;
+ }
+
+ public int echo2(int i)
+ {
+ invoked = true;
+ return i;
+ }
+
+ public int echo3(int i)
+ {
+ invoked = true;
+ return i;
+ }
+
+ public int echo4(int i)
+ {
+ invoked = true;
+ return i;
+ }
+
+ public boolean isInvoked()
+ {
+ return invoked;
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Decorator
+public abstract class SimpleDecorator1 implements SimpleBean
+{
+ @Inject @Delegate
+ SimpleBean delegate;
+
+ public static boolean echo1;
+ public static boolean echo3;
+
+ public static void reset()
+ {
+ echo1 = false;
+ echo3 = false;
+ }
+
+ public int echo1(int i)
+ {
+ echo1 = true;
+ return delegate.echo1(i);
+ }
+
+ public int echo3(int i)
+ {
+ echo3 = true;
+ return delegate.echo3(i);
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+@Decorator
+public abstract class SimpleDecorator2 implements SimpleBean
+{
+ @Inject @Delegate
+ SimpleBean delegate;
+
+ public static boolean echo2;
+ public static boolean echo3;
+
+ public static void reset()
+ {
+ echo2 = false;
+ echo3 = false;
+ }
+
+ public int echo2(int i)
+ {
+ echo2 = true;
+ return delegate.echo2(i);
+ }
+
+ public int echo3(int i)
+ {
+ echo3 = true;
+ return delegate.echo3(i);
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/SimpleDecoratorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+(a)RunWith(Arquillian.class)
+public class SimpleDecoratorTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(SimpleDecorator1.class, SimpleDecorator2.class)
+ .addPackage(SimpleDecoratorTest.class.getPackage());
+ }
+
+ @Test
+ public void testSimpleDecorator(SimpleBean simpleBean)
+ {
+ resetDecorators();
+ Assert.assertEquals(1, simpleBean.echo1(1));
+ assertDecorators(true, false, false);
+ Assert.assertTrue(simpleBean.isInvoked());
+
+ resetDecorators();
+ Assert.assertEquals(2, simpleBean.echo2(2));
+ assertDecorators(false, true, false);
+ Assert.assertTrue(simpleBean.isInvoked());
+
+ //Only SimpleDecorator1 gets invoked, although I think SimpleDecorator2 should get invoked too
+ resetDecorators();
+ Assert.assertEquals(3, simpleBean.echo3(3));
+ assertDecorators(false, false, true);
+
+ Assert.assertTrue(simpleBean.isInvoked());
+
+ resetDecorators();
+ Assert.assertEquals(4, simpleBean.echo4(4));
+ assertDecorators(false, false, false);
+
+ Assert.assertTrue(simpleBean.isInvoked());
+ }
+
+ private void resetDecorators()
+ {
+ SimpleDecorator1.reset();
+ SimpleDecorator2.reset();
+ }
+
+ private void assertDecorators(boolean echo1, boolean echo2, boolean echo3)
+ {
+ Assert.assertEquals(echo1, SimpleDecorator1.echo1);
+ Assert.assertEquals(echo2, SimpleDecorator2.echo2);
+ Assert.assertEquals(echo3, SimpleDecorator2.echo3);
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+public class AbstractDecoratorTestHelper
+{
+ static void resetAll()
+ {
+ WindowImpl.drawn = false;
+ WindowImpl.moved = false;
+ FrameWithFieldInjectedDelegate.drawn = false;
+ FrameWithFieldInjectedDelegateAndAbstractMethod.moved = false;
+ FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.moved = false;
+ FrameWithConstructorInjectedDelegate.drawn = false;
+ FrameWithConstructorInjectedDelegateAndAbstractMethod.moved = false;
+ FrameWithInitializerMethodInjectedDelegate.drawn = false;
+ FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.moved = false;
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@Decorator
+public abstract class FrameWithConstructorInjectedDelegate implements Window
+{
+
+ static boolean drawn;
+
+ Window window;
+
+ @Inject
+ FrameWithConstructorInjectedDelegate(@Delegate Window window)
+ {
+ this.window = window;
+ }
+
+ public void draw()
+ {
+ drawn = true;
+ window.draw();
+ }
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@Decorator
+public abstract class FrameWithConstructorInjectedDelegateAndAbstractMethod implements Window
+{
+
+ Window window;
+
+ static boolean moved = false;
+
+ @Inject
+ FrameWithConstructorInjectedDelegateAndAbstractMethod(@Delegate Window window)
+ {
+ this.window = window;
+ }
+
+ public abstract void draw();
+
+ public void move()
+ {
+ moved = true;
+ draw();
+ }
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@Decorator
+public abstract class FrameWithFieldInjectedDelegate implements Window
+{
+
+ static boolean drawn;
+
+ @Inject @Delegate
+ Window window;
+
+ public void draw()
+ {
+ drawn = true;
+ window.draw();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@Decorator
+public abstract class FrameWithFieldInjectedDelegateAndAbstractMethod implements Window
+{
+
+ static boolean moved;
+
+ @Inject @Delegate
+ Window window;
+
+ public abstract void draw();
+
+ public void move()
+ {
+ moved = true;
+ window.move();
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@Decorator
+public abstract class FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod implements Window
+{
+
+ static boolean moved;
+
+ @Inject @Delegate
+ Window window;
+
+ public abstract void draw();
+
+ public void move()
+ {
+ moved = true;
+ draw();
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@Decorator
+public abstract class FrameWithInitializerMethodInjectedDelegate implements Window
+{
+
+ static boolean drawn;
+
+ private Window window;
+
+ @Inject
+ void initWindow(@Delegate Window window){
+ this.window = window;
+ }
+
+ public void draw() {
+ drawn = true;
+ window.draw();
+ }
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@Decorator
+public abstract class FrameWithInitializerMethodInjectedDelegateAndAbstractMethod implements Window
+{
+
+ static boolean moved;
+
+ private Window window;
+
+ @Inject
+ void initWindow(@Delegate Window window)
+ {
+ this.window = window;
+ }
+
+ public abstract void draw();
+
+ public void move()
+ {
+ moved = true;
+ window.move();
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+(a)RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(FrameWithFieldInjectedDelegate.class)
+ .addPackage(SimpleAbstractDecoratorTest.class.getPackage());
+ }
+
+ @Test
+ public void testAbstractDecoratorApplied(WindowImpl window)
+ {
+ resetAll();
+
+ window.draw();
+ Assert.assertTrue(WindowImpl.drawn);
+ Assert.assertTrue(FrameWithFieldInjectedDelegate.drawn);
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,63 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+(a)RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(
+ FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.class,
+ FrameWithFieldInjectedDelegate.class)
+ .addPackage(SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.class.getPackage());
+ }
+
+ @Test
+ public void testAbstractDecoratorApplied(WindowImpl window)
+ {
+ resetAll();
+ window.draw();
+ Assert.assertTrue(WindowImpl.drawn);
+ Assert.assertTrue(FrameWithFieldInjectedDelegate.drawn);
+ Assert.assertFalse(FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.moved);
+
+ resetAll();
+ window.move();
+ Assert.assertTrue(WindowImpl.moved);
+ Assert.assertFalse(FrameWithFieldInjectedDelegate.drawn);
+ Assert.assertTrue(FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.moved);
+ }
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+(a)RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithAbstractMethodTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(
+ FrameWithFieldInjectedDelegateAndAbstractMethod.class,
+ FrameWithFieldInjectedDelegate.class)
+ .addPackage(SimpleAbstractDecoratorWithAbstractMethodTest.class.getPackage());
+ }
+
+ @Test
+ public void testAbstractDecoratorApplied(WindowImpl window)
+ {
+ resetAll();
+ window.draw();
+ Assert.assertTrue(WindowImpl.drawn);
+ Assert.assertTrue(FrameWithFieldInjectedDelegate.drawn);
+ Assert.assertFalse(FrameWithFieldInjectedDelegateAndAbstractMethod.moved);
+
+ resetAll();
+ window.move();
+ Assert.assertTrue(WindowImpl.moved);
+ Assert.assertFalse(FrameWithFieldInjectedDelegate.drawn);
+ Assert.assertTrue(FrameWithFieldInjectedDelegateAndAbstractMethod.moved);
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+(a)RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithCallToItselfTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(
+ FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.class,
+ FrameWithFieldInjectedDelegate.class)
+ .addPackage(SimpleAbstractDecoratorWithCallToItselfTest.class.getPackage());
+ }
+
+ @Test
+ public void testAbstractDecoratorApplied(WindowImpl window)
+ {
+ resetAll();
+ window.move();
+ Assert.assertTrue(WindowImpl.drawn);
+ Assert.assertTrue(FrameWithFieldInjectedDelegate.drawn);
+ Assert.assertTrue(FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.moved);
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+(a)RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithConstructorTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(
+ FrameWithConstructorInjectedDelegateAndAbstractMethod.class,
+ FrameWithConstructorInjectedDelegate.class)
+ .addPackage(SimpleAbstractDecoratorWithConstructorTest.class.getPackage());
+ }
+
+ @Test
+ public void testAbstractDecoratorApplied(WindowImpl window)
+ {
+ resetAll();
+
+ window.draw();
+ Assert.assertTrue(WindowImpl.drawn);
+ Assert.assertTrue(FrameWithConstructorInjectedDelegate.drawn);
+
+ resetAll();
+ window.move();
+ Assert.assertFalse(WindowImpl.moved);
+ Assert.assertTrue(WindowImpl.drawn);
+ Assert.assertTrue(FrameWithConstructorInjectedDelegate.drawn);
+ Assert.assertTrue(FrameWithConstructorInjectedDelegateAndAbstractMethod.moved);
+ }
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+import static org.jboss.weld.tests.decorators.abstractDecorator.AbstractDecoratorTestHelper.resetAll;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+(a)RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithInitializerMethodTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(FrameWithInitializerMethodInjectedDelegate.class)
+ .addPackage(SimpleAbstractDecoratorWithInitializerMethodTest.class.getPackage());
+ }
+
+ @Test
+ public void testAbstractDecoratorApplied(WindowImpl window)
+ {
+ resetAll();
+
+ window.draw();
+ Assert.assertTrue(WindowImpl.drawn);
+ Assert.assertTrue(FrameWithInitializerMethodInjectedDelegate.drawn);
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface Window
+{
+ void draw();
+
+ void move();
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.abstractDecorator;
+
+/**
+ *
+ * @author Marius Bogoevici
+ */
+public class WindowImpl implements Window
+{
+ static boolean drawn;
+
+ static boolean moved;
+
+ public void draw()
+ {
+ drawn = true;
+ }
+
+ public void move()
+ {
+ moved = true;
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/broken/SimpleAbstractDecoratorWithInvalidAbstractMethodTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -17,26 +17,37 @@
package org.jboss.weld.tests.decorators.abstractDecorator.broken;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.exceptions.DefinitionException;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
/**
* @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
*/
-@Artifact
-@BeansXml("beans-withInvalidAbstractMethod.xml")
-(a)ExpectedDeploymentException(DefinitionException.class)
-public class SimpleAbstractDecoratorWithInvalidAbstractMethodTest extends AbstractWeldTest
+//(a)ExpectedDeploymentException(DefinitionException.class)
+(a)RunWith(Arquillian.class)
+public class SimpleAbstractDecoratorWithInvalidAbstractMethodTest
{
- @Test(groups = "broken")
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(Frame.class)
+ .addPackage(SimpleAbstractDecoratorWithInvalidAbstractMethodTest.class.getPackage());
+ }
+
+ @Test
+ @Category(Broken.class)
// TODO: needs exception transformer to run in JBAS
public void testAbstractDecoratorApplied()
{
- assert false;
+ Assert.assertFalse(false);
}
-
}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -19,20 +19,20 @@
import java.util.Arrays;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.Extension;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.context.spi.CreationalContext;
import org.jboss.weld.manager.BeanManagerImpl;
-import org.jboss.weld.mock.TestContainer;
-import org.jboss.weld.mock.MockServletLifecycle;
import org.jboss.weld.mock.MockBeanDeploymentArchive;
import org.jboss.weld.mock.MockDeployment;
+import org.jboss.weld.mock.MockServletLifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.jboss.weld.util.serviceProvider.PackageServiceLoaderFactory;
import org.jboss.weld.util.serviceProvider.ServiceLoaderFactory;
-import org.jboss.weld.util.serviceProvider.PackageServiceLoaderFactory;
+import org.junit.Assert;
+import org.junit.Test;
-import org.testng.annotations.Test;
-
/**
* @author Marius Bogoevici
*/
@@ -55,8 +55,8 @@
WindowImpl window = (WindowImpl) windowBean.create(creationalContext);
window.draw();
- assert window.isDrawn();
- assert CustomWindowFrame.drawn;
+ Assert.assertTrue(window.isDrawn());
+ Assert.assertTrue(CustomWindowFrame.drawn);
testContainer.stopContainer();
}
@@ -76,10 +76,10 @@
WindowImpl window = (WindowImpl) windowBean.create(creationalContext);
window.draw();
- assert window.isDrawn();
- assert OuterWindowFrame.drawn;
- assert InnerWindowFrame.drawn;
- assert CustomWindowFrame.drawn;
+ Assert.assertTrue(window.isDrawn());
+ Assert.assertTrue(OuterWindowFrame.drawn);
+ Assert.assertTrue(InnerWindowFrame.drawn);
+ Assert.assertTrue(CustomWindowFrame.drawn);
testContainer.stopContainer();
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/decoratedTypes/PartialDecoratorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -14,32 +14,40 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.jboss.weld.tests.decorators.decoratedTypes;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* @author Marius Bogoevici
*/
-@Artifact
-@BeansXml("beans.xml")
-public class PartialDecoratorTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class PartialDecoratorTest
{
-
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(PartialDecorator.class)
+ .addPackage(PartialDecoratorTest.class.getPackage());
+ }
+
@Test
- public void testDecoratorDoesNotDecorateOutsideDecoratedTypes()
+ public void testDecoratorDoesNotDecorateOutsideDecoratedTypes(TestBean testBean)
{
- TestBean testBean = getReference(TestBean.class);
testBean.decoratedMethod();
testBean.notDecoratedMethod();
- assert PartialDecorator.decoratedInvoked;
- assert !PartialDecorator.notDecoratedInvoked;
- assert TestBean.decoratedInvoked;
- assert TestBean.notDecoratedInvoked;
+ Assert.assertTrue(PartialDecorator.decoratedInvoked);
+ Assert.assertFalse(PartialDecorator.notDecoratedInvoked);
+ Assert.assertTrue(TestBean.decoratedInvoked);
+ Assert.assertTrue(TestBean.notDecoratedInvoked);
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/Decorated.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface Decorated<T>
+{
+ T decoratedEcho(T parameter);
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/GenericBean.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class GenericBean<T> implements Decorated<T>, NotDecorated<T>
+{
+ static boolean decoratedInvoked;
+ static boolean notDecoratedInvoked;
+
+ public T notDecoratedEcho(T parameter)
+ {
+ notDecoratedInvoked = true;
+ return parameter;
+ }
+
+ public T decoratedEcho(T parameter)
+ {
+ decoratedInvoked = true;
+ return parameter;
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/NotDecorated.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface NotDecorated<T>
+{
+ T notDecoratedEcho(T parameter);
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecorator.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Decorator
+public class PartialDecorator<T> implements Decorated<T>
+{
+
+ @Inject @Delegate GenericBean<T> delegate;
+
+ static boolean decoratedInvoked = false;
+
+ static boolean notDecoratedInvoked = false;
+
+ public T decoratedEcho(T parameter)
+ {
+ decoratedInvoked = true;
+ return delegate.decoratedEcho(parameter);
+ }
+
+ /**
+ * Should not be invoked
+ */
+ public T notDecoratedEcho(T parameter)
+ {
+ notDecoratedInvoked = true;
+ return delegate.notDecoratedEcho(parameter);
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
+
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Marius Bogoevici
+ */
+(a)RunWith(Arquillian.class)
+public class PartialDecoratorTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(PartialDecorator.class, StringPartialDecorator.class)
+ .addPackage(PartialDecoratorTest.class.getPackage());
+ }
+
+ @Test
+ public void testDecoratorDoesNotDecorateOutsideDecoratedTypes(TestBean testBean)
+ {
+ testBean.invoke();
+
+ Assert.assertTrue(PartialDecorator.decoratedInvoked);
+ Assert.assertFalse(PartialDecorator.notDecoratedInvoked);
+ Assert.assertTrue(StringPartialDecorator.invoked);
+ Assert.assertTrue(GenericBean.decoratedInvoked);
+ Assert.assertTrue(GenericBean.notDecoratedInvoked);
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/StringPartialDecorator.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Decorator
+public class StringPartialDecorator implements Decorated<String>
+{
+ @Inject
+ @Delegate
+ GenericBean<String> delegate;
+
+ static boolean invoked = false;
+
+ public String decoratedEcho(String parameter)
+ {
+ invoked = true;
+ return delegate.decoratedEcho(parameter);
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/TestBean.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.decorators.generic;
+
+import javax.enterprise.context.Dependent;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class TestBean
+{
+ @Inject @Dependent GenericBean<String> genericBean;
+
+ public void invoke()
+ {
+ genericBean.decoratedEcho("hello");
+ genericBean.notDecoratedEcho("hello");
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/extend)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendDecoratorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendDecoratorTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/generic/extend/ExtendDecoratorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -17,28 +17,33 @@
package org.jboss.weld.tests.decorators.generic.extend;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
/**
* @author Marius Bogoevici
*/
-@Artifact
-@BeansXml("beans.xml")
-public class ExtendDecoratorTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class ExtendDecoratorTest
{
-
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(ExtendsDecoratedDecorator.class)
+ .addPackage(ExtendDecoratorTest.class.getPackage());
+ }
+
@Test
- public void testExtendedDecorator()
+ public void testExtendedDecorator(ExtendsDecorated instance)
{
- ExtendsDecorated instance = getReference(ExtendsDecorated.class);
-
String result = instance.decoratedEcho("hello");
- Assert.assertEquals(result, "decorated-hello-decorated");
-
+ Assert.assertEquals("decorated-hello-decorated", result);
}
}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/interceptor)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/InterceptorAndDecoratorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/interceptor/InterceptorAndDecoratorTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/InterceptorAndDecoratorTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -17,27 +17,36 @@
package org.jboss.weld.tests.decorators.interceptor;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-import org.testng.annotations.Test;
-
-@Artifact
-@BeansXml("beans.xml")
-public class InterceptorAndDecoratorTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class InterceptorAndDecoratorTest
{
-
- @Test(description="WELD-314")
- public void test()
+ @Deployment
+ public static Archive<?> deploy()
{
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(ServiceDecorator.class)
+ .intercept(ServiceInterceptor.class)
+ .addPackage(InterceptorAndDecoratorTest.class.getPackage());
+ }
+
+ @Test // description="WELD-314"
+ public void test(Service service)
+ {
ServiceImpl.invocationCount = 0;
ServiceDecorator.invocationCount = 0;
ServiceInterceptor.invocationCount = 0;
- getReference(Service.class).execute();
- assert ServiceImpl.invocationCount == 1;
- assert ServiceDecorator.invocationCount == 1;
- assert ServiceInterceptor.invocationCount == 1;
+ service.execute();
+ Assert.assertEquals(1, ServiceImpl.invocationCount);
+ Assert.assertEquals(1, ServiceDecorator.invocationCount);
+ Assert.assertEquals(1, ServiceInterceptor.invocationCount);
}
-
}
\ No newline at end of file
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceDecorator.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceDecorator.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceDecorator.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -22,9 +22,6 @@
package org.jboss.weld.tests.decorators.interceptor;
-import java.math.BigDecimal;
-import java.util.concurrent.atomic.AtomicInteger;
-
import javax.decorator.Decorator;
import javax.decorator.Delegate;
import javax.inject.Inject;
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceInterceptor.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceInterceptor.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/interceptor/ServiceInterceptor.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -30,7 +30,7 @@
@AroundInvoke
public Object interceptService(InvocationContext invocationContext) throws Exception
{
- this.invocationCount++;
+ invocationCount++;
return invocationContext.proceed();
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/multidelegate)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/TestMultiDelegate.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/multidelegate/TestMultiDelegate.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/multidelegate/TestMultiDelegate.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,18 +16,29 @@
*/
package org.jboss.weld.tests.decorators.multidelegate;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-@BeansXml("beans.xml")
-public class TestMultiDelegate extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class TestMultiDelegate
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(AccountDecorator.class)
+ .addPackage(TestMultiDelegate.class.getPackage());
+ }
- @Test(description="http://seamframework.org/Community/SerializableDecorators")
+ /**
+ * description="http://seamframework.org/Community/SerializableDecorators"
+ */
+ @Test
public void go() {
}
-
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/resolution)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/BasicDecoratorResolutionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/resolution/BasicDecoratorResolutionTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/BasicDecoratorResolutionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -17,37 +17,40 @@
package org.jboss.weld.tests.decorators.resolution;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-import javax.enterprise.inject.spi.Decorator;
-import javax.enterprise.util.AnnotationLiteral;
-
-import java.util.*;
-
/**
* @author Marius Bogoevici
*/
-@Artifact
-@BeansXml("beans-basic.xml")
-public class BasicDecoratorResolutionTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class BasicDecoratorResolutionTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(SimpleDecorator.class, ComplexDecorator.class)
+ .addPackage(BasicDecoratorResolutionTest.class.getPackage());
+ }
@Test
- public void testBasicDecoratorInvocation()
+ public void testBasicDecoratorInvocation(@Simple SimpleBean simpleBean)
{
- SimpleBean simpleBean = getReference(SimpleBean.class, new AnnotationLiteral<Simple>(){});
String result = simpleBean.hello("world");
- assert "simple-Hello, world-simple".equals(result);
+ Assert.assertEquals("simple-Hello, world-simple", result);
}
@Test
- public void testComplexDecoratorInvocation()
+ public void testComplexDecoratorInvocation(@Complex ComplexBean complexBean)
{
- ComplexBean complexBean = getReference(ComplexBean.class, new AnnotationLiteral<Complex>(){});
String result = complexBean.hello("world");
- assert "simple-complex-Sophisticated Hello, world-complex-simple".equals(result);
+ Assert.assertEquals("simple-complex-Sophisticated Hello, world-complex-simple", result);
}
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Complex.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/resolution/Complex.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Complex.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -30,7 +30,7 @@
*/
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
-(a)Target({ElementType.TYPE, ElementType.FIELD})
+(a)Target({ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER})
@Documented
public @interface Complex
{
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Simple.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/resolution/Simple.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/resolution/Simple.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -30,7 +30,7 @@
*/
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
-(a)Target({ElementType.TYPE, ElementType.FIELD})
+(a)Target({ElementType.TYPE, ElementType.FIELD, ElementType.PARAMETER})
@Documented
public @interface Simple
{
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/decorators/stackoverflow/StackOverFlowTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -18,22 +18,31 @@
import java.math.BigDecimal;
-import javax.enterprise.util.AnnotationLiteral;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
-
-@Artifact
-@BeansXml("beans.xml")
-public class StackOverFlowTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class StackOverFlowTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .decorate(SecurePaymentService.class)
+ .addPackage(StackOverFlowTest.class.getPackage());
+ }
- @Test(description="WELD-296")
- public void test()
+ /**
+ * description="WELD-296"
+ */
+ @Test
+ public void test(@SimpleService PaymentService paymentService)
{
- getReference(PaymentService.class, new AnnotationLiteral<SimpleService>() {}).pay("Pete", new BigDecimal(100));
+ paymentService.pay("Pete", new BigDecimal(100));
}
-
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAO.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+public interface AbstractDAO<E>
+{
+ public boolean save(E entity);
+
+ public boolean isSaved();
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/AbstractDAOImpl.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+
+public abstract class AbstractDAOImpl<E>
+{
+
+ private boolean saved;
+
+ public boolean save(E entity)
+ {
+ this.saved = true;
+ return true;
+ }
+
+ public boolean isSaved()
+ {
+ return saved;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Animal.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Animal.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Animal.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Animal.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+public interface Animal
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Bird.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Bird.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Bird.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Bird.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface Bird
+{
+
+ public void observe(Feed feed);
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/BowlerHatException.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+public class BowlerHatException extends RuntimeException
+{
+
+ public BowlerHatException()
+ {
+ super();
+ }
+
+ public BowlerHatException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public BowlerHatException(String message)
+ {
+ super(message);
+ }
+
+ public BowlerHatException(Throwable cause)
+ {
+ super(cause);
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Capercaillie.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Stateful;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Observes;
+
+@Stateful
+@RequestScoped
+public class Capercaillie implements Scottish, Bird
+{
+
+ private Feed feed;
+
+ public void observe(@Observes Feed feed)
+ {
+ this.feed = feed;
+ }
+
+ public Feed getFeed()
+ {
+ return feed;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Castle.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Castle.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Castle.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Castle.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Stateless;
+
+@Stateless
+public class Castle
+{
+
+ private boolean pinged;
+
+ public boolean isPinged()
+ {
+ return pinged;
+ }
+
+ public void ping()
+ {
+ this.pinged = true;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Cat.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Cat.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Cat.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Cat.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Stateful;
+
+/**
+ * @author pmuir
+ *
+ */
+@Stateful
+public class Cat implements CatLocal
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/CatLocal.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+/**
+ * @author pmuir
+ *
+ */
+@Local
+public interface CatLocal
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DAO.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DAO.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DAO.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DAO.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface DAO
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Dog.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Dog.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Dog.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Dog.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface Dog extends Animal
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/DogBean.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Stateless;
+
+
+@Stateless
+public class DogBean implements Dog
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EjbDescriptorLookupTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.ejb.InternalEjbDescriptor;
+import org.jboss.weld.ejb.spi.EjbDescriptor;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author pmuir
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class EjbDescriptorLookupTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(JavaArchive.class)
+ .addPackage(EjbDescriptorLookupTest.class.getPackage())
+ .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+ );
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
+ public void testCorrectSubType()
+ {
+ EjbDescriptor<CatLocal> descriptor = beanManager.getEjbDescriptor("Cat");
+ assert descriptor.getClass().equals(InternalEjbDescriptor.class);
+ Bean<CatLocal> bean = beanManager.getBean(descriptor);
+ Assert.assertNotNull(bean);
+ Assert.assertTrue(bean instanceof SessionBean<?>);
+ Assert.assertEquals(Cat.class, bean.getBeanClass());
+ InjectionTarget<CatLocal> it = beanManager.createInjectionTarget(descriptor);
+ Assert.assertNotNull(it);
+ Assert.assertEquals(bean.getInjectionPoints(), it.getInjectionPoints());
+ Assert.assertTrue(it.produce(beanManager.createCreationalContext(bean)) instanceof CatLocal);
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanDefinitionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class EnterpriseBeanDefinitionTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(BeanArchive.class)
+ .addPackage(EnterpriseBeanDefinitionTest.class.getPackage())
+ .addClass(Utils.class)
+ );
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ /*
+ * description="WELD-305"
+ */
+ @Test
+ public void testSuperInterfacesAreBeanTypes()
+ {
+ Bean<?> bean = Utils.getBean(beanManager, Dog.class);
+ Assert.assertTrue(Utils.typeSetMatches(bean.getTypes(), Object.class, Dog.class, Animal.class));
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/EnterpriseBeanTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,154 @@
+/*
+
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.EJBException;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.bean.SessionBean;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class EnterpriseBeanTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(JavaArchive.class)
+ .addPackage(EnterpriseBeanTest.class.getPackage())
+ .addClass(Utils.class)
+ .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+ .addManifestResource(EjbDescriptorLookupTest.class.getPackage(), "ejb-jar.xml", "ejb-jar.xml")
+ );
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ /*
+ * description="WBRI-179"
+ */
+ @Test
+ public void testSFSBWithOnlyRemoteInterfacesDeploys()
+ {
+ // TODO: Need implementation ?
+ }
+
+ /*
+ * description="WELD-326"
+ */
+ @Test
+ public void testInvocationExceptionIsUnwrapped(Fedora fedora)
+ {
+ try
+ {
+ fedora.causeRuntimeException();
+ }
+ catch (Throwable t)
+ {
+ if (t instanceof EJBException && t.getCause() instanceof BowlerHatException)
+ {
+ return;
+ }
+ }
+ Assert.fail("Expected a BowlerHatException to be thrown");
+ }
+
+ /*
+ * description="WBRI-275"
+ */
+ @Test
+ public void testSLSBBusinessMethodThrowsRuntimeException(Fedora fedora)
+ {
+ try
+ {
+ fedora.causeRuntimeException();
+ }
+ catch (Throwable t)
+ {
+ if (Utils.isExceptionInHierarchy(t, BowlerHatException.class))
+ {
+ return;
+ }
+ }
+ Assert.fail("Expected a BowlerHatException to be in the cause stack");
+ }
+
+ /*
+ * description = "WELD-364"
+ */
+ @Test
+ @Category(Broken.class)
+ public void testEJBRemoteInterfacesOkForObservers(Scottish scottish)
+ {
+ Feed feed = new Feed();
+ beanManager.fireEvent(feed);
+ Assert.assertEquals(feed, scottish.getFeed());
+ }
+
+ /*
+ * description = "WELD-381"
+ */
+ @Test
+ public void testGenericEJBWorks(ResultClient client)
+ {
+ Assert.assertEquals("pete", client.lookupPete().getUsername());
+ }
+
+ /*
+ * description = "WELD-80"
+ */
+ @Test
+ @Category(Broken.class)
+ public void testPassivationOfEjbs(HelloAction action)
+ {
+ action.executeRequest();
+ Assert.assertEquals("hello", action.getHello());
+ Assert.assertEquals("goodbye", action.getGoodBye());
+ }
+
+ /*
+ * description = "Simple test for no-interface views"
+ */
+ @Test
+ @Category(Broken.class)
+ public void testNoInterfaceView(Castle castle)
+ {
+ castle.ping();
+ Assert.assertTrue(castle.isPinged());
+ Assert.assertTrue(Utils.getBean(beanManager, Castle.class) instanceof SessionBean<?>);
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Fedora.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface Fedora
+{
+
+ public void causeRuntimeException();
+
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/FedoraImpl.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Stateless;
+
+@Stateless
+public class FedoraImpl implements Fedora
+{
+
+ public void causeRuntimeException()
+ {
+ throw new BowlerHatException();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Feed.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Feed.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Feed.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Feed.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+public class Feed
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Hat.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Hat.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Hat.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Hat.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Stateful;
+
+@Stateful
+public class Hat implements HatRemote
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HatRemote.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Remote;
+
+@Remote
+public interface HatRemote
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloAction.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.inject.Inject;
+
+public class HelloAction
+{
+
+ public static long sleepDuration = 1000 * 2;
+
+ @Inject
+ private IHelloBean helloBean;
+
+ private String hello;
+ private String goodBye;
+
+ public void executeRequest()
+ {
+ hello = helloBean.sayHello();
+ try
+ {
+ Thread.sleep(sleepDuration);
+ }
+ catch (InterruptedException e)
+ {
+ System.out.println("Caught Interruption.");
+ }
+ goodBye = helloBean.sayGoodbye();
+ }
+
+ public String getHello()
+ {
+ return hello;
+ }
+
+ public String getGoodBye()
+ {
+ return goodBye;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/HelloBean.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.annotation.Resource;
+import javax.ejb.Remove;
+import javax.ejb.Stateful;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.ejb3.annotation.CacheConfig;
+
+@Stateful
+@SessionScoped
+@CacheConfig(idleTimeoutSeconds=1)
+public class HelloBean implements IHelloBean
+{
+ @Resource(mappedName = "java:comp/BeanManager")
+ private BeanManager beanManager;
+
+ public String sayHello()
+ {
+ return "hello";
+ }
+
+ public String sayGoodbye()
+ {
+ return beanManager.getELResolver() != null ? "goodbye" : "error";
+ }
+
+ @Remove
+ public void remove()
+ {
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/IHelloBean.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface IHelloBean
+{
+
+ public abstract String sayHello();
+
+ public abstract String sayGoodbye();
+
+ public abstract void remove();
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Result.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Result.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Result.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Result.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+public class Result
+{
+
+ private final String username;
+
+ public Result(String username)
+ {
+ this.username = username;
+ }
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultClient.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.inject.Inject;
+
+public class ResultClient
+{
+
+ @Inject @DAO ResultDAO result;
+
+ public Result lookupPete()
+ {
+ return result.findByUser("pete");
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAO.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface ResultDAO extends AbstractDAO<Result>
+{
+
+ public Result findByUser(String username);
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/ResultDAOImpl.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Stateless;
+
+@DAO
+@Stateless
+public class ResultDAOImpl extends AbstractDAOImpl<Result> implements ResultDAO
+{
+ public Result findByUser(String username)
+ {
+ return new Result(username);
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/Scottish.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.enterprise;
+
+import javax.ejb.Local;
+
+@Local
+public interface Scottish
+{
+
+ public Feed getFeed();
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/lifecycle)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,23 +16,27 @@
*/
package org.jboss.weld.tests.enterprise.lifecycle;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.weld.Container;
import org.jboss.weld.context.ContextLifecycle;
import org.jboss.weld.context.RequestContext;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
/**
* Sections
@@ -49,63 +53,74 @@
* Spec version: Public Release Draft 2
*
*/
-@Artifact
-(a)Packaging(PackagingType.EAR)
-@IntegrationTest
-public class EnterpriseBeanLifecycleTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class EnterpriseBeanLifecycleTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(JavaArchive.class, "test.jar")
+ .addPackage(EnterpriseBeanLifecycleTest.class.getPackage())
+ .addClass(Utils.class)
+ .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+ );
+ }
+ @Inject
+ private BeanManagerImpl beanManager;
+
/**
* When the create() method of a Bean object that represents a stateful
* session bean that is called, the container creates and returns a session
* bean proxy, as defined in Section 3.3.9, "Session bean proxies".
*/
- @Test(groups = { "enterpriseBeans", "clientProxy", "lifecycle", "integration" })
- public void testCreateSFSB()
+ @Test
+ public void testCreateSFSB(GrossStadt frankfurt)
{
- GrossStadt frankfurt = getReference(GrossStadt.class);
- Bean<KleinStadt> stadtBean = getBean(KleinStadt.class);
- assert stadtBean != null : "Expected a bean for stateful session bean Kassel";
+ Bean<KleinStadt> stadtBean = Utils.getBean(beanManager, KleinStadt.class);
+ Assert.assertNotNull("Expected a bean for stateful session bean Kassel", stadtBean);
CreationalContext<KleinStadt> creationalContext = new MockCreationalContext<KleinStadt>();
KleinStadt stadtInstance = stadtBean.create(creationalContext);
- assert stadtInstance != null : "Expected instance to be created by container";
- assert frankfurt.isKleinStadtCreated() : "PostConstruct should be invoked when bean instance is created";
+ Assert.assertNotNull("Expected instance to be created by container", stadtInstance);
+ Assert.assertTrue("PostConstruct should be invoked when bean instance is created", frankfurt.isKleinStadtCreated());
frankfurt.resetCreatedFlags();
// Create a second one to make sure create always does create a new session bean
KleinStadt anotherStadtInstance = stadtBean.create(creationalContext);
- assert anotherStadtInstance != null : "Expected second instance of session bean";
- assert frankfurt.isKleinStadtCreated();
- assert anotherStadtInstance != stadtInstance : "create() should not return same bean as before";
+ Assert.assertNotNull("Expected second instance of session bean", anotherStadtInstance);
+ Assert.assertTrue(frankfurt.isKleinStadtCreated());
+ Assert.assertNotSame("create() should not return same bean as before", anotherStadtInstance, stadtInstance);
// Verify that the instance returned is a proxy by checking for all local interfaces
- assert stadtInstance instanceof KleinStadt;
- assert stadtInstance instanceof SchoeneStadt;
+ Assert.assertTrue(stadtInstance instanceof KleinStadt);
+ Assert.assertTrue(stadtInstance instanceof SchoeneStadt);
}
- @Test(groups = { "enterpriseBeans", "clientProxy", "lifecycle", "integration" })
- public void testDestroyRemovesSFSB() throws Exception
+ @Test
+ public void testDestroyRemovesSFSB(GrossStadt frankfurt) throws Exception
{
- GrossStadt frankfurt = getReference(GrossStadt.class);
- Bean<KleinStadt> stadtBean = getBean(KleinStadt.class);
- assert stadtBean != null : "Expected a bean for stateful session bean Kassel";
+ Bean<KleinStadt> stadtBean = Utils.getBean(beanManager, KleinStadt.class);
+ Assert.assertNotNull("Expected a bean for stateful session bean Kassel", stadtBean);
RequestContext requestContext = Container.instance().services().get(ContextLifecycle.class).getRequestContext();
CreationalContext<KleinStadt> creationalContext = new MockCreationalContext<KleinStadt>();
KleinStadt kassel = requestContext.get(stadtBean, creationalContext);
stadtBean.destroy(kassel, creationalContext);
- assert frankfurt.isKleinStadtDestroyed() : "Expected SFSB bean to be destroyed";
+ Assert.assertTrue("Expected SFSB bean to be destroyed", frankfurt.isKleinStadtDestroyed());
requestContext.destroy();
kassel = requestContext.get(stadtBean);
- assert kassel == null : "SFSB bean should not exist after being destroyed";
+ Assert.assertNull("SFSB bean should not exist after being destroyed", kassel);
}
@Test
public void testDestroyDoesntTryToRemoveSLSB()
{
- Bean<BeanLocal> bean = getBean(BeanLocal.class);
- assert bean != null : "Expected a bean for stateless session bean BeanLocal";
- CreationalContext<BeanLocal> creationalContext = getCurrentManager().createCreationalContext(bean);
+ Bean<BeanLocal> bean = Utils.getBean(beanManager, BeanLocal.class);
+ Assert.assertNotNull("Expected a bean for stateless session bean BeanLocal", bean);
+ CreationalContext<BeanLocal> creationalContext = beanManager.createCreationalContext(bean);
BeanLocal instance = bean.create(creationalContext);
bean.destroy(instance, creationalContext);
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/proxyability)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/EnterpriseBeanLifecycleTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/proxyability/EnterpriseBeanLifecycleTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/enterprise/proxyability/EnterpriseBeanLifecycleTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,25 +16,40 @@
*/
package org.jboss.weld.tests.enterprise.proxyability;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
-@Artifact
-(a)Packaging(PackagingType.EAR)
-@IntegrationTest
-public class EnterpriseBeanLifecycleTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class EnterpriseBeanLifecycleTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(JavaArchive.class)
+ .addPackage(EnterpriseBeanLifecycleTest.class.getPackage())
+ .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+ );
+ }
- @Test(description="WELD-290")
- public void testSLSBInjectedIntoPassivatingManagedBean()
+ /*
+ * description="WELD-290"
+ */
+ @Test
+ public void testSLSBInjectedIntoPassivatingManagedBean(SimpleBean bean)
{
- SimpleBean bean = getReference(SimpleBean.class);
- assert bean.getMessage().equals("This is my message from my stateless bean");
-
+ Assert.assertEquals("This is my message from my stateless bean", bean.getMessage());
}
-
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Bar.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Bar.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Bar.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+@RequestScoped
+public class Bar
+{
+
+ @Inject Event<String> event;
+
+ @Inject @Updated Event<String> updatedEvent;
+
+ @Inject BeanManager manager;
+
+ private boolean unqualifiedObserved;
+ private boolean updatedObserved;
+
+ public void fireWithNoQualifiers()
+ {
+ event.fire("");
+ }
+
+ public void fireWithUpdatedQualifierViaSelect()
+ {
+ event.select(new AnnotationLiteral<Updated>() {}).fire("");
+ }
+
+ public void fireWithNoQualifiersViaManager()
+ {
+ manager.fireEvent("");
+ }
+
+ public void fireWithUpdatedQualifierViaManager()
+ {
+ manager.fireEvent("", new AnnotationLiteral<Updated>() {});
+ }
+
+ public void fireWithUpdatedQualifierViaAnnotation()
+ {
+ updatedEvent.fire("");
+ }
+
+ public void reset()
+ {
+ unqualifiedObserved = false;
+ updatedObserved = false;
+ }
+
+ public void onEvent(@Observes String event)
+ {
+ unqualifiedObserved = true;
+ }
+
+ private void onUpdatedEvent(@Observes @Updated String event)
+ {
+ updatedObserved = true;
+ }
+
+ public boolean isUnqualifiedObserved()
+ {
+ return unqualifiedObserved;
+ }
+
+ public boolean isUpdatedObserved()
+ {
+ return updatedObserved;
+ }
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/EventQualifierTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class EventQualifierTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(EventQualifierTest.class.getPackage());
+ }
+
+ /*
+ * description = "WELD-226"
+ */
+ @Test
+ public void testDefaultQualifierNotRequired(Bar bar)
+ {
+ bar.fireWithNoQualifiers();
+ Assert.assertTrue(bar.isUnqualifiedObserved());
+ Assert.assertFalse(bar.isUpdatedObserved());
+ bar.reset();
+ bar.fireWithNoQualifiersViaManager();
+ Assert.assertTrue(bar.isUnqualifiedObserved());
+ Assert.assertFalse(bar.isUpdatedObserved());
+ bar.reset();
+ bar.fireWithUpdatedQualifierViaAnnotation();
+ Assert.assertTrue(bar.isUnqualifiedObserved());
+ Assert.assertTrue(bar.isUpdatedObserved());
+ bar.reset();
+ bar.fireWithUpdatedQualifierViaManager();
+ Assert.assertTrue(bar.isUpdatedObserved());
+ Assert.assertTrue(bar.isUnqualifiedObserved());
+ bar.reset();
+ bar.fireWithUpdatedQualifierViaSelect();
+ Assert.assertTrue(bar.isUnqualifiedObserved());
+ Assert.assertTrue(bar.isUpdatedObserved());
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Foo.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Foo.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Foo.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
+
+public class Foo
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/NormalScopedBean.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.event.Event;
+import javax.enterprise.inject.Any;
+
+@SessionScoped
+public class NormalScopedBean implements Serializable
+{
+
+ @Any Event<Foo> event;
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/SimpleEventTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
+
+import javax.enterprise.event.Event;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Any;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class SimpleEventTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(SimpleEventTest.class.getPackage());
+ }
+
+ private static boolean RECEIVE_1_OBSERVED;
+ private static boolean RECEIVE_2_OBSERVED;
+ private static boolean RECEIVE_3_OBSERVED;
+
+ private static void initFlags() {
+ RECEIVE_1_OBSERVED = false;
+ RECEIVE_2_OBSERVED = false;
+ RECEIVE_3_OBSERVED = false;
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
+ public void testFireEventOnManager()
+ {
+ initFlags();
+
+ beanManager.fireEvent("Fired using Manager Interface with AnnotationLiteral.", new AnnotationLiteral<Updated>(){});
+
+ assert RECEIVE_1_OBSERVED == true;
+ assert RECEIVE_2_OBSERVED == true;
+ assert RECEIVE_3_OBSERVED == true;
+
+ initFlags();
+
+ beanManager.fireEvent("Fired using Manager Interface.");
+
+ assert RECEIVE_1_OBSERVED == false; // not called
+ assert RECEIVE_2_OBSERVED == true;
+ assert RECEIVE_3_OBSERVED == true;
+ }
+
+ @Test
+ public void testFireEventOnEvent(App app)
+ {
+ initFlags();
+
+ app.fireEventByBindingDeclaredAtInjectionPoint();
+
+ assert RECEIVE_1_OBSERVED == true;
+ assert RECEIVE_2_OBSERVED == true;
+ assert RECEIVE_3_OBSERVED == true;
+
+ initFlags();
+
+ app.fireEventByAnnotationLiteral();
+
+ assert RECEIVE_1_OBSERVED == true;
+ assert RECEIVE_2_OBSERVED == true;
+ assert RECEIVE_3_OBSERVED == true;
+
+ initFlags();
+
+ app.fireEventViaAny();
+
+ assert RECEIVE_2_OBSERVED == true;
+ assert RECEIVE_1_OBSERVED == false; // not called
+ assert RECEIVE_3_OBSERVED == true;
+
+ initFlags();
+
+ app.fireEventViaWithNoQualifier();
+
+ assert RECEIVE_1_OBSERVED == false; // not called
+ assert RECEIVE_2_OBSERVED == true;
+ assert RECEIVE_3_OBSERVED == true;
+ }
+
+ public static class App
+ {
+ @Inject @Any
+ Event<String> event1;
+
+ @Inject @Updated
+ Event<String> event2;
+
+ @Inject
+ Event<String> event4;
+
+ public void fireEventByAnnotationLiteral()
+ {
+ event1.select(new AnnotationLiteral<Updated>(){}).fire("Fired using Event Interface with AnnotationLiteral.");
+ }
+
+ public void fireEventByBindingDeclaredAtInjectionPoint()
+ {
+ event2.fire("Fired using Event Interface with Binding Declared.");
+ }
+
+ public void fireEventViaAny()
+ {
+ event1.fire("Fired using Event Interface");
+ }
+
+ public void fireEventViaWithNoQualifier()
+ {
+ event4.fire("Fired using Event Interface with no qualifier");
+ }
+ }
+
+ public static class Receiver
+ {
+ public void receive1(@Observes @Updated String s)
+ {
+ RECEIVE_1_OBSERVED = true;
+ }
+
+ public void receive2(@Any @Observes String s)
+ {
+ RECEIVE_2_OBSERVED = true;
+ }
+
+ public void receive3(@Observes String s)
+ {
+ RECEIVE_3_OBSERVED = true;
+ }
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Updated.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/event/Updated.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Updated.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/event/Updated.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.event;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.Qualifier;
+
+@Qualifier
+@Retention(RUNTIME)
+@Target( { TYPE, METHOD, FIELD, PARAMETER })
+@Documented
+@interface Updated
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/examples)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/ExampleTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/examples/ExampleTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/ExampleTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,35 +16,42 @@
*/
package org.jboss.weld.tests.examples;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class ExampleTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class ExampleTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ExampleTest.class.getPackage());
+ }
+
@Test
- public void testGameGenerator() throws Exception
+ public void testGameGenerator(Game game1, Game game2, Generator gen1, Generator gen2) throws Exception
{
- Game game1 = getReference(Game.class);
- Game game2 = getReference(Game.class);
- assert game1!=game2;
- assert game1.getNumber()!=game2.getNumber();
- Generator gen1 = getReference(Generator.class);
- Generator gen2 = getReference(Generator.class);
- assert gen1.getRandom()!=null;
- assert gen1.getRandom()==gen2.getRandom();
+ Assert.assertNotSame(game1, game2);
+ Assert.assertNotSame(game1.getNumber(), game2.getNumber());
+
+ Assert.assertNotNull(gen1.getRandom());
+ Assert.assertEquals(gen1.getRandom(), gen2.getRandom());
}
@Test
- public void testSentenceTranslator() throws Exception
+ public void testSentenceTranslator(TextTranslator tt1) throws Exception
{
-
- TextTranslator tt1 = getReference(TextTranslator.class);
try
{
tt1.translate("hello world");
- assert false;
+ Assert.fail();
}
catch (UnsupportedOperationException uoe)
{
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/MockExampleTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/examples/MockExampleTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/examples/MockExampleTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,21 +16,32 @@
*/
package org.jboss.weld.tests.examples;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-@BeansXml("beans.xml")
-public class MockExampleTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class MockExampleTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .alternate(MockSentenceTranslator.class)
+ .addPackage(ExampleTest.class.getPackage());
+ }
@Test
- public void testMockSentenceTranslator() throws Exception
+ public void testMockSentenceTranslator(TextTranslator tt2) throws Exception
{
- TextTranslator tt2 = getReference(TextTranslator.class);
- assert "Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.".equals( tt2.translate("Hello world. How's tricks?") );
+ Assert.assertEquals(
+ "Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.",
+ tt2.translate("Hello world. How's tricks?") );
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/exceptions)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/ExceptionHandlingTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/exceptions/ExceptionHandlingTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/exceptions/ExceptionHandlingTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -18,21 +18,38 @@
import javax.enterprise.inject.CreationException;
import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class ExceptionHandlingTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class ExceptionHandlingTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ExceptionHandlingTest.class.getPackage())
+ .addClass(Utils.class);
+ }
- @Test(expectedExceptions=FooException.class)
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test(expected = FooException.class)
public void testCreationExceptionWrapsRealExceptionForSimpleBean() throws Exception
{
try
{
- getReference(Lorry_Broken.class);
+ Utils.getReference(beanManager, Lorry_Broken.class);
}
catch (Exception e)
{
@@ -44,12 +61,12 @@
}
- @Test(expectedExceptions=FooException.class)
+ @Test(expected = FooException.class)
public void testCreationExceptionWrapsRealExceptionForProducerBean() throws Exception
{
try
{
- getReference(Ship.class, new AnnotationLiteral<Large>() {});
+ Utils.getReference(beanManager, Ship.class, new AnnotationLiteral<Large>() {});
}
catch (Exception e)
{
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Capercaillie.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+public class Capercaillie
+{
+
+ public Capercaillie(String name)
+ {
+ // TODO Auto-generated constructor stub
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Cow.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Cow.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Cow.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Cow.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+import javax.ejb.Stateless;
+
+@Stateless
+public class Cow implements CowLocal
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/CowLocal.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+import javax.ejb.Local;
+
+@Local
+public interface CowLocal
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionObserver.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,295 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.inject.spi.ProcessProducerField;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+import javax.enterprise.inject.spi.ProcessSessionBean;
+
+public class ExtensionObserver implements Extension
+{
+
+ private boolean allBeforeBeanDiscovery;
+ private boolean allAfterBeanDiscovery;
+ private boolean allAfterDeploymentValidation;
+ private boolean allProcessBean;
+ private boolean allProcessInjectionTarget;
+ private boolean allProcessManagedBean;
+ private boolean allProcessObserverMethod;
+ private boolean allProcessProducer;
+ private boolean allProcessProducerField;
+ private boolean allProcessProducerMethod;
+ private boolean allProcessSessionBean;
+ private boolean allProcessAnnnotatedType;
+
+ private boolean beforeBeanDiscovery;
+ private boolean afterBeanDiscovery;
+ private boolean afterDeploymentValidation;
+ private boolean processBean;
+ private boolean processInjectionTarget;
+ private boolean processManagedBean;
+ private boolean processObserverMethod;
+ private boolean processProducer;
+ private boolean processProducerField;
+ private boolean processProducerMethod;
+ private boolean processSessionBean;
+ private boolean processAnnotatedType;
+
+ public void observeAll(@Observes Object event)
+ {
+ if (event instanceof BeforeBeanDiscovery)
+ {
+ allBeforeBeanDiscovery = true;
+ }
+ if (event instanceof AfterBeanDiscovery)
+ {
+ allAfterBeanDiscovery = true;
+ }
+ if (event instanceof AfterDeploymentValidation)
+ {
+ allAfterDeploymentValidation = true;
+ }
+ if (event instanceof ProcessBean<?> && !(event instanceof ProcessProducerField<?, ?> || event instanceof ProcessProducerMethod<?, ?> || event instanceof ProcessManagedBean<?> || event instanceof ProcessSessionBean<?>))
+ {
+ allProcessBean = true;
+ }
+ if (event instanceof ProcessInjectionTarget<?>)
+ {
+ allProcessInjectionTarget = true;
+ }
+ if (event instanceof ProcessManagedBean<?>)
+ {
+ allProcessManagedBean = true;
+ }
+ if (event instanceof ProcessObserverMethod<?, ?>)
+ {
+ allProcessObserverMethod = true;
+ }
+ if (event instanceof ProcessProducer<?, ?>)
+ {
+ allProcessProducer = true;
+ }
+ if (event instanceof ProcessProducerField<?, ?>)
+ {
+ allProcessProducerField = true;
+ }
+ if (event instanceof ProcessProducerMethod<?, ?>)
+ {
+ allProcessProducerMethod = true;
+ }
+ if (event instanceof ProcessSessionBean<?>)
+ {
+ allProcessSessionBean = true;
+ }
+ if (event instanceof ProcessAnnotatedType<?>)
+ {
+ allProcessAnnnotatedType = true;
+ }
+ }
+
+ public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery event)
+ {
+ beforeBeanDiscovery = true;
+ }
+
+ public void observeAfterBeanDiscovery(@Observes AfterBeanDiscovery event)
+ {
+ afterBeanDiscovery = true;
+ }
+
+ public void observeAfterDeploymentValidation(@Observes AfterDeploymentValidation event)
+ {
+ afterDeploymentValidation = true;
+ }
+
+ public void observeProcessBean(@Observes ProcessBean<?> event)
+ {
+ processBean = true;
+ }
+
+ public void observeProcessInjectionTarget(@Observes ProcessInjectionTarget<?> event)
+ {
+ processInjectionTarget = true;
+ }
+
+ public void observeProcessProducer(@Observes ProcessProducer<?, ?> event)
+ {
+ processProducer = true;
+ }
+
+ public void observeProcessProducerMethod(@Observes ProcessProducerMethod<?, ?> event)
+ {
+ processProducerMethod = true;
+ }
+
+ public void observeProcessProducerField(@Observes ProcessProducerField<?, ?> event)
+ {
+ processProducerField = true;
+ }
+
+ public void observeProcessObserverMethod(@Observes ProcessObserverMethod<?, ?> event)
+ {
+ processObserverMethod = true;
+ }
+
+ public void observeProcessManagedBean(@Observes ProcessManagedBean<?> event)
+ {
+ processManagedBean = true;
+ }
+
+ public void observeProcessSessionBean(@Observes ProcessSessionBean<?> event)
+ {
+ processSessionBean = true;
+ }
+
+ public void observeProcessAnnotatedType(@Observes ProcessAnnotatedType<?> event)
+ {
+ processAnnotatedType = true;
+ }
+
+ public boolean isAllBeforeBeanDiscovery()
+ {
+ return allBeforeBeanDiscovery;
+ }
+
+ public boolean isAllAfterBeanDiscovery()
+ {
+ return allAfterBeanDiscovery;
+ }
+
+ public boolean isAllAfterDeploymentValidation()
+ {
+ return allAfterDeploymentValidation;
+ }
+
+ public boolean isAllProcessBean()
+ {
+ return allProcessBean;
+ }
+
+ public boolean isAllProcessInjectionTarget()
+ {
+ return allProcessInjectionTarget;
+ }
+
+ public boolean isAllProcessManagedBean()
+ {
+ return allProcessManagedBean;
+ }
+
+ public boolean isAllProcessObserverMethod()
+ {
+ return allProcessObserverMethod;
+ }
+
+ public boolean isAllProcessProducer()
+ {
+ return allProcessProducer;
+ }
+
+ public boolean isAllProcessProducerField()
+ {
+ return allProcessProducerField;
+ }
+
+ public boolean isAllProcessProducerMethod()
+ {
+ return allProcessProducerMethod;
+ }
+
+ public boolean isAllProcessSessionBean()
+ {
+ return allProcessSessionBean;
+ }
+
+ public boolean isAllProcessAnnnotatedType()
+ {
+ return allProcessAnnnotatedType;
+ }
+
+ public boolean isBeforeBeanDiscovery()
+ {
+ return beforeBeanDiscovery;
+ }
+
+ public boolean isAfterBeanDiscovery()
+ {
+ return afterBeanDiscovery;
+ }
+
+ public boolean isAfterDeploymentValidation()
+ {
+ return afterDeploymentValidation;
+ }
+
+ public boolean isProcessBean()
+ {
+ return processBean;
+ }
+
+ public boolean isProcessInjectionTarget()
+ {
+ return processInjectionTarget;
+ }
+
+ public boolean isProcessManagedBean()
+ {
+ return processManagedBean;
+ }
+
+ public boolean isProcessObserverMethod()
+ {
+ return processObserverMethod;
+ }
+
+ public boolean isProcessProducer()
+ {
+ return processProducer;
+ }
+
+ public boolean isProcessProducerField()
+ {
+ return processProducerField;
+ }
+
+ public boolean isProcessProducerMethod()
+ {
+ return processProducerMethod;
+ }
+
+ public boolean isProcessSessionBean()
+ {
+ return processSessionBean;
+ }
+
+ public boolean isProcessAnnotatedType()
+ {
+ return processAnnotatedType;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/ExtensionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,136 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+import javax.enterprise.inject.spi.Extension;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class ExtensionTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ExtensionTest.class.getPackage())
+ .addServiceProvider(Extension.class,
+ SimpleExtension.class,
+ ExtensionObserver.class,
+ WoodlandExtension.class)
+ );
+ }
+
+ /*
+ * description = "WELD-234"
+ */
+ @Test
+ public void testExtensionInjectableAsBean(SimpleExtension extension)
+ {
+ Assert.assertTrue(extension.isObservedBeforeBeanDiscovery());
+ }
+
+ /*
+ * description = "WELD-243"
+ */
+ @Test
+ public void testContainerEventsOnlySentToExtensionBeans(ExtensionObserver extensionObserver, OtherObserver otherObserver)
+ {
+ Assert.assertTrue(extensionObserver.isBeforeBeanDiscovery());
+ Assert.assertTrue(extensionObserver.isAllBeforeBeanDiscovery());
+ Assert.assertFalse(otherObserver.isBeforeBeanDiscovery());
+ Assert.assertFalse(otherObserver.isAllBeforeBeanDiscovery());
+
+ Assert.assertTrue(extensionObserver.isAfterBeanDiscovery());
+ Assert.assertTrue(extensionObserver.isAllAfterBeanDiscovery());
+ Assert.assertFalse(otherObserver.isAfterBeanDiscovery());
+ Assert.assertFalse(otherObserver.isAllAfterBeanDiscovery());
+
+ Assert.assertTrue(extensionObserver.isProcessAnnotatedType());
+ Assert.assertTrue(extensionObserver.isAllProcessAnnnotatedType());
+ Assert.assertFalse(otherObserver.isProcessAnnotatedType());
+ Assert.assertFalse(otherObserver.isAllProcessAnnotatedType());
+
+ Assert.assertTrue(extensionObserver.isProcessBean());
+ Assert.assertTrue(extensionObserver.isAllProcessBean());
+ Assert.assertFalse(otherObserver.isProcessBean());
+ Assert.assertFalse(otherObserver.isAllProcessBean());
+
+ Assert.assertTrue(extensionObserver.isProcessInjectionTarget());
+ Assert.assertTrue(extensionObserver.isAllProcessInjectionTarget());
+ Assert.assertFalse(otherObserver.isProcessInjectionTarget());
+ Assert.assertFalse(otherObserver.isAllProcessInjectionTarget());
+
+ Assert.assertTrue(extensionObserver.isProcessManagedBean());
+ Assert.assertTrue(extensionObserver.isAllProcessManagedBean());
+ Assert.assertFalse(otherObserver.isProcessManagedBean());
+ Assert.assertFalse(otherObserver.isAllProcessManagedBean());
+
+ Assert.assertTrue(extensionObserver.isProcessObserverMethod());
+ Assert.assertTrue(extensionObserver.isAllProcessObserverMethod());
+ Assert.assertFalse(otherObserver.isProcessObserverMethod());
+ Assert.assertFalse(otherObserver.isAllProcessObserverMethod());
+
+ Assert.assertTrue(extensionObserver.isProcessProducer());
+ Assert.assertTrue(extensionObserver.isAllProcessProducer());
+ Assert.assertFalse(otherObserver.isProcessProducer());
+ Assert.assertFalse(otherObserver.isAllProcessProducer());
+
+ Assert.assertTrue(extensionObserver.isProcessProducerField());
+ Assert.assertTrue(extensionObserver.isAllProcessProducerField());
+ Assert.assertFalse(otherObserver.isProcessProducerField());
+ Assert.assertFalse(otherObserver.isAllProcessProducerField());
+
+ Assert.assertTrue(extensionObserver.isProcessProducerMethod());
+ Assert.assertTrue(extensionObserver.isAllProcessProducerField());
+ Assert.assertFalse(otherObserver.isProcessProducerMethod());
+ Assert.assertFalse(otherObserver.isAllProcessProducerMethod());
+
+ Assert.assertTrue(extensionObserver.isProcessSessionBean());
+ Assert.assertTrue(extensionObserver.isAllProcessSessionBean());
+ Assert.assertFalse(otherObserver.isProcessSessionBean());
+ Assert.assertFalse(otherObserver.isAllProcessSessionBean());
+
+ Assert.assertTrue(extensionObserver.isAfterDeploymentValidation());
+ Assert.assertTrue(extensionObserver.isAllAfterDeploymentValidation());
+ Assert.assertFalse(otherObserver.isAfterDeploymentValidation());
+ Assert.assertFalse(otherObserver.isAllAfterDeploymentValidation());
+ }
+
+ @Test
+ public void testInjectionTargetWrapped(Capercaillie capercaillie)
+ {
+ Assert.assertTrue(Woodland.isPostConstructCalled());
+ Assert.assertTrue(WoodlandExtension.isInjectCalled());
+ Assert.assertTrue(WoodlandExtension.isPostConstructCalled());
+ Assert.assertTrue(WoodlandExtension.isPreDestroyCalled());
+ Assert.assertTrue(WoodlandExtension.isProduceCalled());
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Foo.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Foo.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Foo.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+import javax.inject.Inject;
+
+public class Foo
+{
+
+ @Inject SimpleExtension simpleExtension;
+
+ public SimpleExtension getSimpleExtension()
+ {
+ return simpleExtension;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Horse.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Horse.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Horse.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Horse.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+public class Horse
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/OtherObserver.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,296 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AfterDeploymentValidation;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.enterprise.inject.spi.ProcessBean;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+import javax.enterprise.inject.spi.ProcessManagedBean;
+import javax.enterprise.inject.spi.ProcessObserverMethod;
+import javax.enterprise.inject.spi.ProcessProducer;
+import javax.enterprise.inject.spi.ProcessProducerField;
+import javax.enterprise.inject.spi.ProcessProducerMethod;
+import javax.enterprise.inject.spi.ProcessSessionBean;
+
+@ApplicationScoped
+public class OtherObserver
+{
+
+ private boolean allBeforeBeanDiscovery;
+ private boolean allAfterBeanDiscovery;
+ private boolean allAfterDeploymentValidation;
+ private boolean allProcessBean;
+ private boolean allProcessInjectionTarget;
+ private boolean allProcessManagedBean;
+ private boolean allProcessObserverMethod;
+ private boolean allProcessProducer;
+ private boolean allProcessProducerField;
+ private boolean allProcessProducerMethod;
+ private boolean allProcessSession;
+ private boolean allProcessAnnotatedType;
+
+ private boolean beforeBeanDiscovery;
+ private boolean afterBeanDiscovery;
+ private boolean afterDeploymentValidation;
+ private boolean processBean;
+ private boolean processInjectionTarget;
+ private boolean processManagedBean;
+ private boolean processObserverMethod;
+ private boolean processProducer;
+ private boolean processProducerField;
+ private boolean processProducerMethod;
+ private boolean processSessionBean;
+ private boolean processAnnotatedType;
+
+ public void observeAll(@Observes Object event)
+ {
+ if (event instanceof BeforeBeanDiscovery)
+ {
+ allBeforeBeanDiscovery = true;
+ }
+ if (event instanceof AfterBeanDiscovery)
+ {
+ allAfterBeanDiscovery = true;
+ }
+ if (event instanceof AfterDeploymentValidation)
+ {
+ allAfterDeploymentValidation = true;
+ }
+ if (event instanceof ProcessBean<?> && !(event instanceof ProcessProducerField<?, ?> || event instanceof ProcessProducerMethod<?, ?> || event instanceof ProcessManagedBean<?> || event instanceof ProcessSessionBean<?>))
+ {
+ allProcessBean = true;
+ }
+ if (event instanceof ProcessInjectionTarget<?>)
+ {
+ allProcessInjectionTarget = true;
+ }
+ if (event instanceof ProcessManagedBean<?>)
+ {
+ allProcessManagedBean = true;
+ }
+ if (event instanceof ProcessObserverMethod<?, ?>)
+ {
+ allProcessObserverMethod = true;
+ }
+ if (event instanceof ProcessProducer<?, ?>)
+ {
+ allProcessProducer = true;
+ }
+ if (event instanceof ProcessProducerField<?, ?>)
+ {
+ allProcessProducerField = true;
+ }
+ if (event instanceof ProcessProducerMethod<?, ?>)
+ {
+ allProcessProducerMethod = true;
+ }
+ if (event instanceof ProcessSessionBean<?>)
+ {
+ allProcessSession = true;
+ }
+ if (event instanceof ProcessAnnotatedType<?>)
+ {
+ allProcessAnnotatedType = true;
+ }
+ }
+
+ public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery event)
+ {
+ beforeBeanDiscovery = true;
+ }
+
+ public void observeAfterBeanDiscovery(@Observes AfterBeanDiscovery event)
+ {
+ afterBeanDiscovery = true;
+ }
+
+ public void observeAfterDeploymentValidation(@Observes AfterDeploymentValidation event)
+ {
+ afterDeploymentValidation = true;
+ }
+
+ public void observeProcessBean(@Observes ProcessBean<?> event)
+ {
+ processBean = true;
+ }
+
+ public void observeProcessInjectionTarget(@Observes ProcessInjectionTarget<?> event)
+ {
+ processInjectionTarget = true;
+ }
+
+ public void observeProcessProducer(@Observes ProcessProducer<?, ?> event)
+ {
+ processProducer = true;
+ }
+
+ public void observeProcessProducerMethod(@Observes ProcessProducerMethod<?, ?> event)
+ {
+ processProducerMethod = true;
+ }
+
+ public void observeProcessProducerField(@Observes ProcessProducerField<?, ?> event)
+ {
+ processProducerField = true;
+ }
+
+ public void observeProcessObserverMethod(@Observes ProcessObserverMethod<?, ?> event)
+ {
+ processObserverMethod = true;
+ }
+
+ public void observeProcessManagedBean(@Observes ProcessManagedBean<?> event)
+ {
+ processManagedBean = true;
+ }
+
+ public void observeProcessSessionBean(@Observes ProcessSessionBean<?> event)
+ {
+ processSessionBean = true;
+ }
+
+ public void observeProcessAnnotatedType(@Observes ProcessAnnotatedType<?> event)
+ {
+ processAnnotatedType = true;
+ }
+
+ public boolean isAllBeforeBeanDiscovery()
+ {
+ return allBeforeBeanDiscovery;
+ }
+
+ public boolean isAllAfterBeanDiscovery()
+ {
+ return allAfterBeanDiscovery;
+ }
+
+ public boolean isAllAfterDeploymentValidation()
+ {
+ return allAfterDeploymentValidation;
+ }
+
+ public boolean isAllProcessBean()
+ {
+ return allProcessBean;
+ }
+
+ public boolean isAllProcessInjectionTarget()
+ {
+ return allProcessInjectionTarget;
+ }
+
+ public boolean isAllProcessManagedBean()
+ {
+ return allProcessManagedBean;
+ }
+
+ public boolean isAllProcessObserverMethod()
+ {
+ return allProcessObserverMethod;
+ }
+
+ public boolean isAllProcessProducer()
+ {
+ return allProcessProducer;
+ }
+
+ public boolean isAllProcessProducerField()
+ {
+ return allProcessProducerField;
+ }
+
+ public boolean isAllProcessProducerMethod()
+ {
+ return allProcessProducerMethod;
+ }
+
+ public boolean isAllProcessSessionBean()
+ {
+ return allProcessSession;
+ }
+
+ public boolean isAllProcessAnnotatedType()
+ {
+ return allProcessAnnotatedType;
+ }
+
+ public boolean isBeforeBeanDiscovery()
+ {
+ return beforeBeanDiscovery;
+ }
+
+ public boolean isAfterBeanDiscovery()
+ {
+ return afterBeanDiscovery;
+ }
+
+ public boolean isAfterDeploymentValidation()
+ {
+ return afterDeploymentValidation;
+ }
+
+ public boolean isProcessBean()
+ {
+ return processBean;
+ }
+
+ public boolean isProcessInjectionTarget()
+ {
+ return processInjectionTarget;
+ }
+
+ public boolean isProcessManagedBean()
+ {
+ return processManagedBean;
+ }
+
+ public boolean isProcessObserverMethod()
+ {
+ return processObserverMethod;
+ }
+
+ public boolean isProcessProducer()
+ {
+ return processProducer;
+ }
+
+ public boolean isProcessProducerField()
+ {
+ return processProducerField;
+ }
+
+ public boolean isProcessProducerMethod()
+ {
+ return processProducerMethod;
+ }
+
+ public boolean isProcessSessionBean()
+ {
+ return processSessionBean;
+ }
+
+ public boolean isProcessAnnotatedType()
+ {
+ return processAnnotatedType;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Rat.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Rat.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Rat.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Rat.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+public class Rat
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/SimpleExtension.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.inject.spi.Extension;
+
+
+public class SimpleExtension implements Extension
+{
+
+ private static boolean observedBeforeBeanDiscovery;
+
+ public void observe(@Observes BeforeBeanDiscovery event)
+ {
+ observedBeforeBeanDiscovery = true;
+ }
+
+ public static boolean isObservedBeforeBeanDiscovery()
+ {
+ return observedBeforeBeanDiscovery;
+ }
+
+ public void observeBeforeShutdown(@Observes BeforeShutdown beforeShutdown, BeanManager beanManager)
+ {
+ assert beanManager != null;
+ assert beanManager.getELResolver() != null;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Special.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Special.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Special.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Special.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Special
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Stable.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Stable.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Stable.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Stable.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+import javax.enterprise.inject.Produces;
+
+public class Stable
+{
+
+ @Produces @Special Rat rat = new Rat();
+
+ @Produces @Special Horse produce()
+ {
+ return new Horse();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Woodland.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/Woodland.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Woodland.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/Woodland.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.inject.Produces;
+
+public class Woodland
+{
+
+ private static boolean postConstructCalled;
+
+ @Produces
+ private Capercaillie capercaillie = new Capercaillie("bob");
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ postConstructCalled = true;
+ }
+
+ public static boolean isPostConstructCalled()
+ {
+ return postConstructCalled;
+ }
+
+ public static void reset()
+ {
+ postConstructCalled = false;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/WoodlandExtension.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions;
+
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.BeforeShutdown;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.InjectionTarget;
+import javax.enterprise.inject.spi.ProcessInjectionTarget;
+
+public class WoodlandExtension implements Extension
+{
+
+ private static boolean injectCalled;
+ private static boolean postConstructCalled;
+ private static boolean preDestroyCalled;
+ private static boolean produceCalled;
+
+ public void cleanup(@Observes BeforeShutdown shutdown)
+ {
+ reset();
+ Woodland.reset();
+ }
+
+ public void enhanceWoodland(final @Observes ProcessInjectionTarget<Woodland> processWoodland)
+ {
+ final InjectionTarget<Woodland> it = processWoodland.getInjectionTarget();
+ processWoodland.setInjectionTarget(new InjectionTarget<Woodland>()
+ {
+
+ public void inject(Woodland instance, CreationalContext<Woodland> ctx)
+ {
+ injectCalled = true;
+ it.inject(instance, ctx);
+ }
+
+ public void postConstruct(Woodland instance)
+ {
+ postConstructCalled = true;
+ it.postConstruct(instance);
+ }
+
+ public void preDestroy(Woodland instance)
+ {
+ preDestroyCalled = true;
+ it.preDestroy(instance);
+ }
+
+ public void dispose(Woodland instance)
+ {
+ // No-op for class bean
+
+ }
+
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return it.getInjectionPoints();
+ }
+
+ public Woodland produce(CreationalContext<Woodland> ctx)
+ {
+ produceCalled = true;
+ return it.produce(ctx);
+ }
+
+ });
+ }
+
+ public static void reset()
+ {
+ injectCalled = false;
+ postConstructCalled = false;
+ preDestroyCalled = false;
+ preDestroyCalled = false;
+ }
+
+ public static boolean isInjectCalled()
+ {
+ return injectCalled;
+ }
+
+ public static boolean isPostConstructCalled()
+ {
+ return postConstructCalled;
+ }
+
+ public static boolean isPreDestroyCalled()
+ {
+ return preDestroyCalled;
+ }
+
+ public static boolean isProduceCalled()
+ {
+ return produceCalled;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtension.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,563 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AnnotatedCallable;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+import javax.inject.Inject;
+
+import org.jboss.weld.tests.extensions.annotatedType.EcoFriendlyWashingMachine.EcoFriendlyWashingMachineLiteral;
+import org.jboss.weld.util.collections.Arrays2;
+
+public class AnnotatedTypeExtension implements Extension
+{
+
+ public void addTumbleDryer(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
+ {
+
+ final Set<AnnotatedConstructor<TumbleDryer>> constructors = new HashSet<AnnotatedConstructor<TumbleDryer>>();
+ final Set<AnnotatedField<? super TumbleDryer>> fields = new HashSet<AnnotatedField<? super TumbleDryer>>();
+ final Set<AnnotatedMethod<? super TumbleDryer>> methods = new HashSet<AnnotatedMethod<? super TumbleDryer>>();
+
+ final AnnotatedType<TumbleDryer> tumbleDryer = new AnnotatedType<TumbleDryer>()
+ {
+
+ public Set<AnnotatedConstructor<TumbleDryer>> getConstructors()
+ {
+ return constructors;
+ }
+
+ public Set<AnnotatedField<? super TumbleDryer>> getFields()
+ {
+ return fields;
+ }
+
+ public Set<AnnotatedMethod<? super TumbleDryer>> getMethods()
+ {
+ return methods;
+ }
+
+ // Now the easy stuff
+
+ public Class<TumbleDryer> getJavaClass()
+ {
+ return TumbleDryer.class;
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ // Class has no annotations
+ return null;
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ return Collections.emptySet();
+ }
+
+ public Type getBaseType()
+ {
+ return TumbleDryer.class;
+ }
+
+ public Set<Type> getTypeClosure()
+ {
+ return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ // Class has no annotations
+ return false;
+ }
+
+ };
+
+ AnnotatedField<TumbleDryer> plug = new AnnotatedField<TumbleDryer>()
+ {
+
+ public Field getJavaMember()
+ {
+ try
+ {
+ return TumbleDryer.class.getDeclaredField("plug");
+ }
+ catch (NoSuchFieldException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public boolean isStatic()
+ {
+ return false;
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ if (annotationType.equals(Inject.class))
+ {
+ return annotationType.cast(InjectLiteral.INSTANCE);
+ }
+ else if (annotationType.equals(Special.class))
+ {
+ return annotationType.cast(SpecialLiteral.INSTANCE);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ return Arrays2.asSet(InjectLiteral.INSTANCE, SpecialLiteral.INSTANCE);
+ }
+
+ public Type getBaseType()
+ {
+ return Plug.class;
+ }
+
+ public Set<Type> getTypeClosure()
+ {
+ return Arrays2.<Type>asSet(Plug.class, Object.class);
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ if (annotationType.equals(Inject.class) || annotationType.equals(Special.class))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public AnnotatedType<TumbleDryer> getDeclaringType()
+ {
+ return tumbleDryer;
+ }
+ };
+ fields.add(plug);
+
+
+ final List<AnnotatedParameter<TumbleDryer>> runningTimeParameters = new ArrayList<AnnotatedParameter<TumbleDryer>>();
+ final AnnotatedMethod<TumbleDryer> runningTimeMethod = new AnnotatedMethod<TumbleDryer>()
+ {
+
+ public Method getJavaMember()
+ {
+ try
+ {
+ return TumbleDryer.class.getDeclaredMethod("setRunningTime", RunningTime.class);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public List<AnnotatedParameter<TumbleDryer>> getParameters()
+ {
+ return runningTimeParameters;
+ }
+
+ public AnnotatedType<TumbleDryer> getDeclaringType()
+ {
+ return tumbleDryer;
+ }
+
+ public boolean isStatic()
+ {
+ return false;
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ if (annotationType.equals(Inject.class))
+ {
+ return annotationType.cast(InjectLiteral.INSTANCE);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ return Collections.<Annotation>singleton(InjectLiteral.INSTANCE);
+ }
+
+ public Type getBaseType()
+ {
+ return TumbleDryer.class;
+ }
+
+ public Set<Type> getTypeClosure()
+ {
+ return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ if (annotationType.equals(Inject.class))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ };
+ methods.add(runningTimeMethod);
+
+ final AnnotatedParameter<TumbleDryer> runningTimeParameter = new AnnotatedParameter<TumbleDryer>()
+ {
+
+ public AnnotatedCallable<TumbleDryer> getDeclaringCallable()
+ {
+ return runningTimeMethod;
+ }
+
+ public int getPosition()
+ {
+ return 0;
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ if (annotationType.equals(Special.class))
+ {
+ return annotationType.cast(SpecialLiteral.INSTANCE);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ return Collections.<Annotation>singleton(SpecialLiteral.INSTANCE);
+ }
+
+ public Type getBaseType()
+ {
+ return RunningTime.class;
+ }
+
+ public Set<Type> getTypeClosure()
+ {
+ return Collections.<Type>singleton(RunningTime.class);
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ if (annotationType.equals(Special.class))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ };
+ runningTimeParameters.add(runningTimeParameter);
+
+ final List<AnnotatedParameter<TumbleDryer>> clothesParameters = new ArrayList<AnnotatedParameter<TumbleDryer>>();
+ final AnnotatedConstructor<TumbleDryer> clothesConstructor = new AnnotatedConstructor<TumbleDryer>()
+ {
+
+ public Constructor<TumbleDryer> getJavaMember()
+ {
+ try
+ {
+ return TumbleDryer.class.getDeclaredConstructor(Clothes.class);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public List<AnnotatedParameter<TumbleDryer>> getParameters()
+ {
+ return clothesParameters;
+ }
+
+ public AnnotatedType<TumbleDryer> getDeclaringType()
+ {
+ return tumbleDryer;
+ }
+
+ public boolean isStatic()
+ {
+ return false;
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ if (annotationType.equals(Inject.class))
+ {
+ return annotationType.cast(InjectLiteral.INSTANCE);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ return Collections.<Annotation>singleton(InjectLiteral.INSTANCE);
+ }
+
+ public Type getBaseType()
+ {
+ return TumbleDryer.class;
+ }
+
+ public Set<Type> getTypeClosure()
+ {
+ return Arrays2.<Type>asSet(TumbleDryer.class, Object.class);
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ if (annotationType.equals(Inject.class))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ };
+ constructors.add(clothesConstructor);
+
+ AnnotatedParameter<TumbleDryer> clothesParameter = new AnnotatedParameter<TumbleDryer>()
+ {
+
+ public AnnotatedCallable<TumbleDryer> getDeclaringCallable()
+ {
+ return clothesConstructor;
+ }
+
+ public int getPosition()
+ {
+ return 0;
+ }
+
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ if (annotationType.equals(Special.class))
+ {
+ return annotationType.cast(SpecialLiteral.INSTANCE);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ return Collections.<Annotation>singleton(SpecialLiteral.INSTANCE);
+ }
+
+ public Type getBaseType()
+ {
+ return Clothes.class;
+ }
+
+ public Set<Type> getTypeClosure()
+ {
+ return Arrays2.<Type>asSet(Clothes.class, Object.class);
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ if (annotationType.equals(Special.class))
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ };
+ clothesParameters.add(clothesParameter);
+
+ beforeBeanDiscovery.addAnnotatedType(tumbleDryer);
+ }
+
+ /**
+ * Adds an eco friendly wasing machine
+ * @param beforeBeanDiscovery
+ */
+ public void addWashingMachine(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
+ {
+ final Set<AnnotatedConstructor<WashingMachine>> constructors = new HashSet<AnnotatedConstructor<WashingMachine>>();
+ final AnnotatedType<WashingMachine> type = new AnnotatedType<WashingMachine>()
+ {
+
+ public Set<AnnotatedConstructor<WashingMachine>> getConstructors()
+ {
+ return constructors;
+ }
+
+ public Set<AnnotatedField<? super WashingMachine>> getFields()
+ {
+ return Collections.emptySet();
+ }
+
+ public Class<WashingMachine> getJavaClass()
+ {
+ return WashingMachine.class;
+ }
+
+ public Set<AnnotatedMethod<? super WashingMachine>> getMethods()
+ {
+ return Collections.emptySet();
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ if(annotationType == EcoFriendlyWashingMachine.class)
+ {
+ return annotationType.cast(EcoFriendlyWashingMachineLiteral.INSTANCE);
+ }
+ return null;
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ return Collections.<Annotation>singleton(EcoFriendlyWashingMachineLiteral.INSTANCE);
+ }
+
+ public Type getBaseType()
+ {
+ return WashingMachine.class;
+ }
+
+ public Set<Type> getTypeClosure()
+ {
+ return Arrays2.<Type>asSet(WashingMachine.class, Object.class);
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return annotationType == EcoFriendlyWashingMachine.class;
+ }
+
+ };
+
+ final AnnotatedConstructor<WashingMachine> constructor = new AnnotatedConstructor<WashingMachine>()
+ {
+
+ public Constructor<WashingMachine> getJavaMember()
+ {
+ try
+ {
+ return WashingMachine.class.getDeclaredConstructor();
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public List<AnnotatedParameter<WashingMachine>> getParameters()
+ {
+ return Collections.emptyList();
+ }
+
+ public AnnotatedType<WashingMachine> getDeclaringType()
+ {
+ return type;
+ }
+
+ public boolean isStatic()
+ {
+ return false;
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+ {
+ return null;
+ }
+
+ public Set<Annotation> getAnnotations()
+ {
+ return Collections.emptySet();
+ }
+
+ public Type getBaseType()
+ {
+ return WashingMachine.class;
+ }
+
+ public Set<Type> getTypeClosure()
+ {
+ return Arrays2.<Type>asSet(WashingMachine.class, Object.class);
+ }
+
+ public boolean isAnnotationPresent(Class<? extends Annotation> annotationType)
+ {
+ return false;
+ }
+ };
+ constructors.add(constructor);
+
+ beforeBeanDiscovery.addAnnotatedType(type);
+ }
+
+ public void vetoOriginalTumbleDryer(@Observes ProcessAnnotatedType<TumbleDryer> event)
+ {
+ event.veto();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/AnnotatedTypeExtensionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,179 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Set;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.spi.AnnotatedConstructor;
+import javax.enterprise.inject.spi.AnnotatedField;
+import javax.enterprise.inject.spi.AnnotatedMethod;
+import javax.enterprise.inject.spi.AnnotatedParameter;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Integration;
+import org.jboss.weld.tests.extensions.annotatedType.EcoFriendlyWashingMachine.EcoFriendlyWashingMachineLiteral;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class AnnotatedTypeExtensionTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(BeanArchive.class)
+ .addPackage(AnnotatedTypeExtensionTest.class.getPackage())
+ .addClass(Utils.class)
+ .addServiceProvider(Extension.class, AnnotatedTypeExtension.class)
+ );
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
+ public void testMultipleBeansOfSameType(Laundry laundry)
+ {
+ Assert.assertNotNull(laundry.ecoFriendlyWashingMachine);
+ Assert.assertNotNull(laundry.fastWashingMachine);
+ }
+
+ /*
+ * description = "WELD-371"
+ */
+ @Test
+ public void testAnnotationsAreOverridden()
+ {
+ Bean<WashingMachine> bean = Utils.getBean(beanManager, WashingMachine.class, EcoFriendlyWashingMachineLiteral.INSTANCE);
+ Assert.assertTrue(Utils.annotationSetMatches(bean.getQualifiers(), Any.class, EcoFriendlyWashingMachine.class));
+
+ // Verify overriding the class structure works
+ Clothes.reset();
+ TumbleDryer tumbleDryer = Utils.getReference(beanManager, TumbleDryer.class);
+ Bean<TumbleDryer> tumbleDryerBean = Utils.getBean(beanManager, TumbleDryer.class);
+ Assert.assertNotNull(tumbleDryer);
+
+ Assert.assertFalse(containsConstructor(tumbleDryerBean.getInjectionPoints(), SerialNumber.class));
+ Assert.assertTrue(containsConstructor(tumbleDryerBean.getInjectionPoints(), Clothes.class));
+ Assert.assertNull(tumbleDryer.getSerialNumber());
+ Assert.assertNotNull(tumbleDryer.getClothes());
+ Assert.assertFalse(Clothes.getInjectionPoint().getAnnotated().isAnnotationPresent(Original.class));
+ AnnotatedConstructor<?> clothesConstructor = getConstructor(tumbleDryerBean.getInjectionPoints(), Clothes.class);
+ Assert.assertTrue(clothesConstructor.getParameters().get(0).isAnnotationPresent(Special.class));
+ Assert.assertFalse(clothesConstructor.getParameters().get(0).isAnnotationPresent(Original.class));
+
+ Assert.assertTrue(containsField(tumbleDryerBean.getInjectionPoints(), "plug"));
+ Assert.assertFalse(containsField(tumbleDryerBean.getInjectionPoints(), "coins"));
+ Assert.assertNotNull(tumbleDryer.getPlug());
+ Assert.assertNull(tumbleDryer.getCoins());
+
+ Assert.assertTrue(containsMethod(tumbleDryerBean.getInjectionPoints(), "setRunningTime", RunningTime.class));
+ Assert.assertFalse(containsMethod(tumbleDryerBean.getInjectionPoints(), "setHotAir", HotAir.class));
+ Assert.assertNotNull(tumbleDryer.getRunningTime());
+ Assert.assertNull(tumbleDryer.getHotAir());
+ AnnotatedMethod<?> runningTimeMethod = getMethod(tumbleDryerBean.getInjectionPoints(), "setRunningTime", RunningTime.class);
+ Assert.assertTrue(runningTimeMethod.getParameters().get(0).isAnnotationPresent(Special.class));
+ Assert.assertFalse(runningTimeMethod.getParameters().get(0).isAnnotationPresent(Original.class));
+ }
+
+ private static boolean containsField(Set<InjectionPoint> injectionPoints, String name)
+ {
+ for (InjectionPoint ip : injectionPoints)
+ {
+ if (ip.getAnnotated() instanceof AnnotatedField<?>)
+ {
+ AnnotatedField<?> field = (AnnotatedField<?>) ip.getAnnotated();
+ if (field.getJavaMember().getName().equals(name))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private static boolean containsConstructor(Set<InjectionPoint> injectionPoints, Class<?>... parameters)
+ {
+ return getConstructor(injectionPoints, parameters) != null;
+ }
+
+ private static AnnotatedConstructor<?> getConstructor(Set<InjectionPoint> injectionPoints, Class<?>... parameters)
+ {
+ for (InjectionPoint ip : injectionPoints)
+ {
+ if (ip.getAnnotated() instanceof AnnotatedParameter<?>)
+ {
+ AnnotatedParameter<?> param = (AnnotatedParameter<?>) ip.getAnnotated();
+ if (param.getDeclaringCallable() instanceof AnnotatedConstructor<?>)
+ {
+ Class<?>[] parameterTypes = ((Constructor<?>) param.getDeclaringCallable().getJavaMember()).getParameterTypes();
+ if (Arrays.equals(parameters, parameterTypes))
+ {
+ return (AnnotatedConstructor<?>) param.getDeclaringCallable();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ private static boolean containsMethod(Set<InjectionPoint> injectionPoints, String name, Class<?>... parameters)
+ {
+ return getMethod(injectionPoints, name, parameters) != null;
+ }
+
+ private static AnnotatedMethod<?> getMethod(Set<InjectionPoint> injectionPoints, String name, Class<?>... parameters)
+ {
+ for (InjectionPoint ip : injectionPoints)
+ {
+ if (ip.getAnnotated() instanceof AnnotatedParameter<?>)
+ {
+ AnnotatedParameter<?> param = (AnnotatedParameter<?>) ip.getAnnotated();
+ if (param.getDeclaringCallable() instanceof AnnotatedMethod<?>)
+ {
+ Class<?>[] parameterTypes = ((Method) param.getDeclaringCallable().getJavaMember()).getParameterTypes();
+ String methodName = param.getDeclaringCallable().getJavaMember().getName();
+ if (Arrays.equals(parameters, parameterTypes) && methodName.equals(name))
+ {
+ return (AnnotatedMethod<?>) param.getDeclaringCallable();
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Clothes.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+@Special
+public class Clothes
+{
+
+ private static InjectionPoint injectionPoint;
+
+ @Inject
+ public void setInjectionPoint(InjectionPoint injectionPoint)
+ {
+ Clothes.injectionPoint = injectionPoint;
+ }
+
+ public static void reset()
+ {
+ injectionPoint = null;
+ }
+
+ public static InjectionPoint getInjectionPoint()
+ {
+ return injectionPoint;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Coins.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+public class Coins
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/EcoFriendlyWashingMachine.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.enterprise.util.AnnotationLiteral;
+import javax.inject.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+public @interface EcoFriendlyWashingMachine
+{
+
+ @SuppressWarnings("serial")
+ public static class EcoFriendlyWashingMachineLiteral extends AnnotationLiteral<EcoFriendlyWashingMachine> implements EcoFriendlyWashingMachine
+ {
+
+ public static final EcoFriendlyWashingMachine INSTANCE = new EcoFriendlyWashingMachineLiteral();
+
+ private EcoFriendlyWashingMachineLiteral() {}
+
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/FastWashingMachine.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+public @interface FastWashingMachine
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/HotAir.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+public class HotAir
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/InjectLiteral.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+public class InjectLiteral extends AnnotationLiteral<Inject> implements Inject
+{
+
+ public static final Inject INSTANCE = new InjectLiteral();
+
+ private InjectLiteral() {}
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Laundry.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+import javax.inject.Inject;
+
+public class Laundry
+{
+ @Inject @FastWashingMachine
+ public WashingMachine fastWashingMachine;
+
+ @Inject @EcoFriendlyWashingMachine
+ public WashingMachine ecoFriendlyWashingMachine;
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Original.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+public @interface Original
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Plug.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+@Special
+public class Plug
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/RunningTime.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+@Special
+public class RunningTime
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SerialNumber.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+public class SerialNumber
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/Special.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+public @interface Special
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/SpecialLiteral.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+public class SpecialLiteral extends AnnotationLiteral<Special> implements Special
+{
+
+ public static final Special INSTANCE = new SpecialLiteral();
+
+ private SpecialLiteral() {}
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/TumbleDryer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,93 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+import javax.inject.Inject;
+
+
+public class TumbleDryer
+{
+
+
+ private Plug plug;
+
+ @Inject @Original
+ private Coins coins;
+
+ private final Clothes clothers;
+
+ private RunningTime runningTime;
+
+ private final SerialNumber serialNumber;
+
+ private HotAir hotAir;
+
+ public TumbleDryer(@Original Clothes clothes)
+ {
+ this.clothers = clothes;
+ this.serialNumber = null;
+ }
+
+ @Inject
+ public TumbleDryer(SerialNumber serialNumber)
+ {
+ this.serialNumber = serialNumber;
+ this.clothers = null;
+ }
+
+ public void setRunningTime(@Original RunningTime runningTime)
+ {
+ this.runningTime = runningTime;
+ }
+
+ @Inject
+ public void setHotAir(HotAir hotAir)
+ {
+ this.hotAir = hotAir;
+ }
+
+ public Plug getPlug()
+ {
+ return plug;
+ }
+
+ public Clothes getClothes()
+ {
+ return clothers;
+ }
+
+ public HotAir getHotAir()
+ {
+ return hotAir;
+ }
+
+ public RunningTime getRunningTime()
+ {
+ return runningTime;
+ }
+
+ public SerialNumber getSerialNumber()
+ {
+ return serialNumber;
+ }
+
+ public Coins getCoins()
+ {
+ return coins;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/WashingMachine.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,23 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.extensions.annotatedType;
+
+@FastWashingMachine
+public class WashingMachine
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeSessionBeanTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeSessionBeanTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/ejb/AnnotatedTypeSessionBeanTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,41 +16,51 @@
*/
package org.jboss.weld.tests.extensions.annotatedType.ejb;
-import javax.enterprise.util.AnnotationLiteral;
+import javax.enterprise.inject.spi.Extension;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Classes;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.jsr299.Extension;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.tests.category.Integration;
+import org.jboss.weld.tests.util.annotated.TestAnnotatedTypeBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
/**
* Tests that it is possible to override ejb annotations through the SPI
* @author Stuart Douglas <stuart(a)baileyroberts.com.au>
*
*/
-@Artifact
-(a)Packaging(PackagingType.EAR)
-@IntegrationTest
-@Extension("javax.enterprise.inject.spi.Extension")
-@Classes(packages = { "org.jboss.weld.tests.util.annotated" })
-public class AnnotatedTypeSessionBeanTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class AnnotatedTypeSessionBeanTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(BeanArchive.class)
+ .addPackage(AnnotatedTypeSessionBeanTest.class.getPackage())
+ .addPackage(TestAnnotatedTypeBuilder.class.getPackage())
+ .addServiceProvider(Extension.class, AnnotatedTypeEjbExtension.class)
+ );
+ }
+
@Test
- public void testOverridingEjbAnnotations()
+ public void testOverridingEjbAnnotations(@ConveyorShaft Shaft conveyerShaft)
{
- Shaft conveyerShaft = getReference(Shaft.class, new AnnotationLiteral<ConveyorShaft>() { });
- assert conveyerShaft != null;
+ Assert.assertNotNull(conveyerShaft);
}
@Test
- public void testAddingBultipleBeansPerEjbClass()
+ public void testAddingBultipleBeansPerEjbClass(@BigLathe LatheLocal bigLathe, @SmallLathe LatheLocal smallLathe)
{
- LatheLocal bigLathe = getReference(LatheLocal.class, new AnnotationLiteral<BigLathe>() { });
- assert bigLathe != null;
- LatheLocal smallLathe = getReference(LatheLocal.class, new AnnotationLiteral<SmallLathe>() { });
- assert smallLathe != null;
+ Assert.assertNotNull(bigLathe);
+ Assert.assertNotNull(smallLathe);
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters (from rev 6827, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtensionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtensionTest.java 2010-07-28 18:04:45 UTC (rev 6827)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/annotatedType/invalidParameters/AnnotatedTypeExtensionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,25 +16,40 @@
*/
package org.jboss.weld.tests.extensions.annotatedType.invalidParameters;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.jsr299.Extension;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import javax.enterprise.inject.spi.Extension;
-@Artifact
-@IntegrationTest
-(a)ExpectedDeploymentException(Exception.class)
-@Extension("javax.enterprise.inject.spi.Extension")
-public class AnnotatedTypeExtensionTest extends AbstractWeldTest
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+//(a)ExpectedDeploymentException(Exception.class)
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class AnnotatedTypeExtensionTest
{
-
- @Test(description = "WELD-371")
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(WebArchive.class, "test.war")
+ .addWebResource(EmptyAsset.INSTANCE, "beans.xml")
+ .addPackage(AnnotatedTypeExtensionTest.class.getPackage())
+ .addServiceProvider(Extension.class, AnnotatedTypeExtension.class);
+ }
+
+ /*
+ * description = "WELD-371"
+ */
+ @Test
public void testIncorrectlyOverridenParameters()
{
assert false;
}
-
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/injectionTarget (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/injectionTarget)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/injectionTarget/InjectionTargetTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/injectionTarget/InjectionTargetTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/injectionTarget/InjectionTargetTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -18,54 +18,84 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Extension;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.testharness.impl.packaging.jsr299.Extension;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
-@Artifact
-@IntegrationTest
-@BeansXml("beans.xml")
-(a)Packaging(PackagingType.EAR)
-@Extension("javax.enterprise.inject.spi.Extension")
-public class InjectionTargetTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class InjectionTargetTest
{
- @Test(description="WELD-557")
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(BeanArchive.class)
+ .intercept(SecurityInterceptor.class)
+ .decorate(AircraftDecorator.class)
+ .addPackage(InjectionTargetTest.class.getPackage())
+ .addClass(Utils.class)
+ .addServiceProvider(Extension.class, InjectionTargetExtension.class)
+ );
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ /*
+ * description = "WELD-557"
+ */
+ @Test
public void testActualInstanceAndNotProxyPassedToInject()
{
InjectionTargetWrapper.clear();
- Spitfire aircraft = getReference(Spitfire.class);
+ Spitfire aircraft = Utils.getReference(beanManager, Spitfire.class);
aircraft.isFlying();
- assert aircraft.isTheSameInstance(InjectionTargetWrapper.injectInstance);
+ Assert.assertTrue(aircraft.isTheSameInstance(InjectionTargetWrapper.injectInstance));
}
- @Test(description="WELD-557")
+ /*
+ * description = "WELD-557"
+ */
+ @Test
public void testActualInstanceAndNotProxyPassedToPostConstruct()
{
InjectionTargetWrapper.clear();
- Spitfire aircraft = getReference(Spitfire.class);
+ Spitfire aircraft = Utils.getReference(beanManager, Spitfire.class);
aircraft.isFlying();
- assert aircraft.isTheSameInstance(InjectionTargetWrapper.postConstructInstance);
+ Assert.assertTrue(aircraft.isTheSameInstance(InjectionTargetWrapper.postConstructInstance));
}
- @Test(description="WELD-557")
+ /*
+ * description = "WELD-557"
+ */
+ @Test
public void testActualInstanceAndNotProxyPassedToPreDestroy()
{
// prepare instance
InjectionTargetWrapper.clear();
- Bean<Spitfire> bean = getBean(Spitfire.class);
- CreationalContext<Spitfire> ctx = getCurrentManager().createCreationalContext(bean);
- Spitfire aircraft = (Spitfire) getCurrentManager().getReference(bean, Spitfire.class, ctx);
+ Bean<Spitfire> bean = Utils.getBean(beanManager, Spitfire.class);
+ CreationalContext<Spitfire> ctx = beanManager.createCreationalContext(bean);
+ Spitfire aircraft = (Spitfire) beanManager.getReference(bean, Spitfire.class, ctx);
// invoke business method
aircraft.isFlying();
// destroy instance
bean.destroy(aircraft, ctx);
- assert aircraft.isTheSameInstance(InjectionTargetWrapper.preDestroyInstance);
+ Assert.assertTrue(aircraft.isTheSameInstance(InjectionTargetWrapper.preDestroyInstance));
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/interceptors)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtensionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtensionTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/interceptors/InterceptorExtensionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -18,16 +18,23 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Classes;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
-import org.jboss.testharness.impl.packaging.jsr299.Extension;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Integration;
+import org.jboss.weld.tests.util.annotated.TestAnnotatedTypeBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
/**
* Tests that interceptors registered via the SPI work correctly
@@ -35,34 +42,45 @@
* @author Stuart Douglas <stuart(a)baileyroberts.com.au>
*
*/
-@Artifact
-@IntegrationTest
-(a)Packaging(PackagingType.EAR)
-@Extension("javax.enterprise.inject.spi.Extension")
-@BeansXml("beans.xml")
-@Classes(packages = { "org.jboss.weld.tests.util.annotated" })
-public class InterceptorExtensionTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class InterceptorExtensionTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(BeanArchive.class)
+ .intercept(IncrementingInterceptor.class, LifecycleInterceptor.class)
+ .addPackage(InterceptorExtensionTest.class.getPackage())
+ .addPackage(TestAnnotatedTypeBuilder.class.getPackage())
+ .addServiceProvider(Extension.class, InterceptorExtension.class)
+ );
+ }
+
+ @Inject
+ private BeanManager beanManager;
+
@Test
- public void testInterceptorCalled()
+ public void testInterceptorCalled(NumberSource ng)
{
- NumberSource ng = getReference(NumberSource.class);
- assert ng.value() == 2;
- assert IncrementingInterceptor.isDoAroundCalled();
+ Assert.assertEquals(1, ng.value());
+ Assert.assertTrue(IncrementingInterceptor.isDoAroundCalled());
}
@Test
@SuppressWarnings("unchecked")
public void testLifecycleInterceptor()
{
- Bean bean = getCurrentManager().getBeans(Marathon.class).iterator().next();
- CreationalContext creationalContext = getCurrentManager().createCreationalContext(bean);
+ Bean bean = beanManager.getBeans(Marathon.class).iterator().next();
+ CreationalContext creationalContext = beanManager.createCreationalContext(bean);
Marathon m = (Marathon)bean.create(creationalContext);
- assert LifecycleInterceptor.isPostConstructCalled();
- assert m.getLength()==42;
+ Assert.assertTrue(LifecycleInterceptor.isPostConstructCalled());
+ Assert.assertEquals(24, m.getLength());
bean.destroy(m, creationalContext);
- assert LifecycleInterceptor.isPreDestroyCalled();
+ Assert.assertTrue(LifecycleInterceptor.isPreDestroyCalled());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/multipleBeans)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/extensions/multipleBeans/MultipleBeansTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -17,15 +17,25 @@
package org.jboss.weld.tests.extensions.multipleBeans;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Classes;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.jsr299.Extension;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import javax.enterprise.inject.spi.Extension;
+import javax.inject.Inject;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.jboss.weld.tests.category.Integration;
+import org.jboss.weld.tests.util.annotated.TestAnnotatedTypeBuilder;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
/**
* Tests that it is possible to add multiple beans with the same java class type
* through the SPI
@@ -33,23 +43,35 @@
* @author Stuart Douglas <stuart(a)baileyroberts.com.au>
*
*/
-@Artifact
-@IntegrationTest
-(a)Packaging(PackagingType.EAR)
-@Extension("javax.enterprise.inject.spi.Extension")
-@Classes(packages = { "org.jboss.weld.tests.util.annotated" })
-public class MultipleBeansTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class MultipleBeansTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(BeanArchive.class)
+ .addPackage(MultipleBeansTest.class.getPackage())
+ .addPackage(TestAnnotatedTypeBuilder.class.getPackage())
+ .addClass(Utils.class)
+ .addServiceProvider(Extension.class, MultipleBeansExtension.class)
+ );
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
@Test
public void testFormatterRegistered()
{
// test that we have added two beans with the same qualifiers
- assert getBeans(BlogFormatter.class).size() == 2;
+ Assert.assertEquals(2, Utils.getBeans(beanManager, BlogFormatter.class).size());
// test that the beans which have different producer methods produce
// different values
- assert getReference(String.class, new FormattedBlogLiteral("Bob")).equals("+Bob's content+");
- assert getReference(String.class, new FormattedBlogLiteral("Barry")).equals("+Barry's content+");
+ Assert.assertEquals("+Bob's content+", Utils.getReference(beanManager, String.class, new FormattedBlogLiteral("Bob")));
+ Assert.assertEquals("+Barry's content+", Utils.getReference(beanManager, String.class, new FormattedBlogLiteral("Barry")));
}
@Test
@@ -57,31 +79,22 @@
{
// test that the two different BlogConsumers have been registered
// correctly
- BlogConsumer consumer = getReference(BlogConsumer.class, new ConsumerLiteral("Barry"));
- assert consumer.blogContent.equals("+Barry's content+");
- consumer = getReference(BlogConsumer.class, new ConsumerLiteral("Bob"));
- assert consumer.blogContent.equals("+Bob's content+");
+ BlogConsumer consumer = Utils.getReference(beanManager, BlogConsumer.class, new ConsumerLiteral("Barry"));
+ Assert.assertEquals("+Barry's content+", consumer.blogContent);
+ consumer = Utils.getReference(beanManager, BlogConsumer.class, new ConsumerLiteral("Bob"));
+ Assert.assertEquals("+Bob's content+", consumer.blogContent);
}
- /**
- * makes sure that ProcessAnnotatedType is thrown for types
- * added through BeforeBeanDiscovery.addAnnotatedType
- */
- @Test
- public void testProcessAnnotatedTypeEventFiredForSPIAddedType()
- {
- MultipleBeansExtension ext = getReference(MultipleBeansExtension.class);
- assert ext.isAddedBlogFormatterSeen();
- }
/**
* Apparently it is not possible to add two beans that are exactly the same.
* Even though this is not very useful it should still be possible.
*
*/
- @Test(groups = { "broken" })
+ @Test
+ @Category(Broken.class)
public void testTwoBeansExactlyTheSame()
{
- assert getBeans(UselessBean.class).size() == 2;
+ Assert.assertEquals(2, beanManager.getBeans(UselessBean.class).size());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/generic)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/generic/GenericBeanTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -14,31 +14,42 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.jboss.weld.tests.generic;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* @author Marius Bogoevici
*/
-@Artifact
-public class GenericBeanTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class GenericBeanTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(GenericBeanTest.class.getPackage());
+ }
@Test
- public void testGenericBean()
+ public void testGenericBean(TestBean testBean)
{
- TestBean testBean = getReference(TestBean.class);
- assert "Hello".equals(testBean.echo("Hello"));
- assert Integer.valueOf(1).equals(testBean.echo(1));
+ Assert.assertEquals("Hello", testBean.echo("Hello"));
+ Assert.assertEquals(Integer.valueOf(1), testBean.echo(1));
+
Subclass subclassInstance = new Subclass();
- assert subclassInstance == testBean.echo(subclassInstance);
- assert subclassInstance == testBean.echo((BaseClass)subclassInstance);
+ Assert.assertSame(subclassInstance, testBean.echo(subclassInstance));
+ Assert.assertSame(subclassInstance, testBean.echo((BaseClass)subclassInstance));
+
BaseClass baseInstance = new BaseClass();
- assert baseInstance == testBean.echo(baseInstance);
+ Assert.assertSame(baseInstance, testBean.echo(baseInstance));
}
}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Cow.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+public class Cow
+{
+
+ private final String name;
+
+ public Cow(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/CowShed.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.weld.injection.FieldInjectionPoint;
+
+public class CowShed
+{
+
+ @Produces
+ public Cow get(InjectionPoint ip)
+ {
+ assert ip instanceof FieldInjectionPoint<?, ?>;
+ FieldInjectionPoint<?, ?> fip = (FieldInjectionPoint<?, ?>) ip;
+ assert fip.getDeclaringType().getJavaClass().equals(Field.class);
+ return new Cow("daisy");
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+@SessionScoped
+public class DoubleConsumer implements Serializable
+{
+
+ private static final long serialVersionUID = 6619645042310126425L;
+
+ @Inject
+ private double maxNumber;
+
+ public DoubleConsumer()
+ {
+ }
+
+ public void ping()
+ {
+
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/DoubleGenerator.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import java.io.Serializable;
+import java.util.Timer;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+@ApplicationScoped
+public class DoubleGenerator implements Serializable
+{
+
+ private static final long serialVersionUID = -7213673465118041882L;
+
+ @Inject Timer timer;
+
+ @Produces
+ double getDouble()
+ {
+ timer.cancel();
+ return 11.1;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecial.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, 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.weld.tests.injectionPoint;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface ExtraSpecial
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/ExtraSpecialLiteral.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, 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.weld.tests.injectionPoint;
+
+import javax.enterprise.util.AnnotationLiteral;
+
+public class ExtraSpecialLiteral extends AnnotationLiteral<ExtraSpecial> implements ExtraSpecial
+{
+ public static final ExtraSpecial INSTANCE = new ExtraSpecialLiteral();
+
+ private ExtraSpecialLiteral() {
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Field.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import javax.inject.Inject;
+
+public class Field
+{
+
+ @Inject Cow cow;
+
+ public Cow getCow()
+ {
+ return cow;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/GrassyField.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+public class GrassyField extends Field
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/InjectionPointTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import java.lang.reflect.ParameterizedType;
+
+import javax.enterprise.inject.IllegalProductException;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class InjectionPointTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(InjectionPointTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ /*
+ * description = "WELD-239"
+ */
+ @Test
+ public void testCorrectInjectionPointUsed(IntConsumer intConsumer, DoubleConsumer doubleConsumer)
+ {
+ intConsumer.ping();
+
+ try
+ {
+ doubleConsumer.ping();
+ }
+ catch (IllegalProductException e)
+ {
+ Assert.assertTrue(e.getMessage().contains("Injection Point: field org.jboss.weld.tests.injectionPoint.DoubleGenerator.timer"));
+ }
+ }
+
+ /*
+ * description = "WELD-316"
+ */
+ @Test
+ public void testFieldInjectionPointSerializability(StringConsumer consumer) throws Throwable
+ {
+ consumer.ping();
+ InjectionPoint ip = StringGenerator.getInjectionPoint();
+ Assert.assertNotNull(ip);
+ Assert.assertEquals("str", ip.getMember().getName());
+ InjectionPoint ip1 = Utils.deserialize(Utils.serialize(ip));
+ Assert.assertEquals("str", ip1.getMember().getName());
+ }
+
+ @Test
+ public void testGetDeclaringType(GrassyField field)
+ {
+ Assert.assertEquals("daisy", field.getCow().getName());
+ }
+
+ /*
+ * description = "WELD-438"
+ */
+ @Test
+ public void testInjectionPointWhenInstanceGetIsUsed(PigSty pigSty) throws Exception
+ {
+ Pig pig = pigSty.getPig();
+ Assert.assertNotNull(pig);
+ Assert.assertNotNull(pig.getInjectionPoint().getBean());
+ Assert.assertEquals(PigSty.class, pig.getInjectionPoint().getBean().getBeanClass());
+ Assert.assertEquals(PigSty.class.getDeclaredField("pig"), pig.getInjectionPoint().getMember());
+ Assert.assertNotNull(pig.getInjectionPoint().getAnnotated());
+ Assert.assertTrue(pig.getInjectionPoint().getAnnotated().getBaseType() instanceof ParameterizedType);
+ ParameterizedType parameterizedType = ((ParameterizedType) pig.getInjectionPoint().getAnnotated().getBaseType());
+ Assert.assertEquals(Instance.class, parameterizedType.getRawType());
+ Assert.assertEquals(1, parameterizedType.getActualTypeArguments().length);
+ Assert.assertEquals(Pig.class, parameterizedType.getActualTypeArguments()[0]);
+ Assert.assertTrue(pig.getInjectionPoint().getAnnotated().isAnnotationPresent(Special.class));
+ Assert.assertFalse(pig.getInjectionPoint().getAnnotated().isAnnotationPresent(ExtraSpecial.class));
+ Assert.assertTrue(Utils.annotationSetMatches(pig.injectionPoint.getQualifiers(), Special.class, ExtraSpecial.class));
+ Assert.assertEquals(Pig.class, pig.getInjectionPoint().getType());
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named
+@SessionScoped
+public class IntConsumer implements Serializable
+{
+
+ private static final long serialVersionUID = 6619645042310126425L;
+
+ @Inject
+ private int maxNumber;
+
+ public IntConsumer()
+ {
+ }
+
+ public void ping()
+ {
+
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/IntGenerator.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import java.io.Serializable;
+import java.util.Timer;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Instance;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+
+@ApplicationScoped
+public class IntGenerator implements Serializable
+{
+
+ private static final long serialVersionUID = -7213673465118041882L;
+
+ @Inject
+ private Instance<Timer> timerInstance;
+
+ @Produces
+ int getInt()
+ {
+ // This has no purpose other than to invoke a method on the proxy so that the proxy instance
+ // is retrieved via the producer method
+ timerInstance.get().cancel();
+ return 100;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Pig.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+@Special @ExtraSpecial
+public class Pig
+{
+
+ @Inject InjectionPoint injectionPoint;
+
+ public InjectionPoint getInjectionPoint()
+ {
+ return injectionPoint;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/PigSty.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, 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.weld.tests.injectionPoint;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class PigSty
+{
+ @Inject @Special Instance<Pig> pig;
+
+ public Pig getPig()
+ {
+ return pig.select(ExtraSpecialLiteral.INSTANCE).get();
+ }
+
+}
+
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/Special.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Special
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import javax.inject.Inject;
+
+public class StringConsumer
+{
+
+ @Inject String str;
+
+ public void ping() {}
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/StringGenerator.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+public class StringGenerator
+{
+
+ private static InjectionPoint injectionPoint;
+
+ public static InjectionPoint getInjectionPoint()
+ {
+ return injectionPoint;
+ }
+
+ public static void reset()
+ {
+ injectionPoint = null;
+ }
+
+ @Produces String getString(InjectionPoint ip)
+ {
+ injectionPoint = ip;
+ return "";
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/TimerManager.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.injectionPoint;
+
+import java.io.Serializable;
+import java.util.Timer;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+public class TimerManager implements Serializable
+{
+
+ private static final long serialVersionUID = 5156835887786174326L;
+
+ @Produces
+ @RequestScoped
+ public Timer getTimer()
+ {
+ return new Timer();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/injectionPoint/other (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/injectionPoint/other)
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/managed/newBean)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/NewSimpleBeanTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/managed/newBean/NewSimpleBeanTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/managed/newBean/NewSimpleBeanTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -19,70 +19,92 @@
import java.util.Set;
import javax.enterprise.inject.New;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.weld.bean.ManagedBean;
import org.jboss.weld.bean.NewManagedBean;
import org.jboss.weld.introspector.WeldAnnotated;
import org.jboss.weld.literal.NewLiteral;
-import org.jboss.weld.test.AbstractWeldTest;
import org.jboss.weld.util.AnnotatedTypes;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class NewSimpleBeanTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class NewSimpleBeanTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(NewSimpleBeanTest.class.getPackage());
+ }
+
private ManagedBean<WrappedSimpleBean> wrappedSimpleBean;
private NewManagedBean<WrappedSimpleBean> newSimpleBean;
private static final New NEW_LITERAL = new NewLiteral();
+ @Inject
+ private BeanManager beanManager;
+
public void initNewBean() {
- assert getCurrentManager().getBeans(WrappedSimpleBean.class).size() == 1;
- assert getCurrentManager().getBeans(WrappedSimpleBean.class).iterator().next() instanceof ManagedBean;
- wrappedSimpleBean = (ManagedBean<WrappedSimpleBean>) getCurrentManager().getBeans(WrappedSimpleBean.class).iterator().next();
+ Assert.assertEquals(1, beanManager.getBeans(WrappedSimpleBean.class).size());
+ Assert.assertTrue(beanManager.getBeans(WrappedSimpleBean.class).iterator().next() instanceof ManagedBean);
+ wrappedSimpleBean = (ManagedBean<WrappedSimpleBean>) beanManager.getBeans(WrappedSimpleBean.class).iterator().next();
- assert getCurrentManager().getBeans(WrappedSimpleBean.class, NEW_LITERAL).size() == 1;
- assert getCurrentManager().getBeans(WrappedSimpleBean.class, NEW_LITERAL).iterator().next() instanceof NewManagedBean;
- newSimpleBean = (NewManagedBean<WrappedSimpleBean>) getCurrentManager().getBeans(WrappedSimpleBean.class, NEW_LITERAL).iterator().next();
+ Assert.assertEquals(1, beanManager.getBeans(WrappedSimpleBean.class, NEW_LITERAL).size());
+ Assert.assertTrue(beanManager.getBeans(WrappedSimpleBean.class, NEW_LITERAL).iterator().next() instanceof NewManagedBean);
+ newSimpleBean = (NewManagedBean<WrappedSimpleBean>) beanManager.getBeans(WrappedSimpleBean.class, NEW_LITERAL).iterator().next();
}
- @Test(groups = { "new" })
+ // groups = { "new" }
+ @Test
public void testNewBeanHasImplementationClassOfInjectionPointType()
{
initNewBean();
- assert newSimpleBean.getType().equals(WrappedSimpleBean.class);
+ Assert.assertEquals(WrappedSimpleBean.class, newSimpleBean.getType());
}
-
- @Test(groups = { "new" })
+
+ // groups = { "new" }
+ @Test
public void testNewBeanIsSimpleWebBeanIfParameterTypeIsSimpleWebBean()
{
initNewBean();
- assert newSimpleBean.getType().equals(wrappedSimpleBean.getType());
+ Assert.assertEquals(wrappedSimpleBean.getType(), newSimpleBean.getType());
}
- @Test(groups = { "new" })
+ // groups = { "new" }
+ @Test
public void testNewBeanHasSameConstructorAsWrappedBean()
{
initNewBean();
- assert AnnotatedTypes.compareAnnotatedCallable(wrappedSimpleBean.getConstructor(), newSimpleBean.getConstructor());
+ Assert.assertTrue(AnnotatedTypes.compareAnnotatedCallable(wrappedSimpleBean.getConstructor(), newSimpleBean.getConstructor()));
}
- @Test(groups = { "new" })
+ // groups = { "new" }
+ @Test
public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
{
initNewBean();
- assert newSimpleBean.getInitializerMethods().equals(wrappedSimpleBean.getInitializerMethods());
+ Assert.assertEquals(wrappedSimpleBean.getInitializerMethods(), newSimpleBean.getInitializerMethods());
}
- @Test(groups = { "new" })
+ // groups = { "new" }
+ @Test
public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
{
initNewBean();
Set<? extends WeldAnnotated<?, ?>> wrappedBeanInjectionPoints = wrappedSimpleBean.getWeldInjectionPoints();
Set<? extends WeldAnnotated<?, ?>> newBeanInjectionPoints = newSimpleBean.getWeldInjectionPoints();
- assert wrappedBeanInjectionPoints.equals(newBeanInjectionPoints);
+ Assert.assertEquals(wrappedBeanInjectionPoints, newBeanInjectionPoints);
}
-}
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/nonContextual)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ExampleTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/nonContextual/ExampleTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ExampleTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -21,20 +21,35 @@
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionPoint;
import javax.enterprise.inject.spi.InjectionTarget;
+import javax.inject.Inject;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
import org.jboss.metadata.validation.ValidationException;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.Assert;
-import org.testng.annotations.Test;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class ExampleTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class ExampleTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addClasses(External.class, WebBean.class);
+ }
+
+ @Inject
+ private BeanManager beanManager;
+
@Test
public void testNonContextual() throws Exception
{
- NonContextual<External> nonContextual = new NonContextual<External>(getCurrentManager(), External.class);
+ NonContextual<External> nonContextual = new NonContextual<External>(beanManager, External.class);
External external = new External();
Assert.assertNull(external.bean);
@@ -48,13 +63,13 @@
@Test
public void validateNonContextual() throws Exception
{
- NonContextual<External> nonContextual = new NonContextual<External>(getCurrentManager(), External.class);
+ NonContextual<External> nonContextual = new NonContextual<External>(beanManager, External.class);
for (InjectionPoint point : nonContextual.it.getInjectionPoints())
{
try
{
- getCurrentManager().validate(point);
+ beanManager.validate(point);
}
catch(ValidationException e)
{
@@ -86,5 +101,4 @@
it.preDestroy(instance);
}
}
-
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ServletListenerTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/nonContextual/ServletListenerTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/nonContextual/ServletListenerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,22 +16,41 @@
*/
package org.jboss.weld.tests.nonContextual;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.war.WebXml;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
-@Artifact
-@IntegrationTest
-@WebXml("web.xml")
-public class ServletListenerTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class ServletListenerTest
{
-
- @Test(description="WELD-445")
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(WebArchive.class, "test.war")
+ .addClasses(ServletContextListenerImpl.class, LogManager.class)
+ .addWebResource(
+ ServletListenerTest.class.getPackage(), "web.xml", ArchivePaths.create("web.xml"))
+ .addWebResource(
+ EmptyAsset.INSTANCE, ArchivePaths.create("beans.xml"));
+
+ }
+
+ /**
+ * description="WELD-445"
+ */
+ @Test
public void test()
{
- assert ServletContextListenerImpl.ok;
+ Assert.assertTrue(ServletContextListenerImpl.ok);
}
-
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Baz.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Baz.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Baz.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Baz.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,13 @@
+package org.jboss.weld.tests.producer.field;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.inject.Qualifier;
+
+(a)Retention(RetentionPolicy.RUNTIME)
+@Qualifier
+public @interface Baz
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/IntegerCollectionInjection.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
+
+import java.util.Collection;
+
+import javax.inject.Inject;
+
+public class IntegerCollectionInjection
+{
+
+ private Collection<Integer> value;
+
+ @Inject
+ private Collection<Integer> fieldInjection;
+
+ private Collection<Integer> setterInjection;
+
+ @Inject
+ public void init(Collection<Integer> setterInjection)
+ {
+ this.setterInjection = setterInjection;
+ }
+
+ @Inject
+ 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;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListInstance.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
+
+import java.util.List;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class ListInstance
+{
+ @Inject @Any
+ Instance<List> instance;
+
+ public Instance<List> get()
+ {
+ return instance;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ListStringInstance.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
+
+import java.util.List;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class ListStringInstance
+{
+ @Inject @Any Instance<List<String>> instance;
+
+ public List<String> get()
+ {
+ return instance.get();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedCollectionInjection.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
+
+import java.util.Collection;
+
+import javax.inject.Inject;
+
+public class ParameterizedCollectionInjection
+{
+
+ private Collection<String> value;
+
+ @Inject
+ private Collection<String> fieldInjection;
+
+ private Collection<String> setterInjection;
+
+ @Inject
+ public void init(Collection<String> setterInjection)
+ {
+ this.setterInjection = setterInjection;
+ }
+
+ @Inject
+ 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;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedListInjection.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
+
+import java.util.List;
+
+import javax.inject.Inject;
+
+public class ParameterizedListInjection
+{
+
+ private List<String> value;
+
+ @Inject
+ private List<String> fieldInjection;
+
+ private List<String> setterInjection;
+
+ @Inject
+ public void init(List<String> setterInjection)
+ {
+ this.setterInjection = setterInjection;
+ }
+
+ @Inject
+ public ParameterizedListInjection(List<String> com)
+ {
+ this.value = com;
+ }
+
+ public java.util.List<String> getValue()
+ {
+ return value;
+ }
+
+ public List<String> getFieldInjection()
+ {
+ return fieldInjection;
+ }
+
+ public List<String> getSetterInjection()
+ {
+ return setterInjection;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.enterprise.inject.Produces;
+
+public class ParameterizedProducer
+{
+
+ @Produces
+ public List<String> createStringList()
+ {
+ return Arrays.asList("aaa", "bbb");
+ }
+
+ @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;
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ParameterizedProducerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ParameterizedProducerTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ParameterizedProducerTest.class.getPackage());
+ }
+
+ @Test
+ public void testParameterizedListInjection(Target target, ParameterizedListInjection item)
+ {
+ List<String> strings = target.getStringList();
+ Assert.assertEquals(2, strings.size());
+
+ Assert.assertEquals(2, item.getFieldInjection().size());
+ Assert.assertEquals(2, item.getValue().size());
+ Assert.assertEquals(2, item.getSetterInjection().size());
+
+ }
+
+ @Test
+ public void testParameterizedCollectionInjection(Target target, ParameterizedCollectionInjection item)
+ {
+ Collection<String> strings = target.getStrings();
+ Assert.assertEquals(2, strings.size());
+
+ Assert.assertEquals(2, item.getFieldInjection().size());
+ Assert.assertEquals(2, item.getValue().size());
+ Assert.assertEquals(2, item.getSetterInjection().size() );
+ }
+
+ @Test
+ public void testIntegerCollectionInjection(Target target, IntegerCollectionInjection item)
+ {
+ Collection<Integer> integers = target.getIntegers();
+ Assert.assertEquals(4, integers.size());
+
+ Assert.assertEquals(4, item.getFieldInjection().size());
+ Assert.assertEquals(4, item.getValue().size());
+ Assert.assertEquals(4, item.getSetterInjection().size());
+
+ }
+
+ @Test
+ public void testInstanceList(ListInstance listInstance)
+ {
+ Assert.assertTrue(listInstance.get().isAmbiguous());
+ }
+
+ @Test
+ public void testTypeParameterInstance(ListStringInstance listInstance)
+ {
+ Assert.assertEquals(2, listInstance.get().size());
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/ProducerBeanInvocationTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, 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.weld.tests.producer.field;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Simple test which invokes a method directly on a normal scoped producer
+ * bean to ensure that it's proxy is for that bean and not the product
+ * of a producer method.
+ *
+ * @author David Allen
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class ProducerBeanInvocationTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ProducerBeanInvocationTest.class.getPackage());
+ }
+
+ /*
+ * description = "WELD-546"
+ */
+ @Test
+ public void test(Qux bar, QuxProducer producer, @Baz Qux bazBar)
+ {
+ Assert.assertEquals("qux", bar.getBar());
+ Assert.assertTrue(producer.ping());
+ Assert.assertEquals("baz", bazBar.getBar());
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Qux.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Qux.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Qux.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Qux.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,26 @@
+package org.jboss.weld.tests.producer.field;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+public class Qux
+{
+
+ private final String name;
+
+ public Qux(String name)
+ {
+ this.name = name;
+ }
+
+ public Qux()
+ {
+ this("qux");
+ }
+
+ public String getBar()
+ {
+ return name;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/QuxProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,18 @@
+package org.jboss.weld.tests.producer.field;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+@RequestScoped
+public class QuxProducer
+{
+
+ @Produces @Baz @RequestScoped
+ private Qux bar = new Qux("baz");
+
+ public boolean ping()
+ {
+ return true;
+ };
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Target.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/field/Target.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Target.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/field/Target.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.field;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.inject.Inject;
+
+public class Target
+{
+
+ @Inject private Collection<String> strings;
+
+ @Inject private Collection<Integer> integers;
+
+ @Inject private List<String> stringList;
+
+ public Collection<String> getStrings()
+ {
+ return strings;
+ }
+
+ public Collection<Integer> getIntegers()
+ {
+ return integers;
+ }
+
+ public List<String> getStringList()
+ {
+ return stringList;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Bar.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Bar.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Bar.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+public class Bar
+{
+
+ public Bar(String blah)
+ {
+
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Inject;
+
+@RequestScoped
+public class BarConsumer
+{
+ @Inject
+ private Bar bar;
+
+ public Bar getBar()
+ {
+ return bar;
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/BarProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import java.lang.reflect.Member;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.InjectionPoint;
+
+/**
+ * Class with a producer method and disposal method both containing InjectionPoint
+ * parameters.
+ *
+ * @author David Allen
+ *
+ */
+public class BarProducer
+{
+ private static Bar disposedBar;
+ private static Member disposedInjection;
+ private static Member producedInjection;
+
+ @Produces
+ public Bar getBar(InjectionPoint injectionPoint)
+ {
+ producedInjection = injectionPoint.getMember();
+ return new Bar("blah");
+ }
+
+ public void dispose(@Disposes @Any Bar bar, InjectionPoint injectionPoint)
+ {
+ disposedBar = bar;
+ disposedInjection = injectionPoint.getMember();
+ }
+
+ public static Bar getDisposedBar()
+ {
+ return disposedBar;
+ }
+
+ public static Member getDisposedInjection()
+ {
+ return disposedInjection;
+ }
+
+ public static Member getProducedInjection()
+ {
+ return producedInjection;
+ }
+
+ public static void reset()
+ {
+ disposedBar = null;
+ disposedInjection = null;
+ producedInjection = null;
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Baz.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Baz.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Baz.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Baz.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,13 @@
+package org.jboss.weld.tests.producer.method;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.inject.Qualifier;
+
+(a)Retention(RetentionPolicy.RUNTIME)
+@Qualifier
+public @interface Baz
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Car.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Car.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Car.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Car.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import java.io.Serializable;
+
+public class Car implements Serializable
+{
+
+ private static final long serialVersionUID = 1L;
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/CarFactory.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import javax.enterprise.inject.Produces;
+
+public class CarFactory
+{
+
+ @Produces @Important
+ public Car produceGovernmentCar()
+ {
+ return null;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodInjectionPointTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class DisposalMethodInjectionPointTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(DisposalMethodInjectionPointTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ /*
+ * description = "WELD-358"
+ */
+ @Test
+ @Category(Broken.class)
+ public void test()
+ {
+ BarProducer.reset();
+ Bean<BarConsumer> barConsumerBean = Utils.getBean(beanManager, BarConsumer.class);
+ CreationalContext<BarConsumer> ctx = beanManager.createCreationalContext(barConsumerBean);
+ BarConsumer barConsumer = barConsumerBean.create(ctx);
+ Assert.assertEquals("bar", BarProducer.getProducedInjection().getName());
+ Bar bar = barConsumer.getBar();
+ barConsumerBean.destroy(barConsumer, ctx);
+ Assert.assertEquals(bar, BarProducer.getDisposedBar());
+ Assert.assertEquals("bar", BarProducer.getDisposedInjection().getName());
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class DisposalMethodOnOtherBeanNotResolvedTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(DisposalMethodOnOtherBeanNotResolvedTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
+ public void test()
+ {
+ FooDisposer.reset();
+ FooProducer.reset();
+ Bean<Foo> bean = Utils.getBean(beanManager, Foo.class);
+ CreationalContext<Foo> ctx = beanManager.createCreationalContext(bean);
+ Foo instance = bean.create(ctx);
+ Assert.assertEquals("foo!", instance.getBlah());
+ bean.destroy(instance, ctx);
+ Assert.assertFalse(FooDisposer.isDisposed());
+ Assert.assertTrue(FooProducer.isDisposed());
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Foo.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Foo.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Foo.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Foo
+{
+
+ private final String blah;
+
+ public Foo(String blah)
+ {
+ this.blah = blah;
+ }
+
+ /**
+ * @return the blah
+ */
+ public String getBlah()
+ {
+ return blah;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooDisposer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+/**
+ * @author pmuir
+ *
+ */
+public class FooDisposer
+{
+
+ private static boolean disposed;
+
+ public static void reset()
+ {
+ disposed = false;
+ }
+
+ void disposeFoo(@Disposes @Any Foo foo)
+ {
+ disposed = true;
+ }
+
+ /**
+ * @return the disposed
+ */
+ public static boolean isDisposed()
+ {
+ return disposed;
+ }
+
+ @Produces @Important
+ public Foo getFoo()
+ {
+ return new Foo("bar!");
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/FooProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+/**
+ * @author pmuir
+ *
+ */
+public class FooProducer
+{
+
+ @Produces Foo getFoo()
+ {
+ return new Foo("foo!");
+ }
+
+ private static boolean disposed;
+
+ public static void reset()
+ {
+ disposed = false;
+ }
+
+ public void disposeFoo(@Disposes Foo foo)
+ {
+ disposed = true;
+ }
+
+ /**
+ * @return the disposed
+ */
+ public static boolean isDisposed()
+ {
+ return disposed;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Government.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Government.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Government.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Government.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+@SessionScoped
+public class Government implements Serializable
+{
+
+ private static final long serialVersionUID = 1L;
+
+ @Important Car governmentCar;
+
+ public void destabilize()
+ {
+
+ }
+
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Important.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Important.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Important.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Important.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * @author Dan Allen
+ */
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+@Inherited
+public @interface Important {
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/IntInjection.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import javax.inject.Inject;
+
+public class IntInjection
+{
+
+ int value;
+
+ @Inject public IntInjection(Integer integer)
+ {
+ this.value = integer;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplate.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+public class JmsTemplate
+{
+
+ private final int receiveTimeout;
+
+ public JmsTemplate(int receiveTimeout)
+ {
+ this.receiveTimeout = receiveTimeout;
+ }
+
+ public int getReceiveTimeout()
+ {
+ return receiveTimeout;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/JmsTemplateConfigurationProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class JmsTemplateConfigurationProducer
+{
+
+ public static final int LONG_RECEIVE_TIMEOUT = 3 * 3600;
+ public static final int SHORT_RECEIVE_TIMEOUT = 100;
+
+ @Produces @Long
+ private int longReceiveTimeout = LONG_RECEIVE_TIMEOUT;
+
+ @Produces @Short
+ private int shortReceiveTimeout = SHORT_RECEIVE_TIMEOUT;
+
+ @Produces
+ @Named
+ public JmsTemplate getErrorQueueTemplate(@Long int receiveTimeout)
+ {
+ return new JmsTemplate(receiveTimeout);
+ }
+
+ @Produces
+ @Named
+ public JmsTemplate getLogQueueTemplate(@Short int receiveTimeout)
+ {
+ return new JmsTemplate(receiveTimeout);
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Long.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Long.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Long.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Long.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * @author Dan Allen
+ */
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+@Inherited
+public @interface Long {
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.inject.Inject;
+
+class ManagerProducer
+{
+
+ @Inject BeanManager beanManager;
+
+ private static boolean injectionPointInjected;
+
+ public static boolean isInjectionPointInjected()
+ {
+ return injectionPointInjected;
+ }
+
+ public static void setInjectionPointInjected(boolean injectionPointInjected)
+ {
+ ManagerProducer.injectionPointInjected = injectionPointInjected;
+ }
+
+ @Produces
+ Integer create(InjectionPoint point)
+ {
+ injectionPointInjected = point != null;
+ return 10;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ManagerProducerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ManagerProducerTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ManagerProducerTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ /*
+ * description = "WBRI-183"
+ */
+ @Test
+ public void testInjectManagerProducer()
+ {
+ ManagerProducer.setInjectionPointInjected(false);
+ Utils.getReference(beanManager, IntInjection.class);
+ Assert.assertTrue(ManagerProducer.isInjectionPointInjected());
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+public class NamedProducer
+{
+ @Named("itoen")
+ @Produces
+ public String[] createName()
+ {
+ return new String[] { "oh", "otya" };
+ }
+
+ @Named("iemon")
+ @Produces
+ public String[] createName2()
+ {
+ return new String[] { "fukujyuen", "iemon", "otya" };
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class NamedProducerTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(NamedProducerTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
+ public void testNamedProducer()
+ {
+ Bean<?> iemonBean = beanManager.resolve(beanManager.getBeans("iemon"));
+ String[] iemon = (String[]) beanManager.getReference(iemonBean, Object.class, beanManager.createCreationalContext(iemonBean));
+ Assert.assertEquals(3, iemon.length);
+ Bean<?> itoenBean = beanManager.resolve(beanManager.getBeans("itoen"));
+ String[] itoen = (String[]) beanManager.getReference(itoenBean, Object.class, beanManager.createCreationalContext(itoenBean));
+ Assert.assertEquals(2, itoen.length);
+ }
+
+ @Test
+ public void testDefaultNamedProducerMethod()
+ {
+ Set<Bean<?>> beans = beanManager.getBeans(JmsTemplate.class);
+ Assert.assertEquals(2, beans.size());
+ List<String> beanNames = new ArrayList<String>(Arrays.asList("errorQueueTemplate", "logQueueTemplate"));
+ for (Bean<?> b : beans)
+ {
+ beanNames.remove(b.getName());
+ }
+ Assert.assertTrue(beanNames.isEmpty());
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBinding.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import java.util.Date;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+/**
+ * @author Dan Allen
+ */
+public class NamedProducerWithBinding {
+ public @Produces @Important @Named Date getDate() {
+ return new Date();
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NamedProducerWithBindingTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import java.util.Date;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Dan Allen
+ */
+(a)RunWith(Arquillian.class)
+public class NamedProducerWithBindingTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(NamedProducerWithBindingTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
+ public void testGetNamedProducerWithBinding()
+ {
+ Bean<?> bean = beanManager.resolve(beanManager.getBeans("date"));
+ Date date = (Date) beanManager.getReference(bean, Object.class, beanManager.createCreationalContext(bean));
+ Assert.assertNotNull(date);
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/NullProducerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.test.Utils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class NullProducerTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(NullProducerTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ /*
+ * description = "WBRI-276"
+ */
+ @Test
+ public void testProducerMethodReturnsNull(Government government)
+ {
+ government.destabilize();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/ProducerBeanInvocationTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat, Inc. and/or its affiliates, 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.weld.tests.producer.method;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Simple test which invokes a method directly on a normal scoped producer
+ * bean to ensure that it's proxy is for that bean and not the product
+ * of a producer method.
+ *
+ * @author David Allen
+ *
+ */
+(a)RunWith(Arquillian.class)
+public class ProducerBeanInvocationTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ProducerBeanInvocationTest.class.getPackage());
+ }
+
+ /*
+ * description = "WELD-546"
+ */
+ @Test
+ public void test(Qux bar, QuxProducer producer, @Baz Qux bazBar)
+ {
+ Assert.assertEquals("qux", bar.getBar());
+ Assert.assertTrue(producer.ping());
+ Assert.assertEquals("baz", bazBar.getBar());
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Qux.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Qux.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Qux.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Qux.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,26 @@
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+public class Qux
+{
+
+ private final String name;
+
+ public Qux(String name)
+ {
+ this.name = name;
+ }
+
+ public Qux()
+ {
+ this("qux");
+ }
+
+ public String getBar()
+ {
+ return name;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/QuxProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,21 @@
+package org.jboss.weld.tests.producer.method;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+
+@RequestScoped
+public class QuxProducer
+{
+
+ @Produces @Baz @RequestScoped
+ public Qux getQux()
+ {
+ return new Qux("baz");
+ }
+
+ public boolean ping()
+ {
+ return true;
+ };
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Short.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/Short.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Short.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/Short.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.producer.method;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+/**
+ * @author Dan Allen
+ */
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+@Inherited
+public @interface Short {
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/circular)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/CircularInjectionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/circular/CircularInjectionTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/circular/CircularInjectionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,15 +16,28 @@
*/
package org.jboss.weld.tests.producer.method.circular;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class CircularInjectionTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class CircularInjectionTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(CircularInjectionTest.class.getPackage());
+ }
- @Test(description="WELD-310")
+ /*
+ * description = "WELD-310"
+ */
+ @Test
public void testProducerCalledOnBeanUnderConstruction()
{
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/parameterized)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/producer/method/parameterized/ParameterizedTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,19 +16,31 @@
*/
package org.jboss.weld.tests.producer.method.parameterized;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class ParameterizedTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class ParameterizedTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ParameterizedTest.class.getPackage());
+ }
- @Test(description = "WELD-452")
- public void testEventQualifiersCorrect()
+ /*
+ * description = "WELD-452"
+ */
+ @Test
+ public void testEventQualifiersCorrect(TestBean testBean)
{
- TestBean testBean = getReference(TestBean.class);
- assert testBean != null;
+ Assert.assertNotNull(testBean);
}
-
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/Foo.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/Foo.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/Foo.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.proxy;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.RequestScoped;
+import javax.inject.Named;
+
+@Named
+@RequestScoped
+class Foo implements Serializable
+{
+
+ public String getMsg()
+ {
+ return "Hi";
+ }
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/ProxyTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.proxy;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ProxyTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ProxyTest.class.getPackage());
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ /*
+ * description = "WBRI-122"
+ */
+ @Test
+ public void testImplementationClassImplementsSerializable()
+ {
+ Bean<?> bean = beanManager.resolve(beanManager.getBeans("foo"));
+ Assert.assertNotNull(beanManager.getReference(bean, Object.class, beanManager.createCreationalContext(bean)));
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/enterprise)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/enterprise/EnterpriseBeanProxyTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,28 +16,46 @@
*/
package org.jboss.weld.tests.proxy.enterprise;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.weld.test.AbstractWeldTest;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.weld.test.Utils;
-import org.testng.annotations.Test;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
-@Artifact
-(a)Packaging(PackagingType.EAR)
-public class EnterpriseBeanProxyTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class EnterpriseBeanProxyTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(JavaArchive.class)
+ .addPackage(EnterpriseBeanProxyTest.class.getPackage())
+ .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+ );
+ }
/*
+ * description = "WBRI-109"
+ *
* <a href="https://jira.jboss.org/jira/browse/WBRI-109">WBRI-109</a>
*/
// Broken due to WELDINT-45
- @Test(description="WBRI-109", groups = "broken")
- public void testNoInterfaceView() throws Exception
+ @Test
+ @Category(Broken.class)
+ public void testNoInterfaceView(Mouse mouse) throws Exception
{
- Object mouse = getReference(Mouse.class);
- assert Utils.isProxy(mouse);
- assert mouse instanceof Mouse;
+ Assert.assertTrue(Utils.isProxy(mouse));
+ Assert.assertTrue(mouse instanceof Mouse);
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/observer)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/ObserverInjectionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/observer/ObserverInjectionTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/observer/ObserverInjectionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -1,20 +1,39 @@
package org.jboss.weld.tests.proxy.observer;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import javax.inject.Inject;
-@Artifact
-public class ObserverInjectionTest extends AbstractWeldTest
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ObserverInjectionTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ObserverInjectionTest.class.getPackage());
+ }
- @Test(description="WELD-535")
- public void testInjectionHappens()
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ /*
+ * description = "WELD-535"
+ */
+ @Test
+ public void testInjectionHappens(SampleObserver sampleObserver)
{
- SampleObserver sampleObserver = getReference(SampleObserver.class);
- assert !sampleObserver.isInjectionAndObservationOccured();
- getCurrentManager().fireEvent(new Baz());
- assert sampleObserver.isInjectionAndObservationOccured();
+ Assert.assertFalse(sampleObserver.isInjectionAndObservationOccured());
+ beanManager.fireEvent(new Baz());
+ Assert.assertTrue(sampleObserver.isInjectionAndObservationOccured());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477 (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/weld477)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld477/ProxiabilityTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,22 +16,34 @@
*/
package org.jboss.weld.tests.proxy.weld477;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.Assert;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* @author Marius Bogoevici
*/
-@Artifact
-public class ProxiabilityTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class ProxiabilityTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ProxiabilityTest.class.getPackage());
+ }
- @Test(description = "https://jira.jboss.org/jira/browse/WELD-477")
- public void testClassWithPrivateFinalMethodsProxyable()
+ /*
+ * description = "WELD-477"
+ */
+ @Test
+ public void testClassWithPrivateFinalMethodsProxyable(InjectedClass injectedClassInstance)
{
- InjectedClass injectedClassInstance = getReference(InjectedClass.class);
Assert.assertNotNull(injectedClassInstance.getDependency());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56 (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/weld56)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/ProxyTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/proxy/weld56/ProxyTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/proxy/weld56/ProxyTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,24 +16,34 @@
*/
package org.jboss.weld.tests.proxy.weld56;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
-import org.jboss.testharness.impl.packaging.Resource;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
-@Artifact
-@IntegrationTest
-(a)Packaging(PackagingType.WAR)
-@Resource(source = "org.jboss.weld.enableUnsafeProxies", destination = "WEB-INF/classes/META-INF/org.jboss.weld.enableUnsafeProxies")
-public class ProxyTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class ProxyTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(WebArchive.class, "test.war")
+ .addPackage(ProxyTest.class.getPackage())
+ .addWebResource(EmptyAsset.INSTANCE, "beans.xml")
+ .addWebResource(EmptyAsset.INSTANCE, "classes/META-INF/org.jboss.weld.enableUnsafeProxies");
+ }
@Test
- public void testProxy()
+ public void testProxy(Foo foo)
{
- assert "ping".equals(getReference(Foo.class).ping());
+ Assert.assertEquals("ping", foo.ping());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Bar.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Bar.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Bar.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
+
+public class Bar
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Baz.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Baz.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Baz.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Baz.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,22 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
+
+public class Baz
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Foo.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Foo.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Foo.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
+
+public class Foo extends FooBase<Bar>
+{
+
+ public String getName()
+ {
+ return "foo";
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooBase.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/FooBase.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooBase.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooBase.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
+
+public class FooBase<T>
+{
+
+ public String getName()
+ {
+ return "foobase";
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/FooProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
+
+import javax.enterprise.inject.Produces;
+
+public class FooProducer
+{
+
+ @Produces @Special
+ public FooBase<Baz> produce()
+ {
+ return new FooBase<Baz>();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupFoo.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
+
+import javax.inject.Inject;
+
+public class LookupFoo
+{
+
+ @Inject Foo foo;
+
+ @Inject @Special FooBase<Baz> foobaz;
+
+ public Foo getFoo()
+ {
+ return foo;
+ }
+
+ public FooBase<Baz> getFoobaz()
+ {
+ return foobaz;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/LookupInstanceTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
+
+import java.util.List;
+
+import javax.enterprise.inject.Instance;
+import javax.enterprise.util.TypeLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.literal.DefaultLiteral;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class LookupInstanceTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(LookupInstanceTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
+ public void testLookupInstance() throws Exception
+ {
+ Assert.assertNull(
+ Utils.getReference(
+ beanManager,
+ new TypeLiteral<Instance<List<?>>>(){}.getRawType(), DefaultLiteral.INSTANCE));
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Special.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Special.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Special.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Special.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Special
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/Weld256Test.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class Weld256Test
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(Weld256Test.class.getPackage());
+ }
+
+ @Test
+ public void testParameterizedInjection(LookupFoo lookupFoo)
+ {
+ Assert.assertEquals("foo", lookupFoo.getFoo().getName());
+ Assert.assertEquals("foobase", lookupFoo.getFoobaz().getName());
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+@ApplicationScoped
+class Bar
+{
+
+ public static boolean success;
+
+ @Inject Foo foo;
+
+ public Bar()
+ {
+ success = false;
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ if (foo.getName().equals("foo"))
+ {
+ success = true;
+ }
+ }
+
+ public String getName()
+ {
+ return "bar";
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/CircularDependencyTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class CircularDependencyTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(CircularDependencyTest.class.getPackage());
+ }
+
+ @Test
+ public void testCircularInjectionOnTwoSimpleDependentBeans(Foo foo) throws Exception
+ {
+ foo.getName();
+ Assert.assertTrue(Foo.success);
+ Assert.assertTrue(Bar.success);
+ }
+
+ @Test
+ public void testDependentProducerMethodDeclaredOnDependentBeanWhichInjectsProducedBean(DependentSelfConsumingDependentProducer producer) throws Exception
+ {
+ producer.ping();
+ }
+
+ @Test
+ public void testDependentSelfConsumingProducer(Violation violation) throws Exception
+ {
+ violation.ping();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLooping.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+@interface DependentLooping
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentLoopingProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import javax.enterprise.inject.Produces;
+
+class DependentLoopingProducer
+{
+
+ @Produces @DependentLooping
+ public Violation produceViolation(@DependentLooping Violation violation) {
+ return new Violation();
+ }
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/DependentSelfConsumingDependentProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import javax.enterprise.inject.Produces;
+
+class DependentSelfConsumingDependentProducer
+{
+ @SelfConsumingDependent Violation violation;
+
+ @Produces @SelfConsumingDependent
+ public Violation produceViolation() {
+ return new Violation();
+ }
+
+ public void ping() {
+
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Farm.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import javax.inject.Inject;
+
+class Farm
+{
+
+ @Inject
+ public Farm(Farm farm)
+ {
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Fish.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import javax.inject.Inject;
+
+class Fish
+{
+
+ private Water water;
+
+ @Inject
+ public Fish(Water water)
+ {
+ this.water = water;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+class Foo
+{
+
+ public static boolean success;
+
+ @Inject Bar bar;
+
+ public Foo()
+ {
+ success = false;
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ if (bar.getName().equals("bar"))
+ {
+ success = true;
+ }
+ }
+
+ public String getName()
+ {
+ return "foo";
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLooping.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+@interface NormalLooping
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/NormalLoopingProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+
+@ApplicationScoped
+class NormalLoopingProducer
+{
+
+ @Produces @ApplicationScoped @NormalLooping
+ public Violation produceViolation(@NormalLooping Violation violation) {
+ return new Violation();
+ }
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/SelfConsumingDependent.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+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.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+@interface SelfConsumingDependent
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Violation.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import java.io.Serializable;
+
+class Violation implements Serializable
+{
+
+ public void ping()
+ {
+
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/Water.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.resolution.circular;
+
+import javax.inject.Inject;
+
+class Water
+{
+ @Inject
+ public Water(Fish fish)
+ {
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/resource)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/ResourceCircularDependencyTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/circular/resource/ResourceCircularDependencyTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/circular/resource/ResourceCircularDependencyTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,26 +16,33 @@
*/
package org.jboss.weld.tests.resolution.circular.resource;
-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.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
-@Artifact
-@IntegrationTest
-@Resources({
- @Resource(source="persistence.xml", destination="WEB-INF/classes/META-INF/persistence.xml")
-})
-public class ResourceCircularDependencyTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class ResourceCircularDependencyTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ResourceCircularDependencyTest.class.getPackage())
+ .addManifestResource(
+ ResourceCircularDependencyTest.class.getPackage(), "persistence.xml", "persistence.xml");
+ }
@Test
- public void testResourceProducerField() throws Exception
+ public void testResourceProducerField(Baz baz) throws Exception
{
- assert getReference(Baz.class).getFooDb().isOpen();
- assert true;
+ Assert.assertTrue(baz.getFooDb().isOpen());
}
-
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/named)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/named/NamedBeanTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -17,29 +17,49 @@
package org.jboss.weld.tests.resolution.named;
import javax.enterprise.inject.spi.Bean;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* @author Dan Allen
*/
-@Artifact(addCurrentPackage = true)
-public class NamedBeanTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class NamedBeanTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(NamedBeanTest.class.getPackage());
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
@Test
public void testGetNamedBeanWithBinding()
{
- Bean<?> bean = getCurrentManager().resolve(getCurrentManager().getBeans("namedBeanWithBinding"));
- NamedBeanWithBinding instance = (NamedBeanWithBinding) getCurrentManager().getReference(bean, Object.class, getCurrentManager().createCreationalContext(bean));
- assert instance != null;
+ Bean<?> bean = beanManager.resolve(beanManager.getBeans("namedBeanWithBinding"));
+ NamedBeanWithBinding instance = (NamedBeanWithBinding) beanManager.getReference(bean, Object.class, beanManager.createCreationalContext(bean));
+ Assert.assertNotNull(instance);
}
- @Test(description = "WELD-435")
- public void testNamedInjectedFieldUsesFieldName()
+ /*
+ * description = "WELD-435"
+ */
+ @Test
+ public void testNamedInjectedFieldUsesFieldName(NamedBeanConsumer consumer)
{
- assert getReference(NamedBeanConsumer.class).getFoo() != null;
+ Assert.assertNotNull(consumer.getFoo());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279 (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/wbri279)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/Weld279Test.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/wbri279/Weld279Test.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri279/Weld279Test.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,22 +16,35 @@
*/
package org.jboss.weld.tests.resolution.wbri279;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* @author pmuir
*
*/
-@Artifact
-public class Weld279Test extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class Weld279Test
{
-
- @Test(description="WELD-279")
- public void testLookupOfGenericTypeSubclass()
+ @Deployment
+ public static Archive<?> deploy()
{
- assert getReference(SomeBean.class).getObjectAsString().equals(IntegerFactory.VALUE.toString());
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(Weld279Test.class.getPackage());
}
+ /*
+ * description = "WELD-279"
+ */
+ @Test
+ public void testLookupOfGenericTypeSubclass(SomeBean bean)
+ {
+ Assert.assertEquals(IntegerFactory.VALUE.toString(), bean.getObjectAsString());
+ }
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293 (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/wbri293)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/ContextualReferenceTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resolution/wbri293/ContextualReferenceTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resolution/wbri293/ContextualReferenceTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,25 +16,48 @@
*/
package org.jboss.weld.tests.resolution.wbri293;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import javax.inject.Inject;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
/**
*
* @author Jozef Hartinger
*
*/
-@Artifact
-public class ContextualReferenceTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class ContextualReferenceTest
{
- @Test(groups = "broken")
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ContextualReferenceTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ @Test
+ @Category(Broken.class)
public void testReferencesEqual() {
- Sheep sheep = getReference(Sheep.class);
+ Sheep sheep = Utils.getReference(beanManager, Sheep.class);
sheep.setAge(10);
- Sheep sheep2 = getReference(Sheep.class);
- assert sheep.getAge() == sheep2.getAge();
- assert sheep.equals(sheep2);
+ Sheep sheep2 = Utils.getReference(beanManager, Sheep.class);
+ Assert.assertEquals(sheep.getAge(), sheep2.getAge());
+ Assert.assertEquals(sheep, sheep2);
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/resources)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/ResourceTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/resources/ResourceTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/resources/ResourceTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,21 +16,34 @@
*/
package org.jboss.weld.tests.resources;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.IntegrationTest;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.tests.category.Integration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
-@Artifact
-@IntegrationTest
-public class ResourceTest extends AbstractWeldTest
+(a)Category(Integration.class)
+(a)RunWith(Arquillian.class)
+public class ResourceTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ResourceTest.class.getPackage());
+ }
- @Test(description="WELD-385")
- public void testUTInjectedByResource()
+ /*
+ * description = "WELD-385"
+ */
+ @Test
+ public void testUTInjectedByResource(UTConsumer consumer)
{
- assert getReference(UTConsumer.class).getUserTransaction() != null;
+ Assert.assertNotNull(consumer.getUserTransaction());
}
-
-
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Bar.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Bar.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Bar.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
+
+import javax.enterprise.context.Dependent;
+
+@Dependent
+class Bar extends Foo
+{
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Foo.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Foo.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Foo.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,24 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
+
+import javax.enterprise.context.RequestScoped;
+
+@RequestScoped
+class Foo
+{
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/ScopeTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
+
+import java.lang.annotation.Annotation;
+
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.inject.Inject;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.Container;
+import org.jboss.weld.context.ContextLifecycle;
+import org.jboss.weld.context.beanstore.HashMapBeanStore;
+import org.jboss.weld.manager.BeanManagerImpl;
+import org.jboss.weld.test.Utils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class ScopeTest
+{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(ScopeTest.class.getPackage())
+ .addClass(Utils.class);
+ }
+
+ private static Annotation USELESS_LITERAL = new AnnotationLiteral<Useless>() {};
+ private static Annotation SPECIAL_LITERAL = new AnnotationLiteral<Special>() {};
+
+ @Inject
+ private BeanManagerImpl beanManager;
+
+ /*
+ * description = "WELD-322"
+ */
+ @Test
+ public void testScopeDeclaredOnSubclassOverridesScopeOnSuperClass()
+ {
+ Assert.assertEquals(Dependent.class, beanManager.resolve(beanManager.getBeans(Bar.class)).getScope());
+ }
+
+ /*
+ * description = "WELD-311"
+ */
+ @Test
+ public void testScopeOfProducerMethod()
+ {
+ Bean<Temp> specialTempBean = Utils.getBean(beanManager, Temp.class, SPECIAL_LITERAL);
+ Bean<Temp> uselessTempBean = Utils.getBean(beanManager, Temp.class, USELESS_LITERAL);
+ Assert.assertEquals(RequestScoped.class, specialTempBean.getScope());
+ Assert.assertEquals(RequestScoped.class, uselessTempBean.getScope());
+ Assert.assertEquals(10, Utils.getReference(beanManager, specialTempBean).getNumber());
+ Assert.assertEquals(11, Utils.getReference(beanManager, uselessTempBean).getNumber());
+
+ TempConsumer tempConsumer = Utils.getReference(beanManager, TempConsumer.class);
+ tempConsumer.getSpecialTemp().setNumber(101);
+ tempConsumer.getUselessTemp().setNumber(102);
+
+ Assert.assertEquals(101, tempConsumer.getSpecialTemp().getNumber());
+ Assert.assertEquals(102, tempConsumer.getUselessTemp().getNumber());
+ Assert.assertEquals(101, Utils.getReference(beanManager, specialTempBean).getNumber());
+ Assert.assertEquals(102, Utils.getReference(beanManager, uselessTempBean).getNumber());
+
+ newRequest();
+
+ Assert.assertEquals(10, tempConsumer.getSpecialTemp().getNumber());
+ Assert.assertEquals(11, tempConsumer.getUselessTemp().getNumber());
+ Assert.assertEquals(10, Utils.getReference(beanManager, specialTempBean).getNumber());
+ Assert.assertEquals(11, Utils.getReference(beanManager, uselessTempBean).getNumber());
+ }
+
+ private void newRequest()
+ {
+ ContextLifecycle lifecycle = Container.instance().services().get(ContextLifecycle.class);
+ lifecycle.endRequest("test", lifecycle.getRequestContext().getBeanStore());
+ lifecycle.restoreSession("test", new HashMapBeanStore());
+ lifecycle.beginRequest("test", new HashMapBeanStore());
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Special.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Special.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Special.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Special.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Special
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Temp.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Temp.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Temp.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Temp.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
+
+public class Temp
+{
+
+ private int number;
+
+ public Temp(int number)
+ {
+ this.number = number;
+ }
+
+ public Temp()
+ {
+ number = 0;
+ }
+
+ public int getNumber()
+ {
+ return number;
+ }
+
+ public void setNumber(int number)
+ {
+ this.number = number;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempConsumer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+@ApplicationScoped
+public class TempConsumer
+{
+
+ @Inject @Special Temp specialTemp;
+ @Inject @Useless Temp uselessTemp;
+
+ public Temp getSpecialTemp()
+ {
+ return specialTemp;
+ }
+
+ public Temp getUselessTemp()
+ {
+ return uselessTemp;
+ }
+
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempProducer.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/TempProducer.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempProducer.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/TempProducer.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+@Named
+@SessionScoped
+public class TempProducer implements Serializable
+{
+
+ @Produces
+ @RequestScoped
+ @Special
+ public Temp getTemp()
+ {
+ return new Temp(10);
+ }
+
+ @Produces
+ @RequestScoped
+ @Useless
+ Temp t = new Temp(11);
+
+}
\ No newline at end of file
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Useless.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/scope/Useless.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Useless.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/scope/Useless.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.scope;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target({FIELD, METHOD, TYPE, PARAMETER})
+public @interface Useless
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -19,48 +19,60 @@
import java.io.Serializable;
import javax.enterprise.inject.IllegalProductException;
-import javax.enterprise.util.AnnotationLiteral;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.weld.test.Utils;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class SerializationTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class SerializationTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(SerializationTest.class.getPackage());
+ }
- @Test(description="WELD-363")
- public void testConversationManagerSerializable()
+ /*
+ * description = "WELD-363"
+ */
+ @Test
+ public void testConversationManagerSerializable(@Mock TestConversationManager cMgr)
throws Exception
{
- TestConversationManager cMgr = getReference(TestConversationManager.class, new AnnotationLiteral<Mock>()
- {
- });
+ Assert.assertNotNull(cMgr.getConversationInstance());
- assert cMgr.getConversationInstance() != null;
-
Object deserialized = Utils.deserialize(Utils.serialize(cMgr));
- assert deserialized instanceof TestConversationManager;
+ Assert.assertTrue(deserialized instanceof TestConversationManager);
TestConversationManager deserializedCMgr = (TestConversationManager) deserialized;
- assert deserializedCMgr.getConversationInstance() != null;
+ Assert.assertNotNull(deserializedCMgr.getConversationInstance());
}
- @Test(description="http://lists.jboss.org/pipermail/weld-dev/2010-February/002265.html")
- public void testNonSerializableProductInjectedIntoSessionScopedBean()
+ /*
+ * description = "http://lists.jboss.org/pipermail/weld-dev/2010-February/002265.html"
+ */
+ @Test
+ public void testNonSerializableProductInjectedIntoSessionScopedBean(LoggerConsumer consumer)
{
try
{
- getReference(LoggerConsumer.class).ping();
+ consumer.ping();
}
catch (Exception e)
{
// If Logger isn't serializable, we get here
- assert e instanceof IllegalProductException;
+ Assert.assertTrue(e instanceof IllegalProductException);
return;
}
// If Logger is serializable we get here
- assert getReference(LoggerConsumer.class).getLog() instanceof Serializable;
+ Assert.assertTrue(consumer.getLog() instanceof Serializable);
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/session/newBean)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/NewEnterpriseBeanTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/session/newBean/NewEnterpriseBeanTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/session/newBean/NewEnterpriseBeanTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -20,25 +20,42 @@
import javax.enterprise.inject.New;
import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.testharness.impl.packaging.Packaging;
-import org.jboss.testharness.impl.packaging.PackagingType;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.jboss.weld.bean.NewSessionBean;
import org.jboss.weld.bean.SessionBean;
import org.jboss.weld.introspector.WeldAnnotated;
import org.jboss.weld.literal.NewLiteral;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
-@Artifact
-(a)Packaging(PackagingType.EAR)
-public class NewEnterpriseBeanTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class NewEnterpriseBeanTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
+ .addModule(
+ ShrinkWrap.create(JavaArchive.class)
+ .addPackage(NewEnterpriseBeanTest.class.getPackage())
+ .addManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+ );
+ }
private static final New NEW_LITERAL = new NewLiteral()
{
-
@Override
public java.lang.Class<?> value()
{
@@ -46,44 +63,47 @@
}
};
+
+ @Inject
+ private BeanManager beanManager;
private SessionBean<WrappedEnterpriseBeanLocal> wrappedEnterpriseBean;
private NewSessionBean<WrappedEnterpriseBeanLocal> newEnterpriseBean;
public void initNewBean()
{
- Set<Bean<?>> beans = getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class);
- assert getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class).size() == 1;
- assert getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class).iterator().next() instanceof SessionBean;
- wrappedEnterpriseBean = (SessionBean<WrappedEnterpriseBeanLocal>) getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class).iterator().next();
+ Set<Bean<?>> beans = beanManager.getBeans(WrappedEnterpriseBeanLocal.class);
+ Assert.assertEquals(1, beanManager.getBeans(WrappedEnterpriseBeanLocal.class).size());
+ Assert.assertTrue(beanManager.getBeans(WrappedEnterpriseBeanLocal.class).iterator().next() instanceof SessionBean<?>);
+ wrappedEnterpriseBean = (SessionBean<WrappedEnterpriseBeanLocal>) beanManager.getBeans(WrappedEnterpriseBeanLocal.class).iterator().next();
- assert getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).size() == 1;
- assert getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next() instanceof NewSessionBean;
- newEnterpriseBean = (NewSessionBean<WrappedEnterpriseBeanLocal>) getCurrentManager().getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next();
-
+ Assert.assertEquals(1, beanManager.getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).size());
+ Assert.assertTrue(beanManager.getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next() instanceof NewSessionBean<?>);
+ newEnterpriseBean = (NewSessionBean<WrappedEnterpriseBeanLocal>) beanManager.getBeans(WrappedEnterpriseBeanLocal.class, NEW_LITERAL).iterator().next();
}
- @Test(groups = { "new", "broken" })
+ @Test
+ @Category(Broken.class)
public void testNewBeanHasImplementationClassOfInjectionPointType()
{
initNewBean();
- assert newEnterpriseBean.getType().equals(WrappedEnterpriseBean.class);
+ Assert.assertEquals(WrappedEnterpriseBean.class, newEnterpriseBean.getType());
}
- @Test(groups = { "new" })
+ @Test
public void testNewBeanHasSameInitializerMethodsAsWrappedBean()
{
initNewBean();
- assert newEnterpriseBean.getInitializerMethods().equals(wrappedEnterpriseBean.getInitializerMethods());
+ Assert.assertEquals(wrappedEnterpriseBean.getInitializerMethods(), newEnterpriseBean.getInitializerMethods());
}
- @Test(groups = { "new" })
+ @Test
public void testNewBeanHasSameInjectedFieldsAsWrappedBean()
{
initNewBean();
Set<? extends WeldAnnotated<?, ?>> wrappedBeanInjectionPoints = wrappedEnterpriseBean.getWeldInjectionPoints();
Set<? extends WeldAnnotated<?, ?>> newBeanInjectionPoints = newEnterpriseBean.getWeldInjectionPoints();
- assert wrappedBeanInjectionPoints.equals(newBeanInjectionPoints);
+ Assert.assertEquals(wrappedBeanInjectionPoints, newBeanInjectionPoints);
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/specialization)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/SpecializationTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/specialization/SpecializationTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/specialization/SpecializationTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,18 +16,38 @@
*/
package org.jboss.weld.tests.specialization;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
-@Artifact
-public class SpecializationTest extends AbstractWeldTest
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+(a)RunWith(Arquillian.class)
+public class SpecializationTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(SpecializationTest.class.getPackage());
+ }
- @Test(groups="WELD-321")
+ @Inject
+ private BeanManager beanManager;
+
+ /**
+ * WELD-321
+ */
+ @Test
public void testSpecialization()
{
- assert getCurrentManager().resolve(getCurrentManager().getBeans(User.class)).getBeanClass().equals(User2.class);
+ Assert.assertEquals(User2.class, beanManager.resolve(beanManager.getBeans(User.class)).getBeanClass());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/stereotypes)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/StereotypesTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/stereotypes/StereotypesTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/stereotypes/StereotypesTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -18,16 +18,27 @@
import javax.enterprise.context.RequestScoped;
-import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.weld.metadata.TypeStore;
import org.jboss.weld.metadata.cache.StereotypeModel;
import org.jboss.weld.resources.ClassTransformer;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-@Artifact
-public class StereotypesTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class StereotypesTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class)
+ .addPackage(StereotypesTest.class.getPackage());
+ }
private final ClassTransformer transformer = new ClassTransformer(new TypeStore());
@@ -35,30 +46,29 @@
public void testAnimalStereotype()
{
StereotypeModel<AnimalStereotype> animalStereotype = new StereotypeModel<AnimalStereotype>(AnimalStereotype.class, transformer);
- assert animalStereotype.getDefaultScopeType().annotationType().equals(RequestScoped.class);
- assert animalStereotype.getInterceptorBindings().size() == 0;
- assert !animalStereotype.isBeanNameDefaulted();
- assert !animalStereotype.isAlternative();
+ Assert.assertEquals(RequestScoped.class, animalStereotype.getDefaultScopeType().annotationType());
+ Assert.assertEquals(0, animalStereotype.getInterceptorBindings().size());
+ Assert.assertFalse(animalStereotype.isBeanNameDefaulted());
+ Assert.assertFalse(animalStereotype.isAlternative());
}
@Test
public void testAnimalOrderStereotype()
{
StereotypeModel<AnimalOrderStereotype> animalStereotype = new StereotypeModel<AnimalOrderStereotype>(AnimalOrderStereotype.class, transformer);
- assert animalStereotype.getDefaultScopeType() == null;
- assert animalStereotype.getInterceptorBindings().size() == 0;
- assert !animalStereotype.isBeanNameDefaulted();
- assert !animalStereotype.isAlternative();
+ Assert.assertNull(animalStereotype.getDefaultScopeType());
+ Assert.assertEquals(0, animalStereotype.getInterceptorBindings().size());
+ Assert.assertFalse(animalStereotype.isBeanNameDefaulted());
+ Assert.assertFalse(animalStereotype.isAlternative());
}
@Test
public void testRequestScopedAnimalStereotype()
{
StereotypeModel<RequestScopedAnimalStereotype> animalStereotype = new StereotypeModel<RequestScopedAnimalStereotype>(RequestScopedAnimalStereotype.class, transformer);
- assert animalStereotype.getDefaultScopeType() == null;
- assert animalStereotype.getInterceptorBindings().size() == 0;
- assert !animalStereotype.isBeanNameDefaulted();
- assert !animalStereotype.isAlternative();
+ Assert.assertNull(animalStereotype.getDefaultScopeType());
+ Assert.assertEquals(0, animalStereotype.getInterceptorBindings().size());
+ Assert.assertFalse(animalStereotype.isBeanNameDefaulted());
+ Assert.assertFalse(animalStereotype.isAlternative());
}
-
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Bar.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Bar
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/CheckableInjectionServices.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
+
+import org.jboss.weld.injection.spi.InjectionContext;
+import org.jboss.weld.injection.spi.InjectionServices;
+
+/**
+ * @author pmuir
+ *
+ */
+public class CheckableInjectionServices implements InjectionServices
+{
+
+ private boolean before = false;
+ private boolean after = false;
+ private boolean injectedAfter = false;
+ private boolean injectionTargetCorrect = false;
+
+ public <T> void aroundInject(InjectionContext<T> injectionContext)
+ {
+ before = true;
+ if (injectionContext.getTarget() instanceof Foo)
+ {
+ ((Foo) injectionContext.getTarget()).message = "hi!";
+ if (injectionContext.getInjectionTarget().getInjectionPoints().size() == 1)
+ {
+ injectionTargetCorrect = injectionContext.getInjectionTarget().getInjectionPoints().iterator().next().getType().equals(Bar.class);
+ }
+ }
+ injectionContext.proceed();
+ after = true;
+ if (injectionContext.getTarget() instanceof Foo)
+ {
+ Foo foo = (Foo) injectionContext.getTarget();
+ injectedAfter = foo.getBar() instanceof Bar && foo.getMessage().equals("hi!");
+ }
+ }
+
+ public void reset()
+ {
+ before = false;
+ after = false;
+ injectedAfter = false;
+ injectionTargetCorrect = false;
+ }
+
+ public boolean isBefore()
+ {
+ return before;
+ }
+
+ public boolean isAfter()
+ {
+ return after;
+ }
+
+ public boolean isInjectedAfter()
+ {
+ return injectedAfter;
+ }
+
+ public boolean isInjectionTargetCorrect()
+ {
+ return injectionTargetCorrect;
+ }
+
+ public void cleanup() {}
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/ContainerStatusTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
+
+import org.jboss.weld.Container;
+import org.jboss.weld.ContainerState;
+import org.jboss.weld.mock.MockServletLifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class ContainerStatusTest
+{
+
+ @Test
+ public void testStatus()
+ {
+ TestContainer container = new TestContainer(new MockServletLifecycle());
+ Assert.assertFalse(Container.available());
+ container.getLifecycle().initialize();
+ Assert.assertFalse(Container.available());
+ Assert.assertEquals(ContainerState.STARTING, Container.instance().getState());
+ container.getLifecycle().getBootstrap().startInitialization();
+ Assert.assertFalse(Container.available());
+ Assert.assertEquals(ContainerState.STARTING, Container.instance().getState());
+ container.getLifecycle().getBootstrap().deployBeans();
+ Assert.assertTrue(Container.available());
+ Assert.assertEquals(ContainerState.INITIALIZED, Container.instance().getState());
+ container.getLifecycle().getBootstrap().validateBeans().endInitialization();
+ Assert.assertTrue(Container.available());
+ Assert.assertEquals(ContainerState.VALIDATED, Container.instance().getState());
+ container.stopContainer();
+ Assert.assertFalse(Container.available());
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/DiscoverFailsBootstrapTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
+
+import org.jboss.weld.bootstrap.WeldBootstrap;
+import org.jboss.weld.bootstrap.api.Bootstrap;
+import org.jboss.weld.bootstrap.api.Environments;
+import org.jboss.weld.context.api.helpers.ConcurrentHashMapBeanStore;
+import org.junit.Test;
+
+public class DiscoverFailsBootstrapTest
+{
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testDiscoverFails()
+ {
+ Bootstrap bootstrap = new WeldBootstrap();
+ bootstrap.startContainer(Environments.SE, null, new ConcurrentHashMapBeanStore());
+ }
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/Foo.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
+
+import javax.inject.Inject;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Foo
+{
+
+ @Inject
+ private Bar bar;
+
+ public String message;
+
+ /**
+ * @return the bar
+ */
+ public Bar getBar()
+ {
+ return bar;
+ }
+
+ /**
+ * @return the message
+ */
+ public String getMessage()
+ {
+ return message;
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/InjectionServicesTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
+
+import java.util.Arrays;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.injection.spi.InjectionServices;
+import org.jboss.weld.mock.MockEELifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class InjectionServicesTest
+{
+
+ @Test
+ public void testInjectionOfTarget()
+ {
+ TestContainer container = new TestContainer(new MockEELifecycle(), Arrays.asList(Foo.class, Bar.class), null);
+ CheckableInjectionServices ijs = new CheckableInjectionServices();
+ container.getLifecycle().getWar().getServices().add(InjectionServices.class, ijs);
+ container.startContainer();
+ container.ensureRequestActive();
+
+ BeanManager manager = container.getBeanManager();
+
+ Bean<? extends Object> bean = manager.resolve(manager.getBeans(Foo.class));
+ ijs.reset();
+ Foo foo = (Foo) manager.getReference(bean, Foo.class, manager.createCreationalContext(bean));
+
+ Assert.assertTrue(ijs.isBefore());
+ Assert.assertTrue(ijs.isAfter());
+ Assert.assertTrue(ijs.isInjectedAfter());
+ Assert.assertTrue(ijs.isInjectionTargetCorrect());
+
+ Assert.assertNotNull(foo.getBar());
+ Assert.assertEquals("hi!", foo.getMessage());
+
+
+ container.stopContainer();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/PreinstantiateBeanManagerTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.mock.MockEELifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author kkhan
+ *
+ */
+public class PreinstantiateBeanManagerTest
+{
+
+ @Test
+ public void test()
+ {
+ //Start the container, but do not deploy weld yet
+ List<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(WeldBean.class);
+ TestContainer container = new TestContainer(new MockEELifecycle(), classes, null);
+ container.getLifecycle().initialize();
+
+ BeanManager bootstrapManager = container.getBeanManager();
+ Assert.assertNotNull(bootstrapManager);
+
+ //Check the bean is null since it is not there yet
+ Set<Bean<?>> beans = bootstrapManager.getBeans(WeldBean.class);
+ Assert.assertNotNull(beans);
+ Assert.assertEquals(0, beans.size());
+
+ //Start the application
+ container.getLifecycle().beginApplication();
+ container.ensureRequestActive();
+
+ //Check the manager is the same as before
+ BeanManager manager = container.getBeanManager();
+ Assert.assertNotNull(manager);
+ Assert.assertEquals(bootstrapManager, manager);
+
+ //Check we can get the bean
+ Bean<? extends Object> bean = manager.resolve(manager.getBeans(WeldBean.class));
+ WeldBean weldBean = (WeldBean) manager.getReference(bean, WeldBean.class, manager.createCreationalContext(bean));
+ Assert.assertNotNull(weldBean);
+
+ container.stopContainer();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldBean.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,27 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class WeldBean
+{
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java)
===================================================================
--- core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java (rev 0)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/WeldStartupTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., 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.weld.tests.unit.bootstrap;
+
+import java.util.Arrays;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.weld.mock.MockEELifecycle;
+import org.jboss.weld.mock.TestContainer;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author pmuir
+ *
+ */
+public class WeldStartupTest
+{
+
+ @Test
+ public void test()
+ {
+ TestContainer container = new TestContainer(new MockEELifecycle(), Arrays.asList(Foo.class, Bar.class), null);
+ container.startContainer();
+ container.ensureRequestActive();
+
+ BeanManager manager = container.getBeanManager();
+
+ Bean<? extends Object> bean = manager.resolve(manager.getBeans(Foo.class));
+ Foo foo = (Foo) manager.getReference(bean, Foo.class, manager.createCreationalContext(bean));
+
+ Assert.assertNotNull(foo);
+ Assert.assertNotNull(foo.getBar());
+
+ container.stopContainer();
+ }
+
+}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/BeansXmlTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/BeansXmlTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/bootstrap/xml/BeansXmlTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -26,7 +26,8 @@
import org.jboss.weld.mock.MockEELifecycle;
import org.jboss.weld.mock.TestContainer;
import org.jboss.weld.xml.WeldXmlException;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
@SuppressWarnings("unchecked")
public class BeansXmlTest
@@ -110,8 +111,8 @@
List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
List<URL> beansXmls = Arrays.asList(getClass().getResource("alternative.xml"));
TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
- assert container.getBeanManager().getEnabledClasses().getAlternativeClasses().size() == 1;
- assert container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next() == Alt.class;
+ Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getAlternativeClasses().size());
+ Assert.assertEquals(Alt.class, container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next());
container.stopContainer();
}
@@ -121,8 +122,8 @@
List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
List<URL> beansXmls = Arrays.asList(getClass().getResource("decorator.xml"));
TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
- assert container.getBeanManager().getEnabledClasses().getDecorators().size() == 1;
- assert container.getBeanManager().getEnabledClasses().getDecorators().iterator().next() == Dec.class;
+ Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getDecorators().size());
+ Assert.assertEquals(Dec.class, container.getBeanManager().getEnabledClasses().getDecorators().iterator().next());
container.stopContainer();
}
@@ -132,8 +133,8 @@
List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
List<URL> beansXmls = Arrays.asList(getClass().getResource("interceptor.xml"));
TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
- assert container.getBeanManager().getEnabledClasses().getInterceptors().size() == 1;
- assert container.getBeanManager().getEnabledClasses().getInterceptors().iterator().next() == Int.class;
+ Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getInterceptors().size());
+ Assert.assertEquals(Int.class, container.getBeanManager().getEnabledClasses().getInterceptors().iterator().next());
container.stopContainer();
}
@@ -143,12 +144,12 @@
List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
List<URL> beansXmls = Arrays.asList(getClass().getResource("alternative.xml"), getClass().getResource("decorator.xml"), getClass().getResource("interceptor.xml"));
TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
- assert container.getBeanManager().getEnabledClasses().getAlternativeClasses().size() == 1;
- assert container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next() == Alt.class;
- assert container.getBeanManager().getEnabledClasses().getInterceptors().size() == 1;
- assert container.getBeanManager().getEnabledClasses().getInterceptors().iterator().next() == Int.class;
- assert container.getBeanManager().getEnabledClasses().getDecorators().size() == 1;
- assert container.getBeanManager().getEnabledClasses().getDecorators().iterator().next() == Dec.class;
+ Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getAlternativeClasses().size());
+ Assert.assertEquals(Alt.class, container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next());
+ Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getInterceptors().size());
+ Assert.assertEquals(Int.class, container.getBeanManager().getEnabledClasses().getInterceptors().iterator().next());
+ Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getDecorators().size());
+ Assert.assertEquals(Dec.class, container.getBeanManager().getEnabledClasses().getDecorators().iterator().next());
container.stopContainer();
}
@@ -165,8 +166,8 @@
List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
List<URL> beansXmls = Arrays.asList(getClass().getResource("namespaced.xml"));
TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
- assert container.getBeanManager().getEnabledClasses().getAlternativeClasses().size() == 1;
- assert container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next() == Alt.class;
+ Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getAlternativeClasses().size());
+ Assert.assertEquals(Alt.class, container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next());
container.stopContainer();
}
@@ -177,8 +178,8 @@
List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
List<URL> beansXmls = Arrays.asList(getClass().getResource("nonDefaultNamespaced.xml"));
TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
- assert container.getBeanManager().getEnabledClasses().getAlternativeClasses().size() == 1;
- assert container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next() == Alt.class;
+ Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getAlternativeClasses().size());
+ Assert.assertEquals(Alt.class, container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next());
container.stopContainer();
}
@@ -191,8 +192,8 @@
List<Class<?>> beans = Arrays.asList(Alt.class, Dec.class, Int.class, IntBind.class, Plain.class);
List<URL> beansXmls = Arrays.asList(getClass().getResource("nonPrettyPrinted.xml"));
TestContainer container = new TestContainer(new MockEELifecycle(), beans, beansXmls).startContainer().ensureRequestActive();
- assert container.getBeanManager().getEnabledClasses().getAlternativeClasses().size() == 1;
- assert container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next() == Alt.class;
+ Assert.assertEquals(1, container.getBeanManager().getEnabledClasses().getAlternativeClasses().size());
+ Assert.assertEquals(Alt.class, container.getBeanManager().getEnabledClasses().getAlternativeClasses().iterator().next());
container.stopContainer();
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/extensions/NonBdaExtensionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -28,12 +28,15 @@
import org.jboss.weld.test.Utils;
import org.jboss.weld.util.serviceProvider.PackageServiceLoaderFactory;
import org.jboss.weld.util.serviceProvider.ServiceLoaderFactory;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
public class NonBdaExtensionTest
{
-
- @Test(description="WELD-233")
+ /*
+ * description = "WELD-233"
+ */
+ @Test
public void test()
{
// Create the BDA in which we will deploy Observer1 and Foo. This is equivalent to a war or ejb jar
@@ -79,30 +82,32 @@
BeanManagerImpl beanManager2 = container.getLifecycle().getBootstrap().getManager(bda2);
Observer1 observer1 = Utils.getReference(beanManager1, Observer1.class);
- assert observer1.isBeforeBeanDiscoveryCalled();
- assert observer1.getBeforeBeanDiscoveryBeanManager().equals(beanManager1);
- assert observer1.isAfterBeanDiscoveryCalled();
- assert observer1.isAfterDeploymentValidationCalled();
- assert observer1.isProcessInjectionTargetCalled();
- assert observer1.isProcessManagedBeanCalled();
- assert observer1.isProcessProducerCalled();
+ Assert.assertTrue(observer1.isBeforeBeanDiscoveryCalled());
+ Assert.assertEquals(beanManager1, observer1.getBeforeBeanDiscoveryBeanManager());
+ Assert.assertTrue(observer1.isAfterBeanDiscoveryCalled());
+ Assert.assertTrue(observer1.isAfterDeploymentValidationCalled());
+ Assert.assertTrue(observer1.isProcessInjectionTargetCalled());
+ Assert.assertTrue(observer1.isProcessManagedBeanCalled());
+ Assert.assertTrue(observer1.isProcessProducerCalled());
- assert beanManager2.getBeans(Observer2.class).size() == 1;
+ Assert.assertEquals(1, beanManager2.getBeans(Observer2.class).size());
// Also check that the accessibility graph has been updated
- assert beanManager1.getBeans(Observer2.class).size() == 1;
+ Assert.assertEquals(1, beanManager1.getBeans(Observer2.class).size());
Observer2 observer2 = Utils.getReference(beanManager2, Observer2.class);
- assert observer2.isBeforeBeanDiscoveryCalled();
- assert observer2.getBeforeBeanDiscoveryBeanManager().equals(beanManager2);
- assert observer2.isAfterBeanDiscoveryCalled();
- assert observer2.isAfterDeploymentValidationCalled();
- assert observer2.isProcessInjectionTargetCalled();
- assert observer2.isProcessManagedBeanCalled();
- assert observer2.isProcessProducerCalled();
-
+ Assert.assertTrue(observer2.isBeforeBeanDiscoveryCalled());
+ Assert.assertEquals(beanManager2, observer2.getBeforeBeanDiscoveryBeanManager());
+ Assert.assertTrue(observer2.isAfterBeanDiscoveryCalled());
+ Assert.assertTrue(observer2.isAfterDeploymentValidationCalled());
+ Assert.assertTrue(observer2.isProcessInjectionTargetCalled());
+ Assert.assertTrue(observer2.isProcessManagedBeanCalled());
+ Assert.assertTrue(observer2.isProcessProducerCalled());
}
- @Test(description="WELD-258")
+ /*
+ * description = "WELD-258"
+ */
+ @Test
public void testEventsSentOnceOnly()
{
// Create the BDA in which we will deploy Observer1 and Foo. This is equivalent to a war or ejb jar
@@ -148,12 +153,12 @@
CountingObserver1 observer1 = Utils.getReference(beanManager1, CountingObserver1.class);
CountingObserver2 observer2 = Utils.getReference(beanManager1, CountingObserver2.class);
- assert observer1.getBeforeBeanDiscovery() == 1;
- assert observer1.getProcessFooManagedBean() == 1;
- assert observer1.getProcessBarManagedBean() == 0;
- assert observer2.getBeforeBeanDiscovery() == 1;
- assert observer2.getProcessFooManagedBean() == 1;
- assert observer2.getProcessBarManagedBean() == 1;
+ Assert.assertEquals(1, observer1.getBeforeBeanDiscovery());
+ Assert.assertEquals(1, observer1.getProcessFooManagedBean());
+ Assert.assertEquals(0, observer1.getProcessBarManagedBean());
+ Assert.assertEquals(1, observer2.getBeforeBeanDiscovery());
+ Assert.assertEquals(1, observer2.getProcessFooManagedBean());
+ Assert.assertEquals(1, observer2.getProcessBarManagedBean());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/nonTransitiveResolution/TransitiveResolutionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -25,12 +25,15 @@
import org.jboss.weld.mock.MockServletLifecycle;
import org.jboss.weld.mock.TestContainer;
import org.jboss.weld.test.Utils;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
public class TransitiveResolutionTest
{
-
- @Test(description = "WELD-319")
+ /*
+ * description = "WELD-319"
+ */
+ @Test
public void testBeansXmlIsolation()
{
MockBeanDeploymentArchive jar1 = new MockBeanDeploymentArchive("first-jar", Alt.class);
@@ -49,9 +52,9 @@
BeanManagerImpl warBeanManager = container.getBeanManager();
BeanManagerImpl jar1BeanManager = container.getLifecycle().getBootstrap().getManager(jar1);
BeanManagerImpl jar2BeanManager = container.getLifecycle().getBootstrap().getManager(jar2);
- assert warBeanManager.getEnabledClasses().getAlternativeClasses().isEmpty();
- assert !jar1BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty();
- assert jar2BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty();
+ Assert.assertTrue(warBeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
+ Assert.assertFalse(jar1BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
+ Assert.assertTrue(jar2BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
}
finally
{
@@ -62,7 +65,10 @@
}
}
- @Test(description = "WELD-319")
+ /*
+ * description = "WELD-319"
+ */
+ @Test
public void testBeansXmlMultipleEnabling()
{
MockBeanDeploymentArchive jar1 = new MockBeanDeploymentArchive("first-jar", Alt.class);
@@ -82,9 +88,9 @@
BeanManagerImpl warBeanManager = container.getBeanManager();
BeanManagerImpl jar1BeanManager = container.getLifecycle().getBootstrap().getManager(jar1);
BeanManagerImpl jar2BeanManager = container.getLifecycle().getBootstrap().getManager(jar2);
- assert warBeanManager.getEnabledClasses().getAlternativeClasses().isEmpty();
- assert !jar1BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty();
- assert !jar2BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty();
+ Assert.assertTrue(warBeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
+ Assert.assertFalse(jar1BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
+ Assert.assertFalse(jar2BeanManager.getEnabledClasses().getAlternativeClasses().isEmpty());
}
finally
{
@@ -95,7 +101,10 @@
}
}
- @Test(description = "WELD-236")
+ /*
+ * description = "WELD-236"
+ */
+ @Test
public void testTypicalEarStructure()
{
@@ -129,15 +138,15 @@
BeanManagerImpl warBeanManager = container.getBeanManager();
BeanManagerImpl ejbJarBeanManager = container.getLifecycle().getBootstrap().getManager(ejbJar);
- assert warBeanManager.getBeans(Bar.class).size() == 1;
- assert warBeanManager.getBeans(Foo.class).size() == 1;
- assert ejbJarBeanManager.getBeans(Foo.class).size() == 1;
- assert ejbJarBeanManager.getBeans(Bar.class).size() == 0;
+ Assert.assertEquals(1, warBeanManager.getBeans(Bar.class).size());
+ Assert.assertEquals(1, warBeanManager.getBeans(Foo.class).size());
+ Assert.assertEquals(1, ejbJarBeanManager.getBeans(Foo.class).size());
+ Assert.assertEquals(0, ejbJarBeanManager.getBeans(Bar.class).size());
Bar bar = Utils.getReference(warBeanManager, Bar.class);
- assert bar.getFoo() != null;
- assert bar.getBeanManager() != null;
- assert bar.getBeanManager().equals(warBeanManager);
- assert bar.getFoo().getBeanManager().equals(ejbJarBeanManager);
+ Assert.assertNotNull(bar.getFoo());
+ Assert.assertNotNull(bar.getBeanManager());
+ Assert.assertEquals(warBeanManager, bar.getBeanManager());
+ Assert.assertEquals(ejbJarBeanManager, bar.getFoo().getBeanManager());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/deployment/structure/resolution/AccessibleManagerResolutionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -37,8 +37,9 @@
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.serialization.ContextualStoreImpl;
import org.jboss.weld.serialization.spi.ContextualStore;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
public class AccessibleManagerResolutionTest
{
@@ -46,7 +47,7 @@
private ClassTransformer classTransformer;
private ServiceRegistry services;
- @BeforeMethod
+ @Before
public void beforeMethod()
{
this.classTransformer = new ClassTransformer(new TypeStore());
@@ -73,14 +74,14 @@
Container.initialize(root, services);
BeanManagerImpl child = BeanManagerImpl.newRootManager("child", services, new EnabledClasses());
addBean(root, Cow.class);
- assert root.getBeans(Cow.class).size() == 1;
- assert child.getBeans(Cow.class).size() == 0;
+ Assert.assertEquals(1, root.getBeans(Cow.class).size());
+ Assert.assertEquals(0, child.getBeans(Cow.class).size());
child.addAccessibleBeanManager(root);
Set<Bean<?>> beans = child.getBeans(Cow.class);
- assert child.getBeans(Cow.class).size() == 1;
+ Assert.assertEquals(1, child.getBeans(Cow.class).size());
addBean(child, Chicken.class);
- assert child.getBeans(Chicken.class).size() == 1;
- assert root.getBeans(Chicken.class).size() == 0;
+ Assert.assertEquals(1, child.getBeans(Chicken.class).size());
+ Assert.assertEquals(0, root.getBeans(Chicken.class).size());
}
@Test
@@ -101,28 +102,28 @@
addBean(child, Chicken.class);
addBean(grandchild, Pig.class);
addBean(child1, Horse.class);
- assert root.getBeans(Pig.class).size() == 0;
- assert root.getBeans(Chicken.class).size() == 0;
- assert root.getBeans(Cow.class).size() == 1;
- assert root.getBeans(Horse.class).size() == 0;
- assert root.getBeans(Cat.class).size() == 0;
- assert child.getBeans(Pig.class).size() == 0;
- assert child.getBeans(Chicken.class).size() == 1;
- assert child.getBeans(Cow.class).size() == 1;
- assert child.getBeans(Horse.class).size() == 0;
- assert child.getBeans(Cat.class).size() == 0;
- assert child1.getBeans(Cow.class).size() == 0;
- assert child1.getBeans(Horse.class).size() == 1;
- assert grandchild.getBeans(Pig.class).size() == 1;
- assert grandchild.getBeans(Chicken.class).size() == 1;
- assert grandchild.getBeans(Cow.class).size() == 1;
- assert grandchild.getBeans(Horse.class).size() ==1;
- assert grandchild.getBeans(Cat.class).size() == 0;
- assert greatGrandchild.getBeans(Pig.class).size() == 1;
- assert greatGrandchild.getBeans(Chicken.class).size() == 1;
- assert greatGrandchild.getBeans(Cow.class).size() == 1;
- assert greatGrandchild.getBeans(Horse.class).size() ==1;
- assert greatGrandchild.getBeans(Cat.class).size() == 1;
+ Assert.assertEquals(0, root.getBeans(Pig.class).size());
+ Assert.assertEquals(0, root.getBeans(Chicken.class).size());
+ Assert.assertEquals(1, root.getBeans(Cow.class).size());
+ Assert.assertEquals(0, root.getBeans(Horse.class).size());
+ Assert.assertEquals(0, root.getBeans(Cat.class).size());
+ Assert.assertEquals(0, child.getBeans(Pig.class).size());
+ Assert.assertEquals(1, child.getBeans(Chicken.class).size());
+ Assert.assertEquals(1, child.getBeans(Cow.class).size());
+ Assert.assertEquals(0, child.getBeans(Horse.class).size());
+ Assert.assertEquals(0, child.getBeans(Cat.class).size());
+ Assert.assertEquals(0, child1.getBeans(Cow.class).size());
+ Assert.assertEquals(1, child1.getBeans(Horse.class).size());
+ Assert.assertEquals(1, grandchild.getBeans(Pig.class).size());
+ Assert.assertEquals(1, grandchild.getBeans(Chicken.class).size());
+ Assert.assertEquals(1, grandchild.getBeans(Cow.class).size());
+ Assert.assertEquals(1, grandchild.getBeans(Horse.class).size());
+ Assert.assertEquals(0, grandchild.getBeans(Cat.class).size());
+ Assert.assertEquals(1, greatGrandchild.getBeans(Pig.class).size());
+ Assert.assertEquals(1, greatGrandchild.getBeans(Chicken.class).size());
+ Assert.assertEquals(1, greatGrandchild.getBeans(Cow.class).size());
+ Assert.assertEquals(1, greatGrandchild.getBeans(Horse.class).size());
+ Assert.assertEquals(1, greatGrandchild.getBeans(Cat.class).size());
}
@Test
@@ -138,15 +139,15 @@
addBean(root, Cow.class);
addBean(child, Chicken.class);
addBean(grandchild, Pig.class);
- assert root.getBeans(Pig.class).size() == 0;
- assert root.getBeans(Chicken.class).size() == 0;
- assert root.getBeans(Cow.class).size() == 1;
- assert child.getBeans(Pig.class).size() == 0;
- assert child.getBeans(Chicken.class).size() == 1;
- assert child.getBeans(Cow.class).size() == 1;
- assert grandchild.getBeans(Pig.class).size() == 1;
- assert grandchild.getBeans(Chicken.class).size() == 1;
- assert grandchild.getBeans(Cow.class).size() == 1;
+ Assert.assertEquals(0, root.getBeans(Pig.class).size());
+ Assert.assertEquals(0, root.getBeans(Chicken.class).size());
+ Assert.assertEquals(1, root.getBeans(Cow.class).size());
+ Assert.assertEquals(0, child.getBeans(Pig.class).size());
+ Assert.assertEquals(1, child.getBeans(Chicken.class).size());
+ Assert.assertEquals(1, child.getBeans(Cow.class).size());
+ Assert.assertEquals(1, grandchild.getBeans(Pig.class).size());
+ Assert.assertEquals(1, grandchild.getBeans(Chicken.class).size());
+ Assert.assertEquals(1, grandchild.getBeans(Cow.class).size());
}
@Test
@@ -163,15 +164,15 @@
addBean(root, Cow.class);
addBean(child, Chicken.class);
addBean(grandchild, Pig.class);
- assert root.getBeans(Pig.class).size() == 1;
- assert root.getBeans(Chicken.class).size() == 1;
- assert root.getBeans(Cow.class).size() == 1;
- assert child.getBeans(Pig.class).size() == 1;
- assert child.getBeans(Chicken.class).size() == 1;
- assert child.getBeans(Cow.class).size() == 1;
- assert grandchild.getBeans(Pig.class).size() == 1;
- assert grandchild.getBeans(Chicken.class).size() == 1;
- assert grandchild.getBeans(Cow.class).size() == 1;
+ Assert.assertEquals(1, root.getBeans(Pig.class).size());
+ Assert.assertEquals(1, root.getBeans(Chicken.class).size());
+ Assert.assertEquals(1, root.getBeans(Cow.class).size());
+ Assert.assertEquals(1, child.getBeans(Pig.class).size());
+ Assert.assertEquals(1, child.getBeans(Chicken.class).size());
+ Assert.assertEquals(1, child.getBeans(Cow.class).size());
+ Assert.assertEquals(1, grandchild.getBeans(Pig.class).size());
+ Assert.assertEquals(1, grandchild.getBeans(Chicken.class).size());
+ Assert.assertEquals(1, grandchild.getBeans(Cow.class).size());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/environments/servlet)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletEnvironmentTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -30,18 +30,19 @@
import org.jboss.weld.mock.MockServletLifecycle;
import org.jboss.weld.mock.TestContainer;
import org.jboss.weld.test.Utils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
public class ServletEnvironmentTest
{
- private TestContainer container;
- private BeanManagerImpl manager;
+ private static TestContainer container;
+ private static BeanManagerImpl manager;
@BeforeClass
- public void beforeClass() throws Throwable
+ public static void beforeClass() throws Throwable
{
container = new TestContainer(new MockServletLifecycle(), Arrays.asList(Animal.class, DeadlyAnimal.class, DeadlySpider.class, DeadlyAnimal.class, Hound.class, HoundLocal.class, Salmon.class, ScottishFish.class, SeaBass.class, Sole.class, Spider.class, Tarantula.class, TarantulaProducer.class, Tuna.class), null);
container.startContainer();
@@ -49,8 +50,8 @@
manager = container.getBeanManager();
}
- @AfterClass(alwaysRun=true)
- public void afterClass() throws Exception
+ @AfterClass
+ public static void afterClass() throws Exception
{
container.stopContainer();
container = null;
@@ -68,15 +69,15 @@
beans.put(((RIBean<?>) bean).getType(), bean);
}
}
- assert beans.containsKey(Tuna.class);
- assert beans.containsKey(Salmon.class);
- assert beans.containsKey(SeaBass.class);
- assert beans.containsKey(Sole.class);
+ Assert.assertTrue(beans.containsKey(Tuna.class));
+ Assert.assertTrue(beans.containsKey(Salmon.class));
+ Assert.assertTrue(beans.containsKey(SeaBass.class));
+ Assert.assertTrue(beans.containsKey(Sole.class));
- assert beans.get(Tuna.class) instanceof ManagedBean<?>;
- assert beans.get(Salmon.class) instanceof ManagedBean<?>;
- assert beans.get(SeaBass.class) instanceof ManagedBean<?>;
- assert beans.get(Sole.class) instanceof ManagedBean<?>;
+ Assert.assertTrue(beans.get(Tuna.class) instanceof ManagedBean<?>);
+ Assert.assertTrue(beans.get(Salmon.class) instanceof ManagedBean<?>);
+ Assert.assertTrue(beans.get(SeaBass.class) instanceof ManagedBean<?>);
+ Assert.assertTrue(beans.get(Sole.class) instanceof ManagedBean<?>);
Utils.getReference(manager, Sole.class, new AnnotationLiteral<Whitefish>() {}).ping();
}
@@ -91,12 +92,12 @@
beans.put(((RIBean<?>) bean).getType(), bean);
}
}
- assert beans.containsKey(TarantulaProducer.class);
- assert beans.containsKey(Tarantula.class);
+ Assert.assertTrue(beans.containsKey(TarantulaProducer.class));
+ Assert.assertTrue(beans.containsKey(Tarantula.class));
beans.get(TarantulaProducer.class);
- assert beans.get(TarantulaProducer.class) instanceof ManagedBean<?>;
+ Assert.assertTrue(beans.get(TarantulaProducer.class) instanceof ManagedBean<?>);
Utils.getReference(manager, Tarantula.class, new AnnotationLiteral<Tame>() {}).ping();
}
@@ -111,8 +112,8 @@
classes.put(((RIBean<?>) bean).getType(), bean);
}
}
- assert classes.containsKey(Hound.class);
- assert classes.get(Hound.class) instanceof ManagedBean<?>;
+ Assert.assertTrue(classes.containsKey(Hound.class));
+ Assert.assertTrue(classes.get(Hound.class) instanceof ManagedBean<?>);
Utils.getReference(manager, HoundLocal.class, new AnnotationLiteral<Tame>() {}).ping();
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletLifecycleTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletLifecycleTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/environments/servlet/ServletLifecycleTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -16,10 +16,18 @@
*/
package org.jboss.weld.tests.unit.environments.servlet;
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.BeanArchive;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.weld.test.Utils;
+import org.jboss.weld.tests.category.Broken;
+import org.jboss.weld.tests.resolution.wbri293.ContextualReferenceTest;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
/**
* A set of tests that validates that the contexts are properly created and
@@ -35,11 +43,16 @@
*
* @author Dan Allen
*/
-@Artifact
-public class ServletLifecycleTest extends AbstractWeldTest
+(a)RunWith(Arquillian.class)
+public class ServletLifecycleTest
{
+ @Deployment
+ public static Archive<?> deploy()
+ {
+ return ShrinkWrap.create(BeanArchive.class);
+ }
- @Test(groups = "broken")
+ @Test
public void testEndSessionWithActiveRequestAndSessionContexts()
{
// ServletLifecycle servletLifecycle = new ServletLifecycle(new ContextLifecycle());
@@ -57,7 +70,8 @@
// assert Boolean.TRUE.equals(RequestContext.instance().isActive()) : "Request context should still be active";
}
- @Test(groups = "broken")
+ @Test
+ @Category(Broken.class)
public void testEndSessionWithActiveRequestContextOnly()
{
// ServletLifecycle servletLifecycle = new ServletLifecycle(new ContextLifecycle());
@@ -71,7 +85,8 @@
// assert Boolean.TRUE.equals(RequestContext.instance().isActive()) : "Request context should still be active";
}
- @Test(groups = "broken")
+ @Test
+ @Category(Broken.class)
public void testEndSessionWithNoActiveRequestOrSessionContexts()
{
// ServletLifecycle servletLifecycle = new ServletLifecycle(new ContextLifecycle());
@@ -82,7 +97,8 @@
// assert Boolean.FALSE.equals(RequestContext.instance().isActive()) : "Temporary request context should have been deactivated";
}
- @BeforeMethod(groups = "broken")
+ @Before
+ @Category(Broken.class)
public void beforeMethod()
{
// RequestContext.instance().setBeanStore(null);
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/jsf (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/jsf)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/jsf/JsfApiAbstractionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/jsf/JsfApiAbstractionTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/jsf/JsfApiAbstractionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -24,7 +24,8 @@
import org.jboss.weld.resources.spi.ResourceLoader;
import org.jboss.weld.resources.spi.ResourceLoadingException;
import org.jboss.weld.util.ApiAbstraction.Dummy;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author Dan Allen
@@ -36,32 +37,32 @@
public void testDetectsJsf12Version()
{
JsfApiAbstraction abstraction = new JsfApiAbstraction(getResourceLoaderHidingJsf20Classes());
- assert abstraction.MINIMUM_API_VERSION == 1.2;
- assert abstraction.isApiVersionCompatibleWith(2.0) == false;
+ Assert.assertEquals(1.2, abstraction.MINIMUM_API_VERSION, 0);
+ Assert.assertFalse(abstraction.isApiVersionCompatibleWith(2.0));
}
@Test
public void testLoadsJsf12Classes()
{
JsfApiAbstraction abstraction = new JsfApiAbstraction(getResourceLoaderHidingJsf20Classes());
- assert FacesContext.class.equals(abstraction.FACES_CONTEXT);
- assert Dummy.class.equals(abstraction.BEHAVIOR_CLASS);
+ Assert.assertEquals(FacesContext.class, abstraction.FACES_CONTEXT);
+ Assert.assertEquals(Dummy.class, abstraction.BEHAVIOR_CLASS);
}
@Test
public void testDetectsJsf20Version()
{
JsfApiAbstraction abstraction = new JsfApiAbstraction(getResourceLoader());
- assert abstraction.MINIMUM_API_VERSION == 2.0;
- assert abstraction.isApiVersionCompatibleWith(2.0);
+ Assert.assertEquals(2.0, abstraction.MINIMUM_API_VERSION, 0);
+ Assert.assertTrue(abstraction.isApiVersionCompatibleWith(2.0));
}
@Test
public void testLoadsJsf20Classes()
{
JsfApiAbstraction abstraction = new JsfApiAbstraction(getResourceLoader());
- assert FacesContext.class.equals(abstraction.FACES_CONTEXT);
- assert Behavior.class.equals(abstraction.BEHAVIOR_CLASS);
+ Assert.assertEquals(FacesContext.class, abstraction.FACES_CONTEXT);
+ Assert.assertEquals(Behavior.class, abstraction.BEHAVIOR_CLASS);
}
private ResourceLoader getResourceLoader()
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/annotation/AnnotationTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -23,7 +23,8 @@
import java.io.ObjectOutputStream;
import java.lang.reflect.Method;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
@Synchronous
public class AnnotationTest
@@ -41,7 +42,7 @@
{
Method method = Quality.class.getMethod("value");
Object value = method.getDefaultValue();
- assert value.equals("very");
+ Assert.assertEquals("very", value);
}
protected byte[] serialize(Object instance) throws IOException
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/clazz)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/WeldClassTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/WeldClassTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/clazz/WeldClassTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -24,34 +24,46 @@
import javax.enterprise.inject.spi.AnnotatedType;
import javax.inject.Qualifier;
-import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.weld.introspector.WeldClass;
import org.jboss.weld.introspector.jlr.WeldClassImpl;
import org.jboss.weld.metadata.TypeStore;
import org.jboss.weld.resources.ClassTransformer;
-import org.testng.annotations.Test;
+import org.jboss.weld.tests.category.Broken;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
-@Artifact
+//@Artifact
public class WeldClassTest
{
private final ClassTransformer transformer = new ClassTransformer(new TypeStore());
- @Test(groups = "broken", description="WELD-216")
+ /*
+ * description = "WELD-216"
+ */
+ @Test
+ @Category(Broken.class)
public void testMemberClassWithGenericTypes()
{
AnnotatedType at = WeldClassImpl.of(new Kangaroo().procreate().getClass(), transformer);
WeldClassImpl.of(at, transformer);
}
- @Test(description="WELD-216")
+ /*
+ * description = "WELD-216"
+ */
+ @Test
public void testLocalClassWithGenericTypes()
{
AnnotatedType at = WeldClassImpl.of(new Koala().procreate().getClass(), transformer);
WeldClassImpl.of(at, transformer);
}
- @Test(description="WELD-216")
+ /*
+ * description = "WELD-216"
+ */
+ @Test
public void testAnonymousClassWithGenericTypes()
{
AnnotatedType at = WeldClassImpl.of(new Possum().procreate().getClass(), transformer);
@@ -62,9 +74,9 @@
public void testDeclaredAnnotations()
{
WeldClass<Order> annotatedElement = WeldClassImpl.of(Order.class, transformer);
- assert annotatedElement.getAnnotations().size() == 1;
- assert annotatedElement.getAnnotation(Random.class) != null;
- assert annotatedElement.getJavaClass().equals(Order.class);
+ Assert.assertEquals(1, annotatedElement.getAnnotations().size());
+ Assert.assertNotNull(annotatedElement.getAnnotation(Random.class));
+ Assert.assertEquals(Order.class, annotatedElement.getJavaClass());
}
@Test
@@ -72,20 +84,20 @@
{
WeldClass<Order> annotatedElement = WeldClassImpl.of(Order.class, transformer);
Set<Annotation> annotations = annotatedElement.getMetaAnnotations(Qualifier.class);
- assert annotations.size() == 1;
+ Assert.assertEquals(1, annotations.size());
Iterator<Annotation> it = annotations.iterator();
Annotation production = it.next();
- assert Random.class.equals(production.annotationType());
+ Assert.assertEquals(Random.class, production.annotationType());
}
@Test
public void testEmpty()
{
WeldClass<Order> annotatedElement = WeldClassImpl.of(Order.class, transformer);
- assert annotatedElement.getAnnotation(Stereotype.class) == null;
- assert annotatedElement.getMetaAnnotations(Stereotype.class).size() == 0;
+ Assert.assertNull(annotatedElement.getAnnotation(Stereotype.class));
+ Assert.assertEquals(0, annotatedElement.getMetaAnnotations(Stereotype.class).size());
WeldClass<Antelope> classWithNoAnnotations = WeldClassImpl.of(Antelope.class, transformer);
- assert classWithNoAnnotations.getAnnotations().size() == 0;
+ Assert.assertEquals(0, classWithNoAnnotations.getAnnotations().size());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/method)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/WeldMethodTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/reflection/method/WeldMethodTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/reflection/method/WeldMethodTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -24,7 +24,8 @@
import org.jboss.weld.introspector.jlr.WeldMethodImpl;
import org.jboss.weld.metadata.TypeStore;
import org.jboss.weld.resources.ClassTransformer;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
public class WeldMethodTest
{
@@ -32,12 +33,15 @@
private final ClassTransformer transformer = new ClassTransformer(new TypeStore());
private final Class<Choice<?, ?>> CHOICE_LITERAL = new TypeLiteral<Choice<?, ?>>() {}.getRawType();
- @Test(description = "WELD-221")
+ /*
+ * description = "WELD-221"
+ */
+ @Test
public void testMethodReturnsGenericTypeOfClass() throws Exception
{
WeldClass<Choice<?, ?>> clazz = WeldClassImpl.of(CHOICE_LITERAL, transformer);
WeldMethod<Choice<?, ?>, Choice<?, ?>> method = WeldMethodImpl.of(Choice.class.getMethod("aMethod"), clazz, transformer);
- assert method.getTypeClosure().size() == 3;
+ Assert.assertEquals(3, method.getTypeClosure().size());
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/security)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/ReflectionTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/security/ReflectionTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/ReflectionTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -23,7 +23,8 @@
import java.lang.reflect.Method;
import org.jboss.weld.util.reflection.SecureReflections;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
public class ReflectionTest
{
@@ -31,10 +32,10 @@
@Test
public void testGetField() throws NoSuchFieldException
{
- assert SecureReflections.getField(TestObject.class, "publicField") != null;
+ Assert.assertNotNull(SecureReflections.getField(TestObject.class, "publicField"));
}
- @Test(expectedExceptions = NoSuchFieldException.class)
+ @Test(expected = NoSuchFieldException.class)
public void testGetFieldNotFound() throws NoSuchFieldException
{
SecureReflections.getField(TestObject.class, "eioota");
@@ -43,10 +44,10 @@
@Test
public void testGetDeclaredField() throws SecurityException, NoSuchFieldException
{
- assert SecureReflections.getDeclaredField(TestObject.class, "publicField") != null;
+ Assert.assertNotNull(SecureReflections.getDeclaredField(TestObject.class, "publicField"));
}
- @Test(expectedExceptions = NoSuchFieldException.class)
+ @Test(expected = NoSuchFieldException.class)
public void testGetDeclaredFieldNotFound() throws NoSuchFieldException
{
SecureReflections.getDeclaredField(TestObject.class, "eioota");
@@ -55,13 +56,13 @@
@Test
public void testGetFields()
{
- assert SecureReflections.getFields(TestObject.class).length == 1;
+ Assert.assertEquals(1, SecureReflections.getFields(TestObject.class).length);
}
@Test
public void testGetDeclaredFields()
{
- assert SecureReflections.getDeclaredFields(TestObject.class).length == 2;
+ Assert.assertEquals(2, SecureReflections.getDeclaredFields(TestObject.class).length);
}
@Test
@@ -90,7 +91,7 @@
{
if (!object.isAccessible())
{
- assert false;
+ Assert.fail();
}
}
}
@@ -98,10 +99,10 @@
@Test
public void testGetMethod() throws NoSuchMethodException
{
- assert SecureReflections.getMethod(TestObject.class, "publicTest", new Class<?>[] { String.class }) != null;
+ Assert.assertNotNull(SecureReflections.getMethod(TestObject.class, "publicTest", new Class<?>[] { String.class }));
}
- @Test(expectedExceptions = NoSuchMethodException.class)
+ @Test(expected = NoSuchMethodException.class)
public void testGetMethodNotFound() throws NoSuchMethodException
{
SecureReflections.getMethod(TestObject.class, "xpublicTest", new Class<?>[] { String.class });
@@ -110,10 +111,10 @@
@Test
public void testGetDeclaredMethod() throws NoSuchMethodException
{
- assert SecureReflections.getDeclaredMethod(TestObject.class, "publicTest", new Class<?>[] { String.class }) != null;
+ Assert.assertNotNull(SecureReflections.getDeclaredMethod(TestObject.class, "publicTest", new Class<?>[] { String.class }));
}
- @Test(expectedExceptions = NoSuchMethodException.class)
+ @Test(expected = NoSuchMethodException.class)
public void testGetDeclaredMethodNotFound() throws NoSuchMethodException
{
SecureReflections.getDeclaredMethod(TestObject.class, "xpublicTest", new Class<?>[] { String.class });
@@ -122,13 +123,13 @@
@Test
public void testGetMethods()
{
- assert SecureReflections.getMethods(TestObject.class).length == 10;
+ Assert.assertEquals(10, SecureReflections.getMethods(TestObject.class).length);
}
@Test
public void testGetDeclaredMethods()
{
- assert SecureReflections.getDeclaredMethods(TestObject.class).length == 2;
+ Assert.assertEquals(2, SecureReflections.getDeclaredMethods(TestObject.class).length);
}
@Test
@@ -140,10 +141,10 @@
@Test
public void testGetConstructor() throws NoSuchMethodException
{
- assert SecureReflections.getConstructor(TestObject.class, new Class<?>[] { Integer.class }) != null;
+ Assert.assertNotNull(SecureReflections.getConstructor(TestObject.class, new Class<?>[] { Integer.class }));
}
- @Test(expectedExceptions = NoSuchMethodException.class)
+ @Test(expected = NoSuchMethodException.class)
public void testGetConstructorNotFound() throws NoSuchMethodException
{
SecureReflections.getConstructor(TestObject.class, new Class<?>[] { Float.class });
@@ -152,10 +153,10 @@
@Test
public void testGetDeclaredConstructor() throws NoSuchMethodException
{
- assert SecureReflections.getDeclaredConstructor(TestObject.class, new Class<?>[] { String.class }) != null;
+ Assert.assertNotNull(SecureReflections.getDeclaredConstructor(TestObject.class, new Class<?>[] { String.class }));
}
- @Test(expectedExceptions = NoSuchMethodException.class)
+ @Test(expected = NoSuchMethodException.class)
public void testGetDeclaredConstructorNotFound() throws NoSuchMethodException
{
SecureReflections.getDeclaredConstructor(TestObject.class, new Class<?>[] { Float.class });
@@ -164,13 +165,13 @@
@Test
public void testGetConstructors()
{
- assert SecureReflections.getConstructors(TestObject.class).length == 2;
+ Assert.assertEquals(2, SecureReflections.getConstructors(TestObject.class).length);
}
@Test
public void testGetDeclaredConstructors()
{
- assert SecureReflections.getDeclaredConstructors(TestObject.class).length == 3;
+ Assert.assertEquals(3, SecureReflections.getDeclaredConstructors(TestObject.class).length);
}
@Test
@@ -182,7 +183,7 @@
@Test
public void testNewInstance() throws InstantiationException, IllegalAccessException
{
- assert SecureReflections.newInstance(TestObject.class) != null;
+ Assert.assertNotNull(SecureReflections.newInstance(TestObject.class));
}
@Test
@@ -190,20 +191,18 @@
{
TestObject to = new TestObject();
Method m = TestObject.class.getMethod("publicTest", new Class<?>[] { String.class });
- assert SecureReflections.invoke(to, m, "").equals("foo");
+ Assert.assertEquals("foo", SecureReflections.invoke(to, m, ""));
}
@Test
public void testLookupMethod() throws NoSuchMethodException
{
- assert SecureReflections.lookupMethod(TestObject.class, "rootOfAllEvil", new Class<?>[]{}) != null;
+ Assert.assertNotNull(SecureReflections.lookupMethod(TestObject.class, "rootOfAllEvil", new Class<?>[]{}));
}
- @Test(expectedExceptions = NoSuchMethodException.class)
+ @Test(expected = NoSuchMethodException.class)
public void testLookupMethodNotFound() throws NoSuchMethodException
{
- assert SecureReflections.lookupMethod(TestObject.class, "eioota", new Class<?>[]{}) != null;
+ Assert.assertNotNull(SecureReflections.lookupMethod(TestObject.class, "eioota", new Class<?>[]{}));
}
-
-
}
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/SecurityTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/security/SecurityTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/security/SecurityTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -18,7 +18,8 @@
import java.lang.reflect.Field;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
/**
* @author pmuir
@@ -33,11 +34,11 @@
public void testSetAccessibleDoesNotPropagate() throws Exception
{
Field field = SecurityTest.class.getDeclaredField("foo");
- assert !field.isAccessible();
+ Assert.assertFalse(field.isAccessible());
field.setAccessible(true);
- assert field.isAccessible();
- assert !SecurityTest.class.getDeclaredField("foo").isAccessible();
- assert SecurityTest.class.getDeclaredField("foo") != SecurityTest.class.getDeclaredField("foo");
+ Assert.assertTrue(field.isAccessible());
+ Assert.assertFalse(SecurityTest.class.getDeclaredField("foo").isAccessible());
+ Assert.assertFalse(SecurityTest.class.getDeclaredField("foo") == SecurityTest.class.getDeclaredField("foo"));
}
}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/util)
Modified: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/AnnotatedTypesTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/unit/util/AnnotatedTypesTest.java 2010-07-28 19:55:56 UTC (rev 6828)
+++ core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/unit/util/AnnotatedTypesTest.java 2010-07-28 22:23:21 UTC (rev 6832)
@@ -31,7 +31,8 @@
import org.jboss.weld.resources.ClassTransformer;
import org.jboss.weld.tests.util.annotated.TestAnnotatedTypeBuilder;
import org.jboss.weld.util.AnnotatedTypes;
-import org.testng.annotations.Test;
+import org.junit.Assert;
+import org.junit.Test;
/**
* Test comparison and id creation for AnnotatedTypes
@@ -51,7 +52,7 @@
ClassTransformer ct =new ClassTransformer(ts);
WeldClass<Chair> chair1 = WeldClassImpl.of(Chair.class,ct);
WeldClass<Chair> chair2 = WeldClassImpl.of(Chair.class,ct);
- assert AnnotatedTypes.compareAnnotatedTypes(chair1, chair2);
+ Assert.assertTrue(AnnotatedTypes.compareAnnotatedTypes(chair1, chair2));
//check that a different implementation of annotated type is equal to the weld implementation
TestAnnotatedTypeBuilder<Chair> builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
@@ -59,7 +60,7 @@
builder.addToField(Chair.class.getField("legs"), new ProducesLiteral());
builder.addToMethod(Chair.class.getMethod("sit"), new ProducesLiteral());
AnnotatedType<Chair> chair3 = builder.create();
- assert AnnotatedTypes.compareAnnotatedTypes(chair1, chair3);
+ Assert.assertTrue(AnnotatedTypes.compareAnnotatedTypes(chair1, chair3));
//check that the implementation returns false if a field annotation changes
builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
@@ -67,7 +68,7 @@
builder.addToField(Chair.class.getField("legs"), new DefaultLiteral());
builder.addToMethod(Chair.class.getMethod("sit"), new ProducesLiteral());
chair3 = builder.create();
- assert !AnnotatedTypes.compareAnnotatedTypes(chair1, chair3);
+ Assert.assertFalse(AnnotatedTypes.compareAnnotatedTypes(chair1, chair3));
//check that the implementation returns false if a class level annotation changes
builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
@@ -75,7 +76,7 @@
builder.addToField(Chair.class.getField("legs"), new DefaultLiteral());
builder.addToMethod(Chair.class.getMethod("sit"), new ProducesLiteral());
chair3 = builder.create();
- assert !AnnotatedTypes.compareAnnotatedTypes(chair1, chair3);
+ Assert.assertFalse(AnnotatedTypes.compareAnnotatedTypes(chair1, chair3));
}
@@ -87,20 +88,23 @@
AnnotatedType<Chair> chair3 = builder.create();
AnnotatedField<? super Chair> field = chair3.getFields().iterator().next();
String id = AnnotatedTypes.createFieldId(field);
- assert "org.jboss.weld.tests.unit.util.Chair.legs[(a)javax.enterprise.inject.Produces()]".equals(id): "wrong id for field :" + id;
+ Assert.assertEquals("wrong id for field :" + id,
+ "org.jboss.weld.tests.unit.util.Chair.legs[(a)javax.enterprise.inject.Produces()]", id);
builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
chair3 = builder.create();
field = chair3.getFields().iterator().next();
id = AnnotatedTypes.createFieldId(field);
- assert "org.jboss.weld.tests.unit.util.Chair.legs".equals(id) : "wrong id for field :" + id;
+ Assert.assertEquals("wrong id for field :" + id,
+ "org.jboss.weld.tests.unit.util.Chair.legs", id);
builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
builder.addToField(Chair.class.getField("legs"), new ComfyChairLiteral());
chair3 = builder.create();
field = chair3.getFields().iterator().next();
id = AnnotatedTypes.createFieldId(field);
- assert "org.jboss.weld.tests.unit.util.Chair.legs[(a)org.jboss.weld.tests.unit.util.ComfyChair(softness=1)]".equals(id) : "wrong id for field :" + id;
+ Assert.assertEquals("wrong id for field :" + id,
+ "org.jboss.weld.tests.unit.util.Chair.legs[(a)org.jboss.weld.tests.unit.util.ComfyChair(softness=1)]", id);
}
@Test
@@ -113,7 +117,8 @@
AnnotatedMethod<? super Chair> method = it.next();
while(!method.getJavaMember().getName().equals("sit"))method = it.next();
String id = AnnotatedTypes.createCallableId(method);
- assert "org.jboss.weld.tests.unit.util.Chair.sit[(a)javax.enterprise.inject.Produces()]()".equals(id): "wrong id for method :" + id;
+ Assert.assertEquals("wrong id for method :" + id,
+ "org.jboss.weld.tests.unit.util.Chair.sit[(a)javax.enterprise.inject.Produces()]()", id);
builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
chair3 = builder.create();
@@ -121,7 +126,8 @@
method = it.next();
while(!method.getJavaMember().getName().equals("sit"))method = it.next();
id = AnnotatedTypes.createCallableId(method);
- assert "org.jboss.weld.tests.unit.util.Chair.sit()".equals(id) : "wrong id for method :" + id;
+ Assert.assertEquals("wrong id for method :" + id,
+ "org.jboss.weld.tests.unit.util.Chair.sit()", id);
builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
builder.addToMethod(Chair.class.getMethod("sit"), new ComfyChairLiteral());
@@ -130,7 +136,8 @@
method = it.next();
while(!method.getJavaMember().getName().equals("sit"))method = it.next();
id = AnnotatedTypes.createCallableId(method);
- assert "org.jboss.weld.tests.unit.util.Chair.sit[(a)org.jboss.weld.tests.unit.util.ComfyChair(softness=1)]()".equals(id) : "wrong id for method :" + id;
+ Assert.assertEquals("wrong id for method :" + id,
+ "org.jboss.weld.tests.unit.util.Chair.sit[(a)org.jboss.weld.tests.unit.util.ComfyChair(softness=1)]()", id);
}
@Test
@@ -140,18 +147,21 @@
builder.addToMethod(Chair.class.getMethod("sit"), new ProducesLiteral());
AnnotatedType<Chair> chair3 = builder.create();
String id = AnnotatedTypes.createTypeId(chair3);
- assert "org.jboss.weld.tests.unit.util.Chair{org.jboss.weld.tests.unit.util.Chair.sit[(a)javax.enterprise.inject.Produces()]();}".equals(id): "wrong id for type :" + id;
+ Assert.assertEquals("wrong id for type :" + id,
+ "org.jboss.weld.tests.unit.util.Chair{org.jboss.weld.tests.unit.util.Chair.sit[(a)javax.enterprise.inject.Produces()]();}", id);
builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
chair3 = builder.create();
id = AnnotatedTypes.createTypeId(chair3);
- assert "org.jboss.weld.tests.unit.util.Chair{}".equals(id) : "wrong id for type :" + id;
+ Assert.assertEquals("wrong id for type :" + id,
+ "org.jboss.weld.tests.unit.util.Chair{}", id);
builder = new TestAnnotatedTypeBuilder<Chair>(Chair.class);
builder.addToMethod(Chair.class.getMethod("sit"), new ComfyChairLiteral());
chair3 = builder.create();
id = AnnotatedTypes.createTypeId(chair3);
- assert "org.jboss.weld.tests.unit.util.Chair{org.jboss.weld.tests.unit.util.Chair.sit[(a)org.jboss.weld.tests.unit.util.ComfyChair(softness=1)]();}".equals(id) : "wrong id for type :" + id;
+ Assert.assertEquals("wrong id for type :" + id,
+ "org.jboss.weld.tests.unit.util.Chair{org.jboss.weld.tests.unit.util.Chair.sit[(a)org.jboss.weld.tests.unit.util.ComfyChair(softness=1)]();}", id);
}
private static class DefaultLiteral extends AnnotationLiteral<Default> implements Default {}
Copied: core/trunk/tests-arquillian/src/test/java/org/jboss/weld/tests/util/annotated (from rev 6828, core/trunk/tests/src/test/java/org/jboss/weld/tests/util/annotated)
Added: core/trunk/tests-arquillian/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/META-INF/services/org.jboss.arquillian.spi.AuxiliaryArchiveAppender 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1 @@
+org.jboss.weld.tests.CategoryArchiveAppender
\ No newline at end of file
Added: core/trunk/tests-arquillian/src/test/resources/arquillian.xml
===================================================================
--- core/trunk/tests-arquillian/src/test/resources/arquillian.xml (rev 0)
+++ core/trunk/tests-arquillian/src/test/resources/arquillian.xml 2010-07-28 22:23:21 UTC (rev 6832)
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+
+<arquillian xmlns="http://jboss.com/arquillian"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jboss="urn:arq:org.jboss.arquillian.container.jbossas.managed_6">
+
+ <engine>
+ <maxDeploymentsBeforeRestart>20</maxDeploymentsBeforeRestart>
+ </engine>
+
+ <jboss:container>
+<!-- <jboss:jbossHome>/home/aslak/dev/servers/jboss-6.0.0.M3/</jboss:jbossHome> --> <!-- default %JBOSS_HOME% -->
+<!-- <jboss:javaHome>/usr/lib/jvm/java-6-openjdk</jboss:javaHome> --> <!-- default %JAVA_HOME% -->
+ </jboss:container>
+
+</arquillian>
Copied: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/decorators/custom (from rev 6828, core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom)
Copied: core/trunk/tests-arquillian/src/test/resources/org/jboss/weld/tests/unit (from rev 6828, core/trunk/tests/src/test/resources/org/jboss/weld/tests/unit)
14 years, 4 months
Weld SVN: r6831 - in core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors: generic and 1 other directories.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2010-07-28 17:33:56 -0400 (Wed, 28 Jul 2010)
New Revision: 6831
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/AbstractMessageProcessor.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/IntegerProcessor.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/SimpleWeldClassTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/StringProcessor.java
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java
Log:
More tests for WELD-568
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/AbstractMessageProcessor.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/AbstractMessageProcessor.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/AbstractMessageProcessor.java 2010-07-28 21:33:56 UTC (rev 6831)
@@ -0,0 +1,30 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, 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.weld.tests.interceptors.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public abstract class AbstractMessageProcessor<I>
+{
+ void process(I input) {
+ // do nothing;
+ }
+
+ abstract I generate();
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/IntegerProcessor.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/IntegerProcessor.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/IntegerProcessor.java 2010-07-28 21:33:56 UTC (rev 6831)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, 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.weld.tests.interceptors.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class IntegerProcessor extends AbstractMessageProcessor<Integer>
+{
+ @Override
+ void process(Integer input)
+ {
+ super.process(input); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ @Override
+ Integer generate()
+ {
+ return 1;
+ }
+}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/SimpleWeldClassTest.java (from rev 6755, core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/SimpleWeldClassTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/SimpleWeldClassTest.java 2010-07-28 21:33:56 UTC (rev 6831)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, 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.weld.tests.interceptors.generic;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.introspector.WeldMethod;
+import org.jboss.weld.introspector.jlr.WeldClassImpl;
+import org.jboss.weld.metadata.TypeStore;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.jboss.weld.util.Beans;
+import org.testng.annotations.Test;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Artifact
+public class SimpleWeldClassTest extends AbstractWeldTest
+{
+
+ @Test(groups = "broken")
+ public void testWeldClassForGenericSuperclass()
+ {
+ WeldClass<StringProcessor> weldClass = WeldClassImpl.of(StringProcessor.class, new ClassTransformer(new TypeStore()));
+ Collection methods = weldClass.getWeldMethods();
+ assert methods.size() == 2;
+ List<WeldMethod<?,?>> interceptableMethods = Beans.getInterceptableMethods(weldClass);
+ assert interceptableMethods.size() == 4;
+ }
+
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/StringProcessor.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/StringProcessor.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/generic/StringProcessor.java 2010-07-28 21:33:56 UTC (rev 6831)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, 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.weld.tests.interceptors.generic;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class StringProcessor extends AbstractMessageProcessor<String>
+{
+ @Override
+ void process(String input)
+ {
+ super.process(input);
+ }
+
+ @Override
+ String generate()
+ {
+ return "1";
+ }
+}
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java 2010-07-28 20:24:32 UTC (rev 6830)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Attacker.java 2010-07-28 21:33:56 UTC (rev 6831)
@@ -28,7 +28,7 @@
// do nothing
}
- public void pass()
+ protected void pass()
{
}
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java 2010-07-28 20:24:32 UTC (rev 6830)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/Player.java 2010-07-28 21:33:56 UTC (rev 6831)
@@ -28,9 +28,10 @@
public void receiveInstructions()
{
-
+
}
+ @Play
public Player cloneMe()
{
return this;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java 2010-07-28 20:24:32 UTC (rev 6830)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/hierarchical/SimpleWeldClassTest.java 2010-07-28 21:33:56 UTC (rev 6831)
@@ -43,7 +43,7 @@
Collection methods = weldClass.getWeldMethods();
assert methods.size() == 4;
List<WeldMethod<?,?>> interceptableMethods = Beans.getInterceptableMethods(weldClass);
- assert methods.size() == 4;
+ assert interceptableMethods.size() == 4;
}
}
14 years, 4 months
Weld SVN: r6830 - core/trunk/tests-arquillian/src/test.
by weld-commits@lists.jboss.org
Author: aslak
Date: 2010-07-28 16:24:32 -0400 (Wed, 28 Jul 2010)
New Revision: 6830
Added:
core/trunk/tests-arquillian/src/test/java/
Log:
WELD-493 Initial structure for new Arquillian tests
14 years, 4 months