Author: pete.muir(a)jboss.org
Date: 2009-04-06 12:12:49 -0400 (Mon, 06 Apr 2009)
New Revision: 2322
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/current/JndiManagerCurrentActivityTest.java
Log:
use an object factory
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-04-06
15:00:38 UTC (rev 2321)
+++
ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/WebBeansBootstrap.java 2009-04-06
16:12:49 UTC (rev 2322)
@@ -22,6 +22,8 @@
import java.util.List;
import javax.inject.ExecutionException;
+import javax.inject.manager.Manager;
+import javax.naming.Reference;
import org.jboss.webbeans.BeanValidator;
import org.jboss.webbeans.CurrentManager;
@@ -59,6 +61,7 @@
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.resources.DefaultNamingContext;
import org.jboss.webbeans.resources.DefaultResourceLoader;
+import org.jboss.webbeans.resources.ManagerObjectFactory;
import org.jboss.webbeans.resources.spi.NamingContext;
import org.jboss.webbeans.resources.spi.ResourceLoader;
import org.jboss.webbeans.servlet.HttpSessionManager;
@@ -101,17 +104,7 @@
}
addImplementationServices();
this.manager =
ManagerImpl.newRootManager(ServiceRegistries.unmodifiableServiceRegistry(getServices()));
- try
- {
- getServices().get(NamingContext.class).unbind(ManagerImpl.JNDI_KEY);
- }
- catch (ExecutionException e)
- {
- }
- finally
- {
- getServices().get(NamingContext.class).bind(ManagerImpl.JNDI_KEY,
getManager());
- }
+ bindManagerIntoJndi();
CurrentManager.setRootManager(manager);
initializeContexts();
}
@@ -126,10 +119,22 @@
// TODO expose AnnotatedClass on SPI and allow container to provide impl of this
via ResourceLoader
getServices().add(ClassTransformer.class, new ClassTransformer());
getServices().add(MetaDataCache.class, new
MetaDataCache(getServices().get(ClassTransformer.class)));
-
-
}
+ private void bindManagerIntoJndi()
+ {
+ try
+ {
+ getServices().get(NamingContext.class).unbind(ManagerImpl.JNDI_KEY);
+ }
+ catch (ExecutionException e) {}
+ finally
+ {
+ Reference managerReference = new Reference(Manager.class.getName(),
ManagerObjectFactory.class.getName(), null);
+ getServices().get(NamingContext.class).bind(ManagerImpl.JNDI_KEY,
managerReference);
+ }
+ }
+
public ManagerImpl getManager()
{
return manager;
Modified:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/current/JndiManagerCurrentActivityTest.java
===================================================================
---
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/current/JndiManagerCurrentActivityTest.java 2009-04-06
15:00:38 UTC (rev 2321)
+++
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/activities/current/JndiManagerCurrentActivityTest.java 2009-04-06
16:12:49 UTC (rev 2322)
@@ -11,9 +11,11 @@
import org.hibernate.tck.annotations.SpecAssertion;
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.IntegrationTest;
import org.testng.annotations.Test;
@Artifact
+@IntegrationTest
public class JndiManagerCurrentActivityTest extends AbstractJSR299Test
{
@@ -57,7 +59,7 @@
}
- @Test(groups="ri-broken")
+ @Test
@SpecAssertion(section="11.6.1", id="f")
public void testJndiManagerIsCurrentActivity()
{
Show replies by date