geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r826280 - in /geronimo/server/trunk: framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/ framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/util/ plugins/j2ee/geronimo-security-builde...
Date Sat, 17 Oct 2009 17:30:50 GMT
Author: djencks
Date: Sat Oct 17 17:30:50 2009
New Revision: 826280

URL: http://svn.apache.org/viewvc?rev=826280&view=rev
Log:
get geronimo-security-builder to build

Modified:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/util/ConfigurationUtil.java
    geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/CredentialStoreBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/GeronimoSecurityBuilderImpl.java
    geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java
    geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/test/java/org/apache/geronimo/security/deployment/LoginConfigBuilderTest.java

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java?rev=826280&r1=826279&r2=826280&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java
Sat Oct 17 17:30:50 2009
@@ -38,6 +38,7 @@
 import org.osgi.framework.Filter;
 import org.apache.geronimo.kernel.Naming;
 import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.mock.MockConfigurationManager;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
@@ -51,7 +52,7 @@
     protected static final Naming naming = new Jsr77Naming();
 
 
-    private ConfigurationManager configurationManager;
+    private ConfigurationManager configurationManager = new MockConfigurationManager();
     private final Bundle bundle;
     private final ClassLoader classLoader;
     private final Map<Artifact, ConfigurationData> configurationDatas;

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/util/ConfigurationUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/util/ConfigurationUtil.java?rev=826280&r1=826279&r2=826280&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/util/ConfigurationUtil.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/util/ConfigurationUtil.java
Sat Oct 17 17:30:50 2009
@@ -18,18 +18,16 @@
 package org.apache.geronimo.security.util;
 
 import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.security.AccessController;
+import java.security.Principal;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
-import java.security.Principal;
 
 import javax.security.auth.x500.X500Principal;
 import javax.security.jacc.PolicyContext;
 import javax.security.jacc.PolicyContextException;
 import javax.security.jacc.PolicyContextHandler;
-
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.security.DomainPrincipal;
 import org.apache.geronimo.security.PrimaryDomainPrincipal;
@@ -37,8 +35,9 @@
 import org.apache.geronimo.security.PrimaryRealmPrincipal;
 import org.apache.geronimo.security.RealmPrincipal;
 import org.apache.geronimo.security.deploy.PrincipalInfo;
-import org.slf4j.LoggerFactory;
+import org.osgi.framework.Bundle;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -66,21 +65,21 @@
      * Create a Principal from a deployment description.
      *
      * @param principalInfo the deployment description of the principal to be created.
-     * @param classLoader
+     * @param bundle Bundle to load principal class
      * @return a RealmPrincipal from a deployment description
      */
