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", GeronimoPolicyConfigurationFactory.class.getName());
securityService.setAttribute("policyProvider", GeronimoPolicy.class.getName());
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 MockWebServiceBuilder();
GBeanData containerData = bootstrap.addGBean("TomcatContainer", TomcatContainer.GBEAN_INFO);
containerData.setAttribute("catalinaHome", new File(BASEDIR, "target/var/catalina").toString());
containerData.setReferencePattern("EngineGBean", engine.getAbstractName());
containerData.setReferencePattern("ServerInfo", serverInfo.getAbstractName());
AbstractName containerName = containerData.getAbstractName();
GBeanData connector = bootstrap.addGBean("TomcatConnector", Http11ConnectorGBean.GBEAN_INFO);
connector.setAttribute("name", "HTTP");
connector.setAttribute("port", new Integer(8181));
connector.setReferencePattern("TomcatContainer", containerName);
connector.setReferencePattern("ServerInfo", serverInfo.getAbstractName());
GBeanData tm = bootstrap.addGBean("TransactionManager", GeronimoTransactionManagerGBean.GBEAN_INFO);
tmName = tm.getAbstractName();
tm.setAttribute("defaultTransactionTimeoutSeconds", new Integer(10));
GBeanData ctc = bootstrap.addGBean("ConnectionTrackingCoordinator", ConnectionTrackingCoordinatorGBean.GBEAN_INFO);
ctcName = ctc.getAbstractName();
ctc.setReferencePattern("TransactionManager", tmName);
GBeanData cs = bootstrap.addGBean("CredentialStore", DirectConfigurationCredentialStoreImpl.GBEAN_INFO);
Map<String, Map<String, Map<String, String>>> csd = new HashMap<String, Map<String, Map<String, String>>>();
Map<String, Map<String, String>> r = new HashMap<String, Map<String, String>>();
csd.put("foo", r);
Map<String, String> creds = new HashMap<String, String>();
r.put("metro", creds);