// Create the BDA to return from loadBeanDeploymentArchive for Observer2, this is probably a library, though could be another war or ejb jar
// bda2 is accessible from bda1, but isn't added to it's accessibility graph by default. This similar to an archive which doesn't contain a beans.xml but does contain an extension
final BeanDeploymentArchive bda2 = new BeanDeploymentArchiveImpl("2", CountingObserver2.class);
// Create a deployment, that we can use to mirror the structure of one Extension inside a BDA, and one outside
Deployment deployment = new AbstractDeployment(bda1, new Observer1(), new Observer2(), new CountingObserver1(), new CountingObserver2()) {
public BeanDeploymentArchive loadBeanDeploymentArchive(Class<?> beanClass) {
// Return bda2 if it is Observer2. Stick anything else which this test isn't about in bda1
if (beanClass.equals(CountingObserver2.class) || beanClass.equals(Bar.class)) {
// If Observer2 is requested, then we need to add bda2 to the accessibility graph of bda1