public void xtestJavaBeanXmlAttribute() throws Exception {
ReferenceCollection referenceCollection = new MockReferenceCollection();
JavaBeanXmlAttributeBuilder javaBeanXmlAttributeBuilder = new JavaBeanXmlAttributeBuilder();
//this is kind of cheating, we rely on the builder to iterate through existing members of the collection.
referenceCollection.add(javaBeanXmlAttributeBuilder);
Naming naming = new Jsr77Naming();
NamespaceDrivenBuilder gbeanBuilder = new GBeanBuilder(referenceCollection, null);
// ConfigurationBuilder serviceBuilder = new ServiceConfigBuilder(parentEnvironment, null, Collections.singleton(gbeanBuilder), naming);
ClassLoader cl = Thread.currentThread().getContextClassLoader();
final URL plan1 = cl.getResource("services/plan1.xml");
ModuleDocument doc = ModuleDocument.Factory.parse(plan1);
ModuleType plan = doc.getModule();
File outFile = File.createTempFile("foo", "bar");
outFile.delete();
if (!outFile.mkdirs()) {
fail("could not create temp dir");
}
try {
Environment environment = EnvironmentBuilder.buildEnvironment(plan.getEnvironment());
Map<Artifact, File> repo = new HashMap<Artifact, File>();
File file = new File(plan1.getFile());
locations.put(file.getAbsolutePath(), environment.getConfigId());
repo.put(Artifact.create("geronimo/foo1/DEV/jar"), file);
repo.put(Artifact.create("geronimo/foo2/DEV/jar"), file);
repo.put(Artifact.create("geronimo/foo3/DEV/car"), file);
repo.put(Artifact.create("geronimo/foo4/DEV/car"), file);
ListableRepository mockRepository = new MockRepository(repo);
ArtifactManager artifactManager = new DefaultArtifactManager();
ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, mockRepository);
ConfigurationManager configurationManager = new SimpleConfigurationManager(Collections.EMPTY_SET, artifactResolver, Collections.EMPTY_SET, bundleContext);
bundleContext.setConfigurationManager(configurationManager);
AbstractName moduleName = naming.createRootName(environment.getConfigId(), "foo", "bar");
DeploymentContext context = new DeploymentContext(outFile, null, environment, moduleName, ConfigurationModuleType.CAR, naming, configurationManager, Collections.<Repository>singleton(mockRepository), bundleContext);
context.initializeConfiguration();
gbeanBuilder.build(plan, context, context);
Set gbeanNames = context.getGBeanNames();
assertEquals(1, gbeanNames.size());