tcaName = new ObjectName("geronimo.test:role=ConnectionTrackingCoordinator");
kernel = new Kernel("geronimo.kernel", "test");
kernel.boot();
mbServer = kernel.getMBeanServer();
container = new GBeanMBean(JettyContainerImpl.GBEAN_INFO);
serverInfoGBean = new GBeanMBean(ServerInfo.GBEAN_INFO);
serverInfoName = new ObjectName("geronimo.system:role=ServerInfo");
serverInfoGBean.setAttribute("baseDirectory", ".");
connectorGBean = new GBeanMBean(HTTPConnector.GBEAN_INFO);
connectorGBean.setAttribute("port", new Integer(5678));
connectorGBean.setReferencePatterns("JettyContainer", containerPatterns);
jaasRealmGBean = new GBeanMBean("org.apache.geronimo.jetty.JAASJettyRealm");
jaasRealmName = new ObjectName("geronimo.jetty:role=JaasRealm");
jaasRealmGBean.setReferencePatterns("JettyContainer", containerPatterns);
jaasRealmGBean.setAttribute("name", "Test JAAS Realm");
jaasRealmGBean.setAttribute("loginModuleName", "jaasTest");
securityServiceGBean = new GBeanMBean("org.apache.geronimo.security.SecurityService");
securityServiceName = new ObjectName("geronimo.security:type=SecurityService");
securityServiceGBean.setReferencePatterns("Realms", Collections.singleton(new ObjectName("geronimo.security:type=SecurityRealm,*")));
securityServiceGBean.setAttribute("policyConfigurationFactory", "org.apache.geronimo.security.jacc.GeronimoPolicyConfigurationFactory");
loginServiceGBean = new GBeanMBean("org.apache.geronimo.security.jaas.LoginService");
loginServiceName = new ObjectName("geronimo.security:type=LoginService");
loginServiceGBean.setReferencePatterns("Realms", Collections.singleton(new ObjectName("geronimo.security:type=SecurityRealm,*")));
loginServiceGBean.setAttribute("reclaimPeriod", new Long(1000 * 1000));
loginServiceGBean.setAttribute("algorithm", "HmacSHA1");
loginServiceGBean.setAttribute("password", "secret");
propertiesRealmGBean = new GBeanMBean("org.apache.geronimo.security.realm.providers.PropertiesFileSecurityRealm");
propertiesRealmName = new ObjectName("geronimo.security:type=SecurityRealm,realm=demo-properties-realm");
propertiesRealmGBean.setReferencePatterns("ServerInfo", Collections.singleton(serverInfoName));
propertiesRealmGBean.setAttribute("realmName", "demo-properties-realm");
propertiesRealmGBean.setAttribute("maxLoginModuleAge", new Long(1 * 1000));
propertiesRealmGBean.setAttribute("usersURI", (new File(new File("."), "src/test-resources/data/users.properties")).toURI());
propertiesRealmGBean.setAttribute("groupsURI", (new File(new File("."), "src/test-resources/data/groups.properties")).toURI());
start(serverInfoName, serverInfoGBean);
start(propertiesRealmName, propertiesRealmGBean);
start(containerName, container);
start(securityServiceName, securityServiceGBean);
start(loginServiceName, loginServiceGBean);
start(jaasRealmName, jaasRealmGBean);
start(connectorName, connectorGBean);
tm = new GBeanMBean(GeronimoTransactionManager.GBEAN_INFO);
tm.setAttribute("defaultTransactionTimeoutSeconds", new Integer(10));
Set patterns = new HashSet();
patterns.add(ObjectName.getInstance("geronimo.server:j2eeType=JCAManagedConnectionFactory,*"));
tm.setReferencePatterns("ResourceManagers", patterns);
start(tmName, tm);
tcm = new GBeanMBean(TransactionContextManager.GBEAN_INFO);
tcm.setReferencePattern("TransactionManager", tmName);
start(tcmName, tcm);
ctc = new GBeanMBean(ConnectionTrackingCoordinator.GBEAN_INFO);
start(tcaName, ctc);
}