super.setUp();
cl = this.getClass().getClassLoader();
kernel = KernelFactory.newInstance().createKernel("test");
kernel.boot();
ConfigurationData bootstrap = new ConfigurationData(baseId, naming);
GBeanData serverInfo = bootstrap.addGBean("ServerInfo", BasicServerInfo.GBEAN_INFO);
serverInfo.setAttribute("baseDirectory", ".");
AbstractName configStoreName = bootstrap.addGBean("MockConfigurationStore", MockConfigStore.GBEAN_INFO).getAbstractName();
GBeanData artifactManagerData = bootstrap.addGBean("ArtifactManager", DefaultArtifactManager.GBEAN_INFO);
GBeanData artifactResolverData = bootstrap.addGBean("ArtifactResolver", DefaultArtifactResolver.GBEAN_INFO);
artifactResolverData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
GBeanData configurationManagerData = bootstrap.addGBean("ConfigurationManager", EditableKernelConfigurationManager.GBEAN_INFO);
configurationManagerData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
configurationManagerData.setReferencePattern("ArtifactResolver", artifactResolverData.getAbstractName());
configurationManagerData.setReferencePattern("Stores", configStoreName);
bootstrap.addGBean(configurationManagerData);
GBeanData serverData = new GBeanData(serverName, J2EEServerImpl.GBEAN_INFO);
bootstrap.addGBean(serverData);
GBeanData securityService = bootstrap.addGBean("SecurityService", SecurityServiceImpl.GBEAN_INFO);
securityService.setAttribute("policyConfigurationFactory", "org.apache.geronimo.security.jacc.GeronimoPolicyConfigurationFactory");
securityService.setAttribute("policyProvider", "org.apache.geronimo.security.jacc.GeronimoPolicy");
securityService.setReferencePattern("ServerInfo", serverInfo.getAbstractName());
// Default Realm
Map initParams = new HashMap();
initParams.put("userClassNames",
"org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal");
initParams.put("roleClassNames",
"org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal");
GBeanData realm = bootstrap.addGBean("tomcatRealm", RealmGBean.GBEAN_INFO);
realm.setAttribute("className",
"org.apache.geronimo.tomcat.realm.TomcatJAASRealm");
realm.setAttribute("initParams", initParams);
// Default Host
initParams = new HashMap();
initParams.put("workDir", "work");
initParams.put("name", "localhost");
initParams.put("appBase", "");
GBeanData host = bootstrap.addGBean("tomcatHost", HostGBean.GBEAN_INFO);
host.setAttribute("className", "org.apache.catalina.core.StandardHost");
host.setAttribute("initParams", initParams);
// Default Engine
initParams = new HashMap();
initParams.put("name", "Geronimo");
GBeanData engine = bootstrap.addGBean("tomcatEngine", EngineGBean.GBEAN_INFO);
engine.setAttribute("className", "org.apache.geronimo.tomcat.TomcatEngine");
engine.setAttribute("initParams", initParams);
engine.setReferencePattern("DefaultHost", host.getAbstractName());
engine.setReferencePattern("RealmGBean", realm.getAbstractName());
engine.setReferencePattern("Hosts", host.getAbstractName());
WebServiceBuilder webServiceBuilder = new UnavailableWebServiceBuilder();
GBeanData containerData = bootstrap.addGBean("TomcatContainer", TomcatContainer.GBEAN_INFO);
containerData.setAttribute("catalinaHome", "target/var/catalina");
containerData.setReferencePattern("EngineGBean", engine.getAbstractName());
containerData.setReferencePattern("ServerInfo", serverInfo.getAbstractName());
AbstractName containerName = containerData.getAbstractName();
GBeanData connector = bootstrap.addGBean("TomcatConnector", ConnectorGBean.GBEAN_INFO);
connector.setAttribute("name", "HTTP");
connector.setAttribute("port", new Integer(8181));
connector.setReferencePattern("TomcatContainer", containerName);
GBeanData tm = bootstrap.addGBean("TransactionManager", TransactionManagerImplGBean.GBEAN_INFO);
tm.setAttribute("defaultTransactionTimeoutSeconds", new Integer(10));
GBeanData tcm = bootstrap.addGBean("TransactionContextManager", TransactionContextManagerGBean.GBEAN_INFO);
tcm.setReferencePattern("TransactionManager", tm.getAbstractName());
tcmName = tcm.getAbstractName();
ctcName = bootstrap.addGBean("ConnectionTrackingCoordinator", ConnectionTrackingCoordinatorGBean.GBEAN_INFO).getAbstractName();
ConfigurationUtil.loadBootstrapConfiguration(kernel, bootstrap, getClass().getClassLoader());
configurationManager = ConfigurationUtil.getEditableConfigurationManager(kernel);
configStore = (ConfigurationStore) kernel.getGBean(configStoreName);