[weld-commits] Weld SVN: r5360 - in core/trunk: impl/src/main/java/org/jboss/weld/bean/proxy and 10 other directories.
weld-commits at lists.jboss.org
weld-commits at lists.jboss.org
Fri Dec 18 23:53:37 EST 2009
Author: marius.bogoevici
Date: 2009-12-18 23:53:36 -0500 (Fri, 18 Dec 2009)
New Revision: 5360
Added:
core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/WeldDecorator.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Deployers.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/custom/CustomDecoratorDeploymentObserver.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomWindowFrame.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/InnerWindowFrame.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/OuterWindowFrame.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/WindowImpl.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/AnotherPartialDecorator.java
Removed:
core/trunk/impl/src/main/java/org/jboss/weld/bean/AnnotatedItemProvidingDecoratorWrapper.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/custom/AfterBeanDiscoveryObserver.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomFrame.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/InnerFrame.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/OuterFrame.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java
core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
core/trunk/jboss-tck-runner/src/test/resources/tck-tests.xml
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/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/custom/CustomDecorator.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.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/interceptors/simple/SimpleDecorator.java
core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/beans-custom-only.xml
core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/beans.xml
core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/javax.enterprise.inject.spi.Extension
core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/generic/beans.xml
Log:
WELD-333. Only methods defined on decorated types are decorated.
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/bean/AnnotatedItemProvidingDecoratorWrapper.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AnnotatedItemProvidingDecoratorWrapper.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AnnotatedItemProvidingDecoratorWrapper.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -1,60 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright <Year>, 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;
-
-import javax.enterprise.inject.spi.Decorator;
-
-import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.introspector.WeldClass;
-import org.jboss.weld.resources.ClassTransformer;
-
-/**
- * A wrapper for a decorated instance. Allows to enhance custom decorators with metadata
- * about the WeldClass at deployment time.
- *
- * @author Marius Bogoevici
- */
-public class AnnotatedItemProvidingDecoratorWrapper extends ForwardingDecorator<Object>
-{
- private Decorator<Object> delegate;
- private WeldClass<?> annotatedItem;
-
- public static AnnotatedItemProvidingDecoratorWrapper of(Decorator<?> delegate, BeanManagerImpl beanManager)
- {
- return new AnnotatedItemProvidingDecoratorWrapper((Decorator<Object>) delegate, beanManager);
- }
-
- private AnnotatedItemProvidingDecoratorWrapper(Decorator<Object> delegate, BeanManagerImpl beanManager)
- {
- this.delegate = delegate;
- ClassTransformer transformer = beanManager.getServices().get(ClassTransformer.class);
- Class<?> beanClass = delegate.getBeanClass();
- this.annotatedItem = transformer.loadClass(beanClass);
- }
-
- @Override
- protected Decorator<Object> delegate()
- {
- return delegate;
- }
-
- public WeldClass<?> getAnnotatedItem()
- {
- return annotatedItem;
- }
-}
Copied: core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java (from rev 5312, core/trunk/impl/src/main/java/org/jboss/weld/bean/AnnotatedItemProvidingDecoratorWrapper.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, 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;
+
+import javax.enterprise.inject.spi.Decorator;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.introspector.MethodSignature;
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.Deployers;
+
+import java.util.Set;
+
+/**
+ * A wrapper for a decorated instance. Allows to enhance custom decorators with metadata
+ * about the WeldClass at deployment time.
+ *
+ * @author Marius Bogoevici
+ */
+public class CustomDecoratorWrapper extends ForwardingDecorator<Object> implements WeldDecorator<Object>
+{
+ private Decorator<Object> delegate;
+ private WeldClass<?> annotatedItem;
+
+ private Set<MethodSignature> decoratedMethodSignatures;
+
+ public static CustomDecoratorWrapper of(Decorator<?> delegate, BeanManagerImpl beanManager)
+ {
+ return new CustomDecoratorWrapper((Decorator<Object>) delegate, beanManager);
+ }
+
+ private CustomDecoratorWrapper(Decorator<Object> delegate, BeanManagerImpl beanManager)
+ {
+ this.delegate = delegate;
+ ClassTransformer transformer = beanManager.getServices().get(ClassTransformer.class);
+ Class<?> beanClass = delegate.getBeanClass();
+ this.annotatedItem = transformer.loadClass(beanClass);
+ this.decoratedMethodSignatures = Deployers.getDecoratedMethodSignatures(beanManager, delegate.getDecoratedTypes());
+ }
+
+ @Override
+ protected Decorator<Object> delegate()
+ {
+ return delegate;
+ }
+
+ public WeldClass<?> getAnnotatedItem()
+ {
+ return annotatedItem;
+ }
+
+ public Set<MethodSignature> getDecoratedMethodSignatures()
+ {
+ return decoratedMethodSignatures;
+ }
+
+}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/DecoratorImpl.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -23,7 +23,6 @@
import static org.jboss.weld.logging.messages.BeanMessage.DELEGATE_TYPE_PARAMETER_MISMATCH;
import static org.jboss.weld.logging.messages.BeanMessage.NO_DELEGATE_FOR_DECORATOR;
import static org.jboss.weld.logging.messages.BeanMessage.TOO_MANY_DELEGATES_FOR_DECORATOR;
-import static org.jboss.weld.logging.messages.BeanMessage.UNABLE_TO_PROCESS;
import java.io.Serializable;
import java.lang.annotation.Annotation;
@@ -43,7 +42,6 @@
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.DefinitionException;
-import org.jboss.weld.ForbiddenStateException;
import org.jboss.weld.bean.proxy.AbstractDecoratorMethodHandler;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.injection.MethodInjectionPoint;
@@ -56,16 +54,19 @@
import org.jboss.weld.introspector.jlr.WeldClassImpl;
import org.jboss.weld.introspector.jlr.WeldConstructorImpl;
import org.jboss.weld.resources.ClassTransformer;
+import org.jboss.weld.util.Deployers;
import org.jboss.weld.util.Proxies;
import org.jboss.weld.util.reflection.Reflections;
-public class DecoratorImpl<T> extends ManagedBean<T> implements Decorator<T>
+public class DecoratorImpl<T> extends ManagedBean<T> implements WeldDecorator<T>
{
private WeldClass<?> annotatedDelegateItem;
private WeldClass<T> proxyClassForAbstractDecorators;
private WeldConstructor<T> constructorForAbstractDecorator;
+ private Set<MethodSignature> decoratedMethodSignatures;
+
public static <T> Decorator<T> wrap(final Decorator<T> decorator)
{
return new ForwardingDecorator<T>()
@@ -110,6 +111,7 @@
private Type delegateType;
private Set<Type> delegateTypes;
private Set<Type> decoratedTypes;
+ private HashSet<WeldClass<?>> annotatedDecoratedTypes;
protected DecoratorImpl(WeldClass<T> type, BeanManagerImpl manager)
{
@@ -136,6 +138,8 @@
this.decoratedTypes = new HashSet<Type>();
this.decoratedTypes.addAll(getAnnotatedItem().getInterfaceOnlyFlattenedTypeHierarchy());
this.decoratedTypes.remove(Serializable.class);
+
+ this.decoratedMethodSignatures = Deployers.getDecoratedMethodSignatures(getManager(), this.decoratedTypes);
}
protected void initDelegateInjectionPoint()
@@ -203,11 +207,6 @@
{
throw new DefinitionException(DELEGATE_MUST_SUPPORT_EVERY_DECORATED_TYPE, decoratedType, this );
}
- else
- {
- throw new ForbiddenStateException(UNABLE_TO_PROCESS, decoratedType);
- }
-
}
}
annotatedDelegateItem = WeldClassImpl.of(delegateInjectionPoint.getJavaClass(), manager.getServices().get(ClassTransformer.class));
@@ -307,4 +306,8 @@
return super.getDescription("decorator");
}
+ public Set<MethodSignature> getDecoratedMethodSignatures()
+ {
+ return decoratedMethodSignatures;
+ }
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -388,9 +388,9 @@
DecoratorImpl<?> decoratorBean = (DecoratorImpl<?>) decorator;
decoratorClass = decoratorBean.getAnnotatedItem();
}
- else if (decorator instanceof AnnotatedItemProvidingDecoratorWrapper)
+ else if (decorator instanceof CustomDecoratorWrapper)
{
- decoratorClass = ((AnnotatedItemProvidingDecoratorWrapper) decorator).getAnnotatedItem();
+ decoratorClass = ((CustomDecoratorWrapper) decorator).getAnnotatedItem();
}
else
{
Added: core/trunk/impl/src/main/java/org/jboss/weld/bean/WeldDecorator.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/WeldDecorator.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/WeldDecorator.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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;
+
+import java.util.Set;
+
+import javax.enterprise.inject.spi.Decorator;
+
+import org.jboss.weld.introspector.MethodSignature;
+import org.jboss.weld.introspector.WeldClass;
+
+
+
+/**
+ * Sub-interface of {@link Decorator} that contains metadata information about Weld-deployed
+ * Decorators (including custom decorators).
+ *
+ * @author Marius Bogoevici
+ */
+public interface WeldDecorator<T> extends Decorator<T>
+{
+
+ WeldClass<?> getAnnotatedItem();
+
+ Set<MethodSignature> getDecoratedMethodSignatures();
+
+}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/DecoratorProxyMethodHandler.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -25,8 +25,7 @@
import org.jboss.interceptor.util.proxy.TargetInstanceProxyMethodHandler;
import org.jboss.weld.ForbiddenStateException;
-import org.jboss.weld.bean.AnnotatedItemProvidingDecoratorWrapper;
-import org.jboss.weld.bean.DecoratorImpl;
+import org.jboss.weld.bean.WeldDecorator;
import org.jboss.weld.introspector.MethodSignature;
import org.jboss.weld.introspector.WeldMethod;
import org.jboss.weld.introspector.jlr.MethodSignatureImpl;
@@ -81,26 +80,23 @@
MethodSignature methodSignature = new MethodSignatureImpl(method);
for (SerializableContextualInstance<Decorator<Object>, Object> beanInstance : decoratorInstances)
{
- WeldMethod<?, ?> decoratorMethod;
-
- if (beanInstance.getContextual().get() instanceof DecoratorImpl<?>)
+ if (beanInstance.getContextual().get() instanceof WeldDecorator<?>)
{
- decoratorMethod = ((DecoratorImpl<?>)beanInstance.getContextual().get()).getAnnotatedItem().getWeldMethod(methodSignature);
+ WeldDecorator<?> decorator = (WeldDecorator<?>) beanInstance.getContextual().get();
+ if (decorator.getDecoratedMethodSignatures().contains(methodSignature))
+ {
+ WeldMethod<?, ?> decoratorMethod = decorator.getAnnotatedItem().getWeldMethod(methodSignature);
+ if (decoratorMethod != null)
+ {
+ return decoratorMethod.invokeOnInstance(beanInstance.getInstance(), args);
+ }
+ }
}
- else if (beanInstance.getContextual().get() instanceof AnnotatedItemProvidingDecoratorWrapper)
- {
- decoratorMethod = ((AnnotatedItemProvidingDecoratorWrapper)beanInstance.getContextual().get()).getAnnotatedItem().getWeldMethod(methodSignature);
- }
else
{
throw new ForbiddenStateException(UNEXPECTED_UNWRAPPED_CUSTOM_DECORATOR, beanInstance.getContextual().get());
}
- if (decoratorMethod != null)
- {
- return decoratorMethod.invokeOnInstance(beanInstance.getInstance(), args);
- }
}
-
- return Reflections.invoke(method,getTargetInstance(), args);
+ return Reflections.invoke(method, getTargetInstance(), args);
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -28,7 +28,7 @@
import javax.enterprise.inject.spi.Decorator;
import org.jboss.weld.BeanManagerImpl;
-import org.jboss.weld.bean.AnnotatedItemProvidingDecoratorWrapper;
+import org.jboss.weld.bean.CustomDecoratorWrapper;
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.weld.bootstrap.spi.Deployment;
@@ -65,7 +65,7 @@
}
else if (bean instanceof Decorator)
{
- beanManager.addDecorator(AnnotatedItemProvidingDecoratorWrapper.of((Decorator<?>)bean, beanManager));
+ beanManager.addDecorator(CustomDecoratorWrapper.of((Decorator<?>)bean, beanManager));
}
else
{
Added: core/trunk/impl/src/main/java/org/jboss/weld/util/Deployers.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Deployers.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Deployers.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.util;
+
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.ForbiddenStateException;
+import org.jboss.weld.introspector.MethodSignature;
+import org.jboss.weld.introspector.WeldClass;
+import org.jboss.weld.introspector.WeldMethod;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.HashSet;
+import java.util.Set;
+
+import static org.jboss.weld.logging.messages.BeanMessage.UNABLE_TO_PROCESS;
+
+/**
+ * Helper class for {@link org.jboss.deployers.spi.deployer.Deployer} inspections.
+ *
+ * @author Marius Bogoevici
+ */
+public class Deployers
+{
+ public static Set<MethodSignature> getDecoratedMethodSignatures(BeanManagerImpl beanManager, Set<Type> decoratedTypes)
+ {
+ Set<MethodSignature> methodSignatures = new HashSet<MethodSignature>();
+ for (Type type: decoratedTypes)
+ {
+ WeldClass<?> weldClass = getWeldClassOfDecoratedType(beanManager, type);
+ for (WeldMethod<?, ?> method : weldClass.getWeldMethods())
+ {
+ if (!methodSignatures.contains(method.getSignature()))
+ {
+ methodSignatures.add(method.getSignature());
+ }
+ }
+ }
+ return methodSignatures;
+ }
+
+ public static WeldClass<?> getWeldClassOfDecoratedType(BeanManagerImpl beanManager, Type type)
+ {
+ if (type instanceof Class<?>)
+ {
+ return (WeldClass<?>) beanManager.createAnnotatedType((Class<?>) type);
+ }
+ if (type instanceof ParameterizedType && (((ParameterizedType) type).getRawType() instanceof Class))
+ {
+ return (WeldClass<?>) beanManager.createAnnotatedType((Class<?>) ((ParameterizedType) type).getRawType());
+ }
+ throw new ForbiddenStateException(UNABLE_TO_PROCESS, type);
+ }
+}
Modified: core/trunk/jboss-tck-runner/src/test/resources/tck-tests.xml
===================================================================
--- core/trunk/jboss-tck-runner/src/test/resources/tck-tests.xml 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/jboss-tck-runner/src/test/resources/tck-tests.xml 2009-12-19 04:53:36 UTC (rev 5360)
@@ -27,11 +27,52 @@
<exclude name="testGetTimerMethod" />
</methods>
</class>
- <!-- T
+ <!--
The following tests are broken in TCK 1.0.0 and succeed because of a bug in the 1.0.0 version of the RI
- The fix for the 1.0.1 version of the RI requires version 1.1.0 of the TCK.
- The tests must be re-enabled once the 1.1.0 version of the TCK is used.
+ The fix for the 1.0.1 version of the RI requires version 1.0.1 or later of the TCK.
+ The tests must be re-enabled once CDI TCK 1.0.1 or later is used.
-->
+ <class name="org.jboss.jsr299.tck.tests.context.dependent.DependentContextTest">
+ <methods>
+ <exclude name="testDependentScopedDecoratorsAreDependentObjectsOfBean"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.decorators.definition.DecoratorDefinitionTest">
+ <methods>
+ <exclude name="testDecoratorIsManagedBean"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.decorators.definition.inject.delegateConstructor.DelegateInjectionPointTest">
+ <methods>
+ <exclude name="testDecoratorDelegateInjectionPoints"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.decorators.definition.inject.delegateField.DelegateFieldInjectionPointTest">
+ <methods>
+ <exclude name="testDecoratorDelegateInjectionPoints"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.decorators.definition.inject.delegateInitializerMethod.DelegateInjectionPointTest">
+ <methods>
+ <exclude name="testDecoratorDelegateInjectionPoints"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.decorators.invocation.DecoratorInvocationTest">
+ <methods>
+ <exclude name="testChainedDecoratorInvocation"/>
+ <exclude name="testDecoratorInvocation"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.decorators.invocation.observer.DecoratorInvocationTest">
+ <methods>
+ <exclude name="testDecoratorInvocation"/>
+ </methods>
+ </class>
+ <class name="org.jboss.jsr299.tck.tests.decorators.invocation.producer.method.DecoratorInvocationTest">
+ <methods>
+ <exclude name="testDecoratorInvocation"/>
+ </methods>
+ </class>
<class name="org.jboss.jsr299.tck.tests.implementation.producer.field.definition.ProducerFieldDefinitionTest">
<methods>
<exclude name="testApiTypeForArrayTypeReturn"/>
@@ -50,6 +91,11 @@
<exclude name="testStereotype"/>
</methods>
</class>
+ <class name="org.jboss.jsr299.tck.tests.lookup.injectionpoint.InjectionPointTest">
+ <methods>
+ <exclude name="testIsDelegate"/>
+ </methods>
+ </class>
<class name="org.jboss.jsr299.tck.tests.implementation.producer.method.definition.ProducerMethodDefinitionTest">
<methods>
<exclude name="testParameterizedReturnType"/>
@@ -61,7 +107,6 @@
<exclude name="testResolveByTypeWithTypeParameter"/>
</methods>
</class>
-
</classes>
</test>
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator1.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -31,7 +31,7 @@
* @version $Revision: 1.1 $
*/
@Decorator
-public class SimpleDecorator1
+public abstract class SimpleDecorator1 implements SimpleBean
{
@Inject @Delegate
SimpleBean delegate;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/SimpleDecorator2.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -31,7 +31,7 @@
* @version $Revision: 1.1 $
*/
@Decorator
-public class SimpleDecorator2
+public abstract class SimpleDecorator2 implements SimpleBean
{
@Inject @Delegate
SimpleBean delegate;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/AbstractDecoratorTestHelper.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -24,8 +24,8 @@
{
static void resetAll()
{
- Window.drawn = false;
- Window.moved = false;
+ WindowImpl.drawn = false;
+ WindowImpl.moved = false;
FrameWithFieldInjectedDelegate.drawn = false;
FrameWithFieldInjectedDelegateAndAbstractMethod.moved = false;
FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.moved = false;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegate.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -25,7 +25,7 @@
* @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
*/
@Decorator
-public abstract class FrameWithConstructorInjectedDelegate
+public abstract class FrameWithConstructorInjectedDelegate implements Window
{
static boolean drawn;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithConstructorInjectedDelegateAndAbstractMethod.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -25,7 +25,7 @@
* @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
*/
@Decorator
-public abstract class FrameWithConstructorInjectedDelegateAndAbstractMethod
+public abstract class FrameWithConstructorInjectedDelegateAndAbstractMethod implements Window
{
Window window;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegate.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -25,7 +25,7 @@
* @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
*/
@Decorator
-public abstract class FrameWithFieldInjectedDelegate
+public abstract class FrameWithFieldInjectedDelegate implements Window
{
static boolean drawn;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndAbstractMethod.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -25,7 +25,7 @@
* @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
*/
@Decorator
-public abstract class FrameWithFieldInjectedDelegateAndAbstractMethod
+public abstract class FrameWithFieldInjectedDelegateAndAbstractMethod implements Window
{
static boolean moved;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -25,7 +25,7 @@
* @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
*/
@Decorator
-public abstract class FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod
+public abstract class FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod implements Window
{
static boolean moved;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegate.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -25,7 +25,7 @@
* @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
*/
@Decorator
-public abstract class FrameWithInitializerMethodInjectedDelegate
+public abstract class FrameWithInitializerMethodInjectedDelegate implements Window
{
static boolean drawn;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -25,7 +25,7 @@
* @author <a href="mailto:mariusb at redhat.com">Marius Bogoevici</a>
*/
@Decorator
-public abstract class FrameWithInitializerMethodInjectedDelegateAndAbstractMethod
+public abstract class FrameWithInitializerMethodInjectedDelegateAndAbstractMethod implements Window
{
static boolean moved;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorTest.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -37,9 +37,9 @@
resetAll();
- Window window = getCurrentManager().getInstanceByType(Window.class);
+ Window window = getCurrentManager().getInstanceByType(WindowImpl.class);
window.draw();
- assert Window.drawn;
+ assert WindowImpl.drawn;
assert FrameWithFieldInjectedDelegate.drawn;
}
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodAndInitializerMethodTest.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -35,17 +35,17 @@
public void testAbstractDecoratorApplied()
{
- Window window = getCurrentManager().getInstanceByType(Window.class);
+ Window window = getCurrentManager().getInstanceByType(WindowImpl.class);
resetAll();
window.draw();
- assert Window.drawn;
+ assert WindowImpl.drawn;
assert FrameWithFieldInjectedDelegate.drawn;
assert !FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.moved;
resetAll();
window.move();
- assert Window.moved;
+ assert WindowImpl.moved;
assert !FrameWithFieldInjectedDelegate.drawn;
assert FrameWithInitializerMethodInjectedDelegateAndAbstractMethod.moved;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithAbstractMethodTest.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -35,17 +35,17 @@
public void testAbstractDecoratorApplied()
{
- Window window = getCurrentManager().getInstanceByType(Window.class);
+ Window window = getCurrentManager().getInstanceByType(WindowImpl.class);
resetAll();
window.draw();
- assert Window.drawn;
+ assert WindowImpl.drawn;
assert FrameWithFieldInjectedDelegate.drawn;
assert !FrameWithFieldInjectedDelegateAndAbstractMethod.moved;
resetAll();
window.move();
- assert Window.moved;
+ assert WindowImpl.moved;
assert !FrameWithFieldInjectedDelegate.drawn;
assert FrameWithFieldInjectedDelegateAndAbstractMethod.moved;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithCallToItselfTest.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -35,11 +35,11 @@
public void testAbstractDecoratorApplied()
{
- Window window = getCurrentManager().getInstanceByType(Window.class);
+ Window window = getCurrentManager().getInstanceByType(WindowImpl.class);
resetAll();
window.move();
- assert Window.drawn;
+ assert WindowImpl.drawn;
assert FrameWithFieldInjectedDelegate.drawn;
assert FrameWithFieldInjectedDelegateAndSelfInvokedAbstractMethod.moved;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithConstructorTest.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -37,15 +37,15 @@
resetAll();
- Window window = getCurrentManager().getInstanceByType(Window.class);
+ Window window = getCurrentManager().getInstanceByType(WindowImpl.class);
window.draw();
- assert Window.drawn;
+ assert WindowImpl.drawn;
assert FrameWithConstructorInjectedDelegate.drawn;
resetAll();
window.move();
- assert !Window.moved;
- assert Window.drawn;
+ assert !WindowImpl.moved;
+ assert WindowImpl.drawn;
assert FrameWithConstructorInjectedDelegate.drawn;
assert FrameWithConstructorInjectedDelegateAndAbstractMethod.moved;
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/SimpleAbstractDecoratorWithInitializerMethodTest.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -37,9 +37,9 @@
resetAll();
- Window window = getCurrentManager().getInstanceByType(Window.class);
+ Window window = getCurrentManager().getInstanceByType(WindowImpl.class);
window.draw();
- assert Window.drawn;
+ assert WindowImpl.drawn;
assert FrameWithInitializerMethodInjectedDelegate.drawn;
}
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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, 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.decorators.abstractDecorator;
-
-/**
- *
- * @author Marius Bogoevici
- */
-public class Window
-{
- static boolean drawn;
-
- static boolean moved;
-
- public void draw()
- {
- drawn = true;
- }
-
- public void move()
- {
- moved = true;
- }
-}
\ No newline at end of file
Added: 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 (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/Window.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,28 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.decorators.abstractDecorator;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface Window
+{
+ void draw();
+
+ void move();
+}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java (from rev 5320, 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 (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/abstractDecorator/WindowImpl.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.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/custom/AfterBeanDiscoveryObserver.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/AfterBeanDiscoveryObserver.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/AfterBeanDiscoveryObserver.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -1,32 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright <Year>, 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.decorators.custom;
-
-import javax.enterprise.event.Observes;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.Extension;
-
-
-public class AfterBeanDiscoveryObserver implements Extension
-{
- public void addDecorators(@Observes AfterBeanDiscovery event, BeanManager beanManager)
- {
- event.addBean(new CustomDecorator(beanManager));
- }
-}
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecorator.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecorator.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecorator.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -70,7 +70,7 @@
public Set<Type> getTypes()
{
- return Collections.<Type>singleton(Window.class);
+ return Collections.<Type>singleton(CustomWindowFrame.class);
}
public Set<Annotation> getQualifiers()
@@ -96,7 +96,7 @@
public Class<?> getBeanClass()
{
- return CustomFrame.class;
+ return CustomWindowFrame.class;
}
public boolean isAlternative()
@@ -116,7 +116,7 @@
public Object create(CreationalContext<Object> creationalContext)
{
- CustomFrame customFrame = new CustomFrame();
+ CustomWindowFrame customFrame = new CustomWindowFrame();
customFrame.window = (Window) beanManager.getInjectableReference(injectionPoints.iterator().next(), creationalContext);
return customFrame;
}
@@ -129,12 +129,12 @@
class CustomInjectionPoint implements InjectionPoint
{
private final WeldClass<?> targetClass;
- private final WeldField<CustomFrame,?> windowField;
+ private final WeldField<CustomWindowFrame,?> windowField;
public CustomInjectionPoint()
{
ClassTransformer transformer = new ClassTransformer(new TypeStore());
- targetClass = WeldClassImpl.of(CustomFrame.class, transformer);
+ targetClass = WeldClassImpl.of(CustomWindowFrame.class, transformer);
windowField = targetClass.getDeclaredWeldField("window");
}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorDeploymentObserver.java (from rev 5320, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/AfterBeanDiscoveryObserver.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorDeploymentObserver.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorDeploymentObserver.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, 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.decorators.custom;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.ProcessAnnotatedType;
+
+
+public class CustomDecoratorDeploymentObserver implements Extension
+{
+ public void addDecorators(@Observes AfterBeanDiscovery event, BeanManager beanManager)
+ {
+ event.addBean(new CustomDecorator(beanManager));
+ }
+
+ /**
+ * Must veto the custom decorator class, otherwise a bean will be created
+ */
+ public void vetoCustomDecorator(@Observes ProcessAnnotatedType event, BeanManager beanManager)
+ {
+ if (event.getAnnotatedType().getJavaClass().equals(CustomWindowFrame.class))
+ event.veto();
+ }
+}
Modified: core/trunk/tests/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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomDecoratorTest.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -31,7 +31,6 @@
import org.jboss.weld.util.serviceProvider.PackageServiceLoaderFactory;
import org.jboss.weld.BeanManagerImpl;
-import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
/**
@@ -43,7 +42,7 @@
@Test
public void testCustomDecoratorAppliedByItself()
{
- MockBeanDeploymentArchive beanDeploymentArchive = new MockBeanDeploymentArchive("1", Window.class, CustomFrame.class, InnerFrame.class, OuterFrame.class );
+ MockBeanDeploymentArchive beanDeploymentArchive = new MockBeanDeploymentArchive("1", WindowImpl.class, CustomWindowFrame.class, InnerWindowFrame.class, OuterWindowFrame.class );
beanDeploymentArchive.setBeansXmlFiles(Arrays.asList(CustomDecoratorTest.class.getResource("beans-custom-only.xml")));
TestContainer testContainer = new TestContainer(new MockServletLifecycle(new MockDeployment(beanDeploymentArchive), beanDeploymentArchive));
testContainer.getLifecycle().initialize();
@@ -51,20 +50,20 @@
testContainer.getLifecycle().beginApplication();
BeanManagerImpl beanManager = testContainer.getBeanManager();
- Bean<Object> windowBean = (Bean<Object>) beanManager.getBeans(Window.class).iterator().next();
+ Bean<Object> windowBean = (Bean<Object>) beanManager.getBeans(WindowImpl.class).iterator().next();
CreationalContext<Object> creationalContext = beanManager.createCreationalContext(windowBean);
- Window window = (Window) windowBean.create(creationalContext);
+ WindowImpl window = (WindowImpl) windowBean.create(creationalContext);
window.draw();
assert window.isDrawn();
- assert CustomFrame.drawn;
+ assert CustomWindowFrame.drawn;
testContainer.stopContainer();
}
@Test
public void testCustomDecoratorAppliedWithWeldDecorators()
{
- MockBeanDeploymentArchive beanDeploymentArchive = new MockBeanDeploymentArchive("1", Window.class, CustomFrame.class, InnerFrame.class, OuterFrame.class );
+ MockBeanDeploymentArchive beanDeploymentArchive = new MockBeanDeploymentArchive("1", WindowImpl.class, CustomWindowFrame.class, InnerWindowFrame.class, OuterWindowFrame.class );
beanDeploymentArchive.setBeansXmlFiles(Arrays.asList(CustomDecoratorTest.class.getResource("beans.xml")));
TestContainer testContainer = new TestContainer(new MockServletLifecycle(new MockDeployment(beanDeploymentArchive), beanDeploymentArchive));
testContainer.getLifecycle().initialize();
@@ -72,15 +71,15 @@
testContainer.getLifecycle().beginApplication();
BeanManagerImpl beanManager = testContainer.getBeanManager();
- Bean<Object> windowBean = (Bean<Object>) beanManager.getBeans(Window.class).iterator().next();
+ Bean<Object> windowBean = (Bean<Object>) beanManager.getBeans(WindowImpl.class).iterator().next();
CreationalContext<Object> creationalContext = beanManager.createCreationalContext(windowBean);
- Window window = (Window) windowBean.create(creationalContext);
+ WindowImpl window = (WindowImpl) windowBean.create(creationalContext);
window.draw();
assert window.isDrawn();
- assert OuterFrame.drawn;
- assert InnerFrame.drawn;
- assert CustomFrame.drawn;
+ assert OuterWindowFrame.drawn;
+ assert InnerWindowFrame.drawn;
+ assert CustomWindowFrame.drawn;
testContainer.stopContainer();
}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomFrame.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomFrame.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomFrame.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -1,17 +0,0 @@
-package org.jboss.weld.tests.decorators.custom;
-
-/**
- * @author Marius Bogoevici
- */
-public class CustomFrame
-{
- public static boolean drawn;
-
- Window window;
-
- public void draw()
- {
- window.draw();
- drawn = true;
- }
-}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomWindowFrame.java (from rev 5320, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomFrame.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomWindowFrame.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/CustomWindowFrame.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,17 @@
+package org.jboss.weld.tests.decorators.custom;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class CustomWindowFrame implements Window
+{
+ public static boolean drawn;
+
+ Window window;
+
+ public void draw()
+ {
+ window.draw();
+ drawn = true;
+ }
+}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/InnerFrame.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/InnerFrame.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/InnerFrame.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright <Year>, 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.decorators.custom;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- * @author Marius Bogoevici
- */
- at Decorator
-public class InnerFrame
-{
- static boolean drawn = false;
-
- @Inject @Delegate Window window;
-
- void draw()
- {
- window.draw();
- drawn = true;
- }
-
-}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/InnerWindowFrame.java (from rev 5320, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/InnerFrame.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/InnerWindowFrame.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/InnerWindowFrame.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, 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.decorators.custom;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Decorator
+public class InnerWindowFrame implements Window
+{
+ static boolean drawn = false;
+
+ @Inject @Delegate
+ Window window;
+
+ public void draw()
+ {
+ window.draw();
+ drawn = true;
+ }
+
+}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/OuterFrame.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/OuterFrame.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/OuterFrame.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright <Year>, 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.decorators.custom;
-
-import javax.decorator.Decorator;
-import javax.decorator.Delegate;
-import javax.inject.Inject;
-
-/**
- * @author Marius Bogoevici
- */
- at Decorator
-public class OuterFrame
-{
- static boolean drawn = false;
-
- @Inject @Delegate Window window;
-
- void draw()
- {
- window.draw();
- drawn = true;
- }
-
-}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/OuterWindowFrame.java (from rev 5320, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/OuterFrame.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/OuterWindowFrame.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/OuterWindowFrame.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, 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.decorators.custom;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Decorator
+public class OuterWindowFrame implements Window
+{
+ static boolean drawn = false;
+
+ @Inject @Delegate
+ Window window;
+
+ public void draw()
+ {
+ window.draw();
+ drawn = true;
+ }
+
+}
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright <Year>, 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.decorators.custom;
-
-/**
- * @author Marius Bogoevici
- */
-public class Window
-{
- public boolean drawn = false;
-
- void draw()
- {
- drawn = true;
- }
-
- public boolean isDrawn()
- {
- return drawn;
- }
-}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,26 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.decorators.custom;
+
+/**
+ * @author Marius Bogoevici
+ */
+public interface Window
+{
+ void draw();
+}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/WindowImpl.java (from rev 5320, core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/Window.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/WindowImpl.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/custom/WindowImpl.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.decorators.custom;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class WindowImpl implements Window
+{
+ public boolean drawn = false;
+
+ public void draw()
+ {
+ drawn = true;
+ }
+
+ public boolean isDrawn()
+ {
+ return drawn;
+ }
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/AnotherPartialDecorator.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/AnotherPartialDecorator.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/AnotherPartialDecorator.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright <Year>, 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.decorators.generic;
+
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.inject.Inject;
+
+/**
+ * @author Marius Bogoevici
+ */
+ at Decorator
+public class AnotherPartialDecorator implements Decorated<String>
+{
+ @Inject
+ @Delegate
+ GenericBean<String> delegate;
+
+ static boolean invoked = true;
+
+ public String decoratedEcho(String parameter)
+ {
+ invoked = true;
+ return delegate.decoratedEcho(parameter);
+ }
+}
Modified: 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 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/decorators/generic/PartialDecoratorTest.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -38,6 +38,7 @@
assert PartialDecorator.decoratedInvoked;
assert !PartialDecorator.notDecoratedInvoked;
+ assert AnotherPartialDecorator.invoked;
assert GenericBean.decoratedInvoked;
assert GenericBean.notDecoratedInvoked;
}
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/simple/SimpleDecorator.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/simple/SimpleDecorator.java 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/interceptors/simple/SimpleDecorator.java 2009-12-19 04:53:36 UTC (rev 5360)
@@ -26,7 +26,7 @@
* @version $Revision: 1.1 $
*/
@Decorator
-public class SimpleDecorator
+public class SimpleDecorator implements SimpleBean
{
@Inject @Delegate
SimpleBean delegate;
Modified: core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/beans-custom-only.xml
===================================================================
--- core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/beans-custom-only.xml 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/beans-custom-only.xml 2009-12-19 04:53:36 UTC (rev 5360)
@@ -1,22 +1,5 @@
-<!--
- ~ JBoss, Home of Professional Open Source
- ~ Copyright <Year>, 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.
- -->
-
<beans>
<decorators>
- <decorator>org.jboss.weld.tests.decorators.custom.CustomFrame</decorator>
+ <decorator>org.jboss.weld.tests.decorators.custom.CustomWindowFrame</decorator>
</decorators>
</beans>
Modified: core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/beans.xml
===================================================================
--- core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/beans.xml 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/beans.xml 2009-12-19 04:53:36 UTC (rev 5360)
@@ -17,8 +17,8 @@
<beans>
<decorators>
- <decorator>org.jboss.weld.tests.decorators.custom.OuterFrame</decorator>
- <decorator>org.jboss.weld.tests.decorators.custom.CustomFrame</decorator>
- <decorator>org.jboss.weld.tests.decorators.custom.InnerFrame</decorator>
+ <decorator>org.jboss.weld.tests.decorators.custom.OuterWindowFrame</decorator>
+ <decorator>org.jboss.weld.tests.decorators.custom.CustomWindowFrame</decorator>
+ <decorator>org.jboss.weld.tests.decorators.custom.InnerWindowFrame</decorator>
</decorators>
</beans>
Modified: core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/javax.enterprise.inject.spi.Extension
===================================================================
--- core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/javax.enterprise.inject.spi.Extension 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/custom/javax.enterprise.inject.spi.Extension 2009-12-19 04:53:36 UTC (rev 5360)
@@ -1 +1 @@
-org.jboss.weld.tests.decorators.custom.AfterBeanDiscoveryObserver
+org.jboss.weld.tests.decorators.custom.CustomDecoratorDeploymentObserver
Modified: core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/generic/beans.xml
===================================================================
--- core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/generic/beans.xml 2009-12-18 23:39:01 UTC (rev 5359)
+++ core/trunk/tests/src/test/resources/org/jboss/weld/tests/decorators/generic/beans.xml 2009-12-19 04:53:36 UTC (rev 5360)
@@ -1,5 +1,6 @@
<beans>
<decorators>
<decorator>org.jboss.weld.tests.decorators.generic.PartialDecorator</decorator>
+ <decorator>org.jboss.weld.tests.decorators.generic.AnotherPartialDecorator</decorator>
</decorators>
</beans>
\ No newline at end of file
More information about the weld-commits
mailing list