[webbeans-commits] Webbeans SVN: r3794 - in extensions/trunk/wicket: src/main and 3 other directories.
by webbeans-commits@lists.jboss.org
Author: cpopetz
Date: 2009-09-28 17:44:25 -0400 (Mon, 28 Sep 2009)
New Revision: 3794
Added:
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/BeanManagerLookup.java
extensions/trunk/wicket/src/main/resources/
extensions/trunk/wicket/src/main/resources/META-INF/
extensions/trunk/wicket/src/main/resources/META-INF/beans.xml
Modified:
extensions/trunk/wicket/pom.xml
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansApplication.java
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansComponentInstantiationListener.java
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansMetaData.java
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansRequestCycle.java
extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansWebRequestCycleProcessor.java
Log:
Update for PFD2, use non-contextual-injection SPI.
Modified: extensions/trunk/wicket/pom.xml
===================================================================
--- extensions/trunk/wicket/pom.xml 2009-09-28 21:33:41 UTC (rev 3793)
+++ extensions/trunk/wicket/pom.xml 2009-09-28 21:44:25 UTC (rev 3794)
@@ -1,9 +1,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
- <artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
+ <artifactId>webbeans-version-matrix</artifactId>
<version>1.0.0-SNAPSHOT</version>
- </parent>
+ </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-wicket</artifactId>
@@ -59,10 +59,6 @@
</plugins>
</build>
- <properties>
- <wicket.version>1.3.5.jboss1</wicket.version>
- </properties>
-
<scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/extensions</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/extensions</developerConnection>
Added: extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/BeanManagerLookup.java
===================================================================
--- extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/BeanManagerLookup.java (rev 0)
+++ extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/BeanManagerLookup.java 2009-09-28 21:44:25 UTC (rev 3794)
@@ -0,0 +1,84 @@
+package org.jboss.webbeans.wicket;
+
+import javax.enterprise.inject.spi.BeanManager;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.servlet.ServletContext;
+
+import org.apache.wicket.Application;
+import org.apache.wicket.protocol.http.WebApplication;
+
+/**
+ * A utilty class to provide access to the JSR-299 BeanManager
+ * @author cpopetz
+ *
+ */
+public class BeanManagerLookup
+{
+
+ private static BeanManager cachedManager;
+ /**
+ * This is the spec-defined name for the bean manager as registered in JNDI
+ * See JSR-299 11.3
+ */
+ private static String beanManagerJndiName = "java:comp/BeanManager";
+
+ public static void setBeanManagerJndiName(String beanManagerJndiName)
+ {
+ BeanManagerLookup.beanManagerJndiName = beanManagerJndiName;
+ }
+
+ public static String getBeanManagerJndiName()
+ {
+ return beanManagerJndiName;
+ }
+
+ /**
+ * This is the name under which the bean manager will be stored in the
+ * servlet context. This is not yet specified in JSR-299.
+ */
+ private static String beanManagerServletContextName = BeanManager.class.getName();
+
+ public static void setBeanManagerServletContextName(String beanManagerServletContextName)
+ {
+ BeanManagerLookup.beanManagerServletContextName = beanManagerServletContextName;
+ }
+
+ public static String getBeanManagerServletContextName()
+ {
+ return beanManagerServletContextName;
+ }
+
+
+ /**
+ * We will attempt first to obtain the BeanManager instance from JNDI.
+ * Failing that, we will look in the servlet context.
+ */
+ public static BeanManager getBeanManager()
+ {
+ if (cachedManager == null)
+ {
+ // first look in jndi
+ try
+ {
+ Context initialContext = new InitialContext();
+ cachedManager = (BeanManager) initialContext.lookup(getBeanManagerJndiName());
+ }
+ catch (Exception e)
+ {
+ // we ignore this failure; it could mean we are operating in a
+ // non-jndi (SE or Servlet) env
+ }
+
+ if (cachedManager == null)
+ {
+ ServletContext servletContext = ((WebApplication) Application.get()).getServletContext();
+ if (servletContext != null)
+ {
+ cachedManager = (BeanManager) servletContext.getAttribute(getBeanManagerServletContextName());
+ }
+ }
+ }
+ return cachedManager;
+ }
+}
Modified: extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansApplication.java
===================================================================
--- extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansApplication.java 2009-09-28 21:33:41 UTC (rev 3793)
+++ extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansApplication.java 2009-09-28 21:44:25 UTC (rev 3794)
@@ -1,6 +1,13 @@
package org.jboss.webbeans.wicket;
+import java.lang.reflect.Type;
+import java.util.Set;
+import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
import org.apache.wicket.Request;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.Response;
@@ -27,16 +34,45 @@
*/
public abstract class WebBeansApplication extends WebApplication
{
+
+ private <T> T getInstanceByType(Class<T> beanType)
+ {
+ BeanManager manager = BeanManagerLookup.getBeanManager();
+ Bean<T> bean = (Bean<T>) ensureUniqueBean(beanType, manager.getBeans(beanType));
+ return (T) manager.getReference(bean, beanType, manager.createCreationalContext(bean));
+ }
+
+ private static Bean<?> ensureUniqueBean(Type type, Set<Bean<?>> beans)
+ {
+ if (beans.size() == 0)
+ {
+ throw new UnsatisfiedResolutionException("Unable to resolve any Web Beans of " + type);
+ }
+ else if (beans.size() > 1)
+ {
+ throw new AmbiguousResolutionException("More than one bean available for type " + type);
+ }
+ return beans.iterator().next();
+ }
+
/**
- * Use the constructor to add our component instantiation listener
+ */
+ public WebBeansApplication()
+ {
+ }
+
+ /**
+ * Add our component instantiation listener
*
* @see WebBeansComponentInstantiationListener
*/
- public WebBeansApplication()
+ protected void internalInit()
{
- addComponentInstantiationListener(new WebBeansComponentInstantiationListener());
+ super.internalInit();
+ addComponentInstantiationListener(getInstanceByType(WebBeansComponentInstantiationListener.class));
}
+
/**
* Override to return our WebBeans-specific request cycle processor
*
@@ -45,7 +81,7 @@
@Override
protected IRequestCycleProcessor newRequestCycleProcessor()
{
- return new WebBeansWebRequestCycleProcessor();
+ return getInstanceByType(WebBeansWebRequestCycleProcessor.class);
}
/**
Modified: extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansComponentInstantiationListener.java
===================================================================
--- extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansComponentInstantiationListener.java 2009-09-28 21:33:41 UTC (rev 3793)
+++ extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansComponentInstantiationListener.java 2009-09-28 21:44:25 UTC (rev 3794)
@@ -1,22 +1,31 @@
package org.jboss.webbeans.wicket;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.inject.Inject;
+
import org.apache.wicket.Component;
import org.apache.wicket.application.IComponentInstantiationListener;
-import org.jboss.webbeans.CurrentManager;
-import org.jboss.webbeans.manager.api.WebBeansManager;
/**
- * This listener uses the WebBeansManager to handle injections for all wicket
- * components.
+ * This listener uses the BeanManager to handle injections for all wicket components.
*
* @author cpopetz
- * @see WebBeansManager
*
*/
public class WebBeansComponentInstantiationListener implements IComponentInstantiationListener
{
+ @Inject
+ BeanManager manager;
+
public void onInstantiation(Component component)
{
- ((WebBeansManager) CurrentManager.rootManager()).injectNonContextualInstance(component);
+ /*
+ * The manager could be null in unit testing environments
+ */
+ if (manager != null)
+ {
+ manager.createInjectionTarget(manager.createAnnotatedType((Class) component.getClass()))
+ .inject(component, manager.createCreationalContext(null));
+ }
}
}
\ No newline at end of file
Modified: extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansMetaData.java
===================================================================
--- extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansMetaData.java 2009-09-28 21:33:41 UTC (rev 3793)
+++ extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansMetaData.java 2009-09-28 21:44:25 UTC (rev 3794)
@@ -16,7 +16,7 @@
* This is the key we will use to to store the conversation metadata in the
* wicket page.
*/
- public static final MetaDataKey CID = new MetaDataKey(String.class)
+ public static final MetaDataKey CID = new MetaDataKey<String>()
{
private static final long serialVersionUID = -8788010688731927318L;
};
Modified: extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansRequestCycle.java
===================================================================
--- extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansRequestCycle.java 2009-09-28 21:33:41 UTC (rev 3793)
+++ extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansRequestCycle.java 2009-09-28 21:44:25 UTC (rev 3794)
@@ -1,6 +1,13 @@
package org.jboss.webbeans.wicket;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Set;
+
import javax.enterprise.context.Conversation;
+import javax.enterprise.inject.AmbiguousResolutionException;
+import javax.enterprise.inject.UnsatisfiedResolutionException;
+import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
import org.apache.wicket.IRequestTarget;
@@ -11,7 +18,8 @@
import org.apache.wicket.protocol.http.WebRequestCycle;
import org.apache.wicket.request.target.component.BookmarkablePageRequestTarget;
import org.apache.wicket.request.target.component.IPageRequestTarget;
-import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.Container;
+import org.jboss.webbeans.context.ContextLifecycle;
import org.jboss.webbeans.context.ConversationContext;
import org.jboss.webbeans.conversation.ConversationManager;
import org.jboss.webbeans.servlet.ConversationBeanStore;
@@ -72,14 +80,15 @@
specifiedCid = request.getParameter("cid");
}
- BeanManager manager = CurrentManager.rootManager();
- Conversation conversation = manager.getInstanceByType(Conversation.class);
+ BeanManager manager = BeanManagerLookup.getBeanManager();
+
+ Conversation conversation = getInstanceByType(manager, Conversation.class);
// restore a conversation if it exists
if (specifiedCid != null)
{
// Restore this conversation
- manager.getInstanceByType(ConversationManager.class).beginOrRestoreConversation(specifiedCid);
+ getInstanceByType(manager, ConversationManager.class).beginOrRestoreConversation(specifiedCid);
}
// handle propagation of existing long running converstaions to new
@@ -107,11 +116,35 @@
}
}
+ ConversationContext conversationContext = Container.instance().deploymentServices().get(
+ ContextLifecycle.class).getConversationContext();
// Now set up the conversational context if it isn't already
- if (!ConversationContext.instance().isActive())
+ if (!conversationContext.isActive())
{
- ConversationContext.instance().setBeanStore(new ConversationBeanStore(((WebRequest) request).getHttpServletRequest().getSession(), conversation.getId()));
- ConversationContext.instance().setActive(true);
+ conversationContext.setBeanStore(new ConversationBeanStore(((WebRequest) request)
+ .getHttpServletRequest().getSession(), conversation.getId()));
+ conversationContext.setActive(true);
}
}
+
+ @SuppressWarnings("unchecked")
+ private <T> T getInstanceByType(BeanManager manager, Class<T> beanType, Annotation... bindings)
+ {
+ Bean<T> bean = (Bean<T>) ensureUniqueBean(beanType, manager.getBeans(beanType, bindings));
+ return (T) manager.getReference(bean, beanType, manager.createCreationalContext(bean));
+ }
+
+ private static Bean<?> ensureUniqueBean(Type type, Set<Bean<?>> beans)
+ {
+ if (beans.size() == 0)
+ {
+ throw new UnsatisfiedResolutionException("Unable to resolve any Web Beans of " + type);
+ }
+ else if (beans.size() > 1)
+ {
+ throw new AmbiguousResolutionException("More than one bean available for type " + type);
+ }
+ return beans.iterator().next();
+ }
+
}
\ No newline at end of file
Modified: extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansWebRequestCycleProcessor.java
===================================================================
--- extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansWebRequestCycleProcessor.java 2009-09-28 21:33:41 UTC (rev 3793)
+++ extensions/trunk/wicket/src/main/java/org/jboss/webbeans/wicket/WebBeansWebRequestCycleProcessor.java 2009-09-28 21:44:25 UTC (rev 3794)
@@ -1,11 +1,13 @@
package org.jboss.webbeans.wicket;
import javax.enterprise.context.Conversation;
+import javax.inject.Inject;
import org.apache.wicket.Page;
import org.apache.wicket.RequestCycle;
import org.apache.wicket.protocol.http.WebRequestCycleProcessor;
-import org.jboss.webbeans.CurrentManager;
+import org.jboss.webbeans.Container;
+import org.jboss.webbeans.context.ContextLifecycle;
import org.jboss.webbeans.context.ConversationContext;
import org.jboss.webbeans.conversation.ConversationManager;
@@ -20,6 +22,11 @@
*/
public class WebBeansWebRequestCycleProcessor extends WebRequestCycleProcessor
{
+ @Inject
+ Conversation conversation;
+ @Inject
+ ConversationManager conversationManager;
+
/**
* If a long running conversation has been started, store its id into page
* metadata
@@ -28,7 +35,6 @@
public void respond(RequestCycle requestCycle)
{
super.respond(requestCycle);
- Conversation conversation = CurrentManager.rootManager().getInstanceByType(Conversation.class);
if (conversation.isLongRunning())
{
Page page = RequestCycle.get().getResponsePage();
@@ -39,8 +45,10 @@
}
//cleanup and deactivate the conversation context
+ conversationManager.cleanupConversation();
- CurrentManager.rootManager().getInstanceByType(ConversationManager.class).cleanupConversation();
- ConversationContext.instance().setActive(false);
+ ConversationContext conversationContext = Container.instance().deploymentServices().get(
+ ContextLifecycle.class).getConversationContext();
+ conversationContext.setActive(false);
}
}
\ No newline at end of file
Added: extensions/trunk/wicket/src/main/resources/META-INF/beans.xml
===================================================================
15 years, 2 months
[webbeans-commits] Webbeans SVN: r3793 - ri/trunk/version-matrix.
by webbeans-commits@lists.jboss.org
Author: cpopetz
Date: 2009-09-28 17:33:41 -0400 (Mon, 28 Sep 2009)
New Revision: 3793
Modified:
ri/trunk/version-matrix/pom.xml
Log:
No longer need our own build of wicket; move to 1.4.1
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-09-28 14:37:27 UTC (rev 3792)
+++ ri/trunk/version-matrix/pom.xml 2009-09-28 21:33:41 UTC (rev 3793)
@@ -54,7 +54,7 @@
<webbeans.wicket.version>1.0.0-SNAPSHOT</webbeans.wicket.version>
<jboss.test.harness.version>1.0.0-SNAPSHOT</jboss.test.harness.version>
<jetty.version>6.1.21</jetty.version>
- <wicket.version>1.3.5.jboss1</wicket.version>
+ <wicket.version>1.4.1</wicket.version>
</properties>
<dependencyManagement>
15 years, 2 months
[webbeans-commits] Webbeans SVN: r3792 - ri/trunk/osgi-bundle.
by webbeans-commits@lists.jboss.org
Author: rogerk
Date: 2009-09-28 10:37:27 -0400 (Mon, 28 Sep 2009)
New Revision: 3792
Modified:
ri/trunk/osgi-bundle/pom.xml
Log:
synch with 1.0.0.PREVIEW4.SP1
Modified: ri/trunk/osgi-bundle/pom.xml
===================================================================
--- ri/trunk/osgi-bundle/pom.xml 2009-09-28 14:19:21 UTC (rev 3791)
+++ ri/trunk/osgi-bundle/pom.xml 2009-09-28 14:37:27 UTC (rev 3792)
@@ -21,7 +21,7 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0-SNAPSHOT</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -60,8 +60,8 @@
<Embed-Dependency>*; scope=compile; inline=true</Embed-Dependency>
<_exportcontents>javax.event; javax.context; javax.webbeans; javax.decorator; javax.inject; javax.enterprise.*; version=${osgi.version},
- org.jboss.webbeans.ejb; org.jboss.webbeans.bean.proxy; org.jboss.webbeans.*.api.*; org.jboss.webbeans.*.spi.*; org.jboss.webbeans.conversation; org.jboss.webbeans; org.jboss.webbeans.bootstrap; org.jboss.webbeans.introspector; org.jboss.webbeans.servlet; version=${osgi.version},
- org.jboss.webbeans.el; include:="WebBeansELResolver"; version=${osgi.version},
+ org.jboss.webbeans.context; org.jboss.webbeans.ejb; org.jboss.webbeans.bean; org.jboss.webbeans.bean.proxy; org.jboss.webbeans.*.api.*; org.jboss.webbeans.*.spi.*; org.jboss.webbeans.conversation; org.jboss.webbeans; org.jboss.webbeans.bootstrap; org.jboss.webbeans.introspector; org.jboss.webbeans.servlet; version=${osgi.version},
+ org.jboss.webbeans.el; version=${osgi.version},
org.jboss.webbeans.jsf; include:="WebBeansPhaseListener"; version=${osgi.version},
javassist.util.proxy;version="3.8.1.GA"
</_exportcontents>
@@ -129,7 +129,13 @@
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
</dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>inject-api</artifactId>
+ <version>1.0.0-PRD</version>
+ </dependency>
+
</dependencies>
</project>
15 years, 2 months
[webbeans-commits] Webbeans SVN: r3791 - ri/trunk/impl/src/main/java/org/jboss/webbeans.
by webbeans-commits@lists.jboss.org
Author: cpopetz
Date: 2009-09-28 10:19:21 -0400 (Mon, 28 Sep 2009)
New Revision: 3791
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java
Log:
allow creation of InjectionTarget<T> where T is non-Producible by deferring exception until produce() is invoked
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java 2009-09-25 19:32:22 UTC (rev 3790)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/SimpleInjectionTarget.java 2009-09-28 14:19:21 UTC (rev 3791)
@@ -57,8 +57,18 @@
this.beanManager = beanManager;
this.type = type;
this.injectionPoints = new HashSet<InjectionPoint>();
- this.constructor = Beans.getBeanConstructor(null, type);
- this.injectionPoints.addAll(Beans.getParameterInjectionPoints(null, constructor));
+ ConstructorInjectionPoint<T> constructor = null;
+ try
+ {
+ constructor = Beans.getBeanConstructor(null, type);
+ this.injectionPoints.addAll(Beans.getParameterInjectionPoints(null, constructor));
+ }
+ catch (Exception e)
+ {
+ // this means the bean of a type that cannot be produce()d, but that is non-fatal
+ // unless someone calls produce()
+ }
+ this.constructor = constructor;
this.injectableFields = new HashSet<FieldInjectionPoint<?,?>>();
this.injectableFields.addAll(Beans.getFieldInjectionPoints(null, type));
this.injectionPoints.addAll(injectableFields);
@@ -75,6 +85,16 @@
public T produce(CreationalContext<T> ctx)
{
+ if (constructor == null)
+ {
+ // this means we couldn't find a constructor on instantiation, which
+ // means there isn't one that's spec-compliant
+ // try again so the correct DefinitionException is thrown
+ Beans.getBeanConstructor(null, type);
+ // should not be reached
+ throw new IllegalStateException(
+ "We were not previously able to find the bean constructor, but now are?");
+ }
return constructor.newInstance(beanManager, ctx);
}
15 years, 2 months
[webbeans-commits] Webbeans SVN: r3789 - ri/tags.
by webbeans-commits@lists.jboss.org
Author: rogerk
Date: 2009-09-25 15:25:40 -0400 (Fri, 25 Sep 2009)
New Revision: 3789
Added:
ri/tags/1.0.0.PREVIEW4.SP1/
Log:
1.0.0.PREVIEW4.SP1 tag
Copied: ri/tags/1.0.0.PREVIEW4.SP1 (from rev 3788, ri/branches/1.0.0.PREVIEW4.SP1)
15 years, 2 months
[webbeans-commits] Webbeans SVN: r3788 - in ri/branches/1.0.0.PREVIEW4.SP1: api and 11 other directories.
by webbeans-commits@lists.jboss.org
Author: rogerk
Date: 2009-09-25 15:23:51 -0400 (Fri, 25 Sep 2009)
New Revision: 3788
Modified:
ri/branches/1.0.0.PREVIEW4.SP1/api/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/core-api/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/embedded-tck-runner/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/impl/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/jboss-tck-runner/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/logging/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/osgi-bundle/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/parent/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/porting-package/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/spi/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/tests/pom.xml
ri/branches/1.0.0.PREVIEW4.SP1/version-matrix/pom.xml
Log:
pom updates
Modified: ri/branches/1.0.0.PREVIEW4.SP1/api/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/api/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/api/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -4,12 +4,12 @@
<parent>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-parent</artifactId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<groupId>org.jboss.webbeans</groupId>
<artifactId>jsr299-api</artifactId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
<packaging>jar</packaging>
<name>JSR-299 API</name>
<url>http://www.seamframework.org/WebBeans</url>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/core-api/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/core-api/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/core-api/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-api</artifactId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
<name>Web Beans Core API</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/embedded-tck-runner/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/embedded-tck-runner/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/embedded-tck-runner/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -2,7 +2,7 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/impl/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/impl/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/impl/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-core</artifactId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
<name>Web Beans Core</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/jboss-tck-runner/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/jboss-tck-runner/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/jboss-tck-runner/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -2,7 +2,7 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/logging/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/logging/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/logging/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-logging</artifactId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
<name>Web Beans Logging</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/osgi-bundle/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/osgi-bundle/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/osgi-bundle/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -21,7 +21,7 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/parent/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/parent/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/parent/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -3,12 +3,12 @@
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-parent</artifactId>
<packaging>pom</packaging>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
<parent>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-version-matrix</artifactId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<name>Web Beans, the reference implementation of JSR-299</name>
@@ -227,8 +227,8 @@
</licenses>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4/pa...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4/parent</developerConnection>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4.SP...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4.SP1/p...</developerConnection>
<url>http://fisheye.jboss.org/browse/WebBeans/ri</url>
</scm>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -3,14 +3,14 @@
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-build-aggregator</artifactId>
<packaging>pom</packaging>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
<name>Web Beans Build Aggregator</name>
<url>http://www.seamframework.org/WebBeans</url>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4</developerConnection>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4.SP1</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4.SP1</developerConnection>
<url>http://fisheye.jboss.org/browse/WebBeans</url>
</scm>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/porting-package/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/porting-package/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/porting-package/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-porting-package</artifactId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
<name>Web Beans Porting Package for JSR-299 TCK</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/spi/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/spi/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/spi/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-spi</artifactId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
<name>Web Beans Service Provider Interfaces</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/tests/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/tests/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/tests/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -2,12 +2,12 @@
<parent>
<artifactId>webbeans-parent</artifactId>
<groupId>org.jboss.webbeans</groupId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-core-test</artifactId>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
<name>Web Beans Core Tests</name>
<dependencies>
Modified: ri/branches/1.0.0.PREVIEW4.SP1/version-matrix/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/version-matrix/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
+++ ri/branches/1.0.0.PREVIEW4.SP1/version-matrix/pom.xml 2009-09-25 19:23:51 UTC (rev 3788)
@@ -3,7 +3,7 @@
<groupId>org.jboss.webbeans</groupId>
<artifactId>webbeans-version-matrix</artifactId>
<packaging>pom</packaging>
- <version>1.0.0.PREVIEW4</version>
+ <version>1.0.0.PREVIEW4.SP1</version>
<name>Web Beans Version Matrix</name>
<url>http://www.seamframework.org/WebBeans</url>
@@ -48,10 +48,10 @@
<properties>
<jsr299.tck.version>1.0.0-SNAPSHOT</jsr299.tck.version>
- <webbeans.version>1.0.0.PREVIEW4</webbeans.version>
+ <webbeans.version>1.0.0.PREVIEW4.SP1</webbeans.version>
<webbeans.servlet.version>1.0.0.CR1</webbeans.servlet.version>
- <webbeans.se.version>1.0.0.PREVIEW4</webbeans.se.version>
- <jboss.test.harness.version>1.0.0.PREVIEW4</jboss.test.harness.version>
+ <webbeans.se.version>1.0.0.PREVIEW4.SP1</webbeans.se.version>
+ <jboss.test.harness.version>1.0.0.PREVIEW4.SP1</jboss.test.harness.version>
</properties>
<dependencyManagement>
@@ -551,8 +551,8 @@
</distributionManagement>
<scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4/ve...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4/versi...</developerConnection>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4.SP...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/webbeans/ri/tags/1.0.0.PREVIEW4.SP1/v...</developerConnection>
<url>http://fisheye.jboss.org/browse/WebBeans/ri</url>
</scm>
15 years, 2 months
[webbeans-commits] Webbeans SVN: r3787 - ri/branches/1.0.0.PREVIEW4.SP1/osgi-bundle.
by webbeans-commits@lists.jboss.org
Author: rogerk
Date: 2009-09-25 15:03:48 -0400 (Fri, 25 Sep 2009)
New Revision: 3787
Modified:
ri/branches/1.0.0.PREVIEW4.SP1/osgi-bundle/pom.xml
Log:
add org.jboss.webbeans.bean export
Modified: ri/branches/1.0.0.PREVIEW4.SP1/osgi-bundle/pom.xml
===================================================================
--- ri/branches/1.0.0.PREVIEW4.SP1/osgi-bundle/pom.xml 2009-09-25 19:01:13 UTC (rev 3786)
+++ ri/branches/1.0.0.PREVIEW4.SP1/osgi-bundle/pom.xml 2009-09-25 19:03:48 UTC (rev 3787)
@@ -60,7 +60,7 @@
<Embed-Dependency>*; scope=compile; inline=true</Embed-Dependency>
<_exportcontents>javax.event; javax.context; javax.webbeans; javax.decorator; javax.inject; javax.enterprise.*; version=${osgi.version},
- org.jboss.webbeans.context; org.jboss.webbeans.ejb; org.jboss.webbeans.bean.proxy; org.jboss.webbeans.*.api.*; org.jboss.webbeans.*.spi.*; org.jboss.webbeans.conversation; org.jboss.webbeans; org.jboss.webbeans.bootstrap; org.jboss.webbeans.introspector; org.jboss.webbeans.servlet; version=${osgi.version},
+ org.jboss.webbeans.context; org.jboss.webbeans.ejb; org.jboss.webbeans.bean; org.jboss.webbeans.bean.proxy; org.jboss.webbeans.*.api.*; org.jboss.webbeans.*.spi.*; org.jboss.webbeans.conversation; org.jboss.webbeans; org.jboss.webbeans.bootstrap; org.jboss.webbeans.introspector; org.jboss.webbeans.servlet; version=${osgi.version},
org.jboss.webbeans.el; version=${osgi.version},
org.jboss.webbeans.jsf; include:="WebBeansPhaseListener"; version=${osgi.version},
javassist.util.proxy;version="3.8.1.GA"
15 years, 2 months
[webbeans-commits] Webbeans SVN: r3786 - ri/branches.
by webbeans-commits@lists.jboss.org
Author: rogerk
Date: 2009-09-25 15:01:13 -0400 (Fri, 25 Sep 2009)
New Revision: 3786
Added:
ri/branches/1.0.0.PREVIEW4.SP1/
Log:
1.0.0.PREVIEW4.SP1
Copied: ri/branches/1.0.0.PREVIEW4.SP1 (from rev 3785, ri/branches/1.0.0.PREVIEW4)
15 years, 2 months
[webbeans-commits] Webbeans SVN: r3785 - in ri/trunk/tests/src: main/java/org/jboss/webbeans/test/harness and 4 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-09-25 12:27:20 -0400 (Fri, 25 Sep 2009)
New Revision: 3785
Added:
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/TestContainer.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/Foo.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/NaiveClusterTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/SwitchableContainerTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/SwitchableSingletonProvider.java
Modified:
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DiscoverFailsBootstrapTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InjectionServicesTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/WBStartupTest.java
ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java
Log:
Extract test bootstrap code to TestContainer, use it, and start on a naive cluster test
Added: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -0,0 +1,24 @@
+package org.jboss.webbeans.mock;
+
+import org.jboss.webbeans.bootstrap.api.Lifecycle;
+
+public interface MockLifecycle extends Lifecycle
+{
+
+ public abstract void initialize();
+
+ public abstract void beginApplication();
+
+ public abstract void endApplication();
+
+ public abstract void resetContexts();
+
+ public abstract void beginRequest();
+
+ public abstract void endRequest();
+
+ public abstract void beginSession();
+
+ public abstract void endSession();
+
+}
\ No newline at end of file
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockLifecycle.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java 2009-09-25 16:25:33 UTC (rev 3784)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -11,7 +11,7 @@
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.servlet.api.ServletServices;
-public class MockServletLifecycle extends ForwardingLifecycle
+public class MockServletLifecycle extends ForwardingLifecycle implements MockLifecycle
{
private static final ResourceLoader MOCK_RESOURCE_LOADER = new MockResourceLoader();
@@ -35,6 +35,9 @@
deployment.getServices().add(ServletServices.class, new MockServletServices(deployment.getArchive()));
}
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.mock.MockLifecycle#initialize()
+ */
public void initialize()
{
try
@@ -53,21 +56,28 @@
return lifecycle;
}
- public MockDeployment getDeployment()
+ protected MockDeployment getDeployment()
{
return deployment;
}
- public WebBeansBootstrap getBootstrap()
+ protected WebBeansBootstrap getBootstrap()
{
return bootstrap;
}
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.mock.MockLifecycle#beginApplication()
+ */
public void beginApplication()
{
bootstrap.startInitialization().deployBeans().validateBeans().endInitialization();
}
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.mock.MockLifecycle#endApplication()
+ */
+ @Override
public void endApplication()
{
bootstrap.shutdown();
@@ -78,33 +88,48 @@
return applicationBeanStore;
}
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.mock.MockLifecycle#resetContexts()
+ */
public void resetContexts()
{
}
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.mock.MockLifecycle#beginRequest()
+ */
public void beginRequest()
{
super.beginRequest("Mock", requestBeanStore);
}
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.mock.MockLifecycle#endRequest()
+ */
public void endRequest()
{
super.endRequest("Mock", requestBeanStore);
}
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.mock.MockLifecycle#beginSession()
+ */
public void beginSession()
{
super.restoreSession("Mock", sessionBeanStore);
}
+ /* (non-Javadoc)
+ * @see org.jboss.webbeans.mock.MockLifecycle#endSession()
+ */
public void endSession()
{
// TODO Conversation handling breaks this :-(
//super.endSession("Mock", sessionBeanStore);
}
- public Environment getEnvironment()
+ protected Environment getEnvironment()
{
return Environments.SERVLET;
}
Added: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/TestContainer.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/TestContainer.java (rev 0)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/TestContainer.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -0,0 +1,142 @@
+package org.jboss.webbeans.mock;
+
+import java.net.URL;
+
+import org.jboss.webbeans.BeanManagerImpl;
+
+/**
+ * Control of the container, used for tests. Wraps up common operations.
+ *
+ * @author pmuir
+ *
+ */
+public class TestContainer
+{
+
+ public static class Status
+ {
+
+ private final Exception deploymentException;
+
+ public Status(Exception deploymentException)
+ {
+ this.deploymentException = deploymentException;
+ }
+
+ public Exception getDeploymentException()
+ {
+ return deploymentException;
+ }
+
+ public boolean isSuccess()
+ {
+ return deploymentException == null;
+ }
+
+ }
+
+ private final MockServletLifecycle lifecycle;
+ private final Iterable<Class<?>> classes;
+ private final Iterable<URL> beansXml;
+
+ /**
+ * Create a container, specifying the classes and beans.xml to deploy
+ *
+ * @param lifecycle
+ * @param classes
+ * @param beansXml
+ */
+ public TestContainer(MockServletLifecycle lifecycle, Iterable<Class<?>> classes, Iterable<URL> beansXml)
+ {
+ this.lifecycle = lifecycle;
+ this.classes = classes;
+ this.beansXml = beansXml;
+ }
+
+ /**
+ * Start the container, returning the container state
+ *
+ * @return
+ */
+ public Status startContainerAndReturnStatus()
+ {
+ try
+ {
+ startContainer();
+ }
+ catch (Exception e)
+ {
+ return new Status(e);
+ }
+ return new Status(null);
+ }
+
+ public void startContainer()
+ {
+ MockBeanDeploymentArchive archive = lifecycle.getDeployment().getArchive();
+ archive.setBeanClasses(classes);
+ if (beansXml != null)
+ {
+ archive.setWebBeansXmlFiles(beansXml);
+ }
+ lifecycle.initialize();
+ lifecycle.beginApplication();
+ }
+
+ /**
+ * Get the context lifecycle, allowing fine control over the contexts' state
+ *
+ * @return
+ */
+ public MockLifecycle getLifecycle()
+ {
+ return lifecycle;
+ }
+
+ public BeanManagerImpl getBeanManager()
+ {
+ return lifecycle.getBootstrap().getManager(getDeployment().getArchive());
+ }
+
+ public MockDeployment getDeployment()
+ {
+ return lifecycle.getDeployment();
+ }
+
+ /**
+ * Utility method which ensures a request is active and available for use
+ *
+ */
+ public void ensureRequestActive()
+ {
+ if (!lifecycle.isSessionActive())
+ {
+ lifecycle.beginSession();
+ }
+ if (!lifecycle.isRequestActive())
+ {
+ lifecycle.beginRequest();
+ }
+ }
+
+ /**
+ * Clean up the container, ending any active contexts
+ *
+ */
+ public void stopContainer()
+ {
+ if (lifecycle.isRequestActive())
+ {
+ lifecycle.endRequest();
+ }
+ if (lifecycle.isSessionActive())
+ {
+ lifecycle.endSession();
+ }
+ if (lifecycle.isApplicationActive())
+ {
+ lifecycle.endApplication();
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/TestContainer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java 2009-09-25 16:25:33 UTC (rev 3784)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -4,39 +4,33 @@
import org.jboss.testharness.api.DeploymentException;
import org.jboss.testharness.spi.StandaloneContainers;
-import org.jboss.webbeans.mock.MockBeanDeploymentArchive;
import org.jboss.webbeans.mock.MockServletLifecycle;
+import org.jboss.webbeans.mock.TestContainer;
+import org.jboss.webbeans.mock.TestContainer.Status;
public abstract class AbstractStandaloneContainersImpl implements StandaloneContainers
{
private DeploymentException deploymentException;
+
+ private TestContainer testContainer;
- private MockServletLifecycle lifecycle;
-
public boolean deploy(Iterable<Class<?>> classes, Iterable<URL> beansXml)
{
- this.lifecycle = newLifecycle();
+ this.testContainer = new TestContainer(newLifecycle(), classes, beansXml);
- try
+ Status status = testContainer.startContainerAndReturnStatus();
+ if (!status.isSuccess())
{
- MockBeanDeploymentArchive archive = lifecycle.getDeployment().getArchive();
- archive.setBeanClasses(classes);
- if (beansXml != null)
- {
- archive.setWebBeansXmlFiles(beansXml);
- }
- lifecycle.initialize();
- lifecycle.beginApplication();
+ this.deploymentException = new DeploymentException("Error deploying beans", status.getDeploymentException());
+ return false;
}
- catch (Exception e)
+ else
{
- this.deploymentException = new DeploymentException("Error deploying beans", e);
- return false;
+ testContainer.getLifecycle().beginSession();
+ testContainer.getLifecycle().beginRequest();
+ return true;
}
- lifecycle.beginSession();
- lifecycle.beginRequest();
- return true;
}
protected abstract MockServletLifecycle newLifecycle();
@@ -64,10 +58,8 @@
public void undeploy()
{
- lifecycle.endRequest();
- lifecycle.endSession();
- lifecycle.endApplication();
- lifecycle = null;
+ testContainer.stopContainer();
+ testContainer = null;
deploymentException = null;
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DiscoverFailsBootstrapTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DiscoverFailsBootstrapTest.java 2009-09-25 16:25:33 UTC (rev 3784)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DiscoverFailsBootstrapTest.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -1,6 +1,9 @@
package org.jboss.webbeans.test.unit.bootstrap;
-import org.jboss.webbeans.mock.MockEELifecycle;
+import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
+import org.jboss.webbeans.bootstrap.api.Bootstrap;
+import org.jboss.webbeans.bootstrap.api.Environments;
+import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
import org.testng.annotations.Test;
public class DiscoverFailsBootstrapTest
@@ -9,10 +12,8 @@
@Test(groups="bootstrap", expectedExceptions=IllegalArgumentException.class)
public void testDiscoverFails()
{
- MockEELifecycle lifecycle = new MockEELifecycle();
- lifecycle.getBootstrap().startContainer(lifecycle.getEnvironment(), null, lifecycle.getApplicationBeanStore());
- lifecycle.initialize();
- lifecycle.beginApplication();
+ Bootstrap bootstrap = new WebBeansBootstrap();
+ bootstrap.startContainer(Environments.SE, null, new ConcurrentHashMapBeanStore());
}
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InjectionServicesTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InjectionServicesTest.java 2009-09-25 16:25:33 UTC (rev 3784)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/InjectionServicesTest.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -7,24 +7,22 @@
import org.jboss.webbeans.injection.spi.InjectionServices;
import org.jboss.webbeans.mock.MockEELifecycle;
+import org.jboss.webbeans.mock.TestContainer;
import org.testng.annotations.Test;
public class InjectionServicesTest
{
@Test
- public void testDiscoverFails()
+ public void testInjectionOfTarget()
{
- MockEELifecycle lifecycle = new MockEELifecycle();
- lifecycle.getDeployment().getArchive().setBeanClasses(Arrays.asList(Foo.class, Bar.class));
+ TestContainer container = new TestContainer(new MockEELifecycle(), Arrays.asList(Foo.class, Bar.class), null);
CheckableInjectionServices ijs = new CheckableInjectionServices();
- lifecycle.getDeployment().getArchive().getServices().add(InjectionServices.class, ijs);
- lifecycle.initialize();
- lifecycle.beginApplication();
- lifecycle.beginSession();
- lifecycle.beginRequest();
+ container.getDeployment().getArchive().getServices().add(InjectionServices.class, ijs);
+ container.startContainer();
+ container.ensureRequestActive();
- BeanManager manager = lifecycle.getBootstrap().getManager(lifecycle.getDeployment().getArchive());
+ BeanManager manager = container.getBeanManager();
Bean<? extends Object> bean = manager.resolve(manager.getBeans(Foo.class));
ijs.reset();
@@ -39,9 +37,7 @@
assert foo.getMessage().equals("hi!");
- lifecycle.endRequest();
- lifecycle.endSession();
- lifecycle.endApplication();
+ container.stopContainer();
}
}
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/WBStartupTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/WBStartupTest.java 2009-09-25 16:25:33 UTC (rev 3784)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/WBStartupTest.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -22,6 +22,7 @@
import javax.enterprise.inject.spi.BeanManager;
import org.jboss.webbeans.mock.MockEELifecycle;
+import org.jboss.webbeans.mock.TestContainer;
import org.testng.annotations.Test;
/**
@@ -34,14 +35,11 @@
@Test
public void test()
{
- MockEELifecycle lifecycle = new MockEELifecycle();
- lifecycle.getDeployment().getArchive().setBeanClasses(Arrays.asList(Foo.class, Bar.class));
- lifecycle.initialize();
- lifecycle.beginApplication();
- lifecycle.beginSession();
- lifecycle.beginRequest();
+ TestContainer container = new TestContainer(new MockEELifecycle(), Arrays.asList(Foo.class, Bar.class), null);
+ container.startContainer();
+ container.ensureRequestActive();
- BeanManager manager = lifecycle.getBootstrap().getManager(lifecycle.getDeployment().getArchive());
+ BeanManager manager = container.getBeanManager();
Bean<? extends Object> bean = manager.resolve(manager.getBeans(Foo.class));
Foo foo = (Foo) manager.getReference(bean, Foo.class, manager.createCreationalContext(bean));
@@ -49,10 +47,7 @@
assert foo != null;
assert foo.getBar() != null;
-
- lifecycle.endRequest();
- lifecycle.endSession();
- lifecycle.endApplication();
+ container.stopContainer();
}
}
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/Foo.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/Foo.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/Foo.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -0,0 +1,23 @@
+package org.jboss.webbeans.test.unit.cluster;
+
+import java.io.Serializable;
+
+import javax.enterprise.context.SessionScoped;
+
+@SessionScoped
+public class Foo implements Serializable
+{
+
+ private String name;
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/Foo.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/NaiveClusterTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/NaiveClusterTest.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/NaiveClusterTest.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -0,0 +1,82 @@
+package org.jboss.webbeans.test.unit.cluster;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.Arrays;
+
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bootstrap.api.SingletonProvider;
+import org.jboss.webbeans.context.ContextLifecycle;
+import org.jboss.webbeans.context.api.BeanStore;
+import org.jboss.webbeans.mock.MockEELifecycle;
+import org.jboss.webbeans.mock.TestContainer;
+import org.testng.annotations.Test;
+
+public class NaiveClusterTest
+{
+
+ @Test
+ public void testSessionReplication() throws Exception
+ {
+ SingletonProvider.initialize(new SwitchableSingletonProvider());
+
+ // Bootstrap container 1
+ SwitchableSingletonProvider.use(1);
+
+ TestContainer container1 = new TestContainer(new MockEELifecycle(), Arrays.<Class<?>>asList(Foo.class), null);
+ container1.startContainer();
+ container1.ensureRequestActive();
+
+ BeanManagerImpl beanManager1 = container1.getBeanManager();
+ Bean<?> fooBean1 = beanManager1.resolve(beanManager1.getBeans(Foo.class));
+
+ // Bootstrap container 2
+ SwitchableSingletonProvider.use(2);
+
+ TestContainer container2 = new TestContainer(new MockEELifecycle(), Arrays.<Class<?>>asList(Foo.class), null);
+ container2.startContainer();
+ container2.ensureRequestActive();
+
+ BeanManagerImpl beanManager2 = container2.getBeanManager();
+ Bean<?> fooBean2 = beanManager2.resolve(beanManager2.getBeans(Foo.class));
+
+ SwitchableSingletonProvider.use(1);
+ // Set a value into Foo1
+ Foo foo1 = (Foo) beanManager1.getReference(fooBean1, Foo.class, beanManager1.createCreationalContext(fooBean1));
+ foo1.setName("container 1");
+
+ replicateSession(beanManager1, beanManager2);
+
+ SwitchableSingletonProvider.use(2);
+ Foo foo2 = (Foo) beanManager2.getReference(fooBean2, Foo.class, beanManager2.createCreationalContext(fooBean2));
+ assert foo2.getName().equals("container 1");
+ }
+
+ private void replicateSession(BeanManagerImpl beanManager1, BeanManagerImpl beanManager2) throws Exception
+ {
+ // Mimic replicating the session
+ BeanStore sessionBeanStore = beanManager1.getServices().get(ContextLifecycle.class).getSessionContext().getBeanStore();
+ BeanStore replicatedSessionBeanStore = (BeanStore) deserialize(serialize(sessionBeanStore));
+ beanManager2.getServices().get(ContextLifecycle.class).getSessionContext().setBeanStore(replicatedSessionBeanStore);
+ }
+
+ protected byte[] serialize(Object instance) throws IOException
+ {
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ ObjectOutputStream out = new ObjectOutputStream(bytes);
+ out.writeObject(instance);
+ return bytes.toByteArray();
+ }
+
+ protected Object deserialize(byte[] bytes) throws IOException, ClassNotFoundException
+ {
+ ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
+ return in.readObject();
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/NaiveClusterTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/SwitchableContainerTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/SwitchableContainerTest.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/SwitchableContainerTest.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -0,0 +1,56 @@
+package org.jboss.webbeans.test.unit.cluster;
+
+import java.util.Arrays;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+
+import org.jboss.webbeans.bootstrap.api.SingletonProvider;
+import org.jboss.webbeans.mock.MockEELifecycle;
+import org.jboss.webbeans.mock.TestContainer;
+import org.testng.annotations.Test;
+
+public class SwitchableContainerTest
+{
+
+ @Test
+ public void test()
+ {
+ SingletonProvider.initialize(new SwitchableSingletonProvider());
+
+ // Bootstrap container 1
+ SwitchableSingletonProvider.use(1);
+
+ TestContainer container1 = new TestContainer(new MockEELifecycle(), Arrays.<Class<?>>asList(Foo.class), null);
+ container1.startContainer();
+ container1.ensureRequestActive();
+
+ BeanManager beanManager1 = container1.getBeanManager();
+ Bean<?> fooBean1 = beanManager1.resolve(beanManager1.getBeans(Foo.class));
+ Foo foo1 = (Foo) beanManager1.getReference(fooBean1, Foo.class, beanManager1.createCreationalContext(fooBean1));
+ foo1.setName("container 1");
+
+ // Bootstrap container 2
+ SwitchableSingletonProvider.use(2);
+
+ TestContainer container2 = new TestContainer(new MockEELifecycle(), Arrays.<Class<?>>asList(Foo.class), null);
+ container2.startContainer();
+ container2.ensureRequestActive();
+
+ BeanManager beanManager2 = container2.getBeanManager();
+ Bean<?> fooBean2 = beanManager2.resolve(beanManager2.getBeans(Foo.class));
+ Foo foo2 = (Foo) beanManager2.getReference(fooBean2, Foo.class, beanManager2.createCreationalContext(fooBean2));
+ foo2.setName("container 2");
+
+ // Switch to container 1 and check value
+ SwitchableSingletonProvider.use(1);
+ foo1 = (Foo) beanManager1.getReference(fooBean1, Foo.class, beanManager1.createCreationalContext(fooBean1));
+ assert foo1.getName().equals("container 1");
+
+ // Switch to container 2 and check value
+ SwitchableSingletonProvider.use(2);
+ foo2 = (Foo) beanManager2.getReference(fooBean2, Foo.class, beanManager2.createCreationalContext(fooBean2));
+ assert foo2.getName().equals("container 2");
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/SwitchableContainerTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/SwitchableSingletonProvider.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/SwitchableSingletonProvider.java (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/SwitchableSingletonProvider.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -0,0 +1,61 @@
+package org.jboss.webbeans.test.unit.cluster;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.jboss.webbeans.bootstrap.api.Singleton;
+import org.jboss.webbeans.bootstrap.api.SingletonProvider;
+
+public class SwitchableSingletonProvider extends SingletonProvider
+{
+
+ public static void use(Integer id)
+ {
+ if (id == null)
+ {
+ throw new IllegalArgumentException("id cannot be null");
+ }
+ SwitchableSingleton.id = id;
+ }
+
+ private static class SwitchableSingleton<T> implements Singleton<T>
+ {
+
+ private static Integer id = 0;
+
+ private final Map<Integer, T> store;
+
+ public SwitchableSingleton()
+ {
+ this.store = new Hashtable<Integer, T>();
+ }
+
+ public void clear()
+ {
+ store.remove(id);
+ }
+
+ public T get()
+ {
+ return store.get(id);
+ }
+
+ public boolean isSet()
+ {
+ return store.containsKey(id);
+ }
+
+ public void set(T object)
+ {
+ store.put(id, object);
+ }
+
+ }
+
+ @Override
+ public <T> Singleton<T> create(Class<? extends T> expectedType)
+ {
+ return new SwitchableSingleton<T>();
+ }
+
+}
Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/cluster/SwitchableSingletonProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java 2009-09-25 16:25:33 UTC (rev 3784)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/environments/servlet/ServletEnvironmentTest.java 2009-09-25 16:27:20 UTC (rev 3785)
@@ -9,42 +9,38 @@
import javax.enterprise.inject.spi.Bean;
import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.Container;
-import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.bean.ManagedBean;
-import org.jboss.webbeans.mock.MockBeanDeploymentArchive;
+import org.jboss.webbeans.bean.RIBean;
import org.jboss.webbeans.mock.MockServletLifecycle;
+import org.jboss.webbeans.mock.TestContainer;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
public class ServletEnvironmentTest
{
- private MockServletLifecycle lifecycle;
+ private TestContainer container;
private BeanManagerImpl manager;
@BeforeClass
public void beforeClass() throws Throwable
{
- lifecycle = new MockServletLifecycle();
- lifecycle.initialize();
- MockBeanDeploymentArchive archive = lifecycle.getDeployment().getArchive();
- archive.setBeanClasses(Arrays.asList(Animal.class, DeadlyAnimal.class, DeadlySpider.class, DeadlyAnimal.class, Hound.class, HoundLocal.class, Salmon.class, ScottishFish.class, SeaBass.class, Sole.class, Spider.class, Tarantula.class, TarantulaProducer.class, Tuna.class));
- lifecycle.beginApplication();
- lifecycle.beginSession();
- lifecycle.beginRequest();
- manager = Container.instance().deploymentManager();
+ container = new TestContainer(new MockServletLifecycle(), Arrays.asList(Animal.class, DeadlyAnimal.class, DeadlySpider.class, DeadlyAnimal.class, Hound.class, HoundLocal.class, Salmon.class, ScottishFish.class, SeaBass.class, Sole.class, Spider.class, Tarantula.class, TarantulaProducer.class, Tuna.class), null);
+ container.startContainer();
+ container.ensureRequestActive();
+ manager = container.getBeanManager();
}
@AfterClass(alwaysRun=true)
public void afterClass() throws Exception
{
- lifecycle.endRequest();
- lifecycle.endSession();
- lifecycle.endApplication();
- lifecycle = null;
+ container.stopContainer();
+ container = null;
+ manager = null;
}
+ @Test
public void testSimpleBeans()
{
Map<Class<?>, Bean<?>> beans = new HashMap<Class<?>, Bean<?>>();
@@ -67,6 +63,7 @@
manager.getInstanceByType(Sole.class, new AnnotationLiteral<Whitefish>() {}).ping();
}
+ @Test
public void testProducerMethodBean()
{
Map<Class<?>, Bean<?>> beans = new HashMap<Class<?>, Bean<?>>();
15 years, 2 months