configurationManagerData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
configurationManagerData.setReferencePattern("ArtifactResolver", artifactResolverData.getAbstractName());
ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, getClass().getClassLoader());
EditableConfigurationManager configurationManager = ConfigurationUtil.getEditableConfigurationManager(kernel);
ConfigurationData configurationData = new ConfigurationData(new Artifact("test", "test", "", "car"), kernel.getNaming());
configurationData.addGBean("GlobalContext", GlobalContextGBean.GBEAN_INFO);
contextEnv = new Hashtable();
contextEnv.put(Context.INITIAL_CONTEXT_FACTORY, GlobalContextManager.class.getName());
// dataSources
GBeanData ds1GBean = configurationData.addGBean("ds1", MockDataSource.GBEAN_INFO);
ds1Name = ds1GBean.getAbstractName();
GBeanData ds2GBean = configurationData.addGBean("ds2", MockDataSource.GBEAN_INFO);
ds2Name = ds2GBean.getAbstractName();
// bindings
GBeanData writableGBean = configurationData.addGBean("writable", WritableContextGBean.GBEAN_INFO);
AbstractName writableName = writableGBean.getAbstractName();
writableGBean.setAttribute("nameInNamespace", "writable");
GBeanData dsBinding = configurationData.addGBean("dsBinding", GBeanBinding.GBEAN_INFO);
dsBinding.setReferencePattern("Context", writableName);
dsBinding.setAttribute("name", "ds");
dsBinding.setAttribute("abstractNameQuery", new AbstractNameQuery(null, Collections.EMPTY_MAP, DataSource.class.getName()));
GBeanData ds1Binding = configurationData.addGBean("ds1Binding", GBeanBinding.GBEAN_INFO);
ds1Binding.setReferencePattern("Context", writableName);
ds1Binding.setAttribute("name", "ds1");
ds1Binding.setAttribute("abstractNameQuery", new AbstractNameQuery(null,
Collections.singletonMap("name", "ds1"),
DataSource.class.getName()));
GBeanData ds2Binding = configurationData.addGBean("ds2Binding", GBeanBinding.GBEAN_INFO);
ds2Binding.setReferencePattern("Context", writableName);
ds2Binding.setAttribute("name", "ds2");
ds2Binding.setAttribute("abstractNameQuery", new AbstractNameQuery(null,
Collections.singletonMap("name", "ds2"),
DataSource.class.getName()));
configurationManager.loadConfiguration(configurationData);
configurationManager.startConfiguration(configurationData.getId());
DataSource ds1 = (DataSource) kernel.getGBean(ds1Name);
DataSource ds2 = (DataSource) kernel.getGBean(ds2Name);
// global bindings