Author: alesj
Date: 2009-10-14 16:07:37 -0400 (Wed, 14 Oct 2009)
New Revision: 4100
Added:
extensions/trunk/bean-utils/src/test/java/org/jboss/test/weld/beanutils/MockBULifecycle.java
Modified:
extensions/trunk/bean-utils/src/main/java/org/jboss/weld/beanutils/exisiting/ExistingBeanDescriberImpl.java
extensions/trunk/bean-utils/src/main/java/org/jboss/weld/beanutils/exisiting/ExistingSimpleBean.java
extensions/trunk/bean-utils/src/test/java/org/jboss/test/weld/beanutils/AbstractBeanUtilsTest.java
Log:
Add some hacks to make it build.
Modified:
extensions/trunk/bean-utils/src/main/java/org/jboss/weld/beanutils/exisiting/ExistingBeanDescriberImpl.java
===================================================================
---
extensions/trunk/bean-utils/src/main/java/org/jboss/weld/beanutils/exisiting/ExistingBeanDescriberImpl.java 2009-10-14
17:21:55 UTC (rev 4099)
+++
extensions/trunk/bean-utils/src/main/java/org/jboss/weld/beanutils/exisiting/ExistingBeanDescriberImpl.java 2009-10-14
20:07:37 UTC (rev 4100)
@@ -78,12 +78,12 @@
for (WeldMethod<?, ?> method :
clazz.getDeclaredAnnotatedWeldMethods(Produces.class))
{
- beans.addMethodProducerBean(createProducerMethodBean(bean, env,
(BeanManagerImpl)beanManager, (WeldMethod<T, ?>)method));
+ beans.addMethodProducerBean(createProducerMethodBean(bean, env,
(BeanManagerImpl)beanManager, (WeldMethod<T, T>)method));
}
for (WeldField<?, ?> field :
clazz.getDeclaredAnnotatedWeldFields(Produces.class))
{
- beans.addFieldProducerBean(createProducerFieldBean(bean, env,
(BeanManagerImpl)beanManager, (WeldField<T, ?>)field));
+ beans.addFieldProducerBean(createProducerFieldBean(bean, env,
(BeanManagerImpl)beanManager, (WeldField<T, T>)field));
}
return beans;
@@ -110,9 +110,9 @@
}
private static <T> Bean<T>
createProducerMethodBean(AbstractClassBean<T> declaringBean,
- BeanDeployerEnvironment env, BeanManagerImpl beanManager, WeldMethod<T, ?>
method)
+ BeanDeployerEnvironment env, BeanManagerImpl beanManager, WeldMethod<T, T>
method)
{
- ProducerMethod<T> bean = ProducerMethod.of(method, declaringBean,
beanManager);
+ ProducerMethod<T, T> bean = ProducerMethod.of(method, declaringBean,
beanManager);
//TODO How to get BeanDeployerEnvironment?
bean.initialize(env);
@@ -121,9 +121,9 @@
private static <T> Bean<T>
createProducerFieldBean(AbstractClassBean<T> declaringBean,
- BeanDeployerEnvironment env, BeanManagerImpl beanManager, WeldField<T, ?>
field)
+ BeanDeployerEnvironment env, BeanManagerImpl beanManager, WeldField<T, T>
field)
{
- ProducerField<T> bean = ProducerField.of(field, declaringBean, beanManager);
+ ProducerField<T, T> bean = ProducerField.of(field, declaringBean,
beanManager);
//TODO How to get BeanDeployerEnvironment?
bean.initialize(env);
Modified:
extensions/trunk/bean-utils/src/main/java/org/jboss/weld/beanutils/exisiting/ExistingSimpleBean.java
===================================================================
---
extensions/trunk/bean-utils/src/main/java/org/jboss/weld/beanutils/exisiting/ExistingSimpleBean.java 2009-10-14
17:21:55 UTC (rev 4099)
+++
extensions/trunk/bean-utils/src/main/java/org/jboss/weld/beanutils/exisiting/ExistingSimpleBean.java 2009-10-14
20:07:37 UTC (rev 4100)
@@ -35,7 +35,6 @@
*/
public class ExistingSimpleBean<T> extends ManagedBean<T>
{
-
T instance;
/**
@@ -83,7 +82,7 @@
* @param creationalContext the creational context
* @return the instance
*/
- @Override
+ // TODO -- override?
public T produce(CreationalContext<T> ctx)
{
ctx.release();
Modified:
extensions/trunk/bean-utils/src/test/java/org/jboss/test/weld/beanutils/AbstractBeanUtilsTest.java
===================================================================
---
extensions/trunk/bean-utils/src/test/java/org/jboss/test/weld/beanutils/AbstractBeanUtilsTest.java 2009-10-14
17:21:55 UTC (rev 4099)
+++
extensions/trunk/bean-utils/src/test/java/org/jboss/test/weld/beanutils/AbstractBeanUtilsTest.java 2009-10-14
20:07:37 UTC (rev 4100)
@@ -24,14 +24,12 @@
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.Map;
-
import javax.enterprise.inject.spi.BeanManager;
import org.jboss.weld.bootstrap.BeanDeployerEnvironment;
import org.jboss.weld.bootstrap.BeanDeployment;
import org.jboss.weld.bootstrap.WeldBootstrap;
import org.jboss.weld.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.weld.mock.MockEELifecycle;
/**
*
@@ -43,7 +41,7 @@
/**
* Contains the web beans deployment
*/
- MockEELifecycle lifecycle;
+ MockBULifecycle lifecycle;
boolean deployedWebBeans;
@@ -54,7 +52,7 @@
*/
protected void initialiseEnvironment(Class<?>...classes)
{
- lifecycle = new MockEELifecycle();
+ lifecycle = new MockBULifecycle();
lifecycle.getDeployment().getArchive().setBeanClasses(Arrays.asList(classes));
lifecycle.initialize();
}
@@ -103,6 +101,7 @@
{
if (lifecycle == null)
throw new IllegalStateException("Lifecycle needs to be initialised by
calling initialiseEnvironment()");
+
return
lifecycle.getBootstrap().getManager(lifecycle.getDeployment().getArchive());
}
Copied:
extensions/trunk/bean-utils/src/test/java/org/jboss/test/weld/beanutils/MockBULifecycle.java
(from rev 4052,
extensions/trunk/bean-utils/src/test/java/org/jboss/test/weld/beanutils/AbstractBeanUtilsTest.java)
===================================================================
---
extensions/trunk/bean-utils/src/test/java/org/jboss/test/weld/beanutils/MockBULifecycle.java
(rev 0)
+++
extensions/trunk/bean-utils/src/test/java/org/jboss/test/weld/beanutils/MockBULifecycle.java 2009-10-14
20:07:37 UTC (rev 4100)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source.
+* Copyright 2006, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+*/
+package org.jboss.test.weld.beanutils;
+
+import org.jboss.weld.mock.MockEELifecycle;
+import org.jboss.weld.mock.MockDeployment;
+import org.jboss.weld.bootstrap.WeldBootstrap;
+
+/**
+ * @author <a href="ales.justin(a)jboss.com">Ales Justin</a>
+ */
+class MockBULifecycle extends MockEELifecycle
+{
+ @Override
+ public MockDeployment getDeployment()
+ {
+ return super.getDeployment();
+ }
+
+ @Override
+ public WeldBootstrap getBootstrap()
+ {
+ return super.getBootstrap();
+ }
+}
\ No newline at end of file