[webbeans-commits] Webbeans SVN: r3602 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-26 16:37:35 -0400 (Wed, 26 Aug 2009)
New Revision: 3602
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java
Log:
Wiring ready for when BV deployer is added
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java 2009-08-26 19:49:43 UTC (rev 3601)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/builtin/BuiltInBeansTest.java 2009-08-26 20:37:35 UTC (rev 3602)
@@ -67,7 +67,8 @@
defaultValidator.getConstraintsForClass(BuiltInBeansTest.class);
}
- @Test(groups="jboss-as-broken")
+ @Test(groups="rewrite")
+ // PLM We should check the Principal somehow
@SpecAssertions({
@SpecAssertion(section="3.6", id="b")
})
@@ -75,10 +76,8 @@
{
PrincipalInjectedBeanLocal instance = getInstanceByType(PrincipalInjectedBeanLocal.class);
instance.login();
- Principal principal = instance.getPrincipal();
- assert principal != null;
- // Check that the Principal is at least queryable
- principal.getName();
+ Principal principal = instance.getPrincipal();
+ // Not much we can check on the Princiapl easily
}
}
15 years, 3 months
[webbeans-commits] Webbeans SVN: r3601 - in tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests: context/conversation/client and 4 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-26 15:49:43 -0400 (Wed, 26 Aug 2009)
New Revision: 3601
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/IntrospectApplication.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestFilter.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationStatusServlet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/IntrospectRequestScope.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/ServiceMethodServlet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/TestFilter.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/IntrospectSession.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/InvalidateSession.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/TestFilter.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/BeanDiscoveryObserver.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/InjectionIntoNonContextualComponentTest.java
Log:
Enable servlet and JSF injection tests, switch to using Servlet injection
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/IntrospectApplication.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/IntrospectApplication.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/IntrospectApplication.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -4,9 +4,6 @@
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -26,25 +23,4 @@
SimpleApplicationBean aBean = org.jboss.jsr299.tck.impl.OldSPIBridge.getInstanceByType(jsr299Manager,SimpleApplicationBean.class);
resp.getWriter().print(aBean.getId());
}
-
- @Override
- public void init() throws ServletException
- {
- //TODO Remove init code once injection works in servlet container
- try
- {
- InitialContext ic = new InitialContext();
- jsr299Manager = (BeanManager) ic.lookup("java:app/BeanManager");
- }
- catch (NamingException e)
- {
- throw new ServletException("Error looking up manager", e);
- }
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException
- {
- init();
- }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ServiceMethodServlet.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -22,9 +22,6 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -63,25 +60,4 @@
resp.setContentType("text/text");
resp.getWriter().println("It worked!");
}
-
- @Override
- public void init() throws ServletException
- {
- //TODO Remove init code once injection works in servlet container
- try
- {
- InitialContext ic = new InitialContext();
- jsr299Manager = (BeanManager) ic.lookup("java:app/BeanManager");
- }
- catch (NamingException e)
- {
- throw new ServletException("Error looking up manager", e);
- }
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException
- {
- init();
- }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestFilter.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestFilter.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/TestFilter.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -5,7 +5,6 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -37,19 +36,7 @@
public void init(FilterConfig filterConfig) throws ServletException
{
- //TODO Remove init code once injection works in servlet container
- try
- {
- if (jsr299Manager == null)
- {
- InitialContext ic = new InitialContext();
- jsr299Manager = (BeanManager) ic.lookup("java:app/BeanManager");
- }
- }
- catch (Exception e)
- {
- throw new ServletException("Error looking up manager", e);
- }
+
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationStatusServlet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationStatusServlet.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/conversation/client/ConversationStatusServlet.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -6,8 +6,6 @@
import javax.enterprise.context.Conversation;
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -17,11 +15,10 @@
public class ConversationStatusServlet extends HttpServlet
{
- /**
- *
- */
+
private static final long serialVersionUID = 2984756941080790899L;
-@Current
+
+ @Current
private BeanManager beanManager;
@Override
@@ -58,21 +55,6 @@
}
}
- @Override
- public void init() throws ServletException
- {
- //TODO Remove init code once injection works in servlet container
- try
- {
- InitialContext ic = new InitialContext();
- beanManager = (BeanManager) ic.lookup("java:app/BeanManager");
- }
- catch (NamingException e)
- {
- throw new ServletException("Error looking up manager", e);
- }
- }
-
private void serializeToResponse(Object object, HttpServletResponse resp) throws IOException
{
ObjectOutputStream oos = new ObjectOutputStream(resp.getOutputStream());
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/IntrospectRequestScope.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/IntrospectRequestScope.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/IntrospectRequestScope.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -4,9 +4,6 @@
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -27,24 +24,4 @@
resp.getWriter().print(aBean.getId());
}
- @Override
- public void init() throws ServletException
- {
- //TODO Remove init code once injection works in servlet container
- try
- {
- InitialContext ic = new InitialContext();
- jsr299Manager = (BeanManager) ic.lookup("java:app/BeanManager");
- }
- catch (NamingException e)
- {
- throw new ServletException("Error looking up manager", e);
- }
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException
- {
- init();
- }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/ServiceMethodServlet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/ServiceMethodServlet.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/ServiceMethodServlet.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -22,9 +22,6 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -64,24 +61,4 @@
resp.getWriter().println("It worked!");
}
- @Override
- public void init() throws ServletException
- {
- //TODO Remove init code once injection works in servlet container
- try
- {
- InitialContext ic = new InitialContext();
- jsr299Manager = (BeanManager) ic.lookup("java:app/BeanManager");
- }
- catch (NamingException e)
- {
- throw new ServletException("Error looking up manager", e);
- }
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException
- {
- init();
- }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/TestFilter.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/TestFilter.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/TestFilter.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -5,7 +5,6 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -37,19 +36,7 @@
public void init(FilterConfig filterConfig) throws ServletException
{
- //TODO Remove init code once injection works in servlet container
- try
- {
- if (jsr299Manager == null)
- {
- InitialContext ic = new InitialContext();
- jsr299Manager = (BeanManager) ic.lookup("java:app/BeanManager");
- }
- }
- catch (Exception e)
- {
- throw new ServletException("Error looking up manager", e);
- }
+
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/IntrospectSession.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/IntrospectSession.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/IntrospectSession.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -21,9 +21,6 @@
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -50,24 +47,4 @@
resp.getWriter().print(aBean.hashCode());
}
- @Override
- public void init() throws ServletException
- {
- //TODO Remove init code once injection works in servlet container
- try
- {
- InitialContext ic = new InitialContext();
- jsr299Manager = (BeanManager) ic.lookup("java:app/BeanManager");
- }
- catch (NamingException e)
- {
- throw new ServletException("Error looking up manager", e);
- }
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException
- {
- init();
- }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/InvalidateSession.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/InvalidateSession.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/InvalidateSession.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -4,9 +4,6 @@
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -41,25 +38,4 @@
req.getSession().invalidate();
}
}
-
- @Override
- public void init() throws ServletException
- {
- //TODO Remove init code once injection works in servlet container
- try
- {
- InitialContext ic = new InitialContext();
- jsr299Manager = (BeanManager) ic.lookup("java:app/BeanManager");
- }
- catch (NamingException e)
- {
- throw new ServletException("Error looking up manager", e);
- }
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException
- {
- init();
- }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/ServiceMethodServlet.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -22,9 +22,6 @@
import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
@@ -64,24 +61,4 @@
resp.getWriter().println("It worked!");
}
- @Override
- public void init() throws ServletException
- {
- //TODO Remove init code once injection works in servlet container
- try
- {
- InitialContext ic = new InitialContext();
- jsr299Manager = (BeanManager) ic.lookup("java:app/BeanManager");
- }
- catch (NamingException e)
- {
- throw new ServletException("Error looking up manager", e);
- }
- }
-
- @Override
- public void init(ServletConfig config) throws ServletException
- {
- init();
- }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/TestFilter.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/TestFilter.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/session/TestFilter.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -5,7 +5,6 @@
import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Current;
import javax.enterprise.inject.spi.BeanManager;
-import javax.naming.InitialContext;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
@@ -37,19 +36,6 @@
public void init(FilterConfig filterConfig) throws ServletException
{
- //TODO Remove init code once injection works in servlet container
- try
- {
- if (jsr299Manager == null)
- {
- InitialContext ic = new InitialContext();
- jsr299Manager = (BeanManager) ic.lookup("java:app/BeanManager");
- }
- }
- catch (Exception e)
- {
- throw new ServletException("Error looking up manager", e);
- }
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/BeanDiscoveryObserver.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/BeanDiscoveryObserver.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/deployment/lifecycle/broken/addDefinitionError/BeanDiscoveryObserver.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -2,8 +2,9 @@
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
-class BeanDiscoveryObserver
+public class BeanDiscoveryObserver implements Extension
{
private static int invocationCount = 0;
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/InjectionIntoNonContextualComponentTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/InjectionIntoNonContextualComponentTest.java 2009-08-26 18:51:00 UTC (rev 3600)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/injection/non/contextual/InjectionIntoNonContextualComponentTest.java 2009-08-26 19:49:43 UTC (rev 3601)
@@ -41,11 +41,10 @@
@SpecVersion(spec="cdi", version="1.0.20090625")
public class InjectionIntoNonContextualComponentTest extends AbstractJSR299Test
{
- @Test(groups = "jboss-as-broken")
+ @Test
@SpecAssertions( {
@SpecAssertion(section = "5.6", id = "e"),
@SpecAssertion(section = "5.6.4", id = "a") })
- //JBAS-7046
public void testInjectionIntoServlet() throws Exception
{
WebClient webClient = new WebClient();
@@ -53,11 +52,10 @@
webClient.getPage(getContextPath() + "Test/Servlet");
}
- @Test(groups = "jboss-as-broken")
+ @Test
@SpecAssertions( {
@SpecAssertion(section = "5.6", id = "e"),
@SpecAssertion(section = "5.6.4", id = "a") })
- //JBAS-7046
public void testInjectionIntoFilter() throws Exception
{
WebClient webClient = new WebClient();
@@ -65,9 +63,8 @@
webClient.getPage(getContextPath() + "TestFilter");
}
- @Test(groups = "jboss-as-broken")
+ @Test
@SpecAssertion(section = "5.6", id = "e")
- //JBAS-7046
public void testInjectionIntoServletListener() throws Exception
{
WebClient webClient = new WebClient();
@@ -75,9 +72,8 @@
webClient.getPage(getContextPath() + "Test/ServletListener");
}
- @Test(groups = "jboss-as-broken")
+ @Test
@SpecAssertion(section = "5.6", id = "e")
- //JBAS-7046
public void testInjectionIntoTagHandler() throws Exception
{
WebClient webClient = new WebClient();
@@ -87,9 +83,8 @@
assert response.getContentAsString().contains(TestTagHandler.SUCCESS);
}
- @Test(groups = "jboss-as-broken")
+ @Test
@SpecAssertion(section = "5.6", id = "e")
- //JBAS-7046
public void testInjectionIntoTagLibraryListener() throws Exception
{
WebClient webClient = new WebClient();
@@ -97,9 +92,8 @@
webClient.getPage(getContextPath() + "Test/TagLibraryListener");
}
- @Test(groups = "jboss-as-broken")
+ @Test
@SpecAssertion(section = "5.6", id = "d")
- //JBAS-7046
public void testInjectionIntoJSFManagedBean() throws Exception
{
WebClient webclient = new WebClient();
15 years, 3 months
[webbeans-commits] Webbeans SVN: r3600 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-26 14:51:00 -0400 (Wed, 26 Aug 2009)
New Revision: 3600
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextSharedBetweenTimeoutInvocationTest.java
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextTest.java
Log:
Split out tests due to some weird ordering issue
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextSharedBetweenTimeoutInvocationTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextSharedBetweenTimeoutInvocationTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextSharedBetweenTimeoutInvocationTest.java 2009-08-26 18:51:00 UTC (rev 3600)
@@ -0,0 +1,35 @@
+package org.jboss.jsr299.tck.tests.context.application.ejb;
+
+import org.jboss.jsr299.tck.AbstractJSR299Test;
+import org.jboss.test.audit.annotations.SpecAssertion;
+import org.jboss.test.audit.annotations.SpecVersion;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
+import org.jboss.testharness.impl.packaging.Packaging;
+import org.jboss.testharness.impl.packaging.PackagingType;
+import org.testng.annotations.Test;
+
+/**
+ * EJB and related tests with the built-in application context.
+ *
+ * @author David Allen
+ */
+@Artifact
+@IntegrationTest
+(a)Packaging(PackagingType.EAR)
+@SpecVersion(spec="cdi", version="1.0.20090625")
+public class EJBApplicationContextSharedBetweenTimeoutInvocationTest extends AbstractJSR299Test
+{
+
+ @Test(groups = { "contexts", "ejb3", "integration" })
+ @SpecAssertion(section = "6.7.3", id = "ef")
+ public void testApplicationContextSharedBetweenEJBTimeoutInvocations() throws Exception
+ {
+ FMS flightManagementSystem = getInstanceByType(FMS.class);
+ flightManagementSystem.climb();
+ flightManagementSystem.descend();
+ Thread.sleep(250);
+ assert flightManagementSystem.isSameBean();
+ }
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextSharedBetweenTimeoutInvocationTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextTest.java 2009-08-26 17:29:38 UTC (rev 3599)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/application/ejb/EJBApplicationContextTest.java 2009-08-26 18:51:00 UTC (rev 3600)
@@ -41,15 +41,4 @@
assert flightManagementSystem.isApplicationScopeActive();
}
- @Test(groups = { "contexts", "ejb3", "integration" })
- @SpecAssertion(section = "6.7.3", id = "ef")
- public void testApplicationContextSharedBetweenEJBTimeoutInvocations() throws Exception
- {
- FMS flightManagementSystem = getInstanceByType(FMS.class);
- flightManagementSystem.climb();
- flightManagementSystem.descend();
- Thread.sleep(250);
- assert flightManagementSystem.isSameBean();
- }
-
}
15 years, 3 months
[webbeans-commits] Webbeans SVN: r3599 - in ri/trunk: tests and 1 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-26 13:29:38 -0400 (Wed, 26 Aug 2009)
New Revision: 3599
Modified:
ri/trunk/jboss-tck-runner/pom.xml
ri/trunk/tests/pom.xml
ri/trunk/version-matrix/pom.xml
Log:
update to jboss 5.2.0 deployment
Modified: ri/trunk/jboss-tck-runner/pom.xml
===================================================================
--- ri/trunk/jboss-tck-runner/pom.xml 2009-08-26 16:35:30 UTC (rev 3598)
+++ ri/trunk/jboss-tck-runner/pom.xml 2009-08-26 17:29:38 UTC (rev 3599)
@@ -35,7 +35,7 @@
<dependency>
<groupId>org.jboss.test-harness</groupId>
- <artifactId>jboss-test-harness-jboss-as-51</artifactId>
+ <artifactId>jboss-test-harness-jboss-as-52</artifactId>
</dependency>
Modified: ri/trunk/tests/pom.xml
===================================================================
--- ri/trunk/tests/pom.xml 2009-08-26 16:35:30 UTC (rev 3598)
+++ ri/trunk/tests/pom.xml 2009-08-26 17:29:38 UTC (rev 3599)
@@ -30,7 +30,7 @@
<dependency>
<groupId>org.jboss.test-harness</groupId>
- <artifactId>jboss-test-harness-jboss-as-51</artifactId>
+ <artifactId>jboss-test-harness-jboss-as-52</artifactId>
<scope>test</scope>
</dependency>
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-08-26 16:35:30 UTC (rev 3598)
+++ ri/trunk/version-matrix/pom.xml 2009-08-26 17:29:38 UTC (rev 3599)
@@ -327,7 +327,7 @@
<dependency>
<groupId>org.jboss.test-harness</groupId>
- <artifactId>jboss-test-harness-jboss-as-51</artifactId>
+ <artifactId>jboss-test-harness-jboss-as-52</artifactId>
<version>${jboss.test.harness.version}</version>
</dependency>
15 years, 3 months
[webbeans-commits] Webbeans SVN: r3598 - in ri/trunk/impl/src/main/java/org/jboss/webbeans: event and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-26 12:35:30 -0400 (Wed, 26 Aug 2009)
New Revision: 3598
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
Log:
Improve generic type info
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-08-26 15:59:26 UTC (rev 3597)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDeployer.java 2009-08-26 16:35:30 UTC (rev 3598)
@@ -25,8 +25,6 @@
import javax.enterprise.inject.Initializer;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.AnnotatedMethod;
-import javax.enterprise.inject.spi.AnnotatedType;
-import javax.enterprise.inject.spi.InjectionTarget;
import javax.enterprise.inject.spi.ObserverMethod;
import javax.enterprise.inject.spi.ProcessObserverMethod;
@@ -160,18 +158,19 @@
}
}
- protected void createObserverMethods(RIBean<?> declaringBean, WBClass<?> annotatedClass)
+ protected <X> void createObserverMethods(RIBean<X> declaringBean, WBClass<X> annotatedClass)
{
- for (WBMethod<?, ?> method : annotatedClass.getWBDeclaredMethodsWithAnnotatedParameters(Observes.class))
+ for (WBMethod<?, X> method : annotatedClass.getWBDeclaredMethodsWithAnnotatedParameters(Observes.class))
{
createObserverMethod(declaringBean, method);
}
}
- protected void createObserverMethod(RIBean<?> declaringBean, WBMethod<?, ?> method)
+ protected <X, T> void createObserverMethod(RIBean<X> declaringBean, WBMethod<T, X> method)
{
- ObserverMethodImpl<?, ?> observer = ObserverFactory.create(method, declaringBean, manager);
- //ProcessObserverMethod<?, ?> event = createProcessObserverMethodEvent(observer, method);
+ ObserverMethodImpl<X, T> observer = ObserverFactory.create(method, declaringBean, manager);
+ ProcessObserverMethod<?, ?> event = createProcessObserverMethodEvent(observer, method);
+ manager.fireEvent(event);
getEnvironment().addObserver(observer);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-08-26 15:59:26 UTC (rev 3597)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java 2009-08-26 16:35:30 UTC (rev 3598)
@@ -176,6 +176,14 @@
{
return transactionPhase;
}
+
+ /**
+ * @return the observerMethod
+ */
+ public MethodInjectionPoint<?, ?> getMethod()
+ {
+ return observerMethod;
+ }
/**
* Completes initialization of the observer and allows derived types to
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java 2009-08-26 15:59:26 UTC (rev 3597)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingWBClass.java 2009-08-26 16:35:30 UTC (rev 3598)
@@ -65,7 +65,7 @@
return delegate().getDeclaredWBAnnotatedMethods(annotationType);
}
- public Set<WBMethod<?, ?>> getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, T>> getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
{
return delegate().getWBDeclaredMethodsWithAnnotatedParameters(annotationType);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java 2009-08-26 15:59:26 UTC (rev 3597)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/WBClass.java 2009-08-26 16:35:30 UTC (rev 3598)
@@ -190,7 +190,7 @@
* @return A set of abstracted methods with the given annotation. Returns an
* empty set if there are no matches
*/
- public Set<WBMethod<?, ?>> getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
+ public Set<WBMethod<?, T>> getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType);
/**
* Gets the superclass.
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-08-26 15:59:26 UTC (rev 3597)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/WBClassImpl.java 2009-08-26 16:35:30 UTC (rev 3598)
@@ -105,7 +105,7 @@
// The map from annotation type to abstracted method with annotation
private final SetMultimap<Class<? extends Annotation>, WBMethod<?, ?>> declaredAnnotatedMethods;
// The map from annotation type to method with a parameter with annotation
- private final SetMultimap<Class<? extends Annotation>, WBMethod<?, ?>> declaredMethodsByAnnotatedParameters;
+ private final SetMultimap<Class<? extends Annotation>, WBMethod<?, T>> declaredMethodsByAnnotatedParameters;
// The set of abstracted constructors
private final Set<WBConstructor<T>> constructors;
@@ -351,12 +351,12 @@
}
});
- this.declaredMethodsByAnnotatedParameters = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?, ?>>>(), new Supplier< Set<WBMethod<?, ?>>>()
+ this.declaredMethodsByAnnotatedParameters = Multimaps.newSetMultimap(new HashMap<Class<? extends Annotation>, Collection<WBMethod<?, T>>>(), new Supplier< Set<WBMethod<?, T>>>()
{
- public Set<WBMethod<?, ?>> get()
+ public Set<WBMethod<?, T>> get()
{
- return new HashSet<WBMethod<?, ?>>();
+ return new HashSet<WBMethod<?, T>>();
}
});
@@ -381,14 +381,14 @@
method.setAccessible(true);
}
- WBMethod<?, ?> annotatedMethod = null;
+ WBMethod<?, T> annotatedMethod = null;
if (annotatedTypeMethods.containsKey(method))
{
annotatedMethod = WBMethodImpl.of(annotatedTypeMethods.get(method), this, classTransformer);
}
else
{
- annotatedMethod = WBMethodImpl.of(method, getDeclaringWBClass(method, classTransformer), classTransformer);
+ annotatedMethod = WBMethodImpl.of(method, this.<T>getDeclaringWBClass(method, classTransformer), classTransformer);
}
this.methods.add(annotatedMethod);
this.methodsBySignature.put(annotatedMethod.getSignature(), annotatedMethod);
@@ -594,7 +594,7 @@
return Collections.unmodifiableSet(constructorsByAnnotatedParameters.get(annotationType));
}
- public Set<WBMethod<?, ?>> getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
+ public Set<WBMethod<?, T>> getWBDeclaredMethodsWithAnnotatedParameters(Class<? extends Annotation> annotationType)
{
return Collections.unmodifiableSet(declaredMethodsByAnnotatedParameters.get(annotationType));
}
15 years, 3 months
[webbeans-commits] Webbeans SVN: r3597 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-26 11:59:26 -0400 (Wed, 26 Aug 2009)
New Revision: 3597
Added:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDiscoveryEvent.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractContainerEvent.java
Log:
oops
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDiscoveryEvent.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDiscoveryEvent.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDiscoveryEvent.java 2009-08-26 15:59:26 UTC (rev 3597)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.webbeans.bootstrap;
+
+import java.util.Map;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
+import org.jboss.webbeans.metadata.TypeStore;
+
+/**
+ * @author pmuir
+ */
+public abstract class AbstractBeanDiscoveryEvent extends AbstractContainerEvent
+{
+
+ private final Map<BeanDeploymentArchive, BeanDeployment> beanDeployments;
+ private final BeanManagerImpl deploymentManager;
+ private final Deployment deployment;
+
+ public AbstractBeanDiscoveryEvent(Map<BeanDeploymentArchive, BeanDeployment> beanDeployments, BeanManagerImpl deploymentManager, Deployment deployment)
+ {
+ this.beanDeployments = beanDeployments;
+ this.deploymentManager = deploymentManager;
+ this.deployment = deployment;
+ }
+
+ /**
+ * @return the beanDeployments
+ */
+ protected Map<BeanDeploymentArchive, BeanDeployment> getBeanDeployments()
+ {
+ return beanDeployments;
+ }
+
+ /**
+ * @return the deployment
+ */
+ protected Deployment getDeployment()
+ {
+ return deployment;
+ }
+
+ /**
+ * @return the deploymentManager
+ */
+ protected BeanManagerImpl getDeploymentManager()
+ {
+ return deploymentManager;
+ }
+
+ protected TypeStore getTypeStore()
+ {
+ return getDeployment().getServices().get(TypeStore.class);
+ }
+
+
+ protected BeanDeployment getOrCreateBeanDeployment(Class<?> clazz)
+ {
+ BeanDeploymentArchive beanDeploymentArchive = getDeployment().loadBeanDeploymentArchive(clazz);
+ if (beanDeploymentArchive == null)
+ {
+ throw new IllegalStateException("Unable to find Bean Deployment Archive for " + clazz);
+ }
+ else
+ {
+ if (getBeanDeployments().containsKey(beanDeploymentArchive))
+ {
+ return getBeanDeployments().get(beanDeploymentArchive);
+ }
+ else
+ {
+ BeanDeployment beanDeployment = new BeanDeployment(beanDeploymentArchive, getDeploymentManager());
+ getBeanDeployments().put(beanDeploymentArchive, beanDeployment);
+ return beanDeployment;
+ }
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractBeanDiscoveryEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractContainerEvent.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractContainerEvent.java (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractContainerEvent.java 2009-08-26 15:59:26 UTC (rev 3597)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.webbeans.bootstrap;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author pmuir
+ *
+ */
+public class AbstractContainerEvent
+{
+
+ private final List<Throwable> errors;
+
+ public AbstractContainerEvent()
+ {
+ this.errors = new ArrayList<Throwable>();
+ }
+
+ /**
+ * @return the errors
+ */
+ protected List<Throwable> getErrors()
+ {
+ return errors;
+ }
+
+}
Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AbstractContainerEvent.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 3 months
[webbeans-commits] Webbeans SVN: r3596 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bootstrap and 8 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-26 11:57:55 -0400 (Wed, 26 Aug 2009)
New Revision: 3596
Removed:
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/AbstractBootstrap.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterBeanDiscoveryImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterDeploymentValidationImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployment.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingServiceRegistry.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/SimpleServiceRegistry.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockBootstrap.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockDeployment.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockBeanDeploymentArchive.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockDeployment.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java
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
Log:
WBRI-372
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -301,10 +301,10 @@
* @param serviceRegistry
* @return
*/
- public static BeanManagerImpl newManager(BeanManagerImpl rootManager)
+ public static BeanManagerImpl newManager(BeanManagerImpl rootManager, ServiceRegistry services)
{
return new BeanManagerImpl(
- rootManager.getServices(),
+ services,
new CopyOnWriteArrayList<Bean<?>>(),
new CopyOnWriteArrayList<DecoratorBean<?>>(),
new CopyOnWriteArrayList<ObserverMethod<?,?>>(),
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/CurrentManager.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -65,7 +65,7 @@
public static boolean isAvailable()
{
- return rootManager.isSet();
+ return rootManager.isSet() && beanDeploymentArchives.isSet();
}
/**
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterBeanDiscoveryImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterBeanDiscoveryImpl.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterBeanDiscoveryImpl.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -16,7 +16,6 @@
*/
package org.jboss.webbeans.bootstrap;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -30,29 +29,22 @@
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.webbeans.bootstrap.spi.Deployment;
-public class AfterBeanDiscoveryImpl implements AfterBeanDiscovery
+public class AfterBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements AfterBeanDiscovery
{
-
- private final List<Throwable> definitionErrors = new ArrayList<Throwable>();
- private final Map<BeanDeploymentArchive, BeanDeployment> beanDeployments;
- private final BeanManagerImpl deploymentManager;
- private final Deployment deployment;
-
- public AfterBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments)
+
+ public AfterBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Deployment deployment, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments)
{
- this.beanDeployments = beanDeployments;
- this.deploymentManager = deploymentManager;
- this.deployment = deploymentManager.getServices().get(Deployment.class);
+ super(beanDeployments, deploymentManager, deployment);
}
public void addDefinitionError(Throwable t)
{
- definitionErrors.add(t);
+ getErrors().add(t);
}
public List<Throwable> getDefinitionErrors()
{
- return Collections.unmodifiableList(definitionErrors);
+ return Collections.unmodifiableList(getErrors());
}
public void addBean(Bean<?> bean)
@@ -62,35 +54,12 @@
public void addContext(Context context)
{
- deploymentManager.addContext(context);
+ getDeploymentManager().addContext(context);
}
public void addObserverMethod(ObserverMethod<?, ?> observerMethod)
{
getOrCreateBeanDeployment(observerMethod.getBean().getBeanClass()).getBeanManager().addObserver(observerMethod);
}
-
- private BeanDeployment getOrCreateBeanDeployment(Class<?> clazz)
- {
- BeanDeploymentArchive beanDeploymentArchive = deployment.loadBeanDeploymentArchive(clazz);
- if (beanDeploymentArchive == null)
- {
- throw new IllegalStateException("Unable to find Bean Deployment Archive for " + clazz);
- }
- else
- {
- if (beanDeployments.containsKey(beanDeploymentArchive))
- {
- return beanDeployments.get(beanDeploymentArchive);
- }
- else
- {
- BeanDeployment beanDeployment = new BeanDeployment(beanDeploymentArchive, deploymentManager);
- beanDeployments.put(beanDeploymentArchive, beanDeployment);
- return beanDeployment;
- }
- }
-
- }
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterDeploymentValidationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterDeploymentValidationImpl.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/AfterDeploymentValidationImpl.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -16,22 +16,21 @@
*/
package org.jboss.webbeans.bootstrap;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import javax.enterprise.inject.spi.AfterDeploymentValidation;
-public class AfterDeploymentValidationImpl implements AfterDeploymentValidation
+public class AfterDeploymentValidationImpl extends AbstractContainerEvent implements AfterDeploymentValidation
{
- private List<Throwable> deploymentProblems = new ArrayList<Throwable>();
public void addDeploymentProblem(Throwable t)
{
- deploymentProblems.add(t);
+ getErrors().add(t);
}
public List<Throwable> getDeploymentProblems()
{
- return deploymentProblems;
+ return Collections.unmodifiableList(getErrors());
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployment.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployment.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployment.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -17,7 +17,6 @@
package org.jboss.webbeans.bootstrap;
import org.jboss.webbeans.BeanManagerImpl;
-import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.bean.builtin.DefaultValidatorBean;
import org.jboss.webbeans.bean.builtin.DefaultValidatorFactoryBean;
import org.jboss.webbeans.bean.builtin.InjectionPointBean;
@@ -28,6 +27,8 @@
import org.jboss.webbeans.bean.builtin.facade.InstanceBean;
import org.jboss.webbeans.bootstrap.api.Environment;
import org.jboss.webbeans.bootstrap.api.Environments;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
+import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.webbeans.conversation.ConversationImpl;
import org.jboss.webbeans.conversation.JavaSEConversationTerminator;
@@ -60,9 +61,12 @@
public BeanDeployment(BeanDeploymentArchive beanDeploymentArchive, BeanManagerImpl deploymentManager)
{
this.beanDeploymentArchive = beanDeploymentArchive;
- this.beanManager = BeanManagerImpl.newManager(CurrentManager.rootManager());
+ ServiceRegistry services = new SimpleServiceRegistry();
+ services.addAll(deploymentManager.getServices().entrySet());
+ services.addAll(beanDeploymentArchive.getServices().entrySet());
+ this.beanManager = BeanManagerImpl.newManager(deploymentManager, services);
EjbDescriptorCache ejbDescriptors = new EjbDescriptorCache();
- if (deploymentManager.getServices().contains(EjbServices.class))
+ if (beanManager.getServices().contains(EjbServices.class))
{
// Must populate EJB cache first, as we need it to detect whether a
// bean is an EJB!
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeforeBeanDiscoveryImpl.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -28,38 +28,29 @@
import org.jboss.webbeans.literal.BindingTypeLiteral;
import org.jboss.webbeans.literal.InterceptorBindingTypeLiteral;
import org.jboss.webbeans.literal.ScopeTypeLiteral;
-import org.jboss.webbeans.metadata.TypeStore;
-public class BeforeBeanDiscoveryImpl implements BeforeBeanDiscovery
+public class BeforeBeanDiscoveryImpl extends AbstractBeanDiscoveryEvent implements BeforeBeanDiscovery
{
- private final TypeStore typeStore;
- private final Map<BeanDeploymentArchive, BeanDeployment> beanDeployments;
- private final BeanManagerImpl deploymentManager;
- private final Deployment deployment;
-
- public BeforeBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments)
+ public BeforeBeanDiscoveryImpl(BeanManagerImpl deploymentManager, Deployment deployment, Map<BeanDeploymentArchive, BeanDeployment> beanDeployments)
{
- this.typeStore = deploymentManager.getServices().get(TypeStore.class);
- this.beanDeployments = beanDeployments;
- this.deployment = deploymentManager.getServices().get(Deployment.class);
- this.deploymentManager = deploymentManager;
+ super(beanDeployments, deploymentManager, deployment);
}
public void addBindingType(Class<? extends Annotation> bindingType)
{
- typeStore.add(bindingType, new BindingTypeLiteral());
+ getTypeStore().add(bindingType, new BindingTypeLiteral());
}
public void addInterceptorBindingType(Class<? extends Annotation> bindingType)
{
- typeStore.add(bindingType, new InterceptorBindingTypeLiteral());
+ getTypeStore().add(bindingType, new InterceptorBindingTypeLiteral());
}
public void addScopeType(Class<? extends Annotation> scopeType,
boolean normal, boolean passivating)
{
- typeStore.add(scopeType, new ScopeTypeLiteral(normal, passivating));
+ getTypeStore().add(scopeType, new ScopeTypeLiteral(normal, passivating));
}
public void addStereotype(Class<? extends Annotation> stereotype,
@@ -70,23 +61,7 @@
public void addAnnotatedType(AnnotatedType<?> type)
{
- BeanDeploymentArchive beanDeploymentArchive = deployment.loadBeanDeploymentArchive(type.getJavaClass());
- if (beanDeploymentArchive == null)
- {
- throw new IllegalStateException("Unable to find Bean Deployment Archive for " + type);
- }
- else
- {
- if (beanDeployments.containsKey(beanDeploymentArchive))
- {
- beanDeployments.get(beanDeploymentArchive).getBeanDeployer().addClass(type);
- }
- else
- {
- BeanDeployment beanDeployment = new BeanDeployment(beanDeploymentArchive, deploymentManager);
- beanDeployments.put(beanDeploymentArchive, beanDeployment);
- }
- }
+ getOrCreateBeanDeployment(type.getJavaClass()).getBeanDeployer().addClass(type);
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -34,7 +34,9 @@
import org.jboss.webbeans.Validator;
import org.jboss.webbeans.bean.builtin.ManagerBean;
import org.jboss.webbeans.bootstrap.api.Bootstrap;
-import org.jboss.webbeans.bootstrap.api.helpers.AbstractBootstrap;
+import org.jboss.webbeans.bootstrap.api.Environment;
+import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
import org.jboss.webbeans.bootstrap.api.helpers.ServiceRegistries;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.webbeans.bootstrap.spi.Deployment;
@@ -45,7 +47,6 @@
import org.jboss.webbeans.context.RequestContext;
import org.jboss.webbeans.context.SessionContext;
import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
import org.jboss.webbeans.ejb.EJBApiAbstraction;
import org.jboss.webbeans.ejb.spi.EjbServices;
import org.jboss.webbeans.jsf.JsfApiAbstraction;
@@ -69,7 +70,7 @@
*
* @author Pete Muir
*/
-public class WebBeansBootstrap extends AbstractBootstrap implements Bootstrap
+public class WebBeansBootstrap implements Bootstrap
{
/**
@@ -84,17 +85,21 @@
{
private final BeanManagerImpl deploymentManager;
+ private final Environment environment;
+ private final Deployment deployment;
- public DeploymentVisitor(BeanManagerImpl deploymentManager)
+ public DeploymentVisitor(BeanManagerImpl deploymentManager, Environment environment, Deployment deployment)
{
this.deploymentManager = deploymentManager;
+ this.environment = environment;
+ this.deployment = deployment;
}
public Map<BeanDeploymentArchive, BeanDeployment> visit()
{
Set<BeanDeploymentArchive> seenBeanDeploymentArchives = new HashSet<BeanDeploymentArchive>();
Map<BeanDeploymentArchive, BeanDeployment> managerAwareBeanDeploymentArchives = new HashMap<BeanDeploymentArchive, BeanDeployment>();
- for (BeanDeploymentArchive archvive : deploymentManager.getServices().get(Deployment.class).getBeanDeploymentArchives())
+ for (BeanDeploymentArchive archvive : deployment.getBeanDeploymentArchives())
{
visit(archvive, managerAwareBeanDeploymentArchives, seenBeanDeploymentArchives);
}
@@ -103,6 +108,10 @@
private BeanDeployment visit(BeanDeploymentArchive beanDeploymentArchive, Map<BeanDeploymentArchive, BeanDeployment> managerAwareBeanDeploymentArchives, Set<BeanDeploymentArchive> seenBeanDeploymentArchives)
{
+ // Check that the required services are specified
+ verifyServices(beanDeploymentArchive.getServices(), environment.getRequiredBeanDeploymentArchiveServices());
+
+ // Create the BeanDeployment and attach
BeanDeployment parent = new BeanDeployment(beanDeploymentArchive, deploymentManager);
managerAwareBeanDeploymentArchives.put(beanDeploymentArchive, parent);
seenBeanDeploymentArchives.add(beanDeploymentArchive);
@@ -131,60 +140,79 @@
// The Web Beans manager
private BeanManagerImpl deploymentManager;
private Map<BeanDeploymentArchive, BeanDeployment> beanDeployments;
- private DeploymentVisitor deploymentVisitor;
- private BeanStore requestBeanStore;
+ private Environment environment;
+ private Deployment deployment;
- public WebBeansBootstrap()
+ public Bootstrap startContainer(Environment environment, Deployment deployment, BeanStore applicationBeanStore)
{
- // initialize default services
- getServices().add(ResourceLoader.class, new DefaultResourceLoader());
- }
-
- public Bootstrap startContainer()
- {
synchronized (this)
{
- verify();
- if (!getServices().contains(TransactionServices.class))
+ if (deployment == null)
{
+ throw new IllegalArgumentException("Must start the container with a deployment");
+ }
+ if (!deployment.getServices().contains(ResourceLoader.class))
+ {
+ deployment.getServices().add(ResourceLoader.class, new DefaultResourceLoader());
+ }
+
+ verifyServices(deployment.getServices(), environment.getRequiredDeploymentServices());
+
+ if (!deployment.getServices().contains(TransactionServices.class))
+ {
log.info("Transactional services not available. Injection of @Current UserTransaction not available. Transactional observers will be invoked synchronously.");
}
- if (!getServices().contains(EjbServices.class))
+ if (!deployment.getServices().contains(EjbServices.class))
{
log.info("EJB services not available. Session beans will be simple beans, CDI-style injection into non-contextual EJBs, injection of remote EJBs and injection of @EJB in simple beans will not be available");
}
- if (!getServices().contains(JpaServices.class))
+ if (!deployment.getServices().contains(JpaServices.class))
{
log.info("JPA services not available. Injection of @PersistenceContext will not occur. Entity beans will be discovered as simple beans.");
}
- if (!getServices().contains(ResourceServices.class))
+ if (!deployment.getServices().contains(ResourceServices.class))
{
log.info("@Resource injection not available.");
}
- addImplementationServices();
+ if (applicationBeanStore == null)
+ {
+ throw new IllegalStateException("No application context BeanStore set");
+ }
+
+ this.deployment = deployment;
+ addImplementationServices(deployment.getServices());
+
+
+ this.environment = environment;
+ this.deploymentManager = BeanManagerImpl.newRootManager(ServiceRegistries.unmodifiableServiceRegistry(deployment.getServices()));
+ CurrentManager.setRootManager(deploymentManager);
+
createContexts();
- this.deploymentManager = BeanManagerImpl.newRootManager(ServiceRegistries.unmodifiableServiceRegistry(getServices()));
- CurrentManager.setRootManager(deploymentManager);
initializeContexts();
- this.deploymentVisitor = new DeploymentVisitor(deploymentManager);
+ // Start the application context
+ beginApplication(applicationBeanStore);
+
+ DeploymentVisitor deploymentVisitor = new DeploymentVisitor(deploymentManager, environment, deployment);
+ beanDeployments = deploymentVisitor.visit();
+
return this;
}
}
- private void addImplementationServices()
+ private void addImplementationServices(ServiceRegistry services)
{
- ResourceLoader resourceLoader = getServices().get(ResourceLoader.class);
- getServices().add(EJBApiAbstraction.class, new EJBApiAbstraction(resourceLoader));
- getServices().add(JsfApiAbstraction.class, new JsfApiAbstraction(resourceLoader));
- getServices().add(PersistenceApiAbstraction.class, new PersistenceApiAbstraction(resourceLoader));
- getServices().add(ServletApiAbstraction.class, new ServletApiAbstraction(resourceLoader));
+ ResourceLoader resourceLoader = services.get(ResourceLoader.class);
+ services.add(EJBApiAbstraction.class, new EJBApiAbstraction(resourceLoader));
+ services.add(JsfApiAbstraction.class, new JsfApiAbstraction(resourceLoader));
+ services.add(PersistenceApiAbstraction.class, new PersistenceApiAbstraction(resourceLoader));
+ services.add(ServletApiAbstraction.class, new ServletApiAbstraction(resourceLoader));
// Temporary workaround to provide context for building annotated class
// TODO expose AnnotatedClass on SPI and allow container to provide impl of this via ResourceLoader
- getServices().add(Validator.class, new Validator());
- getServices().add(TypeStore.class, new TypeStore());
- getServices().add(ClassTransformer.class, new ClassTransformer(getServices().get(TypeStore.class)));
- getServices().add(MetaAnnotationStore.class, new MetaAnnotationStore(getServices().get(ClassTransformer.class)));
- getServices().add(ContextualIdStore.class, new ContextualIdStore());
+ services.add(Validator.class, new Validator());
+ services.add(TypeStore.class, new TypeStore());
+ services.add(ClassTransformer.class, new ClassTransformer(services.get(TypeStore.class)));
+ services.add(MetaAnnotationStore.class, new MetaAnnotationStore(services.get(ClassTransformer.class)));
+ services.add(ContextualIdStore.class, new ContextualIdStore());
}
public BeanManagerImpl getManager(BeanDeploymentArchive beanDeploymentArchive)
@@ -207,18 +235,7 @@
{
throw new IllegalStateException("Manager has not been initialized");
}
- if (getApplicationContext() == null)
- {
- throw new IllegalStateException("No application context BeanStore set");
- }
- // Set up the contexts before we start creating bean deployers
- // This allows us to throw errors in the parser
- beginApplication(getApplicationContext());
- requestBeanStore = new ConcurrentHashMapBeanStore();
-
- beanDeployments = deploymentVisitor.visit();
-
ExtensionBeanDeployer extensionBeanDeployer = new ExtensionBeanDeployer(deploymentManager);
extensionBeanDeployer.addExtensions(ServiceLoader.load(Extension.class));
extensionBeanDeployer.createBeans().deploy();
@@ -237,7 +254,7 @@
{
for (Entry<BeanDeploymentArchive, BeanDeployment> entry : beanDeployments.entrySet())
{
- entry.getValue().deployBeans(getEnvironment());
+ entry.getValue().deployBeans(environment);
}
fireAfterBeanDiscoveryEvent();
log.debug("Web Beans initialized. Validating beans.");
@@ -251,7 +268,7 @@
{
for (Entry<BeanDeploymentArchive, BeanDeployment> entry : beanDeployments.entrySet())
{
- getServices().get(Validator.class).validateDeployment(entry.getValue().getBeanManager(), entry.getValue().getBeanDeployer().getEnvironment());
+ deploymentManager.getServices().get(Validator.class).validateDeployment(entry.getValue().getBeanManager(), entry.getValue().getBeanDeployer().getEnvironment());
}
fireAfterDeploymentValidationEvent();
}
@@ -270,7 +287,7 @@
private void fireBeforeBeanDiscoveryEvent()
{
- BeforeBeanDiscovery event = new BeforeBeanDiscoveryImpl(deploymentManager, beanDeployments);
+ BeforeBeanDiscovery event = new BeforeBeanDiscoveryImpl(deploymentManager, deployment, beanDeployments);
try
{
deploymentManager.fireEvent(event);
@@ -296,7 +313,7 @@
private void fireAfterBeanDiscoveryEvent()
{
- AfterBeanDiscoveryImpl event = new AfterBeanDiscoveryImpl(deploymentManager, beanDeployments);
+ AfterBeanDiscoveryImpl event = new AfterBeanDiscoveryImpl(deploymentManager, deployment, beanDeployments);
try
{
deploymentManager.fireEvent(event);
@@ -346,21 +363,21 @@
protected void initializeContexts()
{
- deploymentManager.addContext(getServices().get(DependentContext.class));
- deploymentManager.addContext(getServices().get(RequestContext.class));
- deploymentManager.addContext(getServices().get(ConversationContext.class));
- deploymentManager.addContext(getServices().get(SessionContext.class));
- deploymentManager.addContext(getServices().get(ApplicationContext.class));
+ deploymentManager.addContext(deploymentManager.getServices().get(DependentContext.class));
+ deploymentManager.addContext(deploymentManager.getServices().get(RequestContext.class));
+ deploymentManager.addContext(deploymentManager.getServices().get(ConversationContext.class));
+ deploymentManager.addContext(deploymentManager.getServices().get(SessionContext.class));
+ deploymentManager.addContext(deploymentManager.getServices().get(ApplicationContext.class));
}
protected void createContexts()
{
- getServices().add(ContextLifecycle.class, new ContextLifecycle());
- getServices().add(DependentContext.class, new DependentContext());
- getServices().add(RequestContext.class, new RequestContext());
- getServices().add(ConversationContext.class, new ConversationContext());
- getServices().add(SessionContext.class, new SessionContext());
- getServices().add(ApplicationContext.class, new ApplicationContext());
+ deployment.getServices().add(ContextLifecycle.class, new ContextLifecycle());
+ deployment.getServices().add(DependentContext.class, new DependentContext());
+ deployment.getServices().add(RequestContext.class, new RequestContext());
+ deployment.getServices().add(ConversationContext.class, new ConversationContext());
+ deployment.getServices().add(SessionContext.class, new SessionContext());
+ deployment.getServices().add(ApplicationContext.class, new ApplicationContext());
}
protected void beginApplication(BeanStore applicationBeanStore)
@@ -383,5 +400,16 @@
deploymentManager.shutdown();
}
}
+
+ protected static void verifyServices(ServiceRegistry services, Set<Class<? extends Service>> requiredServices)
+ {
+ for (Class<? extends Service> serviceType : requiredServices)
+ {
+ if (!services.contains(serviceType))
+ {
+ throw new IllegalStateException("Required service " + serviceType.getName() + " has not been specified");
+ }
+ }
+ }
}
Modified: ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java
===================================================================
--- ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/porting-package/src/main/java/org/jboss/webbeans/tck/BeansImpl.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -5,7 +5,6 @@
import org.jboss.jsr299.tck.spi.Beans;
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.ejb.spi.EjbDescriptor;
-import org.jboss.webbeans.ejb.spi.EjbServices;
import org.jboss.webbeans.util.Proxies;
/**
@@ -70,13 +69,7 @@
public <T> T getEnterpriseBean(Class<? extends T> beanType, Class<T> localInterface)
{
- // Get the EJB Descriptor and resolve it
- if (CurrentManager.rootManager().getNewEnterpriseBeanMap().containsKey(beanType))
- {
- EjbDescriptor<?> ejbDescriptor = CurrentManager.rootManager().getNewEnterpriseBeanMap().get(beanType).getEjbDescriptor().delegate();
- return CurrentManager.rootManager().getServices().get(EjbServices.class).resolveEjb(ejbDescriptor).getBusinessObject(localInterface);
- }
- throw new NullPointerException("No EJB found for " + localInterface.getName() + " on bean " + beanType.getName());
+ throw new UnsupportedOperationException();
}
public <T> T createBeanInstance(Bean<T> bean)
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Bootstrap.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -49,20 +49,6 @@
{
/**
- * Set the bean store to use as backing for the application context
- *
- * @param beanStore the bean store to use
- */
- public void setApplicationContext(BeanStore beanStore);
-
- /**
- * Set the environment in use, by default {@link Environments.EE}
- *
- * @param environment the environment to use
- */
- public void setEnvironment(Environment environment);
-
- /**
* Creates the application container:
* <ul>
* <li>Checks that the services required by the environment have been
@@ -72,13 +58,16 @@
* <li>Creates the manager</li>
* </ul>
*
- * This method name is a workaround for weird JBoss MC behavior, calling
- *
- *
+ * @param beanStore the bean store to use as backing for the application
+ * context
+ * @param environment the environment in use, by default
+ * {@link Environments.EE}
+ * @param deployment the Deployment to be booted
* @throws IllegalStateException if not all the services required for the
* given environment are available
+ *
*/
- public Bootstrap startContainer();
+ public Bootstrap startContainer(Environment environment, Deployment deployment, BeanStore beanStore);
/**
* Starts the application container initialization process:
@@ -130,13 +119,6 @@
public void shutdown();
/**
- * Get the services available to this bootstrap
- *
- * @return the services available
- */
- public ServiceRegistry getServices();
-
- /**
* Get the manager used for this beanDeploymentArchive.
*
* If {@link #startContainer()} has not been called, this method will return
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environment.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -19,8 +19,8 @@
import java.util.Set;
/**
- * Represents an environment. Used to control which services Web Beans will require
- * in order to boot
+ * Represents an environment. Specifies the services Web Beans requires
+ *
* @author Pete Muir
*
*/
@@ -28,10 +28,12 @@
{
/**
- * The services to require for this environment
+ * The deployment scoped services required for this environment
*
* @return the services to require
*/
- public Set<Class<? extends Service>> getRequiredServices();
+ public Set<Class<? extends Service>> getRequiredDeploymentServices();
+
+ public Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices();
}
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -16,11 +16,9 @@
*/
package org.jboss.webbeans.bootstrap.api;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
import org.jboss.webbeans.ejb.spi.EjbServices;
import org.jboss.webbeans.jsf.spi.JSFServices;
import org.jboss.webbeans.persistence.spi.JpaServices;
@@ -43,33 +41,87 @@
/**
* Java EE5 or Java EE6
*/
- EE(Deployment.class, EjbServices.class, JpaServices.class, ResourceServices.class, TransactionServices.class, ResourceLoader.class, SecurityServices.class, ValidationServices.class, ServletServices.class, JSFServices.class),
+ EE(new EnvironmentBuilder()
+ .addRequiredDeploymentService(TransactionServices.class)
+ .addRequiredDeploymentService(ResourceLoader.class)
+ .addRequiredDeploymentService(SecurityServices.class)
+ .addRequiredDeploymentService(ValidationServices.class)
+ .addRequiredDeploymentService(ServletServices.class)
+ .addRequiredDeploymentService(JSFServices.class)
+ .addRequiredBeanDeploymentArchiveService(JpaServices.class)
+ .addRequiredBeanDeploymentArchiveService(ResourceServices.class)
+ .addRequiredBeanDeploymentArchiveService(EjbServices.class)
+ ),
/**
- * Java EE6 Web Profile
- */
- EE_WEB_PROFILE(Deployment.class, EjbServices.class, JpaServices.class, ResourceServices.class, TransactionServices.class, ResourceLoader.class, SecurityServices.class, ValidationServices.class, ServletServices.class, JSFServices.class),
-
- /**
* Servlet container such as Tomcat
*/
- SERVLET(Deployment.class, ResourceLoader.class, ServletServices.class),
+ SERVLET(new EnvironmentBuilder()
+ .addRequiredDeploymentService(ResourceLoader.class)
+ .addRequiredDeploymentService(ServletServices.class)
+ ),
/**
* Java SE
*/
- SE(Deployment.class, ResourceLoader.class);
+ SE(new EnvironmentBuilder()
+ );
- private final Set<Class<? extends Service>> requiredServices;
+ private final Set<Class<? extends Service>> requiredDeploymentServices;
- private Environments(Class<? extends Service>... requiredServices)
+ private final Set<Class<? extends Service>> requiredBeanDeploymentArchiveServices;
+
+ private Environments(EnvironmentBuilder builder)
{
- this.requiredServices = new HashSet<Class<? extends Service>>(Arrays.asList(requiredServices));
+ this.requiredDeploymentServices = builder.getRequiredDeploymentServices();
+ this.requiredBeanDeploymentArchiveServices = builder.getRequiredBeanDeploymentArchiveServices();
}
- public Set<Class<? extends Service>> getRequiredServices()
+ public Set<Class<? extends Service>> getRequiredDeploymentServices()
{
- return requiredServices;
+ return requiredDeploymentServices;
}
+ public Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices()
+ {
+ return requiredBeanDeploymentArchiveServices;
+ }
+
+ private static class EnvironmentBuilder
+ {
+
+ private final Set<Class<? extends Service>> requiredDeploymentServices;
+
+ private final Set<Class<? extends Service>> requiredBeanDeploymentArchiveServices;
+
+ public EnvironmentBuilder()
+ {
+ this.requiredBeanDeploymentArchiveServices = new HashSet<Class<? extends Service>>();
+ this.requiredDeploymentServices = new HashSet<Class<? extends Service>>();
+ }
+
+ public Set<Class<? extends Service>> getRequiredBeanDeploymentArchiveServices()
+ {
+ return requiredBeanDeploymentArchiveServices;
+ }
+
+ public Set<Class<? extends Service>> getRequiredDeploymentServices()
+ {
+ return requiredDeploymentServices;
+ }
+
+ public EnvironmentBuilder addRequiredDeploymentService(Class<? extends Service> service)
+ {
+ this.requiredDeploymentServices.add(service);
+ return this;
+ }
+
+ public EnvironmentBuilder addRequiredBeanDeploymentArchiveService(Class<? extends Service> service)
+ {
+ this.requiredBeanDeploymentArchiveServices.add(service);
+ return this;
+ }
+
+ }
+
}
\ No newline at end of file
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/ServiceRegistry.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -1,5 +1,9 @@
package org.jboss.webbeans.bootstrap.api;
+import java.util.Collection;
+import java.util.Set;
+import java.util.Map.Entry;
+
/**
* A service registry
*
@@ -10,7 +14,7 @@
{
/**
- * Add a service to bootstrap
+ * Add a service
*
* @see Service
*
@@ -21,6 +25,15 @@
public <S extends Service> void add(Class<S> type, S service);
/**
+ * Add services
+ *
+ * @param services
+ */
+ public void addAll(Collection<Entry<Class<? extends Service>, Service>> services);
+
+ public Set<Entry<Class<? extends Service>, Service>> entrySet();
+
+ /**
* Retrieve a service implementation
*
* @param <S> the service type
@@ -38,4 +51,6 @@
*/
public <S extends Service> boolean contains(Class<S> type);
+
+
}
\ No newline at end of file
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/AbstractBootstrap.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/AbstractBootstrap.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/AbstractBootstrap.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, 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.webbeans.bootstrap.api.helpers;
-
-import static org.jboss.webbeans.bootstrap.api.Environments.EE;
-
-import org.jboss.webbeans.bootstrap.api.Bootstrap;
-import org.jboss.webbeans.bootstrap.api.Environment;
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
-import org.jboss.webbeans.bootstrap.spi.WebBeanDiscovery;
-import org.jboss.webbeans.context.api.BeanStore;
-import org.jboss.webbeans.ejb.spi.EjbServices;
-import org.jboss.webbeans.resources.spi.ResourceLoader;
-import org.jboss.webbeans.transaction.spi.TransactionServices;
-
-/**
- * A common implementation of {@link Bootstrap}.
- *
- * Not threadsafe
- *
- * @author Pete Muir
- *
- */
-public abstract class AbstractBootstrap implements Bootstrap
-{
- private final ServiceRegistry simpleServiceRegistry;
- private Environment environment = EE;
-
- private BeanStore applicationContext;
-
- public AbstractBootstrap()
- {
- this.simpleServiceRegistry = new SimpleServiceRegistry();
- }
-
- public BeanStore getApplicationContext()
- {
- return applicationContext;
- }
-
- public void setApplicationContext(BeanStore applicationContext)
- {
- this.applicationContext = applicationContext;
- }
-
- public Environment getEnvironment()
- {
- return environment;
- }
-
- public void setEnvironment(Environment environment)
- {
- this.environment = environment;
- }
-
- protected void verify()
- {
- for (Class<? extends Service> serviceType : environment.getRequiredServices())
- {
- if (!getServices().contains(serviceType))
- {
- throw new IllegalStateException("Required service " + serviceType.getName() + " has not been specified");
- }
- }
- }
-
- public ServiceRegistry getServices()
- {
- return simpleServiceRegistry;
- }
-
-}
\ No newline at end of file
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingBootstrap.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -18,8 +18,8 @@
import org.jboss.webbeans.bootstrap.api.Bootstrap;
import org.jboss.webbeans.bootstrap.api.Environment;
-import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.manager.api.WebBeansManager;
@@ -37,11 +37,10 @@
{
return delegate().getManager(beanDeploymentArchive);
}
-
- public void setApplicationContext(BeanStore beanStore)
+ public Bootstrap startContainer(Environment environment, Deployment deployment, BeanStore beanStore)
{
- delegate().setApplicationContext(beanStore);
+ return delegate().startContainer(environment, deployment, beanStore);
}
public void shutdown()
@@ -77,16 +76,6 @@
return delegate().endInitialization();
}
- public ServiceRegistry getServices()
- {
- return delegate().getServices();
- }
-
- public void setEnvironment(Environment environment)
- {
- delegate().setEnvironment(environment);
- }
-
public Bootstrap startInitialization()
{
return delegate().startInitialization();
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingServiceRegistry.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingServiceRegistry.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/ForwardingServiceRegistry.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -1,6 +1,9 @@
package org.jboss.webbeans.bootstrap.api.helpers;
+import java.util.Collection;
import java.util.Iterator;
+import java.util.Set;
+import java.util.Map.Entry;
import org.jboss.webbeans.bootstrap.api.Service;
import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
@@ -29,5 +32,15 @@
{
return delegate().iterator();
}
+
+ public void addAll(Collection<Entry<Class<? extends Service>, Service>> services)
+ {
+ delegate().addAll(services);
+ }
+
+ public Set<Entry<Class<? extends Service>, Service>> entrySet()
+ {
+ return delegate().entrySet();
+ }
}
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/SimpleServiceRegistry.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/SimpleServiceRegistry.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/helpers/SimpleServiceRegistry.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -16,9 +16,11 @@
*/
package org.jboss.webbeans.bootstrap.api.helpers;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
import java.util.Map.Entry;
import org.jboss.webbeans.bootstrap.api.Service;
@@ -42,16 +44,27 @@
public <S extends Service> void add(java.lang.Class<S> type, S service)
{
- if (service == null)
- {
- services.remove(type);
- }
- else
- {
- services.put(type, service);
- }
+ services.put(type, service);
}
+ public void addAll(Collection<Entry<Class<? extends Service>, Service>> services)
+ {
+ for (Entry<Class<? extends Service >, Service> entry : services)
+ {
+ this.services.put(entry.getKey(), entry.getValue());
+ }
+ }
+
+ public Set<Entry<Class<? extends Service>, Service>> entrySet()
+ {
+ return services.entrySet();
+ }
+
+ protected Map<Class<? extends Service>, Service> get()
+ {
+ return services;
+ }
+
@SuppressWarnings("unchecked")
public <S extends Service> S get(Class<S> type)
{
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/BeanDeploymentArchive.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -19,6 +19,7 @@
import java.net.URL;
import java.util.Collection;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
import org.jboss.webbeans.ejb.spi.EjbDescriptor;
/**
@@ -87,5 +88,12 @@
* this is not an EJB archive
*/
public Collection<EjbDescriptor<?>> getEjbs();
+
+ /**
+ * Get the Bean Deployment Archive scoped services
+ *
+ * @return
+ */
+ public ServiceRegistry getServices();
}
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/spi/Deployment.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -18,7 +18,7 @@
import java.util.Collection;
-import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
/**
* Represents a deployment of a CDI application.
@@ -112,7 +112,7 @@
* @author Pete Muir
*
*/
-public interface Deployment extends Service
+public interface Deployment
{
/**
@@ -142,5 +142,13 @@
* @return the {@link BeanDeploymentArchive} containing the bean class
*/
public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass);
+
+ /**
+ * Get the services available to this deployment
+ *
+ * @return the services available
+ */
+ public ServiceRegistry getServices();
+
}
Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -1,9 +1,11 @@
package org.jboss.webbeans.bootstrap.api.test;
+import org.jboss.webbeans.bootstrap.api.Bootstrap;
import org.jboss.webbeans.bootstrap.api.Environments;
-import org.jboss.webbeans.bootstrap.api.helpers.AbstractBootstrap;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
+import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
+import org.jboss.webbeans.bootstrap.api.test.MockDeployment.MockBeanDeploymentArchive;
import org.jboss.webbeans.bootstrap.spi.Deployment;
-import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
import org.jboss.webbeans.ejb.spi.EjbServices;
import org.jboss.webbeans.jsf.spi.JSFServices;
import org.jboss.webbeans.persistence.spi.JpaServices;
@@ -17,220 +19,209 @@
public class BootstrapTest
{
-
- @Test(expectedExceptions=IllegalStateException.class)
- public void testMissingDeployment()
- {
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.SE);
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.startContainer();
- }
-
- @Test(expectedExceptions=IllegalStateException.class)
+
+ @Test(expectedExceptions = IllegalStateException.class)
public void testMissingEjbServices()
{
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.EE);
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
- bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
- bootstrap.getServices().add(SecurityServices.class, new MockSecurityServices());
- bootstrap.getServices().add(ValidationServices.class, new MockValidationServices());
- bootstrap.getServices().add(ServletServices.class, new MockServletServices());
- bootstrap.getServices().add(JSFServices.class, new MockJSFServices());
- bootstrap.startContainer();
+ Bootstrap bootstrap = new MockBootstrap();
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ ServiceRegistry bdaServices = new SimpleServiceRegistry();
+ deploymentServices.add(ResourceLoader.class, new MockResourceLoader());
+ deploymentServices.add(TransactionServices.class, new MockTransactionServices());
+ deploymentServices.add(SecurityServices.class, new MockSecurityServices());
+ deploymentServices.add(ValidationServices.class, new MockValidationServices());
+ deploymentServices.add(ServletServices.class, new MockServletServices());
+ deploymentServices.add(JSFServices.class, new MockJSFServices());
+
+ bdaServices.add(JpaServices.class, new MockJpaServices());
+ bdaServices.add(ResourceServices.class, new MockResourceServices());
+
+ Deployment deployment = new MockDeployment(deploymentServices, new MockBeanDeploymentArchive(bdaServices));
+ bootstrap.startContainer(Environments.EE, deployment, null);
}
-
- @Test(expectedExceptions=IllegalStateException.class)
+
+ @Test(expectedExceptions = IllegalStateException.class)
public void testMissingJpaServices()
{
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.EE);
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
- bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
- bootstrap.getServices().add(SecurityServices.class, new MockSecurityServices());
- bootstrap.getServices().add(ValidationServices.class, new MockValidationServices());
- bootstrap.getServices().add(ServletServices.class, new MockServletServices());
- bootstrap.getServices().add(JSFServices.class, new MockJSFServices());
- bootstrap.startContainer();
+ Bootstrap bootstrap = new MockBootstrap();
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ deploymentServices.add(ResourceLoader.class, new MockResourceLoader());
+ deploymentServices.add(TransactionServices.class, new MockTransactionServices());
+ deploymentServices.add(SecurityServices.class, new MockSecurityServices());
+ deploymentServices.add(ValidationServices.class, new MockValidationServices());
+ deploymentServices.add(ServletServices.class, new MockServletServices());
+ deploymentServices.add(JSFServices.class, new MockJSFServices());
+ ServiceRegistry bdaServices = new SimpleServiceRegistry();
+
+ bdaServices.add(EjbServices.class, new MockEjbServices());
+ bdaServices.add(ResourceServices.class, new MockResourceServices());
+
+ Deployment deployment = new MockDeployment(deploymentServices, new MockBeanDeploymentArchive(bdaServices));
+ bootstrap.startContainer(Environments.EE, deployment, null);
}
-
- @Test(expectedExceptions=IllegalStateException.class)
+
+ @Test(expectedExceptions = IllegalStateException.class)
public void testMissingSecurityServices()
{
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.EE);
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
- bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
- bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
- bootstrap.getServices().add(ValidationServices.class, new MockValidationServices());
- bootstrap.getServices().add(ServletServices.class, new MockServletServices());
- bootstrap.getServices().add(JSFServices.class, new MockJSFServices());
- bootstrap.startContainer();
+ Bootstrap bootstrap = new MockBootstrap();
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ deploymentServices.add(ResourceLoader.class, new MockResourceLoader());
+ deploymentServices.add(TransactionServices.class, new MockTransactionServices());
+ deploymentServices.add(ValidationServices.class, new MockValidationServices());
+ deploymentServices.add(ServletServices.class, new MockServletServices());
+ deploymentServices.add(JSFServices.class, new MockJSFServices());
+
+ ServiceRegistry bdaServices = new SimpleServiceRegistry();
+ bdaServices.add(EjbServices.class, new MockEjbServices());
+ bdaServices.add(JpaServices.class, new MockJpaServices());
+ bdaServices.add(ResourceServices.class, new MockResourceServices());
+
+ Deployment deployment = new MockDeployment(deploymentServices, new MockBeanDeploymentArchive(bdaServices));
+ bootstrap.startContainer(Environments.EE, deployment, null);
}
-
- @Test(expectedExceptions=IllegalStateException.class)
+
+ @Test(expectedExceptions = IllegalStateException.class)
public void testMissingValidationServices()
{
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.EE);
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
- bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
- bootstrap.getServices().add(SecurityServices.class, new MockSecurityServices());
- bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
- bootstrap.getServices().add(ServletServices.class, new MockServletServices());
- bootstrap.getServices().add(JSFServices.class, new MockJSFServices());
- bootstrap.startContainer();
+ Bootstrap bootstrap = new MockBootstrap();
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ deploymentServices.add(ResourceLoader.class, new MockResourceLoader());
+ deploymentServices.add(TransactionServices.class, new MockTransactionServices());
+ deploymentServices.add(SecurityServices.class, new MockSecurityServices());
+ deploymentServices.add(ServletServices.class, new MockServletServices());
+ deploymentServices.add(JSFServices.class, new MockJSFServices());
+
+ ServiceRegistry bdaServices = new SimpleServiceRegistry();
+ bdaServices.add(EjbServices.class, new MockEjbServices());
+ bdaServices.add(JpaServices.class, new MockJpaServices());
+ bdaServices.add(ResourceServices.class, new MockResourceServices());
+
+ Deployment deployment = new MockDeployment(deploymentServices, new MockBeanDeploymentArchive(bdaServices));
+ bootstrap.startContainer(Environments.EE, deployment, null);
}
-
+
@Test
public void testEEEnv()
{
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.EE);
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
- bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
- bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
- bootstrap.getServices().add(SecurityServices.class, new MockSecurityServices());
- bootstrap.getServices().add(ValidationServices.class, new MockValidationServices());
- bootstrap.getServices().add(ServletServices.class, new MockServletServices());
- bootstrap.getServices().add(JSFServices.class, new MockJSFServices());
- bootstrap.startContainer();
+ Bootstrap bootstrap = new MockBootstrap();
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ deploymentServices.add(ResourceLoader.class, new MockResourceLoader());
+ deploymentServices.add(TransactionServices.class, new MockTransactionServices());
+ deploymentServices.add(SecurityServices.class, new MockSecurityServices());
+ deploymentServices.add(ValidationServices.class, new MockValidationServices());
+ deploymentServices.add(ServletServices.class, new MockServletServices());
+ deploymentServices.add(JSFServices.class, new MockJSFServices());
+
+ ServiceRegistry bdaServices = new SimpleServiceRegistry();
+ bdaServices.add(EjbServices.class, new MockEjbServices());
+ bdaServices.add(JpaServices.class, new MockJpaServices());
+ bdaServices.add(ResourceServices.class, new MockResourceServices());
+
+ Deployment deployment = new MockDeployment(deploymentServices, new MockBeanDeploymentArchive(bdaServices));
+ bootstrap.startContainer(Environments.EE, deployment, null);
}
-
- @Test
- public void testEEWebProfileEnv()
- {
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.EE_WEB_PROFILE);
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
- bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
- bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
- bootstrap.getServices().add(SecurityServices.class, new MockSecurityServices());
- bootstrap.getServices().add(ValidationServices.class, new MockValidationServices());
- bootstrap.getServices().add(ServletServices.class, new MockServletServices());
- bootstrap.getServices().add(JSFServices.class, new MockJSFServices());
- bootstrap.startContainer();
- }
-
- @Test(expectedExceptions=IllegalStateException.class)
+
+ @Test(expectedExceptions = IllegalStateException.class)
public void testMissingTxServices()
{
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.EE);
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
- bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
- bootstrap.getServices().add(SecurityServices.class, new MockSecurityServices());
- bootstrap.getServices().add(ValidationServices.class, new MockValidationServices());
- bootstrap.getServices().add(ServletServices.class, new MockServletServices());
- bootstrap.getServices().add(JSFServices.class, new MockJSFServices());
- bootstrap.startContainer();
+ Bootstrap bootstrap = new MockBootstrap();
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ deploymentServices.add(ResourceLoader.class, new MockResourceLoader());
+ deploymentServices.add(SecurityServices.class, new MockSecurityServices());
+ deploymentServices.add(ValidationServices.class, new MockValidationServices());
+ deploymentServices.add(ServletServices.class, new MockServletServices());
+ deploymentServices.add(JSFServices.class, new MockJSFServices());
+
+ ServiceRegistry bdaServices = new SimpleServiceRegistry();
+ bdaServices.add(EjbServices.class, new MockEjbServices());
+ bdaServices.add(JpaServices.class, new MockJpaServices());
+ bdaServices.add(ResourceServices.class, new MockResourceServices());
+
+ Deployment deployment = new MockDeployment(deploymentServices, new MockBeanDeploymentArchive(bdaServices));
+ bootstrap.startContainer(Environments.EE, deployment, null);
}
-
- @Test(expectedExceptions=IllegalStateException.class)
+
+ @Test(expectedExceptions = IllegalStateException.class)
public void testMissingResourceServices()
{
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.EE);
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
- bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
- bootstrap.getServices().add(SecurityServices.class, new MockSecurityServices());
- bootstrap.getServices().add(ValidationServices.class, new MockValidationServices());
- bootstrap.getServices().add(ServletServices.class, new MockServletServices());
- bootstrap.getServices().add(JSFServices.class, new MockJSFServices());
- bootstrap.startContainer();
+ Bootstrap bootstrap = new MockBootstrap();
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ deploymentServices.add(ResourceLoader.class, new MockResourceLoader());
+ deploymentServices.add(TransactionServices.class, new MockTransactionServices());
+ deploymentServices.add(SecurityServices.class, new MockSecurityServices());
+ deploymentServices.add(ValidationServices.class, new MockValidationServices());
+ deploymentServices.add(ServletServices.class, new MockServletServices());
+ deploymentServices.add(JSFServices.class, new MockJSFServices());
+
+ ServiceRegistry bdaServices = new SimpleServiceRegistry();
+ bdaServices.add(EjbServices.class, new MockEjbServices());
+ bdaServices.add(JpaServices.class, new MockJpaServices());
+
+ Deployment deployment = new MockDeployment(deploymentServices, new MockBeanDeploymentArchive(bdaServices));
+ bootstrap.startContainer(Environments.EE, deployment, null);
}
-
- @Test(expectedExceptions=IllegalStateException.class)
+
+ @Test(expectedExceptions = IllegalStateException.class)
public void testMissingJSFServices()
{
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.EE);
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
- bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
- bootstrap.getServices().add(SecurityServices.class, new MockSecurityServices());
- bootstrap.getServices().add(ValidationServices.class, new MockValidationServices());
- bootstrap.getServices().add(ServletServices.class, new MockServletServices());
- bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
- bootstrap.startContainer();
+ Bootstrap bootstrap = new MockBootstrap();
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ deploymentServices.add(ResourceLoader.class, new MockResourceLoader());
+ deploymentServices.add(TransactionServices.class, new MockTransactionServices());
+ deploymentServices.add(SecurityServices.class, new MockSecurityServices());
+ deploymentServices.add(ValidationServices.class, new MockValidationServices());
+ deploymentServices.add(ServletServices.class, new MockServletServices());
+
+ ServiceRegistry bdaServices = new SimpleServiceRegistry();
+ bdaServices.add(EjbServices.class, new MockEjbServices());
+ bdaServices.add(JpaServices.class, new MockJpaServices());
+ bdaServices.add(ResourceServices.class, new MockResourceServices());
+
+ Deployment deployment = new MockDeployment(deploymentServices, new MockBeanDeploymentArchive(bdaServices));
+ bootstrap.startContainer(Environments.EE, deployment, null);
}
-
- @Test(expectedExceptions=IllegalStateException.class)
+
+ @Test(expectedExceptions = IllegalStateException.class)
public void testMissingServletServices()
{
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.EE);
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(EjbServices.class, new MockEjbServices());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.getServices().add(JpaServices.class, new MockJpaServices());
- bootstrap.getServices().add(TransactionServices.class, new MockTransactionServices());
- bootstrap.getServices().add(SecurityServices.class, new MockSecurityServices());
- bootstrap.getServices().add(ValidationServices.class, new MockValidationServices());
- bootstrap.getServices().add(ResourceServices.class, new MockResourceServices());
- bootstrap.getServices().add(JSFServices.class, new MockJSFServices());
- bootstrap.startContainer();
+ Bootstrap bootstrap = new MockBootstrap();
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ deploymentServices.add(ResourceLoader.class, new MockResourceLoader());
+ deploymentServices.add(TransactionServices.class, new MockTransactionServices());
+ deploymentServices.add(SecurityServices.class, new MockSecurityServices());
+ deploymentServices.add(ValidationServices.class, new MockValidationServices());
+ deploymentServices.add(JSFServices.class, new MockJSFServices());
+
+ ServiceRegistry bdaServices = new SimpleServiceRegistry();
+ bdaServices.add(EjbServices.class, new MockEjbServices());
+ bdaServices.add(JpaServices.class, new MockJpaServices());
+ bdaServices.add(ResourceServices.class, new MockResourceServices());
+
+ Deployment deployment = new MockDeployment(deploymentServices, new MockBeanDeploymentArchive(bdaServices));
+ bootstrap.startContainer(Environments.EE, deployment, null);
}
-
+
@Test
public void testSEEnv()
{
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.SE);
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.startContainer();
+ Bootstrap bootstrap = new MockBootstrap();
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ deploymentServices.add(ResourceLoader.class, new MockResourceLoader());
+ ServiceRegistry bdaServices = new SimpleServiceRegistry();
+ Deployment deployment = new MockDeployment(deploymentServices, new MockBeanDeploymentArchive(bdaServices));
+ bootstrap.startContainer(Environments.SE, deployment, null);
}
-
+
@Test
public void testServletEnv()
{
- AbstractBootstrap bootstrap = new MockBootstrap();
- bootstrap.setEnvironment(Environments.SERVLET);
- bootstrap.getServices().add(ResourceLoader.class, new MockResourceLoader());
- bootstrap.setApplicationContext(new ConcurrentHashMapBeanStore());
- bootstrap.getServices().add(Deployment.class, new MockDeployment());
- bootstrap.getServices().add(ServletServices.class, new MockServletServices());
- bootstrap.startContainer();
+ Bootstrap bootstrap = new MockBootstrap();
+ ServiceRegistry deploymentServices = new SimpleServiceRegistry();
+ deploymentServices.add(ResourceLoader.class, new MockResourceLoader());
+ deploymentServices.add(ServletServices.class, new MockServletServices());
+ ServiceRegistry bdaServices = new SimpleServiceRegistry();
+ Deployment deployment = new MockDeployment(deploymentServices, new MockBeanDeploymentArchive(bdaServices));
+ bootstrap.startContainer(Environments.SERVLET, deployment, null);
}
-
+
}
Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockBootstrap.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockBootstrap.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockBootstrap.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -1,11 +1,17 @@
package org.jboss.webbeans.bootstrap.api.test;
+import java.util.Set;
+
import org.jboss.webbeans.bootstrap.api.Bootstrap;
-import org.jboss.webbeans.bootstrap.api.helpers.AbstractBootstrap;
+import org.jboss.webbeans.bootstrap.api.Environment;
+import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+import org.jboss.webbeans.bootstrap.spi.Deployment;
+import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.manager.api.WebBeansManager;
-public class MockBootstrap extends AbstractBootstrap
+public class MockBootstrap implements Bootstrap
{
public WebBeansManager getManager(BeanDeploymentArchive beanDeploymentArchive)
@@ -13,14 +19,6 @@
return null;
}
- public Bootstrap startContainer()
- {
- verify();
- return this;
- }
-
-
-
public void shutdown()
{
}
@@ -45,4 +43,23 @@
return this;
}
+ protected static void verifyServices(ServiceRegistry services, Set<Class<? extends Service>> requiredServices)
+ {
+ for (Class<? extends Service> serviceType : requiredServices)
+ {
+ if (!services.contains(serviceType))
+ {
+ throw new IllegalStateException("Required service " + serviceType.getName() + " has not been specified");
+ }
+ }
+ }
+
+ public Bootstrap startContainer(Environment environment, Deployment deployment, BeanStore beanStore)
+ {
+ verifyServices(deployment.getServices(), environment.getRequiredDeploymentServices());
+ verifyServices(deployment.getBeanDeploymentArchives().iterator().next().getServices(), environment.getRequiredBeanDeploymentArchiveServices());
+ return this;
+ }
+
+
}
Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockDeployment.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockDeployment.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockDeployment.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -16,10 +16,15 @@
*/
package org.jboss.webbeans.bootstrap.api.test;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Collections;
import java.util.List;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.webbeans.bootstrap.spi.Deployment;
+import org.jboss.webbeans.ejb.spi.EjbDescriptor;
/**
* @author pmuir
@@ -27,10 +32,56 @@
*/
public class MockDeployment implements Deployment
{
+
+ static class MockBeanDeploymentArchive implements BeanDeploymentArchive
+ {
+ private final ServiceRegistry services;
+
+ public MockBeanDeploymentArchive(ServiceRegistry services)
+ {
+ this.services = services;
+ }
+
+ public Collection<Class<?>> getBeanClasses()
+ {
+ return Collections.emptySet();
+ }
+
+ public Collection<BeanDeploymentArchive> getBeanDeploymentArchives()
+ {
+ return Collections.emptySet();
+ }
+
+ public Collection<URL> getBeansXml()
+ {
+ return Collections.emptySet();
+ }
+
+ public Collection<EjbDescriptor<?>> getEjbs()
+ {
+ return Collections.emptySet();
+ }
+
+ public ServiceRegistry getServices()
+ {
+ return services;
+ }
+
+ }
+
+ private final ServiceRegistry services;
+ private final BeanDeploymentArchive beanDeploymentArchive;
+
+ public MockDeployment(ServiceRegistry services, MockBeanDeploymentArchive beanDeploymentArchive)
+ {
+ this.services = services;
+ this.beanDeploymentArchive = beanDeploymentArchive;
+ }
+
public List<BeanDeploymentArchive> getBeanDeploymentArchives()
{
- return null;
+ return Collections.singletonList(beanDeploymentArchive);
}
public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass)
@@ -38,4 +89,9 @@
return null;
}
+ public ServiceRegistry getServices()
+ {
+ return services;
+ }
+
}
Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockBeanDeploymentArchive.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockBeanDeploymentArchive.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockBeanDeploymentArchive.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -29,6 +29,8 @@
import javax.ejb.Stateful;
import javax.ejb.Stateless;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
+import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.webbeans.ejb.spi.EjbDescriptor;
@@ -40,14 +42,36 @@
{
- private Set<Class<?>> beanClasses = new HashSet<Class<?>>();
+ private Set<Class<?>> beanClasses;
+ private Collection<URL> webBeansXmlFiles;
+ private List<EjbDescriptor<?>> ejbs;
+ private final ServiceRegistry services;
+
+ public MockBeanDeploymentArchive()
+ {
+ this.services = new SimpleServiceRegistry();
+ this.beanClasses = new HashSet<Class<?>>();
+ this.webBeansXmlFiles = new HashSet<URL>();
+ }
- private Collection<URL> webBeansXmlFiles = new HashSet<URL>();
-
public Collection<Class<?>> getBeanClasses()
{
return beanClasses;
}
+
+ public void setBeanClasses(Iterable<Class<?>> beanClasses)
+ {
+ this.beanClasses.clear();
+ for (Class<?> clazz : beanClasses)
+ {
+ this.beanClasses.add(clazz);
+ }
+ ejbs = new ArrayList<EjbDescriptor<?>>();
+ for (Class<?> ejbClass : discoverEjbs(getBeanClasses()))
+ {
+ ejbs.add(MockEjbDescriptor.of(ejbClass));
+ }
+ }
public Collection<URL> getBeansXml()
{
@@ -68,22 +92,6 @@
return Collections.emptyList();
}
- private List<EjbDescriptor<?>> ejbs;
-
- public void setBeanClasses(Iterable<Class<?>> beanClasses)
- {
- this.beanClasses.clear();
- for (Class<?> clazz : beanClasses)
- {
- this.beanClasses.add(clazz);
- }
- ejbs = new ArrayList<EjbDescriptor<?>>();
- for (Class<?> ejbClass : discoverEjbs(getBeanClasses()))
- {
- ejbs.add(MockEjbDescriptor.of(ejbClass));
- }
- }
-
public Collection<EjbDescriptor<?>> getEjbs()
{
return ejbs;
@@ -101,5 +109,10 @@
}
return ejbs;
}
+
+ public ServiceRegistry getServices()
+ {
+ return services;
+ }
}
Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockDeployment.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockDeployment.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockDeployment.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -19,19 +19,22 @@
import java.util.ArrayList;
import java.util.List;
+import org.jboss.webbeans.bootstrap.api.ServiceRegistry;
+import org.jboss.webbeans.bootstrap.api.helpers.SimpleServiceRegistry;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.webbeans.bootstrap.spi.Deployment;
public class MockDeployment implements Deployment
{
- private MockBeanDeploymentArchive archive;
+ private final MockBeanDeploymentArchive archive;
+ private final List<BeanDeploymentArchive> beanDeploymentArchives;
+ private final ServiceRegistry services;
- private List<BeanDeploymentArchive> beanDeploymentArchives;
-
public MockDeployment()
{
this.archive = new MockBeanDeploymentArchive();
+ this.services = new SimpleServiceRegistry();
this.beanDeploymentArchives = new ArrayList<BeanDeploymentArchive>();
this.beanDeploymentArchives.add(archive);
}
@@ -51,4 +54,9 @@
return archive;
}
+ public ServiceRegistry getServices()
+ {
+ return services;
+ }
+
}
Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java 2009-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -16,6 +16,7 @@
*/
package org.jboss.webbeans.mock;
+import org.jboss.webbeans.bootstrap.api.Environment;
import org.jboss.webbeans.bootstrap.api.Environments;
import org.jboss.webbeans.ejb.spi.EjbServices;
import org.jboss.webbeans.jsf.spi.JSFServices;
@@ -33,16 +34,18 @@
public MockEELifecycle()
{
super();
- getBootstrap().getServices().add(TransactionServices.class, MOCK_TRANSACTION_SERVICES);
- getBootstrap().getServices().add(EjbServices.class, new MockEjBServices());
- getBootstrap().getServices().add(JpaServices.class, new MockJpaServices(getDeployment()));
- getBootstrap().getServices().add(ResourceServices.class, new MockResourceServices());
- getBootstrap().getServices().add(SecurityServices.class, new MockSecurityServices());
- getBootstrap().getServices().add(ValidationServices.class, new MockValidationServices());
- getBootstrap().getServices().add(JSFServices.class, new MockJSFServices());
- getBootstrap().setEnvironment(Environments.EE);
+ getDeployment().getServices().add(TransactionServices.class, MOCK_TRANSACTION_SERVICES);
+ getDeployment().getServices().add(SecurityServices.class, new MockSecurityServices());
+ getDeployment().getServices().add(ValidationServices.class, new MockValidationServices());
+ getDeployment().getServices().add(JSFServices.class, new MockJSFServices());
+ getDeployment().getArchive().getServices().add(EjbServices.class, new MockEjBServices());
+ getDeployment().getArchive().getServices().add(JpaServices.class, new MockJpaServices(getDeployment()));
+ getDeployment().getArchive().getServices().add(ResourceServices.class, new MockResourceServices());
}
-
+ public Environment getEnvironment()
+ {
+ return Environments.EE;
+ }
}
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-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockServletLifecycle.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -1,8 +1,8 @@
package org.jboss.webbeans.mock;
import org.jboss.webbeans.bootstrap.WebBeansBootstrap;
+import org.jboss.webbeans.bootstrap.api.Environment;
import org.jboss.webbeans.bootstrap.api.Environments;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
import org.jboss.webbeans.context.ContextLifecycle;
import org.jboss.webbeans.context.api.BeanStore;
import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
@@ -27,16 +27,13 @@
throw new IllegalStateException("No WebBeanDiscovery is available");
}
bootstrap = new WebBeansBootstrap();
- bootstrap.setEnvironment(Environments.SERVLET);
- bootstrap.getServices().add(ResourceLoader.class, MOCK_RESOURCE_LOADER);
- bootstrap.getServices().add(Deployment.class, deployment);
- bootstrap.getServices().add(ServletServices.class, new MockServletServices(deployment.getArchive()));
- bootstrap.setApplicationContext(applicationBeanStore);
+ deployment.getServices().add(ResourceLoader.class, MOCK_RESOURCE_LOADER);
+ deployment.getServices().add(ServletServices.class, new MockServletServices(deployment.getArchive()));
}
public void initialize()
{
- bootstrap.startContainer();
+ bootstrap.startContainer(getEnvironment(), getDeployment(), getApplicationBeanStore());
}
public MockDeployment getDeployment()
@@ -59,6 +56,11 @@
bootstrap.shutdown();
}
+ public BeanStore getApplicationBeanStore()
+ {
+ return applicationBeanStore;
+ }
+
public void resetContexts()
{
@@ -84,4 +86,9 @@
// TODO Conversation handling breaks this :-(
//super.endSession("Mock", sessionBeanStore);
}
+
+ public Environment getEnvironment()
+ {
+ return Environments.SERVLET;
+ }
}
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-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/test/harness/AbstractStandaloneContainersImpl.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -17,7 +17,7 @@
public boolean deploy(Iterable<Class<?>> classes, Iterable<URL> beansXml)
{
this.lifecycle = newLifecycle();
- lifecycle.initialize();
+
try
{
MockBeanDeploymentArchive archive = lifecycle.getDeployment().getArchive();
@@ -26,6 +26,7 @@
{
archive.setWebBeansXmlFiles(beansXml);
}
+ lifecycle.initialize();
lifecycle.beginApplication();
}
catch (Exception e)
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-08-26 15:54:38 UTC (rev 3595)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/bootstrap/DiscoverFailsBootstrapTest.java 2009-08-26 15:57:55 UTC (rev 3596)
@@ -1,17 +1,16 @@
package org.jboss.webbeans.test.unit.bootstrap;
-import org.jboss.webbeans.bootstrap.spi.Deployment;
import org.jboss.webbeans.mock.MockEELifecycle;
import org.testng.annotations.Test;
public class DiscoverFailsBootstrapTest
{
- @Test(groups="bootstrap", expectedExceptions=IllegalStateException.class)
+ @Test(groups="bootstrap", expectedExceptions=IllegalArgumentException.class)
public void testDiscoverFails()
{
MockEELifecycle lifecycle = new MockEELifecycle();
- lifecycle.getBootstrap().getServices().add(Deployment.class, null);
+ lifecycle.getBootstrap().startContainer(lifecycle.getEnvironment(), null, lifecycle.getApplicationBeanStore());
lifecycle.initialize();
lifecycle.beginApplication();
}
15 years, 3 months
[webbeans-commits] Webbeans SVN: r3595 - in tck/trunk: impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-26 11:54:38 -0400 (Wed, 26 Aug 2009)
New Revision: 3595
Modified:
tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Beans.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
Log:
Assertion has nothing to do with non-contextual ejbs!
Modified: tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Beans.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Beans.java 2009-08-26 12:51:06 UTC (rev 3594)
+++ tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Beans.java 2009-08-26 15:54:38 UTC (rev 3595)
@@ -67,6 +67,7 @@
* @param localInterface The business interface of the bean proxy to return
* @return the EJB proxy from the container
*/
+ @Deprecated
public <T> T getEnterpriseBean(Class<? extends T> beanType, Class<T> localInterface);
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-08-26 12:51:06 UTC (rev 3594)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/enterprise/lifecycle/EnterpriseBeanLifecycleTest.java 2009-08-26 15:54:38 UTC (rev 3595)
@@ -149,8 +149,8 @@
@SpecAssertion(section = "3.8.2", id = "b")
public void testInitializerMethodsCalledWithCurrentParameterValues()
{
- AlteStadt alteStadt = this.getCurrentConfiguration().getBeans().getEnterpriseBean(Mainz.class, AlteStadt.class);
- assert alteStadt != null : "Could not find the AlteStadt EJB";
+ AlteStadt alteStadt = getInstanceByType(AlteStadt.class);
+ assert alteStadt != null : "Could not find the AlteStadt bean";
assert alteStadt.getAnotherPlaceOfInterest() != null;
}
15 years, 3 months
[webbeans-commits] Webbeans SVN: r3594 - in tck/trunk/impl/src/main: java/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processInjectionTargetThrowsException and 3 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-26 08:51:06 -0400 (Wed, 26 Aug 2009)
New Revision: 3594
Added:
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/annotated/broken/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processAnnotatedObserverThrowsException/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processAnnotatedObserverThrowsException/javax.enterprise.inject.spi.Extension
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processAnnotatedObserverThrowsException/ProcessAnnotatedTypeEventThrowsExceptionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processInjectionTargetThrowsException/ProcessInjectionTargetEventThrowsExceptionTest.java
Log:
Fix test, mark tests ri-broken
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processAnnotatedObserverThrowsException/ProcessAnnotatedTypeEventThrowsExceptionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processAnnotatedObserverThrowsException/ProcessAnnotatedTypeEventThrowsExceptionTest.java 2009-08-25 16:17:45 UTC (rev 3593)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processAnnotatedObserverThrowsException/ProcessAnnotatedTypeEventThrowsExceptionTest.java 2009-08-26 12:51:06 UTC (rev 3594)
@@ -43,7 +43,7 @@
@SpecVersion(spec="cdi", version="1.0.20090625")
public class ProcessAnnotatedTypeEventThrowsExceptionTest extends AbstractJSR299Test
{
- @Test
+ @Test(groups="ri-broken")
@SpecAssertion(section = "11.5.5", id = "e")
public void testProcessAnnotatedTypeEventThrowsExceptionNotOk()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processInjectionTargetThrowsException/ProcessInjectionTargetEventThrowsExceptionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processInjectionTargetThrowsException/ProcessInjectionTargetEventThrowsExceptionTest.java 2009-08-25 16:17:45 UTC (rev 3593)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processInjectionTargetThrowsException/ProcessInjectionTargetEventThrowsExceptionTest.java 2009-08-26 12:51:06 UTC (rev 3594)
@@ -38,7 +38,7 @@
@SpecVersion(spec="cdi", version="1.0.20090625")
public class ProcessInjectionTargetEventThrowsExceptionTest extends AbstractJSR299Test
{
- @Test
+ @Test(groups="ri-broken")
@SpecAssertion(section = "11.5.6", id = "f")
public void testProcessInjectionTargetEventThrowsExceptionNotOk()
{
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processAnnotatedObserverThrowsException/javax.enterprise.inject.spi.Extension
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processAnnotatedObserverThrowsException/javax.enterprise.inject.spi.Extension (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/extensions/annotated/broken/processAnnotatedObserverThrowsException/javax.enterprise.inject.spi.Extension 2009-08-26 12:51:06 UTC (rev 3594)
@@ -0,0 +1 @@
+org.jboss.jsr299.tck.tests.extensions.annotated.broken.processAnnotatedObserverThrowsException.ProcessAnnotatedTypeObserver
15 years, 3 months
[webbeans-commits] Webbeans SVN: r3593 - in ri/trunk: spi/src/main/java/org/jboss/webbeans and 7 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-08-25 12:17:45 -0400 (Tue, 25 Aug 2009)
New Revision: 3593
Added:
ri/trunk/spi/src/main/java/org/jboss/webbeans/jsf/
ri/trunk/spi/src/main/java/org/jboss/webbeans/jsf/spi/
ri/trunk/spi/src/main/java/org/jboss/webbeans/jsf/spi/JSFServices.java
Removed:
ri/trunk/spi/src/main/java/org/jboss/webbeans/persistence/spi/helpers/JSFServices.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/JsfHelper.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletServices.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java
ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJSFServices.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java
ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJSFServices.java
Log:
javadoc + proper package
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/JsfHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/JsfHelper.java 2009-08-25 15:14:38 UTC (rev 3592)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/JsfHelper.java 2009-08-25 16:17:45 UTC (rev 3593)
@@ -25,9 +25,9 @@
import org.jboss.webbeans.CurrentManager;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
import org.jboss.webbeans.conversation.ConversationIdName;
+import org.jboss.webbeans.jsf.spi.JSFServices;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
-import org.jboss.webbeans.persistence.spi.helpers.JSFServices;
import org.jboss.webbeans.util.Reflections;
/**
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java 2009-08-25 15:14:38 UTC (rev 3592)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/jsf/WebBeansApplication.java 2009-08-25 16:17:45 UTC (rev 3593)
@@ -28,7 +28,7 @@
import org.jboss.webbeans.el.WebBeansELContextListener;
import org.jboss.webbeans.el.WebBeansELResolverImpl;
import org.jboss.webbeans.el.WebBeansExpressionFactory;
-import org.jboss.webbeans.persistence.spi.helpers.JSFServices;
+import org.jboss.webbeans.jsf.spi.JSFServices;
/**
* @author pmuir
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java 2009-08-25 15:14:38 UTC (rev 3592)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/bootstrap/api/Environments.java 2009-08-25 16:17:45 UTC (rev 3593)
@@ -22,8 +22,8 @@
import org.jboss.webbeans.bootstrap.spi.Deployment;
import org.jboss.webbeans.ejb.spi.EjbServices;
+import org.jboss.webbeans.jsf.spi.JSFServices;
import org.jboss.webbeans.persistence.spi.JpaServices;
-import org.jboss.webbeans.persistence.spi.helpers.JSFServices;
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.resources.spi.ResourceServices;
import org.jboss.webbeans.security.spi.SecurityServices;
Copied: ri/trunk/spi/src/main/java/org/jboss/webbeans/jsf/spi/JSFServices.java (from rev 3580, ri/trunk/spi/src/main/java/org/jboss/webbeans/persistence/spi/helpers/JSFServices.java)
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/jsf/spi/JSFServices.java (rev 0)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/jsf/spi/JSFServices.java 2009-08-25 16:17:45 UTC (rev 3593)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, 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.webbeans.jsf.spi;
+
+import javax.faces.application.Application;
+
+import org.jboss.webbeans.bootstrap.api.Service;
+import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
+
+/**
+ * Allows the container to identify BDA in use for a JSF request. This method will
+ * be called, in the same thread as the request, every time Web Beans needs to
+ * identify a JSF request.
+ *
+ * @author pmuir
+ *
+ */
+public interface JSFServices extends Service
+{
+
+ /**
+ * Get the BDA for the current JSF request. The Application is provided for
+ * context.
+ *
+ * @return
+ */
+ public BeanDeploymentArchive getBeanDeploymentArchive(Application application);
+
+}
Property changes on: ri/trunk/spi/src/main/java/org/jboss/webbeans/jsf/spi/JSFServices.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: ri/trunk/spi/src/main/java/org/jboss/webbeans/persistence/spi/helpers/JSFServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/persistence/spi/helpers/JSFServices.java 2009-08-25 15:14:38 UTC (rev 3592)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/persistence/spi/helpers/JSFServices.java 2009-08-25 16:17:45 UTC (rev 3593)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, 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.webbeans.persistence.spi.helpers;
-
-import javax.faces.application.Application;
-
-import org.jboss.webbeans.bootstrap.api.Service;
-import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-
-/**
- * @author pmuir
- *
- */
-public interface JSFServices extends Service
-{
-
- public BeanDeploymentArchive getBeanDeploymentArchive(Application application);
-
-}
Modified: ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletServices.java
===================================================================
--- ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletServices.java 2009-08-25 15:14:38 UTC (rev 3592)
+++ ri/trunk/spi/src/main/java/org/jboss/webbeans/servlet/api/ServletServices.java 2009-08-25 16:17:45 UTC (rev 3593)
@@ -22,12 +22,23 @@
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
/**
+ * Allows the container to identify BDA in use for a request. This method will
+ * be called, in the same thread as the request, every time Web Beans needs to
+ * identify a request.
+ *
* @author pmuir
*
*/
public interface ServletServices extends Service
{
+ /**
+ * Get the BDA for the current request. The ServletContext is provided for
+ * context.
+ *
+ * @param ctx
+ * @return
+ */
public BeanDeploymentArchive getBeanDeploymentArchive(ServletContext ctx);
}
Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java 2009-08-25 15:14:38 UTC (rev 3592)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/BootstrapTest.java 2009-08-25 16:17:45 UTC (rev 3593)
@@ -5,8 +5,8 @@
import org.jboss.webbeans.bootstrap.spi.Deployment;
import org.jboss.webbeans.context.api.helpers.ConcurrentHashMapBeanStore;
import org.jboss.webbeans.ejb.spi.EjbServices;
+import org.jboss.webbeans.jsf.spi.JSFServices;
import org.jboss.webbeans.persistence.spi.JpaServices;
-import org.jboss.webbeans.persistence.spi.helpers.JSFServices;
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.resources.spi.ResourceServices;
import org.jboss.webbeans.security.spi.SecurityServices;
Modified: ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJSFServices.java
===================================================================
--- ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJSFServices.java 2009-08-25 15:14:38 UTC (rev 3592)
+++ ri/trunk/spi/src/test/java/org/jboss/webbeans/bootstrap/api/test/MockJSFServices.java 2009-08-25 16:17:45 UTC (rev 3593)
@@ -19,7 +19,7 @@
import javax.faces.application.Application;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.persistence.spi.helpers.JSFServices;
+import org.jboss.webbeans.jsf.spi.JSFServices;
/**
* @author pmuir
Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java 2009-08-25 15:14:38 UTC (rev 3592)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockEELifecycle.java 2009-08-25 16:17:45 UTC (rev 3593)
@@ -18,8 +18,8 @@
import org.jboss.webbeans.bootstrap.api.Environments;
import org.jboss.webbeans.ejb.spi.EjbServices;
+import org.jboss.webbeans.jsf.spi.JSFServices;
import org.jboss.webbeans.persistence.spi.JpaServices;
-import org.jboss.webbeans.persistence.spi.helpers.JSFServices;
import org.jboss.webbeans.resources.spi.ResourceServices;
import org.jboss.webbeans.security.spi.SecurityServices;
import org.jboss.webbeans.transaction.spi.TransactionServices;
Modified: ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJSFServices.java
===================================================================
--- ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJSFServices.java 2009-08-25 15:14:38 UTC (rev 3592)
+++ ri/trunk/tests/src/main/java/org/jboss/webbeans/mock/MockJSFServices.java 2009-08-25 16:17:45 UTC (rev 3593)
@@ -19,7 +19,7 @@
import javax.faces.application.Application;
import org.jboss.webbeans.bootstrap.spi.BeanDeploymentArchive;
-import org.jboss.webbeans.persistence.spi.helpers.JSFServices;
+import org.jboss.webbeans.jsf.spi.JSFServices;
/**
* @author pmuir
15 years, 3 months