// load the configuration manager bootstrap service
ConfigurationData bootstrap = new ConfigurationData(new Artifact("bootstrap", "bootstrap", "", "car"), kernel.getNaming());
bootstrap.addGBean("ConfigurationManager", KernelConfigurationManager.GBEAN_INFO);
ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, getClass().getClassLoader());
ConfigurationManager configurationManager = (ConfigurationManager) kernel.getGBean(ConfigurationManager.class);
// create a configuration for our test bean
Artifact configurationId = new Artifact("test", "test", "", "car");
ConfigurationData configurationData = new ConfigurationData(configurationId, kernel.getNaming());
GBeanData mockBean1 = configurationData.addGBean("MyBean", TestGBean.getGBeanInfo());
mockBean1.setAttribute("value", "1234");
// load and start the configuration
configurationManager.loadConfiguration(configurationData);
configurationManager.startConfiguration(configurationId);
// invoke GBean directly
TestGBean testGBean = (TestGBean) kernel.getGBean("MyBean");
assertEquals("1234", testGBean.getValue());
assertEquals("1234", testGBean.fetchValue());
// invoke GBean by short name
assertEquals("1234", kernel.getAttribute("MyBean", "value"));
assertEquals("1234", kernel.invoke("MyBean", "fetchValue"));
// this does not work without addOperation
assertEquals("1234", kernel.invoke("MyBean", "getValue"));
// invoke GBean by type
assertEquals("1234", kernel.getAttribute(TestGBean.class, "value"));
assertEquals("1234", kernel.invoke(TestGBean.class, "fetchValue"));
// invoke GBean by name and type
assertEquals("1234", kernel.getAttribute("MyBean", TestGBean.class, "value"));
assertEquals("1234", kernel.invoke("MyBean", TestGBean.class, "fetchValue"));
// stop and unload configuration
configurationManager.stopConfiguration(configurationId);
configurationManager.unloadConfiguration(configurationId);
// stop the kernel
kernel.shutdown();
}