public void removeClassLoader(org.jboss.deployers.structure.spi.DeploymentUnit unit) throws Exception
{
}
});
DeploymentUnit unit = new MockDeploymentUnit(deploymentUnit);
Ejb3Deployment deployment = new MockEjb3Deployment(unit, deploymentUnit);
deployment.setEJBReferenceResolver(new ScopedEJBReferenceResolver());
/*
* Create Metadata
*/
// Create metadata
JBossMetaData jbossMetaData = MetaDataHelper.getMetaDataFromBeanImplClasses(beanImplementationClasses);
unit.addAttachment(AttachmentNames.PROCESSED_METADATA, jbossMetaData);
// Iterate through each EJB
for (JBossEnterpriseBeanMetaData beanMetaData : jbossMetaData.getEnterpriseBeans())
{
// Ensure a Session Bean
assert beanMetaData.isSession() || beanMetaData.isService() : "The specified EJB must be a Session Bean or a Service Bean";
// Cast
JBossSessionBeanMetaData smd = (JBossSessionBeanMetaData) beanMetaData;
/*
* Determine type
*/
// Initialize as SLSB
ContainerType sessionType = ContainerType.SLSB;
// Set as SFSB if stateful
if (smd.isStateful())
{
sessionType = ContainerType.SFSB;
}
else if (beanMetaData.isService())
sessionType = ContainerType.SERVICE;
// Ensure jndi.properties is accessible
log.info("Found: " + cl.getResource("jndi.properties"));
// Obtain properties required of container construction
String beanClassname = smd.getEjbClass();
Domain domain = getDomain(sessionType.equals(ContainerType.SLSB)
? AbstractEJB3TestCase.DOMAIN_NAME_SLSB
: AbstractEJB3TestCase.DOMAIN_NAME_SFSB);
Hashtable<?, ?> ctxProperties = null;
// Is SFSB, manually set a PM Factory Registry and Cache Factory
//TODO C'mon, here? Much better elsewhere.
if (sessionType.equals(ContainerType.SFSB))
{
// Lookup Factory Registries in MC
PersistenceManagerFactoryRegistry registry = Ejb3RegistrarLocator.locateRegistrar().lookup(
AbstractEJB3TestCase.OBJECT_STORE_NAME_PM_FACTORY_REGISTRY, PersistenceManagerFactoryRegistry.class);
CacheFactoryRegistry cacheFactoryRegistry = Ejb3RegistrarLocator.locateRegistrar().lookup(
AbstractEJB3TestCase.OBJECT_STORE_NAME_CACHE_FACTORY_REGISTRY, CacheFactoryRegistry.class);
// Set on the deployment
deployment.setPersistenceManagerFactoryRegistry(registry);
deployment.setCacheFactoryRegistry(cacheFactoryRegistry);
}
// Create a Session Container
SessionContainer container = instanciateContainer(sessionType, cl, beanClassname, smd.getEjbName(), domain,
ctxProperties, deployment, smd);