}
protected void setUpSecurity() throws Exception {
loginConfigurationName = new ObjectName("geronimo.security:type=LoginConfiguration");
loginConfigurationGBean = new GBeanData(loginConfigurationName, GeronimoLoginConfiguration.getGBeanInfo());
Set configurations = new HashSet();
configurations.add(new ObjectName("geronimo.server:j2eeType=SecurityRealm,*"));
configurations.add(new ObjectName("geronimo.server:j2eeType=ConfigurationEntry,*"));
loginConfigurationGBean.setReferencePatterns("Configurations", configurations);
securityServiceName = new ObjectName("geronimo.server:j2eeType=SecurityService");
securityServiceGBean = new GBeanData(securityServiceName, SecurityServiceImpl.GBEAN_INFO);
securityServiceGBean.setReferencePattern("ServerInfo", serverInfoName);
securityServiceGBean.setAttribute("policyConfigurationFactory", "org.apache.geronimo.security.jacc.GeronimoPolicyConfigurationFactory");
securityServiceGBean.setAttribute("policyProvider", "org.apache.geronimo.security.jacc.GeronimoPolicy");
loginServiceName = new ObjectName("test:name=TestLoginService");
loginServiceGBean = new GBeanData(loginServiceName, JaasLoginService.GBEAN_INFO);
loginServiceGBean.setReferencePattern("Realms", new ObjectName("geronimo.server:j2eeType=SecurityRealm,*"));
loginServiceGBean.setAttribute("algorithm", "HmacSHA1");
loginServiceGBean.setAttribute("password", "secret");
propertiesLMName = new ObjectName("geronimo.security:type=LoginModule,name=Geronimo");
propertiesLMGBean = new GBeanData(propertiesLMName, LoginModuleGBean.GBEAN_INFO);
propertiesLMGBean.setAttribute("loginModuleClass", "org.apache.geronimo.security.realm.providers.PropertiesFileLoginModule");
propertiesLMGBean.setAttribute("serverSide", Boolean.TRUE);
Properties options = new Properties();
options.setProperty("usersURI", "src/test-resources/data/users.properties");
options.setProperty("groupsURI", "src/test-resources/data/groups.properties");
propertiesLMGBean.setAttribute("options", options);
propertiesLMGBean.setAttribute("loginDomainName", "geronimo-properties-realm");
ObjectName testUseName = new ObjectName("geronimo.security:type=LoginModuleUse,name=properties");
GBeanData lmUseGBean = new GBeanData(testUseName, JaasLoginModuleUse.getGBeanInfo());
lmUseGBean.setAttribute("controlFlag", "REQUIRED");
lmUseGBean.setReferencePattern("LoginModule", propertiesLMName);
propertiesRealmName = new ObjectName("geronimo.server:j2eeType=SecurityRealm,name=geronimo-properties-realm");
propertiesRealmGBean = new GBeanData(propertiesRealmName, GenericSecurityRealm.GBEAN_INFO);
propertiesRealmGBean.setReferencePattern("ServerInfo", serverInfoName);
propertiesRealmGBean.setAttribute("realmName", "Geronimo");
propertiesRealmGBean.setReferencePattern("LoginModuleConfiguration", testUseName);
propertiesRealmGBean.setReferencePattern("LoginService", loginServiceName);
Principal.PrincipalEditor principalEditor = new Principal.PrincipalEditor();
principalEditor.setAsText("metro=org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal");
propertiesRealmGBean.setAttribute("defaultPrincipal", principalEditor.getValue());
propertiesRealmName2 = new ObjectName("geronimo.server:j2eeType=SecurityRealm,name=geronimo-properties-realm-2");
propertiesRealmGBean2 = new GBeanData(propertiesRealmName2, GenericSecurityRealm.GBEAN_INFO);
propertiesRealmGBean2.setReferencePattern("ServerInfo", serverInfoName);
propertiesRealmGBean2.setAttribute("realmName", REALM_NAME);
propertiesRealmGBean2.setReferencePattern("LoginModuleConfiguration", testUseName);
propertiesRealmGBean2.setReferencePattern("LoginService", loginServiceName);
Principal.PrincipalEditor principalEditor2 = new Principal.PrincipalEditor();