protected abstract int getExpectedArchives();
public void testSimpleUsage() throws Exception
{
VirtualFile ear = createBasicEar(MockEmptyEjbServices.class);
VFSDeploymentUnit topUnit = assertDeploy(ear);
try
{
assertBean(DeployersUtils.getBootstrapBeanName(topUnit), null, Object.class);
Object bean = getBean(Deployment.class);
Deployment deployment = assertInstanceOf(bean, Deployment.class, false);
initializeDeployment(deployment);
List<BeanDeploymentArchive> archives = new ArrayList<BeanDeploymentArchive>();
getArchives(archives, deployment.getBeanDeploymentArchives());
assertEquals(getExpectedArchives(), archives.size());
//List<BeansXml> urls = new ArrayList<BeansXml>();
List<String> classes = new ArrayList<String>();
for (BeanDeploymentArchive bad : archives)
{
//urls.add(bad.getBeansXml());
for (String clazz : bad.getBeanClasses())
classes.add(clazz);
}
Set<String> expected = new HashSet<String>();
// addExpectedResource(expected, "ejbs.jar");
// addExpectedResource(expected, "ext.jar");
// addExpectedResource(expected, "simple.jar");
// addExpectedResource(expected, "ui.jar");
// addExpectedResource(expected, "crm.jar");
// addExpectedResource(expected, "simple.war", "/WEB-INF/beans.xml");
//
// assertEquals("Illegal size or urls.", expected.size(), urls.size());
// for (URL url : urls)
// {
// boolean found = false;
// Iterator<String> iter = expected.iterator();
// while (iter.hasNext())
// {
// String expectedURL = iter.next();
// if (url.toExternalForm().contains(expectedURL))
// {
// iter.remove();
// found = true;
// break;
// }
// }
// assertTrue("Unexpected wb url: " + url, found);
// }
addExpectedClass(expected, BusinessInterface.class);
addExpectedClass(expected, MySLSBean.class);
addExpectedClass(expected, ExternalWebBean.class);
addExpectedClass(expected, PlainJavaBean.class);
addExpectedClass(expected, UIWebBean.class);
addExpectedClass(expected, ServletWebBean.class);
addExpectedClass(expected, CrmWebBean.class);
assertEquals("Illegal size or classes.", classes.size(), expected.size());
for (String className : classes)
assertTrue(expected.remove(className));
assertEmpty("Should be emtpy, missing " + expected, expected);
Class<?> newBeanClass = topUnit.getClassLoader().loadClass("org.jboss.test.deployers.support.MockTransactionServices");
BeanDeploymentArchive newBDA = deployment.loadBeanDeploymentArchive(newBeanClass);
assertNewBeanDeploymentArchive(archives, newBDA);
}
finally
{