Weld SVN: r3980 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-12 16:12:05 -0400 (Mon, 12 Oct 2009)
New Revision: 3980
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java
Log:
cleanup
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java 2009-10-12 20:11:16 UTC (rev 3979)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/inheritance/specialization/enterprise/EnterpriseBeanSpecializationIntegrationTest.java 2009-10-12 20:12:05 UTC (rev 3980)
@@ -37,12 +37,4 @@
assert farmer.getClassName().equals(LazyFarmer.class.getName());
}
-
- //@Test
- //@SpecAssertion(section="4.3.2", id = "aa") removed from spec
- public void testProducerMethodOnSpecializedBeanCalledOnSpecializingBean() throws Exception
- {
- assert getBeans(Waste.class).size() == 1;
- assert getInstanceByType(Waste.class).getFrom().equals(Office.class.getName());
- }
}
15 years, 1 month
Weld SVN: r3979 - cdi-tck/trunk/impl/src/main/resources.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-12 16:11:16 -0400 (Mon, 12 Oct 2009)
New Revision: 3979
Modified:
cdi-tck/trunk/impl/src/main/resources/tck-tests.xml
Log:
reduce log level
Modified: cdi-tck/trunk/impl/src/main/resources/tck-tests.xml
===================================================================
--- cdi-tck/trunk/impl/src/main/resources/tck-tests.xml 2009-10-12 19:36:37 UTC (rev 3978)
+++ cdi-tck/trunk/impl/src/main/resources/tck-tests.xml 2009-10-12 20:11:16 UTC (rev 3979)
@@ -1,6 +1,6 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
-<suite name="JSR-299 TCK" verbose="2" >
+<suite name="JSR-299 TCK" verbose="1" >
<test name="JSR-299 TCK">
<method-selectors>
<method-selector>
15 years, 1 month
Weld SVN: r3978 - build/trunk/parent.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-12 15:36:37 -0400 (Mon, 12 Oct 2009)
New Revision: 3978
Modified:
build/trunk/parent/pom.xml
Log:
update maven version
Modified: build/trunk/parent/pom.xml
===================================================================
--- build/trunk/parent/pom.xml 2009-10-12 19:25:43 UTC (rev 3977)
+++ build/trunk/parent/pom.xml 2009-10-12 19:36:37 UTC (rev 3978)
@@ -176,7 +176,7 @@
<configuration>
<rules>
<requireMavenVersion>
- <version>2.0.9</version>
+ <version>2.0.10</version>
</requireMavenVersion>
<requirePluginVersions>
<unCheckedPlugins>
15 years, 1 month
Weld SVN: r3977 - in core/trunk: tests and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-12 15:25:43 -0400 (Mon, 12 Oct 2009)
New Revision: 3977
Modified:
core/trunk/jboss-as/build.xml
core/trunk/tests/unit-tests.xml
Log:
minor
Modified: core/trunk/jboss-as/build.xml
===================================================================
--- core/trunk/jboss-as/build.xml 2009-10-12 18:52:53 UTC (rev 3976)
+++ core/trunk/jboss-as/build.xml 2009-10-12 19:25:43 UTC (rev 3977)
@@ -49,7 +49,7 @@
<copy todir="target/weld.deployer/" overwrite="true">
<fileset dir="target/dependency/lib">
<include name="weld-api.jar" />
- <include name="jsr299-api.jar" />
+ <include name="cdi-api.jar" />
<include name="weld-logger.jar" />
</fileset>
</copy>
Modified: core/trunk/tests/unit-tests.xml
===================================================================
--- core/trunk/tests/unit-tests.xml 2009-10-12 18:52:53 UTC (rev 3976)
+++ core/trunk/tests/unit-tests.xml 2009-10-12 19:25:43 UTC (rev 3977)
@@ -1,6 +1,6 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
-<suite name="Weld" verbose="2" >
+<suite name="Weld" verbose="1" >
<test name="Weld">
<method-selectors>
@@ -19,7 +19,6 @@
</groups>
<packages>
<package name="org.jboss.weld.test.examples" />
-
<package name="org.jboss.weld.test.unit.activities" />
<package name="org.jboss.weld.test.unit.activities.current" />
<package name="org.jboss.weld.test.unit.activities.child" />
15 years, 1 month
Weld SVN: r3976 - in cdi-tck/trunk/impl: src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-12 14:52:53 -0400 (Mon, 12 Oct 2009)
New Revision: 3976
Modified:
cdi-tck/trunk/impl/pom.xml
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java
Log:
minor
Modified: cdi-tck/trunk/impl/pom.xml
===================================================================
--- cdi-tck/trunk/impl/pom.xml 2009-10-12 18:29:47 UTC (rev 3975)
+++ cdi-tck/trunk/impl/pom.xml 2009-10-12 18:52:53 UTC (rev 3976)
@@ -232,7 +232,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
- <version>1.2</version>
<executions>
<execution>
<id>attach-artifacts</id>
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java 2009-10-12 18:29:47 UTC (rev 3975)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/decorators/invocation/DecoratorInvocationTest.java 2009-10-12 18:52:53 UTC (rev 3976)
@@ -43,7 +43,6 @@
@SpecAssertion(section="8.1.2", id="f"),
@SpecAssertion(section="8.1.2", id="b"),
@SpecAssertion(section="7.2", id="b")
- //@SpecAssertion(section="7.2", id="ha") removed from spec
})
public void testDecoratorInvocation()
{
15 years, 1 month
Weld SVN: r3974 - in core/trunk: tests/src/test/java/org/jboss/weld/test/unit/interceptor/simple and 1 other directory.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2009-10-12 14:07:54 -0400 (Mon, 12 Oct 2009)
New Revision: 3974
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/simple/SimpleInterceptorTest.java
Log:
Moving interception and decoration to produce.
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-10-12 17:34:43 UTC (rev 3973)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2009-10-12 18:07:54 UTC (rev 3974)
@@ -111,22 +111,12 @@
*/
public T create(CreationalContext<T> creationalContext)
{
- InjectionPoint originalInjectionPoint = null;
- if (hasDecorators())
- {
- originalInjectionPoint = attachCorrectInjectionPoint();
- }
T instance = getInjectionTarget().produce(creationalContext);
getInjectionTarget().inject(instance, creationalContext);
- if (hasDecorators())
- {
- instance = applyDecorators(instance, creationalContext, originalInjectionPoint);
- }
if (isInterceptionCandidate() && (hasBoundInterceptors() || hasDeclaredInterceptors()))
{
- instance = applyInterceptors(instance, creationalContext);
InterceptionUtils.executePostConstruct(instance);
- }
+ }
else
{
getInjectionTarget().postConstruct(instance);
@@ -237,6 +227,19 @@
// Without this, the chaining of decorators will fail as the incomplete instance will be resolved
ctx.push(instance);
}
+ InjectionPoint originalInjectionPoint = null;
+ if (hasDecorators())
+ {
+ originalInjectionPoint = attachCorrectInjectionPoint();
+ }
+ if (hasDecorators())
+ {
+ instance = applyDecorators(instance, ctx, originalInjectionPoint);
+ }
+ if (isInterceptionCandidate() && (hasBoundInterceptors() || hasDeclaredInterceptors()))
+ {
+ instance = applyInterceptors(instance, ctx);
+ }
return instance;
}
});
Modified: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/simple/SimpleInterceptorTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/simple/SimpleInterceptorTest.java 2009-10-12 17:34:43 UTC (rev 3973)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/simple/SimpleInterceptorTest.java 2009-10-12 18:07:54 UTC (rev 3974)
@@ -23,10 +23,13 @@
import org.jboss.weld.test.AbstractWeldTest;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+
import org.testng.annotations.Test;
+import org.testng.annotations.BeforeMethod;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.context.spi.CreationalContext;
+
import java.util.Set;
import java.lang.annotation.Annotation;
@@ -38,6 +41,18 @@
public class SimpleInterceptorTest extends AbstractWeldTest
{
+ @BeforeMethod
+ public void resetInterceptors()
+ {
+ SimpleInterceptor.aroundInvokeCalled = false;
+ SimpleInterceptor.postConstructCalled = false;
+ SimpleInterceptor.preDestroyCalled = false;
+ TwoBindingsInterceptor.aroundInvokeCalled = false;
+ SimpleBeanImpl.postConstructCalled = false;
+ SimpleBeanImpl.businessMethodInvoked = false;
+ }
+
+
@Test
public void testInterceptorModel()
{
@@ -52,7 +67,7 @@
{
Bean bean = getCurrentManager().getBeans(SimpleBeanImpl.class).iterator().next();
CreationalContext creationalContext = getCurrentManager().createCreationalContext(bean);
- SimpleBeanImpl simpleBean = (SimpleBeanImpl)bean.create(creationalContext);
+ SimpleBeanImpl simpleBean = (SimpleBeanImpl) bean.create(creationalContext);
String result = simpleBean.doSomething();
assert "decorated-Hello!-decorated".equals(result);
bean.destroy(simpleBean, creationalContext);
@@ -68,7 +83,7 @@
{
Bean bean = getCurrentManager().getBeans(SimpleBeanWithStereotype.class).iterator().next();
CreationalContext creationalContext = getCurrentManager().createCreationalContext(bean);
- SimpleBeanWithStereotype simpleBean = (SimpleBeanWithStereotype)bean.create(creationalContext);
+ SimpleBeanWithStereotype simpleBean = (SimpleBeanWithStereotype) bean.create(creationalContext);
String result = simpleBean.doSomething();
assert "Hello!".equals(result);
bean.destroy(simpleBean, creationalContext);
@@ -77,6 +92,5 @@
assert SimpleInterceptor.preDestroyCalled;
assert TwoBindingsInterceptor.aroundInvokeCalled;
assert SimpleBeanWithStereotype.postConstructCalled;
-
}
}
15 years, 1 month
Weld SVN: r3973 - in core/trunk: impl/src/main/java/org/jboss/weld/bean and 9 other directories.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2009-10-12 13:34:43 -0400 (Mon, 12 Oct 2009)
New Revision: 3973
Added:
core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandler.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandlerFactory.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/EnterpriseBeanInterceptionTest.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ejb3InterceptionModelTest.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Ball.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Defender.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Goalkeeper.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Pass.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivation.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Shot.java
core/trunk/tests/src/test/resources/org/jboss/weld/test/unit/interceptor/passivation/
core/trunk/tests/src/test/resources/org/jboss/weld/test/unit/interceptor/passivation/beans.xml
Removed:
core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorInterceptionHandlerFactory.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/EnterpriseBeanInterceptionTests.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ejb3InterceptionModelTests.java
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java
core/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualInstance.java
core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ball.java
Log:
Add serialization capability and passivation/activation interception.
Modified: core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java 2009-10-12 17:29:09 UTC (rev 3972)
+++ core/trunk/impl/src/main/java/org/jboss/weld/BeanManagerImpl.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -64,6 +64,7 @@
import org.jboss.weld.bootstrap.api.ServiceRegistry;
import org.jboss.weld.context.CreationalContextImpl;
import org.jboss.weld.context.WeldCreationalContext;
+import org.jboss.weld.context.SerializableContextual;
import org.jboss.weld.ejb.EjbDescriptors;
import org.jboss.weld.ejb.spi.EjbDescriptor;
import org.jboss.weld.el.Namespace;
@@ -261,7 +262,7 @@
/**
* Interception model
*/
- private transient final InterceptorRegistry<Class<?>, Interceptor<?>> boundInterceptorsRegistry = new InterceptorRegistry<Class<?>, Interceptor<?>>();
+ private transient final InterceptorRegistry<Class<?>, SerializableContextual<Interceptor<?>, ?>> boundInterceptorsRegistry = new InterceptorRegistry<Class<?>, SerializableContextual<Interceptor<?>,?>>();
private transient final InterceptorRegistry<Class<?>, Class<?>> declaredInterceptorsRegistry = new InterceptorRegistry<Class<?>, Class<?>>();
/**
@@ -1389,7 +1390,7 @@
this.currentInjectionPoint.remove();
}
- public InterceptorRegistry<Class<?>, Interceptor<?>> getBoundInterceptorsRegistry()
+ public InterceptorRegistry<Class<?>, SerializableContextual<Interceptor<?>, ?>> getBoundInterceptorsRegistry()
{
return boundInterceptorsRegistry;
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2009-10-12 17:29:09 UTC (rev 3972)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/AbstractClassBean.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -45,6 +45,7 @@
import org.jboss.weld.bean.proxy.DecoratorProxyMethodHandler;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.context.SerializableContextualInstance;
+import org.jboss.weld.context.SerializableContextual;
import org.jboss.weld.injection.FieldInjectionPoint;
import org.jboss.weld.injection.MethodInjectionPoint;
import org.jboss.weld.introspector.WeldClass;
@@ -408,7 +409,7 @@
{
if (manager.getBoundInterceptorsRegistry().getInterceptionModel(getType()) == null)
{
- InterceptionModelBuilder<Class<?>, Interceptor<?>> builder = InterceptionModelBuilder.newBuilderFor(getType(), (Class) Interceptor.class);
+ InterceptionModelBuilder<Class<?>, SerializableContextual<Interceptor<?>, ?>> builder = InterceptionModelBuilder.newBuilderFor(getType(), (Class) SerializableContextual.class);
Set<Annotation> classBindingAnnotations = flattenInterceptorBindings(manager, getAnnotatedItem().getAnnotations());
for (Class<? extends Annotation> annotation : getStereotypes())
@@ -416,8 +417,11 @@
classBindingAnnotations.addAll(flattenInterceptorBindings(manager, manager.getStereotypeDefinition(annotation)));
}
- builder.interceptPostConstruct().with(manager.resolveInterceptors(InterceptionType.POST_CONSTRUCT, classBindingAnnotations.toArray(new Annotation[0])).toArray(new Interceptor<?>[]{}));
- builder.interceptPreDestroy().with(manager.resolveInterceptors(InterceptionType.PRE_DESTROY, classBindingAnnotations.toArray(new Annotation[0])).toArray(new Interceptor<?>[]{}));
+ Annotation[] classBindingAnnotationsArray = classBindingAnnotations.toArray(new Annotation[0]);
+ builder.interceptPostConstruct().with(toSerializableContextualArray(manager.resolveInterceptors(InterceptionType.POST_CONSTRUCT, classBindingAnnotationsArray)));
+ builder.interceptPreDestroy().with(toSerializableContextualArray(manager.resolveInterceptors(InterceptionType.PRE_DESTROY, classBindingAnnotationsArray)));
+ builder.interceptPrePassivate().with(toSerializableContextualArray(manager.resolveInterceptors(InterceptionType.PRE_PASSIVATE, classBindingAnnotationsArray)));
+ builder.interceptPostActivate().with(toSerializableContextualArray(manager.resolveInterceptors(InterceptionType.POST_ACTIVATE, classBindingAnnotationsArray)));
List<WeldMethod<?, ?>> businessMethods = Beans.getInterceptableBusinessMethods(getAnnotatedItem());
for (WeldMethod<?, ?> method : businessMethods)
@@ -425,7 +429,7 @@
List<Annotation> methodBindingAnnotations = new ArrayList<Annotation>(classBindingAnnotations);
methodBindingAnnotations.addAll(flattenInterceptorBindings(manager, method.getAnnotations()));
List<Interceptor<?>> methodBoundInterceptors = manager.resolveInterceptors(InterceptionType.AROUND_INVOKE, methodBindingAnnotations.toArray(new Annotation[]{}));
- builder.interceptAroundInvoke(((AnnotatedMethod) method).getJavaMember()).with(methodBoundInterceptors.toArray(new Interceptor[]{}));
+ builder.interceptAroundInvoke(((AnnotatedMethod) method).getJavaMember()).with(toSerializableContextualArray(methodBoundInterceptors));
}
manager.getBoundInterceptorsRegistry().registerInterceptionModel(getType(), builder.build());
}
@@ -479,5 +483,15 @@
}
}
}
-
+
+ private static SerializableContextual[] toSerializableContextualArray(List<Interceptor<?>> interceptors)
+ {
+ List<SerializableContextual> serializableContextuals = new ArrayList<SerializableContextual>();
+ for (Interceptor<?> interceptor: interceptors)
+ {
+ serializableContextuals.add(new SerializableContextual(interceptor));
+ }
+ return serializableContextuals.toArray(new SerializableContextual[]{});
+ }
+
}
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-10-12 17:29:09 UTC (rev 3972)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/ManagedBean.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -30,6 +30,8 @@
import javax.enterprise.inject.spi.InjectionTarget;
import org.jboss.interceptor.model.InterceptionModelBuilder;
+import org.jboss.interceptor.model.InterceptorClassMetadataImpl;
+import org.jboss.interceptor.model.InterceptionModel;
import org.jboss.interceptor.proxy.InterceptionHandlerFactory;
import org.jboss.interceptor.proxy.InterceptorProxyCreatorImpl;
import org.jboss.interceptor.registry.InterceptorRegistry;
@@ -38,7 +40,7 @@
import org.jboss.weld.DefinitionException;
import org.jboss.weld.DeploymentException;
import org.jboss.weld.bean.interceptor.ClassInterceptionHandlerFactory;
-import org.jboss.weld.bean.interceptor.InterceptorInterceptionHandlerFactory;
+import org.jboss.weld.bean.interceptor.CdiInterceptorHandlerFactory;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.injection.ConstructorInjectionPoint;
import org.jboss.weld.injection.InjectionContextImpl;
@@ -443,7 +445,7 @@
if (hasBoundInterceptors())
{
interceptionRegistries.add(manager.getBoundInterceptorsRegistry());
- interceptionHandlerFactories.add(new InterceptorInterceptionHandlerFactory(creationalContext, manager));
+ interceptionHandlerFactories.add(new CdiInterceptorHandlerFactory(creationalContext, manager));
}
if (interceptionRegistries.size() > 0)
instance = new InterceptorProxyCreatorImpl(interceptionRegistries, interceptionHandlerFactories).createProxyFromInstance(instance, getType());
@@ -471,6 +473,8 @@
{
builder.interceptPostConstruct().with(classDeclaredInterceptors);
builder.interceptPreDestroy().with(classDeclaredInterceptors);
+ builder.interceptPrePassivate().with(classDeclaredInterceptors);
+ builder.interceptPostActivate().with(classDeclaredInterceptors);
}
List<WeldMethod<?, ?>> businessMethods = Beans.getInterceptableBusinessMethods(getAnnotatedItem());
@@ -491,7 +495,9 @@
builder.interceptAroundInvoke(((AnnotatedMethod) method).getJavaMember()).with(methodDeclaredInterceptors);
}
}
- manager.getDeclaredInterceptorsRegistry().registerInterceptionModel(getType(), builder.build());
+ InterceptionModel<Class<?>, Class<?>> interceptionModel = builder.build();
+ if (interceptionModel.getAllInterceptors().size() > 0 || new InterceptorClassMetadataImpl(getType()).isInterceptor())
+ manager.getDeclaredInterceptorsRegistry().registerInterceptionModel(getType(), builder.build());
}
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2009-10-12 17:29:09 UTC (rev 3972)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/SessionBean.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -40,6 +40,7 @@
import org.jboss.interceptor.model.InterceptionModel;
import org.jboss.weld.BeanManagerImpl;
import org.jboss.weld.DefinitionException;
+import org.jboss.weld.context.SerializableContextual;
import org.jboss.weld.bean.interceptor.InterceptorBindingsAdapter;
import org.jboss.weld.bean.proxy.EnterpriseBeanInstance;
import org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler;
@@ -421,7 +422,7 @@
private void registerInterceptors()
{
- InterceptionModel<Class<?>,javax.enterprise.inject.spi.Interceptor<?>> model = manager.getBoundInterceptorsRegistry().getInterceptionModel(ejbDescriptor.getBeanClass());
+ InterceptionModel<Class<?>, SerializableContextual<javax.enterprise.inject.spi.Interceptor<?>, ?>> model = manager.getBoundInterceptorsRegistry().getInterceptionModel(ejbDescriptor.getBeanClass());
if (model != null)
getManager().getServices().get(EjbServices.class).registerInterceptors(getEjbDescriptor(), new InterceptorBindingsAdapter(model));
}
Added: core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandler.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandler.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandler.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,28 @@
+package org.jboss.weld.bean.interceptor;
+
+import java.io.Serializable;
+
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.jboss.interceptor.proxy.AbstractClassInterceptionHandler;
+import org.jboss.weld.context.SerializableContextualInstance;
+
+/**
+ * @author Marius Bogoevici
+ */
+public class CdiInterceptorHandler extends AbstractClassInterceptionHandler implements Serializable
+{
+
+ private final SerializableContextualInstance<Interceptor<Object>, Object> serializableContextualInstance;
+
+ public CdiInterceptorHandler(SerializableContextualInstance<Interceptor<Object>, Object> serializableContextualInstance, Class<?> clazz)
+ {
+ super(clazz);
+ this.serializableContextualInstance = serializableContextualInstance;
+ }
+
+ public Object getInterceptorInstance()
+ {
+ return serializableContextualInstance.getInstance();
+ }
+}
Copied: core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandlerFactory.java (from rev 3961, core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorInterceptionHandlerFactory.java)
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandlerFactory.java (rev 0)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandlerFactory.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,55 @@
+/*
+ * 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.interceptor;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Interceptor;
+
+import org.jboss.interceptor.proxy.InterceptionHandler;
+import org.jboss.interceptor.proxy.InterceptionHandlerFactory;
+import org.jboss.weld.BeanManagerImpl;
+import org.jboss.weld.context.SerializableContextualInstance;
+import org.jboss.weld.context.SerializableContextual;
+
+/**
+ * @author Marius Bogoevici
+*/
+public class CdiInterceptorHandlerFactory implements InterceptionHandlerFactory<SerializableContextual<Interceptor<Object>, Object>>
+{
+ private final CreationalContext creationalContext;
+ private BeanManagerImpl manager;
+
+ public CdiInterceptorHandlerFactory(CreationalContext creationalContext, BeanManagerImpl manager)
+ {
+ this.creationalContext = creationalContext;
+ this.manager = manager;
+ }
+
+ public BeanManagerImpl getManager()
+ {
+ return manager;
+ }
+
+ public InterceptionHandler createFor(final SerializableContextual<Interceptor<Object>, Object> serializableContextual)
+ {
+ Object instance = getManager().getReference(serializableContextual.get(), creationalContext);
+ return new CdiInterceptorHandler(new SerializableContextualInstance<Interceptor<Object>, Object>(serializableContextual, instance, creationalContext),
+ serializableContextual.get().getBeanClass());
+ }
+
+}
Property changes on: core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/CdiInterceptorHandlerFactory.java
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java 2009-10-12 17:29:09 UTC (rev 3972)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorBindingsAdapter.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -23,12 +23,14 @@
import java.util.HashSet;
import java.util.Collections;
import java.util.Arrays;
+import java.util.ArrayList;
import java.lang.reflect.Method;
import javax.enterprise.inject.spi.Interceptor;
import javax.enterprise.inject.spi.InterceptionType;
import org.jboss.weld.ejb.spi.InterceptorBindings;
+import org.jboss.weld.context.SerializableContextual;
import org.jboss.interceptor.model.InterceptionModel;
/**
@@ -37,9 +39,9 @@
public class InterceptorBindingsAdapter implements InterceptorBindings
{
- private InterceptionModel<Class<?>, Interceptor<?>> interceptionModel;
+ private InterceptionModel<Class<?>, SerializableContextual<Interceptor<?>, ?>> interceptionModel;
- public InterceptorBindingsAdapter(InterceptionModel<Class<?>, Interceptor<?>> interceptionModel)
+ public InterceptorBindingsAdapter(InterceptionModel<Class<?>, SerializableContextual<Interceptor<?>, ?>> interceptionModel)
{
if (interceptionModel == null)
{
@@ -50,7 +52,8 @@
public Collection<Interceptor<?>> getAllInterceptors()
{
- return interceptionModel.getAllInterceptors();
+ Collection<SerializableContextual<Interceptor<?>, ?>> contextualSet = interceptionModel.getAllInterceptors();
+ return toInterceptorList(contextualSet);
}
public List<Interceptor<?>> getMethodInterceptors(InterceptionType interceptionType, Method method)
@@ -72,7 +75,7 @@
throw new IllegalArgumentException("Interception type must not be lifecycle, but it is " + interceptionType.name());
}
- return interceptionModel.getInterceptors(internalInterceptionType, method);
+ return toInterceptorList(interceptionModel.getInterceptors(internalInterceptionType, method));
}
@@ -90,6 +93,17 @@
throw new IllegalArgumentException("Interception type must be lifecycle, but it is " + interceptionType.name());
}
- return interceptionModel.getInterceptors(internalInterceptionType, null);
+ return toInterceptorList(interceptionModel.getInterceptors(internalInterceptionType, null));
}
+
+ private List<Interceptor<?>> toInterceptorList(Collection<SerializableContextual<Interceptor<?>, ?>> contextualSet)
+ {
+ ArrayList<Interceptor<?>> interceptors = new ArrayList<Interceptor<?>>();
+ for (SerializableContextual<Interceptor<?>, ?> serializableContextual : contextualSet)
+ {
+ interceptors.add(serializableContextual.get());
+ }
+ return interceptors;
+ }
+
}
Deleted: core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorInterceptionHandlerFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorInterceptionHandlerFactory.java 2009-10-12 17:29:09 UTC (rev 3972)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/interceptor/InterceptorInterceptionHandlerFactory.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -1,53 +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.bean.interceptor;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Interceptor;
-
-import org.jboss.interceptor.proxy.DirectClassInterceptionHandler;
-import org.jboss.interceptor.proxy.InterceptionHandler;
-import org.jboss.interceptor.proxy.InterceptionHandlerFactory;
-import org.jboss.weld.BeanManagerImpl;
-
-/**
- * @author Marius Bogoevici
-*/
-public class InterceptorInterceptionHandlerFactory implements InterceptionHandlerFactory<Interceptor<?>>
-{
- private final CreationalContext creationalContext;
- private BeanManagerImpl manager;
-
- public InterceptorInterceptionHandlerFactory(CreationalContext creationalContext, BeanManagerImpl manager)
- {
- this.creationalContext = creationalContext;
- this.manager = manager;
- }
-
- public BeanManagerImpl getManager()
- {
- return manager;
- }
-
- public InterceptionHandler createFor(final Interceptor interceptor)
- {
- Object instance = getManager().getReference(interceptor, creationalContext);
- return new DirectClassInterceptionHandler(instance, interceptor.getBeanClass());
- }
-
-}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualInstance.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualInstance.java 2009-10-12 17:29:09 UTC (rev 3972)
+++ core/trunk/impl/src/main/java/org/jboss/weld/context/SerializableContextualInstance.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -39,6 +39,13 @@
this.creationalContext = creationalContext;
}
+ public SerializableContextualInstance(SerializableContextual<C, I> contextual, I instance, CreationalContext<I> creationalContext)
+ {
+ this.contextual = contextual;
+ this.instance = instance;
+ this.creationalContext = creationalContext;
+ }
+
public SerializableContextual<C, I> getContextual()
{
return contextual;
Modified: core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2009-10-12 17:29:09 UTC (rev 3972)
+++ core/trunk/impl/src/main/java/org/jboss/weld/util/Beans.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -234,10 +234,7 @@
boolean businessMethod = !annotatedMethod.isStatic()
&& (Modifier.isPublic(modifiers)
|| Modifier.isProtected(modifiers))
- && !annotatedMethod.isAnnotationPresent(Inject.class)
- && !annotatedMethod.isAnnotationPresent(Produces.class)
- && annotatedMethod.getAnnotatedWBParameters(Disposes.class).isEmpty()
- && annotatedMethod.getAnnotatedWBParameters(Observes.class).isEmpty();
+ && !annotatedMethod.isAnnotationPresent(Inject.class);
if (businessMethod)
{
Copied: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/EnterpriseBeanInterceptionTest.java (from rev 3961, core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/EnterpriseBeanInterceptionTests.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/EnterpriseBeanInterceptionTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/EnterpriseBeanInterceptionTest.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,49 @@
+package org.jboss.weld.test.unit.interceptor.ejb;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Arrays;
+
+
+import javax.enterprise.inject.spi.InterceptionType;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+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.weld.bean.SessionBean;
+import org.jboss.weld.bean.interceptor.InterceptorBindingsAdapter;
+import org.jboss.weld.test.AbstractWeldTest;
+import org.jboss.weld.ejb.spi.InterceptorBindings;
+
+import org.testng.annotations.Test;
+
+@Artifact
+(a)Packaging(PackagingType.EAR)
+@BeansXml("beans.xml")
+public class EnterpriseBeanInterceptionTest extends AbstractWeldTest
+{
+
+ @Test(groups = { "interceptors"})
+ public void testEnterpriseBeanInterceptionMetadataAdded() throws Exception
+ {
+ SessionBean<Ball> ballSessionBean = (SessionBean<Ball>)getCurrentManager().getBeans(Ball.class).iterator().next();
+ InterceptorBindings interceptorBindings = new InterceptorBindingsAdapter(getCurrentManager().getBoundInterceptorsRegistry().getInterceptionModel(ballSessionBean.getType()));
+ List<javax.enterprise.inject.spi.Interceptor> interceptors =
+ new ArrayList<javax.enterprise.inject.spi.Interceptor>(interceptorBindings.getAllInterceptors());
+
+ assert interceptors.size() == 2;
+ List<Class<?>> expectedInterceptors = Arrays.<Class<?>>asList(Goalkeeper.class, Defender.class);
+ assert expectedInterceptors.contains(interceptors.get(0).getBeanClass());
+ assert expectedInterceptors.contains(interceptors.get(1).getBeanClass());
+
+
+ assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, ballSessionBean.getType().getMethod("shoot")).size() == 1;
+ assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, ballSessionBean.getType().getMethod("shoot")).get(0).getBeanClass().equals(Goalkeeper.class);
+
+ assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, ballSessionBean.getType().getMethod("pass")).size() == 1;
+ assert interceptorBindings.getMethodInterceptors(InterceptionType.AROUND_INVOKE, ballSessionBean.getType().getMethod("pass")).get(0).getBeanClass().equals(Defender.class);
+
+ }
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/EnterpriseBeanInterceptionTest.java
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/EnterpriseBeanInterceptionTests.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/EnterpriseBeanInterceptionTests.java 2009-10-12 17:29:09 UTC (rev 3972)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/EnterpriseBeanInterceptionTests.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -1,45 +0,0 @@
-package org.jboss.weld.test.unit.interceptor.ejb;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.enterprise.inject.spi.Interceptor;
-
-import org.jboss.interceptor.model.InterceptionModel;
-import static org.jboss.interceptor.model.InterceptionType.AROUND_INVOKE;
-import org.jboss.testharness.impl.packaging.Artifact;
-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.weld.bean.SessionBean;
-import org.jboss.weld.test.AbstractWeldTest;
-
-import org.testng.annotations.Test;
-
-@Artifact
-(a)Packaging(PackagingType.EAR)
-@BeansXml("beans.xml")
-public class EnterpriseBeanInterceptionTests extends AbstractWeldTest
-{
-
- @Test(groups = { "interceptors"})
- public void testEnterpriseBeanInterceptionMetadataAdded() throws Exception
- {
- SessionBean<Ball> ballSessionBean = (SessionBean<Ball>)getCurrentManager().getBeans(Ball.class).iterator().next();
- InterceptionModel<Class<?>, Interceptor<?>> interceptionModel = getCurrentManager().getBoundInterceptorsRegistry().getInterceptionModel(ballSessionBean.getType());
- List<javax.enterprise.inject.spi.Interceptor> interceptors =
- new ArrayList<javax.enterprise.inject.spi.Interceptor>(interceptionModel.getAllInterceptors());
-
- assert interceptors.size() == 2;
- assert interceptors.get(0).getBeanClass().equals(Goalkeeper.class);
- assert interceptors.get(1).getBeanClass().equals(Defender.class);
-
- assert interceptionModel.getInterceptors(AROUND_INVOKE, ballSessionBean.getType().getMethod("shoot")).size() == 1;
- assert interceptionModel.getInterceptors(AROUND_INVOKE, ballSessionBean.getType().getMethod("shoot")).get(0).getBeanClass().equals(Goalkeeper.class);
-
- assert interceptionModel.getInterceptors(AROUND_INVOKE, ballSessionBean.getType().getMethod("pass")).size() == 1;
- assert interceptionModel.getInterceptors(AROUND_INVOKE, ballSessionBean.getType().getMethod("pass")).get(0).getBeanClass().equals(Defender.class);
-
- }
-
-}
Modified: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ball.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ball.java 2009-10-12 17:29:09 UTC (rev 3972)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ball.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -19,6 +19,8 @@
import javax.interceptor.Interceptors;
import javax.interceptor.ExcludeClassInterceptors;
+import javax.interceptor.InvocationContext;
+import javax.interceptor.AroundInvoke;
/**
* @author Marius Bogoevici
@@ -27,6 +29,8 @@
public class Ball
{
public static boolean played = false;
+
+ public static boolean aroundInvoke = false;
@ExcludeClassInterceptors
@Interceptors(Defender.class)
@@ -45,4 +49,11 @@
{
played = true;
}
+
+ @AroundInvoke
+ public Object aroundInvoke(InvocationContext invocationContext) throws Exception
+ {
+ aroundInvoke = true;
+ return invocationContext.proceed();
+ }
}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ejb3InterceptionModelTest.java (from rev 3961, core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ejb3InterceptionModelTests.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ejb3InterceptionModelTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ejb3InterceptionModelTest.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,86 @@
+/*
+ * 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.test.unit.interceptor.ejb3model;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.context.spi.CreationalContext;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.weld.test.AbstractWeldTest;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.BeforeMethod;
+
+
+/**
+ * @author Marius Bogoevici
+ */
+@Artifact
+public class Ejb3InterceptionModelTest extends AbstractWeldTest
+{
+ @BeforeMethod
+ public void reset()
+ {
+ Ball.played = false;
+ Goalkeeper.caught = false;
+ Defender.defended = false;
+ Ball.aroundInvoke = false;
+ }
+
+ @Test
+ public void testSimpleInterceptor()
+ {
+ Bean bean = getCurrentManager().getBeans(Ball.class).iterator().next();
+ CreationalContext creationalContext = getCurrentManager().createCreationalContext(bean);
+ Ball ball = (Ball) bean.create(creationalContext);
+ ball.shoot();
+ assert Defender.defended;
+ assert Ball.played;
+ assert !Goalkeeper.caught;
+ assert Ball.aroundInvoke;
+ }
+
+
+ @Test
+ public void testSimpleInterceptor2()
+ {
+ Bean bean = getCurrentManager().getBeans(Ball.class).iterator().next();
+ CreationalContext creationalContext = getCurrentManager().createCreationalContext(bean);
+ Ball ball = (Ball) bean.create(creationalContext);
+ ball.pass();
+ assert Defender.defended;
+ assert Ball.played;
+ assert Goalkeeper.caught;
+ assert Ball.aroundInvoke;
+ }
+
+ @Test
+ public void testSimpleInterceptor3()
+ {
+ Bean bean = getCurrentManager().getBeans(Ball.class).iterator().next();
+ CreationalContext creationalContext = getCurrentManager().createCreationalContext(bean);
+ Ball ball = (Ball) bean.create(creationalContext);
+ ball.lob();
+ assert !Defender.defended;
+ assert Ball.played;
+ assert Goalkeeper.caught;
+ assert Ball.aroundInvoke;
+ }
+
+}
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ejb3InterceptionModelTest.java
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ejb3InterceptionModelTests.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ejb3InterceptionModelTests.java 2009-10-12 17:29:09 UTC (rev 3972)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb3model/Ejb3InterceptionModelTests.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -1,82 +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.test.unit.interceptor.ejb3model;
-
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.context.spi.CreationalContext;
-
-import org.jboss.testharness.impl.packaging.Artifact;
-import org.jboss.weld.test.AbstractWeldTest;
-
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.BeforeMethod;
-
-
-/**
- * @author Marius Bogoevici
- */
-@Artifact
-public class Ejb3InterceptionModelTests extends AbstractWeldTest
-{
- @BeforeMethod
- public void reset()
- {
- Ball.played = false;
- Goalkeeper.caught = false;
- Defender.defended = false;
- }
-
- @Test
- public void testSimpleInterceptor()
- {
- Bean bean = getCurrentManager().getBeans(Ball.class).iterator().next();
- CreationalContext creationalContext = getCurrentManager().createCreationalContext(bean);
- Ball ball = (Ball) bean.create(creationalContext);
- ball.shoot();
- assert Defender.defended;
- assert Ball.played;
- assert !Goalkeeper.caught;
- }
-
-
- @Test
- public void testSimpleInterceptor2()
- {
- Bean bean = getCurrentManager().getBeans(Ball.class).iterator().next();
- CreationalContext creationalContext = getCurrentManager().createCreationalContext(bean);
- Ball ball = (Ball) bean.create(creationalContext);
- ball.pass();
- assert Defender.defended;
- assert Ball.played;
- assert Goalkeeper.caught;
- }
-
- @Test
- public void testSimpleInterceptor3()
- {
- Bean bean = getCurrentManager().getBeans(Ball.class).iterator().next();
- CreationalContext creationalContext = getCurrentManager().createCreationalContext(bean);
- Ball ball = (Ball) bean.create(creationalContext);
- ball.lob();
- assert !Defender.defended;
- assert Ball.played;
- assert Goalkeeper.caught;
- }
-
-}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Ball.java (from rev 3922, core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/BallImpl.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Ball.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Ball.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,39 @@
+/*
+ * 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.test.unit.interceptor.passivation;
+
+import java.io.Serializable;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+
+@PassivationActivation
+public class Ball implements Serializable
+{
+ @Shot
+ public void shoot()
+ {
+ }
+
+ @Pass
+ public void pass()
+ {
+ }
+
+}
\ No newline at end of file
Property changes on: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Ball.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Defender.java (from rev 3922, core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/Defender.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Defender.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Defender.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,41 @@
+/*
+ * 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.test.unit.interceptor.passivation;
+
+import java.io.Serializable;
+
+import javax.interceptor.Interceptor;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+import org.jboss.weld.test.unit.interceptor.ejb.*;
+import org.jboss.weld.test.unit.interceptor.ejb.Pass;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@Pass
+@Interceptor
+public class Defender implements Serializable
+{
+ @AroundInvoke
+ public Object defend(InvocationContext context) throws Exception
+ {
+ return context.proceed();
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Goalkeeper.java (from rev 3922, core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/Goalkeeper.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Goalkeeper.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Goalkeeper.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -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.test.unit.interceptor.passivation;
+
+import java.io.Serializable;
+
+import javax.interceptor.Interceptor;
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+import org.jboss.weld.test.unit.interceptor.ejb.*;
+import org.jboss.weld.test.unit.interceptor.ejb.Shot;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@Shot
+@Interceptor
+public class Goalkeeper implements Serializable
+{
+
+ @AroundInvoke
+ public Object catchBall(InvocationContext invocationContext) throws Exception
+ {
+ return invocationContext.proceed();
+ }
+}
\ No newline at end of file
Copied: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Pass.java (from rev 3922, core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/Pass.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Pass.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Pass.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,37 @@
+/*
+ * 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.test.unit.interceptor.passivation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@InterceptorBinding
+@Retention(RUNTIME)
+(a)Target({ElementType.METHOD, ElementType.TYPE})
+@Documented
+public @interface Pass
+{
+}
\ No newline at end of file
Added: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivation.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivation.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivation.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,37 @@
+/*
+ * 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.test.unit.interceptor.passivation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * @author Marius Bogoevici
+ */
+@InterceptorBinding
+@Retention(RUNTIME)
+(a)Target({ElementType.TYPE})
+@Documented
+public @interface PassivationActivation
+{
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationInterceptor.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,51 @@
+/*
+ * 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.test.unit.interceptor.passivation;
+
+import java.io.Serializable;
+
+import javax.interceptor.Interceptor;
+import javax.interceptor.InvocationContext;
+import javax.ejb.PrePassivate;
+import javax.ejb.PostActivate;
+
+/**
+ * @author Marius Bogoevici
+ */
+@Interceptor @PassivationActivation
+public class PassivationActivationInterceptor implements Serializable
+{
+ public static boolean prePassivateInvoked;
+ public static boolean postActivateInvoked;
+
+ @PrePassivate
+ public void prePassivate(InvocationContext invocationContext) throws Exception
+ {
+ prePassivateInvoked = true;
+ invocationContext.proceed();
+ }
+
+
+ @PostActivate
+ public void postActivate(InvocationContext invocationContext) throws Exception
+ {
+ postActivateInvoked = true;
+ invocationContext.proceed();
+ }
+
+}
Added: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/PassivationActivationTest.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,64 @@
+/*
+ * 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.test.unit.interceptor.passivation;
+
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ByteArrayInputStream;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.context.spi.CreationalContext;
+
+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 PassivationActivationTest extends AbstractWeldTest
+{
+
+ @Test
+ public void testPassivationAndActivation() throws Exception
+ {
+ Bean bean = getCurrentManager().getBeans(Ball.class).iterator().next();
+ CreationalContext creationalContext = getCurrentManager().createCreationalContext(bean);
+ Ball ball = (Ball) bean.create(creationalContext);
+
+ ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+ new ObjectOutputStream(byteArrayOutputStream).writeObject(ball);
+
+ assert PassivationActivationInterceptor.prePassivateInvoked;
+ assert !PassivationActivationInterceptor.postActivateInvoked;
+
+ PassivationActivationInterceptor.prePassivateInvoked = false;
+ PassivationActivationInterceptor.postActivateInvoked = false;
+
+ ball = (Ball)new ObjectInputStream(new ByteArrayInputStream(byteArrayOutputStream.toByteArray())).readObject();
+
+ assert !PassivationActivationInterceptor.prePassivateInvoked;
+ assert PassivationActivationInterceptor.postActivateInvoked;
+
+ }
+}
Copied: core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Shot.java (from rev 3922, core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/ejb/Shot.java)
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Shot.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/test/unit/interceptor/passivation/Shot.java 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,37 @@
+/*
+ * 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.test.unit.interceptor.passivation;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Documented;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import javax.interceptor.InterceptorBinding;
+
+/**
+ * @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
+ */
+@InterceptorBinding
+@Retention(RUNTIME)
+(a)Target({ElementType.METHOD, ElementType.TYPE})
+@Documented
+public @interface Shot
+{
+}
\ No newline at end of file
Copied: core/trunk/tests/src/test/resources/org/jboss/weld/test/unit/interceptor/passivation/beans.xml (from rev 3922, core/trunk/tests/src/test/resources/org/jboss/weld/test/unit/interceptor/ejb/beans.xml)
===================================================================
--- core/trunk/tests/src/test/resources/org/jboss/weld/test/unit/interceptor/passivation/beans.xml (rev 0)
+++ core/trunk/tests/src/test/resources/org/jboss/weld/test/unit/interceptor/passivation/beans.xml 2009-10-12 17:34:43 UTC (rev 3973)
@@ -0,0 +1,7 @@
+<beans>
+ <interceptors>
+ <class>org.jboss.weld.test.unit.interceptor.passivation.Goalkeeper</class>
+ <class>org.jboss.weld.test.unit.interceptor.passivation.Defender</class>
+ <class>org.jboss.weld.test.unit.interceptor.passivation.PassivationActivationInterceptor</class>
+ </interceptors>
+</beans>
15 years, 1 month
Weld SVN: r3971 - build/tags.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-12 13:29:01 -0400 (Mon, 12 Oct 2009)
New Revision: 3971
Added:
build/tags/weld-parent-1/
Log:
[maven-scm] copy for tag weld-parent-1
Copied: build/tags/weld-parent-1 (from rev 3970, build/trunk/parent)
15 years, 1 month
Weld SVN: r3970 - build/tags.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-10-12 13:25:59 -0400 (Mon, 12 Oct 2009)
New Revision: 3970
Removed:
build/tags/weld-parent-1/
Log:
bad tag
15 years, 1 month