Weld SVN: r6175 - in extensions/trunk/src/main/java/org/jboss/weld/extensions: bean and 2 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-04-28 09:07:05 -0400 (Wed, 28 Apr 2010)
New Revision: 6175
Added:
extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/
Removed:
extensions/trunk/src/main/java/org/jboss/weld/extensions/beans/
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/BeanLifecycle.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/CustomBean.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/CustomBeanBuilder.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/CustomInjectionPoint.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/PassivationCapableCustomBean.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/SimpleBeanLifecycle.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/managedproducer/ManagedProducerInvocationHandler.java
Log:
WELDX-98
Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/bean (from rev 6171, extensions/trunk/src/main/java/org/jboss/weld/extensions/beans)
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/BeanLifecycle.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/beans/BeanLifecycle.java 2010-04-28 12:22:19 UTC (rev 6171)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/BeanLifecycle.java 2010-04-28 13:07:05 UTC (rev 6175)
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.weld.extensions.beans;
+package org.jboss.weld.extensions.bean;
import javax.enterprise.context.spi.CreationalContext;
/**
- * Hanlder for the create/destroy methods of CustomBean
+ * Handler for the create/destroy methods of CustomBean
*
* @author stuart
*
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/CustomBean.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/beans/CustomBean.java 2010-04-28 12:22:19 UTC (rev 6171)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/CustomBean.java 2010-04-28 13:07:05 UTC (rev 6175)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.weld.extensions.beans;
+package org.jboss.weld.extensions.bean;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/CustomBeanBuilder.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/beans/CustomBeanBuilder.java 2010-04-28 12:22:19 UTC (rev 6171)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/CustomBeanBuilder.java 2010-04-28 13:07:05 UTC (rev 6175)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.weld.extensions.beans;
+package org.jboss.weld.extensions.bean;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/CustomInjectionPoint.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/beans/CustomInjectionPoint.java 2010-04-28 12:22:19 UTC (rev 6171)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/CustomInjectionPoint.java 2010-04-28 13:07:05 UTC (rev 6175)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.weld.extensions.beans;
+package org.jboss.weld.extensions.bean;
import java.lang.annotation.Annotation;
import java.lang.reflect.Member;
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/PassivationCapableCustomBean.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/beans/PassivationCapableCustomBean.java 2010-04-28 12:22:19 UTC (rev 6171)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/PassivationCapableCustomBean.java 2010-04-28 13:07:05 UTC (rev 6175)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.weld.extensions.beans;
+package org.jboss.weld.extensions.bean;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/SimpleBeanLifecycle.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/beans/SimpleBeanLifecycle.java 2010-04-28 12:22:19 UTC (rev 6171)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/bean/SimpleBeanLifecycle.java 2010-04-28 13:07:05 UTC (rev 6175)
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.jboss.weld.extensions.beans;
+package org.jboss.weld.extensions.bean;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.BeanManager;
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java 2010-04-28 13:05:40 UTC (rev 6174)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/genericbeans/GenericExtension.java 2010-04-28 13:07:05 UTC (rev 6175)
@@ -44,7 +44,7 @@
import javax.enterprise.util.AnnotationLiteral;
import javax.inject.Inject;
-import org.jboss.weld.extensions.beans.CustomBeanBuilder;
+import org.jboss.weld.extensions.bean.CustomBeanBuilder;
import org.jboss.weld.extensions.util.AnnotationInstanceProvider;
import org.jboss.weld.extensions.util.reannotated.ReannotatedField;
import org.jboss.weld.extensions.util.reannotated.ReannotatedParameter;
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/managedproducer/ManagedProducerInvocationHandler.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/managedproducer/ManagedProducerInvocationHandler.java 2010-04-28 13:05:40 UTC (rev 6174)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/managedproducer/ManagedProducerInvocationHandler.java 2010-04-28 13:07:05 UTC (rev 6175)
@@ -34,7 +34,7 @@
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.InjectionPoint;
-import org.jboss.weld.extensions.beans.CustomInjectionPoint;
+import org.jboss.weld.extensions.bean.CustomInjectionPoint;
public class ManagedProducerInvocationHandler<T> implements InvocationHandler
{
14 years, 7 months
Weld SVN: r6174 - extensions/trunk/src/main/java/org/jboss/weld/extensions/beanManager.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-04-28 09:05:40 -0400 (Wed, 28 Apr 2010)
New Revision: 6174
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/beanManager/BeanManagerAware.java
extensions/trunk/src/main/java/org/jboss/weld/extensions/beanManager/BeanManagerProvider.java
Log:
javadoc for BMA/BMP
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/beanManager/BeanManagerAware.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/beanManager/BeanManagerAware.java 2010-04-28 12:47:09 UTC (rev 6173)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/beanManager/BeanManagerAware.java 2010-04-28 13:05:40 UTC (rev 6174)
@@ -29,15 +29,26 @@
import org.jboss.weld.extensions.util.service.ServiceLoader;
/**
+ * <p>
* Super-class for non-CDI-native components that need a reference to the
- * {@link BeanManager}
+ * {@link BeanManager}. {@link BeanManagerProvider}s can be registered to allow
+ * third parties to register custom methods of looking up the BeanManager.
+ * </p>
+ *
* <p>
- * <b>**WARNING**</b> This class is <b>NEVER</b> safe to use outside of specific
- * seam-faces implementation classes, and should be <b>avoided at all costs</b>.
- * If you need a handle to the {@link BeanManager} you should probably register
- * an {@link Extension} instead of using this class; have you tried using @
- * {@link Inject}?
+ * <b>**WARNING**</b> This class is <b>NOT</b> a clever way to get the BeanManager,
+ * and should be <b>avoided at all costs</b>. If you need a handle to the
+ * {@link BeanManager} you should probably register an {@link Extension} instead of
+ * using this class; have you tried using @{@link Inject}?
+ * </p>
*
+ * <p>
+ * If you think you need to use this class, chat to the community and make sure you
+ * aren't missing an trick!
+ * </p>
+ *
+ * @see BeanManagerProvider
+ *
* @author Nicklas Karlsson
*/
public class BeanManagerAware
@@ -56,6 +67,11 @@
}
}
+ /**
+ * Obtain the {@link BeanManager} from the {@link BeanManagerProvider}s
+ *
+ * @return the current BeanManager for the bean archive
+ */
protected BeanManager getBeanManager()
{
if (beanManager == null)
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/beanManager/BeanManagerProvider.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/beanManager/BeanManagerProvider.java 2010-04-28 12:47:09 UTC (rev 6173)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/beanManager/BeanManagerProvider.java 2010-04-28 13:05:40 UTC (rev 6174)
@@ -21,8 +21,20 @@
import org.jboss.weld.extensions.util.Sortable;
/**
- * Provider for obtaining a BeanManager
+ * BeanManagerProvider is an SPI which allows third parties to
+ * register a way of obtaining the BeanManager outside of CDI
+ * managed objects.
*
+ * Built in providers are {@link DefaultJndiBeanManagerProvider}
+ * and {@link JBossJndiBeanManagerProvider}.
+ *
+ * Providers can specify a precedence, allowing a provider to be a
+ * "last resort" provider only.
+ *
+ * Precedence about 100 is reserved for providers that should always
+ * be used. Precedence below 10 is reserved for providers of last
+ * resort.
+ *
* @author Nicklas Karlsson
*
*/
14 years, 7 months
Weld SVN: r6173 - in extensions/trunk/src: main/java/org/jboss/weld/extensions/managedproducer and 1 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-04-28 08:47:09 -0400 (Wed, 28 Apr 2010)
New Revision: 6173
Added:
extensions/trunk/src/main/java/org/jboss/weld/extensions/ManagedProducer.java
Removed:
extensions/trunk/src/main/java/org/jboss/weld/extensions/annotations/
Modified:
extensions/trunk/src/main/java/org/jboss/weld/extensions/managedproducer/ManagedProducerExtension.java
extensions/trunk/src/test/java/org/jboss/weld/test/extensions/managedproducer/BeanProducer.java
Log:
WELDX-98
Copied: extensions/trunk/src/main/java/org/jboss/weld/extensions/ManagedProducer.java (from rev 6171, extensions/trunk/src/main/java/org/jboss/weld/extensions/annotations/ManagedProducer.java)
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/ManagedProducer.java (rev 0)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/ManagedProducer.java 2010-04-28 12:47:09 UTC (rev 6173)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.weld.extensions;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+(a)Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.METHOD })
+public @interface ManagedProducer
+{
+
+}
Modified: extensions/trunk/src/main/java/org/jboss/weld/extensions/managedproducer/ManagedProducerExtension.java
===================================================================
--- extensions/trunk/src/main/java/org/jboss/weld/extensions/managedproducer/ManagedProducerExtension.java 2010-04-28 12:45:29 UTC (rev 6172)
+++ extensions/trunk/src/main/java/org/jboss/weld/extensions/managedproducer/ManagedProducerExtension.java 2010-04-28 12:47:09 UTC (rev 6173)
@@ -26,7 +26,7 @@
import javax.enterprise.inject.spi.Extension;
import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import org.jboss.weld.extensions.annotations.ManagedProducer;
+import org.jboss.weld.extensions.ManagedProducer;
/**
* An extension that allows the use of @ManagedProducer methods
Modified: extensions/trunk/src/test/java/org/jboss/weld/test/extensions/managedproducer/BeanProducer.java
===================================================================
--- extensions/trunk/src/test/java/org/jboss/weld/test/extensions/managedproducer/BeanProducer.java 2010-04-28 12:45:29 UTC (rev 6172)
+++ extensions/trunk/src/test/java/org/jboss/weld/test/extensions/managedproducer/BeanProducer.java 2010-04-28 12:47:09 UTC (rev 6173)
@@ -18,7 +18,7 @@
import javax.enterprise.inject.spi.InjectionPoint;
-import org.jboss.weld.extensions.annotations.ManagedProducer;
+import org.jboss.weld.extensions.ManagedProducer;
public class BeanProducer
{
14 years, 7 months
Weld SVN: r6172 - extensions/trunk/src/test/java/org/jboss/weld/test/extensions/interceptor.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-04-28 08:45:29 -0400 (Wed, 28 Apr 2010)
New Revision: 6172
Modified:
extensions/trunk/src/test/java/org/jboss/weld/test/extensions/interceptor/PrimaryInterceptionBinding.java
Log:
minor
Modified: extensions/trunk/src/test/java/org/jboss/weld/test/extensions/interceptor/PrimaryInterceptionBinding.java
===================================================================
--- extensions/trunk/src/test/java/org/jboss/weld/test/extensions/interceptor/PrimaryInterceptionBinding.java 2010-04-28 12:22:19 UTC (rev 6171)
+++ extensions/trunk/src/test/java/org/jboss/weld/test/extensions/interceptor/PrimaryInterceptionBinding.java 2010-04-28 12:45:29 UTC (rev 6172)
@@ -17,10 +17,15 @@
package org.jboss.weld.test.extensions.interceptor;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
import javax.interceptor.InterceptorBinding;
-import java.lang.annotation.*;
-import static java.lang.annotation.ElementType.*;
-import static java.lang.annotation.RetentionPolicy.*;
/**
* @author <a href="mailto:mariusb@redhat.com">Marius Bogoevici</a>
14 years, 7 months
Weld SVN: r6171 - java-se/trunk.
by weld-commits@lists.jboss.org
Author: peteroyle
Date: 2010-04-28 08:22:19 -0400 (Wed, 28 Apr 2010)
New Revision: 6171
Modified:
java-se/trunk/pom.xml
Log:
WELDSE-1: Added main class to manifest to make the jar executable
Modified: java-se/trunk/pom.xml
===================================================================
--- java-se/trunk/pom.xml 2010-04-28 08:19:38 UTC (rev 6170)
+++ java-se/trunk/pom.xml 2010-04-28 12:22:19 UTC (rev 6171)
@@ -176,6 +176,18 @@
</artifactSet>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <mainClass>org.jboss.weld.environment.se.StartMain</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
</plugins>
</build>
14 years, 7 months
Weld SVN: r6170 - core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization.
by weld-commits@lists.jboss.org
Author: nickarls
Date: 2010-04-28 04:19:38 -0400 (Wed, 28 Apr 2010)
New Revision: 6170
Added:
core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/Mock.java
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java
core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/TestConversationManager.java
Log:
unbreak test. why can't I use specialize on the TCM?
Added: core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/Mock.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/Mock.java (rev 0)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/Mock.java 2010-04-28 08:19:38 UTC (rev 6170)
@@ -0,0 +1,22 @@
+package org.jboss.weld.tests.serialization;
+
+import static java.lang.annotation.ElementType.FIELD;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PARAMETER;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Target( { TYPE, METHOD, PARAMETER, FIELD })
+@Retention(RUNTIME)
+@Documented
+@Qualifier
+@Inherited
+public @interface Mock {
+}
\ No newline at end of file
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java 2010-04-27 23:32:18 UTC (rev 6169)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/SerializationTest.java 2010-04-28 08:19:38 UTC (rev 6170)
@@ -19,6 +19,7 @@
import java.io.Serializable;
import javax.enterprise.inject.IllegalProductException;
+import javax.enterprise.util.AnnotationLiteral;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.weld.test.AbstractWeldTest;
@@ -33,7 +34,9 @@
public void testConversationManagerSerializable()
throws Exception
{
- TestConversationManager cMgr = getReference(TestConversationManager.class);
+ TestConversationManager cMgr = getReference(TestConversationManager.class, new AnnotationLiteral<Mock>()
+ {
+ });
assert cMgr.getConversationInstance() != null;
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/TestConversationManager.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/TestConversationManager.java 2010-04-27 23:32:18 UTC (rev 6169)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/serialization/TestConversationManager.java 2010-04-28 08:19:38 UTC (rev 6170)
@@ -18,13 +18,11 @@
import java.lang.reflect.Field;
-import javax.enterprise.context.Dependent;
-
import org.jboss.weld.conversation.AbstractConversationManager;
import org.jboss.weld.conversation.ConversationImpl;
import org.jboss.weld.conversation.ServletConversationManager;
-@Dependent
+@Mock
public class TestConversationManager extends ServletConversationManager
{
private static final long serialVersionUID = 2;
14 years, 7 months
Weld SVN: r6169 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2010-04-27 19:32:18 -0400 (Tue, 27 Apr 2010)
New Revision: 6169
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
Log:
Fixed test implementation to work better generically with proxies.
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2010-04-27 19:33:23 UTC (rev 6168)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2010-04-27 23:32:18 UTC (rev 6169)
@@ -84,10 +84,9 @@
// Verify that the instance returned is a proxy by checking for all local interfaces
assert getCurrentConfiguration().getBeans().isProxy(stadtInstance);
- Set<Class> interfaces = new HashSet<Class>(Arrays.asList(stadtInstance.getClass().getInterfaces()));
- assert interfaces.contains(KleinStadt.class);
- assert interfaces.contains(SchoeneStadt.class);
- assert interfaces.contains(Serializable.class);
+ assert stadtInstance instanceof KleinStadt;
+ assert stadtInstance instanceof SchoeneStadt;
+ assert stadtInstance instanceof Serializable;
}
@Test(groups = { "enterpriseBeans", "clientProxy", "lifecycle", "integration" })
@@ -157,9 +156,8 @@
assert stadtInstance != null : "Expected instance to be created by container";
// Verify that the instance returned is a proxy by checking for all local interfaces
- Set<Class> interfaces = new HashSet<Class>(Arrays.asList(stadtInstance.getClass().getInterfaces()));
- assert interfaces.contains(NeueStadt.class);
- assert interfaces.contains(GeschichtslosStadt.class);
+ assert stadtInstance instanceof NeueStadt;
+ assert stadtInstance instanceof GeschichtslosStadt;
}
@Test(groups = { "enterpriseBeans", "lifecycle", "integration" })
14 years, 7 months
Weld SVN: r6168 - core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/lifecycle.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2010-04-27 15:33:23 -0400 (Tue, 27 Apr 2010)
New Revision: 6168
Modified:
core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
Log:
Fixed test implementation to work better generically with proxies.
Modified: core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
===================================================================
--- core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2010-04-27 19:32:14 UTC (rev 6167)
+++ core/trunk/tests/src/test/java/org/jboss/weld/tests/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2010-04-27 19:33:23 UTC (rev 6168)
@@ -79,12 +79,8 @@
assert anotherStadtInstance != stadtInstance : "create() should not return same bean as before";
// Verify that the instance returned is a proxy by checking for all local interfaces
- Class<?>[] classes = stadtInstance.getClass().getInterfaces();
- List<Class<?>> classesList = Arrays.asList(classes);
- Set<Class<?>> interfaces = new HashSet<Class<?>>(classesList);
-
- assert interfaces.contains(KleinStadt.class);
- assert interfaces.contains(SchoeneStadt.class);
+ assert stadtInstance instanceof KleinStadt;
+ assert stadtInstance instanceof SchoeneStadt;
}
@Test(groups = { "enterpriseBeans", "clientProxy", "lifecycle", "integration" })
14 years, 7 months
Weld SVN: r6167 - core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy.
by weld-commits@lists.jboss.org
Author: dallen6
Date: 2010-04-27 15:32:14 -0400 (Tue, 27 Apr 2010)
New Revision: 6167
Modified:
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseProxyFactory.java
core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
Log:
Fixed problem with enterprise bean proxies; constructors and remove methods.
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseProxyFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseProxyFactory.java 2010-04-27 18:33:24 UTC (rev 6166)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseProxyFactory.java 2010-04-27 19:32:14 UTC (rev 6167)
@@ -19,7 +19,9 @@
import javassist.CtClass;
import javassist.CtConstructor;
+import javassist.CtMethod;
import javassist.CtNewConstructor;
+import javassist.CtNewMethod;
import org.jboss.weld.exceptions.WeldException;
@@ -42,10 +44,8 @@
public EnterpriseProxyFactory(Class<T> proxiedBeanType)
{
super(proxiedBeanType);
- addInterface(EnterpriseBeanInstance.class);
}
- // Not sure this is a useful approach, but non-default constructors are problematic (DRA)
@Override
protected void addConstructors(CtClass proxyClassType)
{
@@ -54,7 +54,7 @@
CtClass baseType = classPool.get(beanType.getName());
for (CtConstructor constructor : baseType.getConstructors())
{
- proxyClassType.addConstructor(CtNewConstructor.copy(constructor, proxyClassType, null));
+ proxyClassType.addConstructor(CtNewConstructor.make(constructor.getParameterTypes(), constructor.getExceptionTypes(), proxyClassType));
}
}
catch (Exception e)
@@ -69,4 +69,26 @@
return PROXY_SUFFIX;
}
+ @Override
+ protected void addSpecialMethods(CtClass proxyClassType)
+ {
+ super.addSpecialMethods(proxyClassType);
+
+ // Add methods for the EnterpriseBeanInstance interface
+ try
+ {
+ CtClass enterpriseBeanInstanceInterface = classPool.get(EnterpriseBeanInstance.class.getName());
+ proxyClassType.addInterface(enterpriseBeanInstanceInterface);
+ for (CtMethod method : enterpriseBeanInstanceInterface.getDeclaredMethods())
+ {
+ log.trace("Adding method " + method.getLongName());
+ proxyClassType.addMethod(CtNewMethod.make(method.getReturnType(), method.getName(), method.getParameterTypes(), method.getExceptionTypes(), createSpecialInterfaceBody(method, EnterpriseBeanInstance.class), proxyClassType));
+ }
+ }
+ catch (Exception e)
+ {
+ throw new WeldException(e);
+ }
+
+ }
}
Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java 2010-04-27 18:33:24 UTC (rev 6166)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/proxy/ProxyFactory.java 2010-04-27 19:32:14 UTC (rev 6167)
@@ -381,7 +381,12 @@
}
}
- private void addSpecialMethods(CtClass proxyClassType)
+ /**
+ * Adds methods requiring special implementations rather than just delegation.
+ *
+ * @param proxyClassType the Javassist class description for the proxy type
+ */
+ protected void addSpecialMethods(CtClass proxyClassType)
{
try
{
@@ -394,7 +399,7 @@
for (CtMethod method : lifecycleMixinClass.getDeclaredMethods())
{
log.trace("Adding method " + method.getLongName());
- proxyClassType.addMethod(CtNewMethod.make(method.getReturnType(), method.getName(), method.getParameterTypes(), method.getExceptionTypes(), createLifecycleBody(method), proxyClassType));
+ proxyClassType.addMethod(CtNewMethod.make(method.getReturnType(), method.getName(), method.getParameterTypes(), method.getExceptionTypes(), createSpecialInterfaceBody(method, LifecycleMixin.class), proxyClassType));
}
CtClass targetInstanceProxyClass = classPool.get(TargetInstanceProxy.class.getName());
CtMethod getInstanceMethod = targetInstanceProxyClass.getDeclaredMethod("getTargetInstance");
@@ -409,18 +414,19 @@
}
/**
- * Creates the method body code for lifecycle methods which forward the calls
- * directly to the bean instance.
+ * Creates the method body code for methods which forward the calls
+ * directly to the bean instance. These methods are not considered
+ * to be implemented by any superclass of the proxy.
*
- * @param method a lifecycle method
+ * @param method a method
* @return code for the body of the method to be compiled
* @throws NotFoundException if any of the parameter types are not found
*/
- private String createLifecycleBody(CtMethod method) throws NotFoundException
+ protected String createSpecialInterfaceBody(CtMethod method, Class<?> interfaceClazz) throws NotFoundException
{
StringBuilder bodyString = new StringBuilder();
bodyString.append("{ beanInstance.invoke(");
- bodyString.append(LifecycleMixin.class.getName());
+ bodyString.append(interfaceClazz.getName());
bodyString.append(".class.getDeclaredMethod(\"");
bodyString.append(method.getName());
bodyString.append("\", ");
14 years, 7 months
Weld SVN: r6166 - cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback.
by weld-commits@lists.jboss.org
Author: marius.bogoevici
Date: 2010-04-27 14:33:24 -0400 (Tue, 27 Apr 2010)
New Revision: 6166
Modified:
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Animal.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/AnimalInterceptor.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Cow.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Goat.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Hen.java
cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/LifecycleCallbackInterceptorTest.java
Log:
CDITCK-146 replace relying on getClass() by a polymorphic method overridden in each of Animal's hierarchy classes
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Animal.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Animal.java 2010-04-27 08:34:27 UTC (rev 6165)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Animal.java 2010-04-27 18:33:24 UTC (rev 6166)
@@ -22,4 +22,6 @@
{
}
+
+ public abstract String getAnimalType();
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/AnimalInterceptor.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/AnimalInterceptor.java 2010-04-27 08:34:27 UTC (rev 6165)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/AnimalInterceptor.java 2010-04-27 18:33:24 UTC (rev 6166)
@@ -26,13 +26,13 @@
class AnimalInterceptor
{
- private static Set<Class<?>> postConstructInterceptorCalledFor = new HashSet<Class<?>>();
- private static Set<Class<?>> preDestroyInterceptorCalledFor = new HashSet<Class<?>>();
+ private static Set<String> postConstructInterceptorCalledFor = new HashSet<String>();
+ private static Set<String> preDestroyInterceptorCalledFor = new HashSet<String>();
@PostConstruct
public void postConstruct(InvocationContext ctx)
{
- postConstructInterceptorCalledFor.add(ctx.getTarget().getClass());
+ postConstructInterceptorCalledFor.add(((Animal) ctx.getTarget()).getAnimalType());
try
{
ctx.proceed();
@@ -59,7 +59,7 @@
@PreDestroy
public void preDestroy(InvocationContext ctx)
{
- preDestroyInterceptorCalledFor.add(ctx.getTarget().getClass());
+ preDestroyInterceptorCalledFor.add(((Animal) ctx.getTarget()).getAnimalType());
try
{
ctx.proceed();
@@ -70,13 +70,13 @@
}
}
- public static boolean isPostConstructInterceptorCalled(Class<?> clazz)
+ public static boolean isPostConstructInterceptorCalled(String animalType)
{
- return postConstructInterceptorCalledFor.contains(clazz);
+ return postConstructInterceptorCalledFor.contains(animalType);
}
- public static boolean isPreDestroyInterceptorCalled(Class<?> clazz)
+ public static boolean isPreDestroyInterceptorCalled(String animalType)
{
- return preDestroyInterceptorCalledFor.contains(clazz);
+ return preDestroyInterceptorCalledFor.contains(animalType);
}
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Cow.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Cow.java 2010-04-27 08:34:27 UTC (rev 6165)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Cow.java 2010-04-27 18:33:24 UTC (rev 6166)
@@ -25,9 +25,12 @@
@RequestScoped
class Cow extends Animal
{
+ protected static final String COW = "Cow";
+
private static boolean postConstructInterceptorCalled = false;
private static boolean preDestroyInterceptorCalled = false;
+
@PostConstruct
public void postConstruct()
{
@@ -54,4 +57,10 @@
{
return preDestroyInterceptorCalled;
}
+
+ @Override
+ public String getAnimalType()
+ {
+ return COW;
+ }
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Goat.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Goat.java 2010-04-27 08:34:27 UTC (rev 6165)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Goat.java 2010-04-27 18:33:24 UTC (rev 6166)
@@ -23,9 +23,12 @@
@Interceptors(AnimalInterceptor.class)
class Goat extends Animal
{
+ protected static final String GOAT = "Goat";
+
private static boolean postConstructInterceptorCalled = false;
private static boolean preDestroyInterceptorCalled = false;
+
@PostConstruct
public void postConstruct()
{
@@ -52,4 +55,10 @@
{
return preDestroyInterceptorCalled;
}
+
+ @Override
+ public String getAnimalType()
+ {
+ return GOAT;
+ }
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Hen.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Hen.java 2010-04-27 08:34:27 UTC (rev 6165)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/Hen.java 2010-04-27 18:33:24 UTC (rev 6166)
@@ -25,6 +25,8 @@
@ApplicationScoped
class Hen extends Animal
{
+ protected static final String HEN = "Hen";
+
private static boolean postConstructInterceptorCalled = false;
private static boolean preDestroyInterceptorCalled = false;
@@ -54,4 +56,10 @@
{
return preDestroyInterceptorCalled;
}
+
+ @Override
+ public String getAnimalType()
+ {
+ return HEN;
+ }
}
Modified: cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/LifecycleCallbackInterceptorTest.java
===================================================================
--- cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/LifecycleCallbackInterceptorTest.java 2010-04-27 08:34:27 UTC (rev 6165)
+++ cdi-tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/interceptors/tests/lifecycleCallback/LifecycleCallbackInterceptorTest.java 2010-04-27 18:33:24 UTC (rev 6166)
@@ -35,13 +35,13 @@
{
getInstanceByType(Goat.class);
assert Goat.isPostConstructInterceptorCalled();
- assert AnimalInterceptor.isPostConstructInterceptorCalled(Goat.class);
+ assert AnimalInterceptor.isPostConstructInterceptorCalled(Goat.GOAT);
getInstanceByType(Hen.class).toString();
assert Hen.isPostConstructInterceptorCalled();
- assert AnimalInterceptor.isPostConstructInterceptorCalled(Hen.class);
+ assert AnimalInterceptor.isPostConstructInterceptorCalled(Hen.HEN);
getInstanceByType(Cow.class).toString();
assert Cow.isPostConstructInterceptorCalled();
- assert AnimalInterceptor.isPostConstructInterceptorCalled(Cow.class);
+ assert AnimalInterceptor.isPostConstructInterceptorCalled(Cow.COW);
}
@Test
@@ -51,13 +51,13 @@
{
createAndDestroyInstance(Goat.class);
assert Goat.isPreDestroyInterceptorCalled();
- assert AnimalInterceptor.isPreDestroyInterceptorCalled(Goat.class);
+ assert AnimalInterceptor.isPreDestroyInterceptorCalled(Goat.GOAT);
createAndDestroyInstance(Hen.class);
assert Hen.isPreDestroyInterceptorCalled();
- assert AnimalInterceptor.isPreDestroyInterceptorCalled(Hen.class);
+ assert AnimalInterceptor.isPreDestroyInterceptorCalled(Hen.HEN);
createAndDestroyInstance(Cow.class);
assert Cow.isPreDestroyInterceptorCalled();
- assert AnimalInterceptor.isPreDestroyInterceptorCalled(Cow.class);
+ assert AnimalInterceptor.isPreDestroyInterceptorCalled(Cow.COW);
}
@SuppressWarnings("unchecked")
14 years, 7 months