-    public static Principal generatePrincipal(final PrincipalInfo principalInfo, ClassLoader
classLoader) {
-        return generatePrincipal(principalInfo.getClassName(), principalInfo.getPrincipalName(),
classLoader);
+    public static Principal generatePrincipal(final PrincipalInfo principalInfo, Bundle bundle)
{
+        return generatePrincipal(principalInfo.getClassName(), principalInfo.getPrincipalName(),
bundle);
     }
 
-    public static Principal generatePrincipal(final String className, final String principalName,
final ClassLoader classLoader) {
+    public static Principal generatePrincipal(final String className, final String principalName,
final Bundle bundle) {
         try {
             return AccessController.doPrivileged(new PrivilegedExceptionAction<Principal>()
{
                 public Principal run() throws Exception {
-                    Class<Principal> clazz = (Class<Principal>) classLoader.loadClass(className);
+                    Class<Principal> clazz = (Class<Principal>) bundle.loadClass(className);
                     try {
                         Constructor<Principal> constructor = clazz.getDeclaredConstructor(new
Class[]{String.class});
-                        return constructor.newInstance(new Object[]{principalName});
+                        return constructor.newInstance(principalName);
                     } catch (NoSuchMethodException e) {
                         Constructor<Principal>[] constructors = (Constructor<Principal>[])clazz.getDeclaredConstructors();
                         for (Constructor<Principal> constructor: constructors) {
@@ -116,55 +115,55 @@
      * Create a RealmPrincipal from a deployment description.
      *
      * @param principalInfo the deployment description of the principal to be created.
-     * @param classLoader
+     * @param bundle Bundle to load principal class
      * @return a RealmPrincipal from a deployment description
      */
-    public static RealmPrincipal generateRealmPrincipal(final String realm, final String
loginDomain, final PrincipalInfo principalInfo, ClassLoader classLoader) {
-        return generateRealmPrincipal(realm, loginDomain, principalInfo.getClassName(), principalInfo.getPrincipalName(),
classLoader);
+    public static RealmPrincipal generateRealmPrincipal(final String realm, final String
loginDomain, final PrincipalInfo principalInfo, Bundle bundle) {
+        return generateRealmPrincipal(realm, loginDomain, principalInfo.getClassName(), principalInfo.getPrincipalName(),
bundle);
     }
 
     public static RealmPrincipal generateRealmPrincipal(final String realm, final String
loginDomain, final String className, final String principalName,
-                                                        ClassLoader classLoader)
+                                                        Bundle bundle)
     {
-        return new RealmPrincipal(realm, loginDomain, generatePrincipal(className, principalName,
classLoader));
+        return new RealmPrincipal(realm, loginDomain, generatePrincipal(className, principalName,
bundle));
     }
 
     /**
      * Create a DomainPrincipal from a deployment description.
      *
      * @param principalInfo the deployment description of the principal to be created.
-     * @param classLoader
+     * @param bundle Bundle to load principal class
      * @return a RealmPrincipal from a deployment description
      */
-    public static DomainPrincipal generateDomainPrincipal(final String loginDomain, final
PrincipalInfo principalInfo, ClassLoader classLoader) {
-        return generateDomainPrincipal(loginDomain, principalInfo.getClassName(), principalInfo.getPrincipalName(),
classLoader);
+    public static DomainPrincipal generateDomainPrincipal(final String loginDomain, final
PrincipalInfo principalInfo, Bundle bundle) {
+        return generateDomainPrincipal(loginDomain, principalInfo.getClassName(), principalInfo.getPrincipalName(),
bundle);
     }
 
-    public static DomainPrincipal generateDomainPrincipal(final String loginDomain, final
String className, final String principalName, ClassLoader classLoader) {
-        return new DomainPrincipal(loginDomain, generatePrincipal(className, principalName,
classLoader));
+    public static DomainPrincipal generateDomainPrincipal(final String loginDomain, final
String className, final String principalName, Bundle bundle) {
+        return new DomainPrincipal(loginDomain, generatePrincipal(className, principalName,
bundle));
     }
 
     /**
      * Create a RealmPrincipal from a deployment description.
      *
      * @param principalInfo the deployment description of the principal to be created.
-     * @param classLoader
+     * @param bundle Bundle to load principal class
      * @return a PrimaryRealmPrincipal from a deployment description
      */
-    public static PrimaryRealmPrincipal generatePrimaryRealmPrincipal(final String realm,
final String domain, final PrincipalInfo principalInfo, ClassLoader classLoader) throws DeploymentException
{
-        return generatePrimaryRealmPrincipal(realm, domain, principalInfo.getClassName(),
principalInfo.getPrincipalName(), classLoader);
+    public static PrimaryRealmPrincipal generatePrimaryRealmPrincipal(final String realm,
final String domain, final PrincipalInfo principalInfo, Bundle bundle) throws DeploymentException
{
+        return generatePrimaryRealmPrincipal(realm, domain, principalInfo.getClassName(),
principalInfo.getPrincipalName(), bundle);
     }
 
     public static PrimaryRealmPrincipal generatePrimaryRealmPrincipal(final String realm,
final String domain, final String className, final String principalName,
-                                                                      final ClassLoader classLoader)
throws DeploymentException
+                                                                      final Bundle bundle)
throws DeploymentException
     {
         try {
-            return (PrimaryRealmPrincipal) AccessController.doPrivileged(new PrivilegedExceptionAction()
{
-                public Object run() throws Exception {
+            return AccessController.doPrivileged(new PrivilegedExceptionAction<PrimaryRealmPrincipal>()
{
+                public PrimaryRealmPrincipal run() throws Exception {
                     Principal p = null;
-                    Class clazz = classLoader.loadClass(className);
+                    Class clazz = bundle.loadClass(className);
                     Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
-                    p = (Principal) constructor.newInstance(new Object[]{principalName});
+                    p = (Principal) constructor.newInstance(principalName);
 
                     return new PrimaryRealmPrincipal(realm, domain, p);
                 }
@@ -178,23 +177,23 @@
      * Create a DomainPrincipal from a deployment description.
      *
      * @param principalInfo the deployment description of the principal to be created.
-     * @param classLoader
+     * @param bundle Bundle to load principal class
      * @return a PrimaryDomainPrincipal from a deployment description
      */
-    public static PrimaryDomainPrincipal generatePrimaryDomainPrincipal(final String domain,
final PrincipalInfo principalInfo, ClassLoader classLoader) throws DeploymentException {
-        return generatePrimaryDomainPrincipal(domain, principalInfo.getClassName(), principalInfo.getPrincipalName(),
classLoader);
+    public static PrimaryDomainPrincipal generatePrimaryDomainPrincipal(final String domain,
final PrincipalInfo principalInfo, Bundle bundle) throws DeploymentException {
+        return generatePrimaryDomainPrincipal(domain, principalInfo.getClassName(), principalInfo.getPrincipalName(),
bundle);
     }
 
     public static PrimaryDomainPrincipal generatePrimaryDomainPrincipal(final String domain,
final String className, final String principalName,
-                                                                        final ClassLoader
classLoader) throws DeploymentException
+                                                                        final Bundle bundle)
throws DeploymentException
     {
         try {
-            return (PrimaryDomainPrincipal) AccessController.doPrivileged(new PrivilegedExceptionAction()
{
-                public Object run() throws Exception {
+            return AccessController.doPrivileged(new PrivilegedExceptionAction<PrimaryDomainPrincipal>()
{
+                public PrimaryDomainPrincipal run() throws Exception {
                     Principal p = null;
-                    Class clazz = classLoader.loadClass(className);
+                    Class clazz = bundle.loadClass(className);
                     Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
-                    p = (Principal) constructor.newInstance(new Object[]{principalName});
+                    p = (Principal) constructor.newInstance(principalName);
 
                     return new PrimaryDomainPrincipal(domain, p);
                 }
@@ -208,21 +207,21 @@
      * Create a Principal from a deployment description.
      *
      * @param principalInfo the deployment description of the principal to be created.
-     * @param classLoader
+     * @param bundle Bundle to load principal class
      * @return a Principal from a deployment description
      */
-    public static PrimaryPrincipal generatePrimaryPrincipal(final PrincipalInfo principalInfo,
ClassLoader classLoader) throws DeploymentException {
-        return generatePrimaryPrincipal(principalInfo.getClassName(), principalInfo.getPrincipalName(),
classLoader);
+    public static PrimaryPrincipal generatePrimaryPrincipal(final PrincipalInfo principalInfo,
Bundle bundle) throws DeploymentException {
+        return generatePrimaryPrincipal(principalInfo.getClassName(), principalInfo.getPrincipalName(),
bundle);
     }
 
-    public static PrimaryPrincipal generatePrimaryPrincipal(final String className, final
String principalName, final ClassLoader classLoader) throws DeploymentException {
+    public static PrimaryPrincipal generatePrimaryPrincipal(final String className, final
String principalName, final Bundle bundle) throws DeploymentException {
         try {
-            return (PrimaryPrincipal) AccessController.doPrivileged(new PrivilegedExceptionAction()
{
-                public Object run() throws Exception {
+            return AccessController.doPrivileged(new PrivilegedExceptionAction<PrimaryPrincipal>()
{
+                public PrimaryPrincipal run() throws Exception {
                     Principal p = null;
-                    Class clazz = classLoader.loadClass(className);
+                    Class clazz = bundle.loadClass(className);
                     Constructor constructor = clazz.getDeclaredConstructor(new Class[]{String.class});
-                    p = (Principal) constructor.newInstance(new Object[]{principalName});
+                    p = (Principal) constructor.newInstance(principalName);
 
                     return new PrimaryPrincipal(p);
                 }
@@ -245,10 +244,8 @@
      *                registration is preserved and an exception is thrown.
      */
     public static void registerPolicyContextHandler(PolicyContextHandler handler, boolean
replace) throws PolicyContextException {
-        String[] keys = handler.getKeys();
-
-        for (int i = 0; i < keys.length; i++) {
-            PolicyContext.registerHandler(keys[i], handler, replace);
+        for (String key : handler.getKeys()) {
+            PolicyContext.registerHandler(key, handler, replace);
         }
     }
 

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/CredentialStoreBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/CredentialStoreBuilder.java?rev=826280&r1=826279&r2=826280&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/CredentialStoreBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/CredentialStoreBuilder.java
Sat Oct 17 17:30:50 2009
@@ -33,6 +33,7 @@
 import org.apache.geronimo.xbeans.geronimo.credentialstore.RealmType;
 import org.apache.geronimo.xbeans.geronimo.credentialstore.SubjectType;
 import org.apache.xmlbeans.XmlObject;
+import org.osgi.framework.Bundle;
 
 /**
  * @version $Rev$ $Date$
@@ -45,7 +46,7 @@
         return NAMESPACE;
     }
 
-    public Object getValue(XmlObject xmlObject, String type, ClassLoader cl) throws DeploymentException
{
+    public Object getValue(XmlObject xmlObject, String type, Bundle bundle) throws DeploymentException
{
         Map<String, Map<String, Map<String, String>>> credentialStore =
new HashMap<String, Map<String, Map<String, String>>>();
         CredentialStoreType cst = (CredentialStoreType) xmlObject.copy().changeType(CredentialStoreType.type);
         for (RealmType realmType: cst.getRealmArray()) {

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/GeronimoSecurityBuilderImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/GeronimoSecurityBuilderImpl.java?rev=826280&r1=826279&r2=826280&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/GeronimoSecurityBuilderImpl.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/GeronimoSecurityBuilderImpl.java
Sat Oct 17 17:30:50 2009
@@ -78,6 +78,7 @@
 import org.apache.xmlbeans.QNameSet;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
+import org.osgi.framework.Bundle;
 
 /**
  * @version $Rev$ $Date$
@@ -164,14 +165,14 @@
             } catch (XmlException e) {
                 throw new DeploymentException("Could not validate security element", e);
             }
-            ClassLoader classLoader = applicationContext.getClassLoader();
+            Bundle bundle = applicationContext.getBundle();
 
             if (applicationContext instanceof EARContext) {
                 SecurityConfiguration securityConfiguration = buildSecurityConfig(securityType);
                 ((EARContext)applicationContext).setSecurityConfiguration(securityConfiguration);
             }
 
-            AbstractNameQuery roleMapperDataName = configureRoleMapper(applicationContext,
securityType, classLoader);
+            AbstractNameQuery roleMapperDataName = configureRoleMapper(applicationContext,
securityType, bundle);
             if (applicationContext instanceof EARContext) {
                 setRoleMapperName(applicationContext, roleMapperDataName);
             }
@@ -258,16 +259,16 @@
         return new SubjectInfo(realmName, id);
     }
 
-    private static Principal buildRealmPrincipal(GerRealmPrincipalType realmPrincipalType,
ClassLoader classLoader) {
-        return ConfigurationUtil.generateRealmPrincipal(realmPrincipalType.getRealmName().trim(),
realmPrincipalType.getDomainName().trim(), realmPrincipalType.getClass1().trim(), realmPrincipalType.getName().trim(),
classLoader);
+    private static Principal buildRealmPrincipal(GerRealmPrincipalType realmPrincipalType,
Bundle bundle) {
+        return ConfigurationUtil.generateRealmPrincipal(realmPrincipalType.getRealmName().trim(),
realmPrincipalType.getDomainName().trim(), realmPrincipalType.getClass1().trim(), realmPrincipalType.getName().trim(),
bundle);
     }
 
-    private static Principal buildDomainPrincipal(GerLoginDomainPrincipalType domainPrincipalType,
ClassLoader classLoader) {
-        return ConfigurationUtil.generateDomainPrincipal(domainPrincipalType.getDomainName().trim(),
domainPrincipalType.getClass1().trim(), domainPrincipalType.getName().trim(), classLoader);
+    private static Principal buildDomainPrincipal(GerLoginDomainPrincipalType domainPrincipalType,
Bundle bundle) {
+        return ConfigurationUtil.generateDomainPrincipal(domainPrincipalType.getDomainName().trim(),
domainPrincipalType.getClass1().trim(), domainPrincipalType.getName().trim(), bundle);
     }
 
-    private static Principal buildPrincipal(GerPrincipalType principalType, ClassLoader classLoader)
{
-        return ConfigurationUtil.generatePrincipal(principalType.getClass1().trim(), principalType.getName().trim(),
classLoader);
+    private static Principal buildPrincipal(GerPrincipalType principalType, Bundle bundle)
{
+        return ConfigurationUtil.generatePrincipal(principalType.getClass1().trim(), principalType.getName().trim(),
bundle);
     }
 
     //used from TSSConfigEditor
@@ -276,7 +277,7 @@
         return new PrincipalInfo(principalType.getClass1().trim(), principalType.getName().trim());
     }
 
-    protected AbstractNameQuery configureRoleMapper(DeploymentContext deploymentContext,
GerSecurityType securityType, ClassLoader classLoader) throws DeploymentException {
+    protected AbstractNameQuery configureRoleMapper(DeploymentContext deploymentContext,
GerSecurityType securityType, Bundle bundle) throws DeploymentException {
         Map<String, SubjectInfo> roleDesignates = new HashMap<String, SubjectInfo>();
         Map<Principal, Set<String>> principalRoleMap = new HashMap<Principal,
Set<String>>();
         if (securityType.isSetRoleMappings()) {
@@ -291,17 +292,17 @@
                 }
 
                 for (int j = 0; j < roleType.sizeOfRealmPrincipalArray(); j++) {
-                    Principal principal = buildRealmPrincipal(roleType.getRealmPrincipalArray(j),
classLoader);
+                    Principal principal = buildRealmPrincipal(roleType.getRealmPrincipalArray(j),
bundle);
                     add(roleName, principal, principalRoleMap);
                 }
 
                 for (int j = 0; j < roleType.sizeOfLoginDomainPrincipalArray(); j++) {
-                    Principal principal = buildDomainPrincipal(roleType.getLoginDomainPrincipalArray(j),
classLoader);
+                    Principal principal = buildDomainPrincipal(roleType.getLoginDomainPrincipalArray(j),
bundle);
                     add(roleName, principal, principalRoleMap);
                 }
 
                 for (int j = 0; j < roleType.sizeOfPrincipalArray(); j++) {
-                    Principal principal = buildPrincipal(roleType.getPrincipalArray(j), classLoader);
+                    Principal principal = buildPrincipal(roleType.getPrincipalArray(j), bundle);
                     add(roleName, principal, principalRoleMap);
                 }
 

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java?rev=826280&r1=826279&r2=826280&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/main/java/org/apache/geronimo/security/deployment/LoginConfigBuilder.java
Sat Oct 17 17:30:50 2009
@@ -58,6 +58,7 @@
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
+import org.osgi.framework.Bundle;
 
 
 /**
@@ -94,7 +95,7 @@
         return LOGIN_CONFIG_NAMESPACE;
     }
 
-    public ReferencePatterns getReferences(XmlObject xmlObject, DeploymentContext context,
AbstractName parentName, ClassLoader classLoader) throws DeploymentException {
+    public ReferencePatterns getReferences(XmlObject xmlObject, DeploymentContext context,
AbstractName parentName, Bundle bundle) throws DeploymentException {
         List<GBeanData> uses = new ArrayList<GBeanData>();
         GerLoginConfigType loginConfig = (GerLoginConfigType) xmlObject.copy().changeType(GerLoginConfigType.type);
         XmlCursor xmlCursor = loginConfig.newCursor();
@@ -182,7 +183,7 @@
                             if (builder == null) {
                                 throw new DeploymentException("No attribute builder deployed
for namespace: " + namespace);
                             }
-                            Object value = builder.getValue(xmlObject, null, classLoader);
+                            Object value = builder.getValue(xmlObject, null, bundle);
                             options.put(key, value);
                         }
                     }

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/test/java/org/apache/geronimo/security/deployment/LoginConfigBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/test/java/org/apache/geronimo/security/deployment/LoginConfigBuilderTest.java?rev=826280&r1=826279&r2=826280&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/test/java/org/apache/geronimo/security/deployment/LoginConfigBuilderTest.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-security-builder/src/test/java/org/apache/geronimo/security/deployment/LoginConfigBuilderTest.java
Sat Oct 17 17:30:50 2009
@@ -23,6 +23,7 @@
 import java.io.File;
 import java.net.URI;
 import java.util.Collections;
+import java.util.HashMap;
 
 import junit.framework.TestCase;
 import org.apache.geronimo.common.DeploymentException;
@@ -30,13 +31,17 @@
 import org.apache.geronimo.deployment.xmlbeans.XmlBeansUtil;
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.kernel.osgi.MockBundleContext;
 import org.apache.geronimo.kernel.config.ConfigurationModuleType;
+import org.apache.geronimo.kernel.config.ConfigurationData;
 import org.apache.geronimo.kernel.mock.MockConfigurationManager;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.kernel.repository.Environment;
+import org.apache.geronimo.kernel.repository.Repository;
 import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
+import org.osgi.framework.BundleContext;
 
 /**
  * @version $Rev$ $Date$
@@ -117,9 +122,13 @@
         XmlCursor cursor = xmlObject.newCursor();
         cursor.toFirstContentToken();
         xmlObject = cursor.getObject();
-        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1.0/car")),
null, ConfigurationModuleType.SERVICE, new Jsr77Naming(), new MockConfigurationManager(),
Collections.emptySet());
+        HashMap<String, Artifact> locations = new HashMap<String, Artifact>();
+        locations.put(null, Artifact.create("test/foo/1.0/car"));
+        BundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(),
"", new HashMap<Artifact, ConfigurationData>(), locations);
+        DeploymentContext context = new DeploymentContext(new File("."), null, new Environment(Artifact.create("test/foo/1.0/car")),
null, ConfigurationModuleType.SERVICE, new Jsr77Naming(), new MockConfigurationManager(),
Collections.<Repository>emptySet(), bundleContext);
+        context.initializeConfiguration();
         AbstractName parentName = new AbstractName(URI.create("test/foo/1.0/car?name=parent,j2eeType=foo"));
-        builder.getReferences(xmlObject, context, parentName, getClass().getClassLoader());
+        builder.getReferences(xmlObject, context, parentName, bundleContext.getBundle());
         secBuilder.doStop();
     }
 



Mime
View raw message