geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r928947 - in /geronimo/server/trunk: framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/ plugins/connector-1_6/geronimo-connector-builder-1_6/ plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/o...
Date Tue, 30 Mar 2010 00:16:51 GMT
Author: djencks
Date: Tue Mar 30 00:16:51 2010
New Revision: 928947

URL: http://svn.apache.org/viewvc?rev=928947&view=rev
Log:
GERONIMO-5214 automatically export packages that ra.xml lists for client-usable classes

Modified:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundleContext.java
    geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml
    geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
    geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/RAR_1_0DConfigBeanTest.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=928947&r1=928946&r2=928947&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
Tue Mar 30 00:16:51 2010
@@ -58,6 +58,7 @@ public class MockBundleContext implement
     private final Map<Artifact, ConfigurationData> configurationDatas;
     private final Map<String, Artifact> locations;
     private final Map<Long, Bundle> bundles = new HashMap<Long, Bundle>();
+    private final Map<String, ServiceReference> serviceReferences = new HashMap<String,
ServiceReference>();
 
     private long counter = 0;
 
@@ -158,7 +159,9 @@ public class MockBundleContext implement
     }
 
     public ServiceRegistration registerService(String s, Object o, Dictionary dictionary)
{
-        return null;
+        ServiceReference sr = new MockServiceReference(o);
+        serviceReferences.put(s, sr);
+        return new MockServiceRegistration(s, sr);
     }
 
     public ServiceReference[] getServiceReferences(String s, String s1) throws InvalidSyntaxException
{
@@ -170,11 +173,11 @@ public class MockBundleContext implement
     }
 
     public ServiceReference getServiceReference(String s) {
-        return null;
+        return serviceReferences.get(s);
     }
 
     public Object getService(ServiceReference serviceReference) {
-        return null;
+        return ((MockServiceReference)serviceReference).service;
     }
 
     public boolean ungetService(ServiceReference serviceReference) {
@@ -217,4 +220,68 @@ public class MockBundleContext implement
 
     }
 
+    private class MockServiceReference implements ServiceReference {
+
+        private final Object service;
+
+        private MockServiceReference(Object service) {
+            this.service = service;
+        }
+
+        @Override
+        public Object getProperty(String s) {
+            return null;
+        }
+
+        @Override
+        public String[] getPropertyKeys() {
+            return new String[0];
+        }
+
+        @Override
+        public Bundle getBundle() {
+            return bundle;
+        }
+
+        @Override
+        public Bundle[] getUsingBundles() {
+            return new Bundle[0];
+        }
+
+        @Override
+        public boolean isAssignableTo(Bundle bundle, String s) {
+            return false;
+        }
+
+        @Override
+        public int compareTo(Object o) {
+            return 0;
+        }
+    }
+
+    private class MockServiceRegistration implements ServiceRegistration {
+
+        private final String s;
+        private final ServiceReference sr;
+
+        private MockServiceRegistration(String s, ServiceReference sr) {
+            this.s = s;
+            this.sr = sr;
+        }
+
+        @Override
+        public ServiceReference getReference() {
+            return sr;
+        }
+
+        @Override
+        public void setProperties(Dictionary dictionary) {
+        }
+
+        @Override
+        public void unregister() {
+            serviceReferences.remove(s);
+        }
+    }
+
 }

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml?rev=928947&r1=928946&r2=928947&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml (original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml Tue
Mar 30 00:16:51 2010
@@ -141,6 +141,11 @@
             <classifier>tests</classifier>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-jms_1.1_spec</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?rev=928947&r1=928946&r2=928947&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
Tue Mar 30 00:16:51 2010
@@ -88,6 +88,11 @@ import org.apache.geronimo.gbean.GBeanIn
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.MultiGBeanInfoFactory;
 import org.apache.geronimo.gbean.annotation.AnnotationGBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
 import org.apache.geronimo.j2ee.deployment.ActivationSpecInfoLocator;
 import org.apache.geronimo.j2ee.deployment.ConnectorModule;
 import org.apache.geronimo.j2ee.deployment.EARContext;
@@ -139,8 +144,11 @@ import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;
 import org.apache.xmlbeans.XmlObject;
 import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.ExportedPackage;
 import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.service.packageadmin.RequiredBundle;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
@@ -148,6 +156,8 @@ import org.xml.sax.SAXException;
 /**
  * @version $Rev:385659 $ $Date$
  */
+
+@GBean(j2eeType = NameFactory.MODULE_BUILDER)
 public class ConnectorModuleBuilder implements ModuleBuilder, ActivationSpecInfoLocator,
GBeanLifecycle {
     private static final Logger log = LoggerFactory.getLogger(ConnectorModuleBuilder.class);
 
@@ -194,15 +204,18 @@ public class ConnectorModuleBuilder impl
     private final NamespaceDrivenBuilderCollection serviceBuilders;
     private final String defaultWorkManagerName;
 
-    public ConnectorModuleBuilder(Environment defaultEnvironment,
-                                  int defaultMaxSize,
-                                  int defaultMinSize,
-                                  int defaultBlockingTimeoutMilliseconds,
-                                  int defaultIdleTimeoutMinutes,
-                                  boolean defaultXATransactionCaching,
-                                  boolean defaultXAThreadCaching,
-                                  String defaultWorkManagerName,
-                                  Collection<NamespaceDrivenBuilder> serviceBuilders)
{
+    private final PackageAdmin packageAdmin;
+
+    public ConnectorModuleBuilder(@ParamAttribute(name = "defaultEnvironment") Environment
defaultEnvironment,
+                                  @ParamAttribute(name = "defaultMaxSize") int defaultMaxSize,
+                                  @ParamAttribute(name = "defaultMinSize") int defaultMinSize,
+                                  @ParamAttribute(name = "defaultBlockingTimeoutMilliseconds")
int defaultBlockingTimeoutMilliseconds,
+                                  @ParamAttribute(name = "defaultIdleTimeoutMinutes") int
defaultIdleTimeoutMinutes,
+                                  @ParamAttribute(name = "defaultXATransactionCaching") boolean
defaultXATransactionCaching,
+                                  @ParamAttribute(name = "defaultXAThreadCaching") boolean
defaultXAThreadCaching,
+                                  @ParamAttribute(name = "defaultWorkManagerName") String
defaultWorkManagerName,
+                                  @ParamReference(name = "ServiceBuilders", namingType =
NameFactory.MODULE_BUILDER) Collection<NamespaceDrivenBuilder> serviceBuilders,
+                                  @ParamSpecial(type = SpecialAttributeType.bundleContext)
BundleContext bundleContext) {
         this.defaultEnvironment = defaultEnvironment;
 
         this.defaultMaxSize = defaultMaxSize;
@@ -213,6 +226,8 @@ public class ConnectorModuleBuilder impl
         this.defaultXAThreadCaching = defaultXAThreadCaching;
         this.defaultWorkManagerName = defaultWorkManagerName;
         this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders);
+        ServiceReference sr = bundleContext.getServiceReference(PackageAdmin.class.getName());
+        packageAdmin = (PackageAdmin) bundleContext.getService(sr);
     }
 
     public void doStart() throws Exception {
@@ -478,8 +493,6 @@ public class ConnectorModuleBuilder impl
         ConnectorModule<ConnectorBase, XmlObject> resourceModule = (ConnectorModule<ConnectorBase,
XmlObject>) module;
 
         BundleAnnotationFinder classFinder;
-        ServiceReference sr = bundle.getBundleContext().getServiceReference(PackageAdmin.class.getName());
-        PackageAdmin packageAdmin = (PackageAdmin) bundle.getBundleContext().getService(sr);
         try {
             classFinder = new BundleAnnotationFinder(packageAdmin, bundle);
         } catch (Exception e) {
@@ -489,6 +502,7 @@ public class ConnectorModuleBuilder impl
         ConnectorBase connector = resourceModule.getSpecDD();
         connector = mergeMetadata(bundle, classFinder, connector);
 
+        addExportPackages(connector, module.getEnvironment(), bundle);
 
         /*
         The chain of idiotic jsr-77 meaningless objects is:
@@ -615,7 +629,7 @@ public class ConnectorModuleBuilder impl
             ResourceAdapterBase resourceAdapter = new ResourceAdapterBase();
             connector.setResourceAdapter(resourceAdapter);
             resourceAdapter.setResourceAdapterClass(raClass.getName());
-        } else  {
+        } else {
             String raClassName = connector.getResourceAdapter().getResourceAdapterClass();
             if (raClassName != null) {
                 try {
@@ -660,9 +674,9 @@ public class ConnectorModuleBuilder impl
             MessageAdapter messageAdapter = inboundResource.getMessageAdapter();
             List<Class> activationSpecClasses = classFinder.findAnnotatedClasses(Activation.class);
 
-            for (Class<?> asClass: activationSpecClasses) {
+            for (Class<?> asClass : activationSpecClasses) {
                 Activation activation = asClass.getAnnotation(Activation.class);
-                for (Class messageListenerClass: activation.messageListeners()) {
+                for (Class messageListenerClass : activation.messageListeners()) {
                     ActivationSpec activationSpec = getActivationSpec(messageAdapter, messageListenerClass);
 
                     if (activationSpec.getActivationSpecClass() == null) {
@@ -679,7 +693,7 @@ public class ConnectorModuleBuilder impl
             }
 
             //admin objects
-            for (Class adminObjectClass: classFinder.findAnnotatedClasses(AdministeredObject.class))
{
+            for (Class adminObjectClass : classFinder.findAnnotatedClasses(AdministeredObject.class))
{
                 AdministeredObject administeredObject = (AdministeredObject) adminObjectClass.getAnnotation(AdministeredObject.class);
                 Class[] interfaces = administeredObject.adminObjectInterfaces();
                 if (interfaces == null || interfaces.length == 0) {
@@ -692,7 +706,7 @@ public class ConnectorModuleBuilder impl
                     }
                     interfaces = allInterfaces.toArray(new Class[1]);
                 }
-                for (Class aoInterface: interfaces) {
+                for (Class aoInterface : interfaces) {
                     AdminObject adminObject = getAdminObject(resourceAdapter, aoInterface);
                     if (adminObject.getAdminObjectClass() == null) {
                         adminObject.setAdminObjectClass(adminObjectClass.getName());
@@ -709,17 +723,17 @@ public class ConnectorModuleBuilder impl
             }
 
             //outbound
-            for (Class<? extends ManagedConnectionFactory> mcfClass: classFinder.findAnnotatedClasses(javax.resource.spi.ConnectionDefinition.class))
{
+            for (Class<? extends ManagedConnectionFactory> mcfClass : classFinder.findAnnotatedClasses(javax.resource.spi.ConnectionDefinition.class))
{
                 javax.resource.spi.ConnectionDefinition connectionDefinitionAnnotation =
mcfClass.getAnnotation(javax.resource.spi.ConnectionDefinition.class);
                 buildConnectionDefinition(mcfClass, connectionDefinitionAnnotation, outboundResourceAdapter);
             }
-            for (Class<? extends ManagedConnectionFactory> mcfClass: classFinder.findAnnotatedClasses(ConnectionDefinitions.class))
{
+            for (Class<? extends ManagedConnectionFactory> mcfClass : classFinder.findAnnotatedClasses(ConnectionDefinitions.class))
{
                 ConnectionDefinitions connectionDefinitionAnnotations = mcfClass.getAnnotation(ConnectionDefinitions.class);
-                for (javax.resource.spi.ConnectionDefinition connectionDefinitionAnnotation:
connectionDefinitionAnnotations.value()) {
+                for (javax.resource.spi.ConnectionDefinition connectionDefinitionAnnotation
: connectionDefinitionAnnotations.value()) {
                     buildConnectionDefinition(mcfClass, connectionDefinitionAnnotation, outboundResourceAdapter);
                 }
             }
-            if (outboundResourceAdapter.getConnectionDefinition().size() >0) {
+            if (outboundResourceAdapter.getConnectionDefinition().size() > 0) {
                 resourceAdapter.setOutboundResourceAdapter(outboundResourceAdapter);
             }
         }
@@ -728,12 +742,13 @@ public class ConnectorModuleBuilder impl
 
     /**
      * Find or create an ActivationSpec object for the supplied messageListenerClass
-     * @param messageAdapter MessageAdapter container object
+     *
+     * @param messageAdapter       MessageAdapter container object
      * @param messageListenerClass class for the activation spec
      * @return ActivationSpec data object
      */
     private ActivationSpec getActivationSpec(MessageAdapter messageAdapter, Class messageListenerClass)
{
-        for (MessageListener messageListener: messageAdapter.getMessageListener()) {
+        for (MessageListener messageListener : messageAdapter.getMessageListener()) {
             if (messageListenerClass.getName().equals(messageListener.getMessageListenerType()))
{
                 return messageListener.getActivationSpec();
             }
@@ -748,12 +763,13 @@ public class ConnectorModuleBuilder impl
 
     /**
      * find or create an AdminObject for the supplied admin object interface
+     *
      * @param resourceAdapter ResourceAdapter container object
-     * @param aoInterface admin object interface
+     * @param aoInterface     admin object interface
      * @return AdminObject data object
      */
     private AdminObject getAdminObject(ResourceAdapterBase resourceAdapter, Class aoInterface)
{
-        for (AdminObject adminObject: resourceAdapter.getAdminObject()) {
+        for (AdminObject adminObject : resourceAdapter.getAdminObject()) {
             if (aoInterface.getName().equals(adminObject.getAdminObjectInterface())) {
                 return adminObject;
             }
@@ -787,7 +803,7 @@ public class ConnectorModuleBuilder impl
     private void setConfigProperty(List<ConfigProperty> configProperties, javax.resource.spi.ConfigProperty
cpa, String name, Class<?> type) throws DeploymentException {
         name = Introspector.decapitalize(name);
         ConfigProperty target = null;
-        for (ConfigProperty configProperty: configProperties) {
+        for (ConfigProperty configProperty : configProperties) {
             if (name.equals(configProperty.getConfigPropertyName())) {
                 target = configProperty;
                 break;
@@ -799,7 +815,7 @@ public class ConnectorModuleBuilder impl
             configProperties.add(target);
         }
         if (cpa.type() != Object.class && cpa.type() != type) {
-            throw new DeploymentException("wrong type specified: " + cpa.type().getName()
+ " expecting " +  type.getName());
+            throw new DeploymentException("wrong type specified: " + cpa.type().getName()
+ " expecting " + type.getName());
         }
         if (target.getConfigPropertyType() == null) {
             target.setConfigPropertyType(type.getName());
@@ -820,7 +836,7 @@ public class ConnectorModuleBuilder impl
 
     private List<String> toString(Class<?>[] classes) {
         List<String> list = new ArrayList<String>(classes.length);
-        for (Class<?>clazz: classes) {
+        for (Class<?> clazz : classes) {
             list.add(clazz.getName());
         }
         return list;
@@ -840,7 +856,7 @@ public class ConnectorModuleBuilder impl
     }
 
     private ConnectionDefinition getConnectionDefinition(javax.resource.spi.ConnectionDefinition
connectionDefinitionAnnotation, OutboundResourceAdapter outboundResourceAdapter) {
-        for (ConnectionDefinition connectionDefinition: outboundResourceAdapter.getConnectionDefinition())
{
+        for (ConnectionDefinition connectionDefinition : outboundResourceAdapter.getConnectionDefinition())
{
             if (connectionDefinitionAnnotation.connectionFactory().getName().equals(connectionDefinition.getConnectionFactoryInterface()))
{
                 return connectionDefinition;
             }
@@ -851,6 +867,39 @@ public class ConnectorModuleBuilder impl
         return connectionDefinition;
     }
 
+    private void addExportPackages(ConnectorBase connector, Environment environment, Bundle
bundle) throws DeploymentException {
+        if (connector.getResourceAdapter().getOutboundResourceAdapter() != null) {
+            for (ConnectionDefinition connectionDefinition : connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition())
{
+                addExportPackage(environment, connectionDefinition.getConnectionFactoryInterface(),
bundle);
+                addExportPackage(environment, connectionDefinition.getConnectionInterface(),
bundle);
+            }
+        }
+        if (connector.getResourceAdapter().getInboundResourceAdapter() != null) {
+            for (MessageListener messageListener : connector.getResourceAdapter().getInboundResourceAdapter().getMessageAdapter().getMessageListener())
{
+                addExportPackage(environment, messageListener.getMessageListenerType(), bundle);
+                addExportPackage(environment, messageListener.getActivationSpec().getActivationSpecClass(),
bundle);
+            }
+        }
+        for (AdminObject adminObject : connector.getResourceAdapter().getAdminObject()) {
+            addExportPackage(environment, adminObject.getAdminObjectInterface(), bundle);
+        }
+    }
+
+    private void addExportPackage(Environment environment, String intf, Bundle bundle) throws
DeploymentException {
+        try {
+            Class clazz = bundle.loadClass(intf);
+            if (bundle == packageAdmin.getBundle(clazz)) {
+                int pos = intf.lastIndexOf(".");
+                String aPackage = intf.substring(0, pos);
+                //            environment.addImportPackage(aPackage);
+                environment.addExportPackage(aPackage);
+            }
+        } catch (ClassNotFoundException e) {
+            throw new DeploymentException("Could not load exported class: " + intf);
+        }
+
+    }
+
     public void addGBeans(EARContext earContext, Module module, Bundle bundle, Collection
repository) throws DeploymentException {
         //all our gbeans are added in  the initContext step
         //in case we decide connectors should be separate bundles
@@ -1366,39 +1415,4 @@ public class ConnectorModuleBuilder impl
         return (GBeanData) managedConnectionFactoryInfos.get(connectionFactoryInterfaceName);
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(ConnectorModuleBuilder.class,
NameFactory.MODULE_BUILDER);
-
-        infoBuilder.addAttribute("defaultEnvironment", Environment.class, true, true);
-        infoBuilder.addAttribute("defaultMaxSize", int.class, true, true);
-        infoBuilder.addAttribute("defaultMinSize", int.class, true, true);
-        infoBuilder.addAttribute("defaultBlockingTimeoutMilliseconds", int.class, true, true);
-        infoBuilder.addAttribute("defaultIdleTimeoutMinutes", int.class, true, true);
-        infoBuilder.addAttribute("defaultXATransactionCaching", boolean.class, true, true);
-        infoBuilder.addAttribute("defaultXAThreadCaching", boolean.class, true, true);
-        infoBuilder.addAttribute("defaultWorkManagerName", String.class, true, true);
-
-        infoBuilder.addReference("ServiceBuilders", NamespaceDrivenBuilder.class, NameFactory.MODULE_BUILDER);
-
-        infoBuilder.addInterface(ModuleBuilder.class);
-        infoBuilder.addInterface(ActivationSpecInfoLocator.class);
-
-        infoBuilder.setConstructor(new String[]{"defaultEnvironment",
-                "defaultMaxSize",
-                "defaultMinSize",
-                "defaultBlockingTimeoutMilliseconds",
-                "defaultIdleTimeoutMinutes",
-                "defaultXATransactionCaching",
-                "defaultXAThreadCaching",
-                "defaultWorkManagerName",
-                "ServiceBuilders"});
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
-
 }

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=928947&r1=928946&r2=928947&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
(original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
Tue Mar 30 00:16:51 2010
@@ -75,6 +75,9 @@ import org.apache.geronimo.system.server
 import org.apache.geronimo.testsupport.TestSupport;
 import org.apache.geronimo.transaction.wrapper.manager.GeronimoTransactionManagerGBean;
 import org.osgi.framework.Bundle;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.service.packageadmin.RequiredBundle;
 
 /**
  * @version $Rev:385232 $ $Date$
@@ -131,7 +134,7 @@ public class ConnectorModuleBuilderTest 
                     Collections.singleton(repository),
                     null,
                     null,
-                    new ConnectorModuleBuilder(defaultEnvironment, defaultMaxSize, defaultMinSize,
defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes, defaultXATransactionCaching,
defaultXAThreadCaching, defaultWorkManagerName, Collections.<NamespaceDrivenBuilder>singleton(serviceBuilder)),
+                    new ConnectorModuleBuilder(defaultEnvironment, defaultMaxSize, defaultMinSize,
defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes, defaultXATransactionCaching,
defaultXAThreadCaching, defaultWorkManagerName, Collections.<NamespaceDrivenBuilder>singleton(serviceBuilder),
bundleContext),
                     activationSpecInfoLocator,
                     null,
                     serviceBuilder,
@@ -338,7 +341,7 @@ public class ConnectorModuleBuilderTest 
         String resourceAdapterName = "testRA";
 
         try {
-            ConnectorModuleBuilder moduleBuilder = new ConnectorModuleBuilder(defaultEnvironment,
defaultMaxSize, defaultMinSize, defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes,
defaultXATransactionCaching, defaultXAThreadCaching, defaultWorkManagerName, Collections.<NamespaceDrivenBuilder>singleton(new
GBeanBuilder(null, null)));
+            ConnectorModuleBuilder moduleBuilder = new ConnectorModuleBuilder(defaultEnvironment,
defaultMaxSize, defaultMinSize, defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes,
defaultXATransactionCaching, defaultXAThreadCaching, defaultWorkManagerName, Collections.<NamespaceDrivenBuilder>singleton(new
GBeanBuilder(null, null)), bundleContext);
             File rarFile = action.getRARFile();
 
             ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
@@ -535,6 +538,63 @@ public class ConnectorModuleBuilderTest 
         Map<String, Artifact> locations = new HashMap<String, Artifact>();
         locations.put(null, artifact);
         bundleContext = new MockBundleContext(getClass().getClassLoader(), "", null, locations);
+        PackageAdmin packageAdmin = new PackageAdmin() {
+
+                @Override
+                public ExportedPackage[] getExportedPackages(Bundle bundle) {
+                    return new ExportedPackage[0];
+                }
+
+                @Override
+                public ExportedPackage[] getExportedPackages(String s) {
+                    return new ExportedPackage[0];
+                }
+
+                @Override
+                public ExportedPackage getExportedPackage(String s) {
+                    return null;
+                }
+
+                @Override
+                public void refreshPackages(Bundle[] bundles) {
+                }
+
+                @Override
+                public boolean resolveBundles(Bundle[] bundles) {
+                    return false;
+                }
+
+                @Override
+                public RequiredBundle[] getRequiredBundles(String s) {
+                    return new RequiredBundle[0];
+                }
+
+                @Override
+                public Bundle[] getBundles(String s, String s1) {
+                    return new Bundle[0];
+                }
+
+                @Override
+                public Bundle[] getFragments(Bundle bundle) {
+                    return new Bundle[0];
+                }
+
+                @Override
+                public Bundle[] getHosts(Bundle bundle) {
+                    return new Bundle[0];
+                }
+
+                @Override
+                public Bundle getBundle(Class aClass) {
+                    return null;
+                }
+
+                @Override
+                public int getBundleType(Bundle bundle) {
+                    return 0;
+                }
+            };
+        bundleContext.registerService(PackageAdmin.class.getName(), packageAdmin, null);
         kernel = KernelFactory.newInstance(bundleContext).createKernel("test");
         kernel.boot();
 

Modified: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/RAR_1_0DConfigBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/RAR_1_0DConfigBeanTest.java?rev=928947&r1=928946&r2=928947&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/RAR_1_0DConfigBeanTest.java
(original)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/RAR_1_0DConfigBeanTest.java
Tue Mar 30 00:16:51 2010
@@ -110,7 +110,7 @@ public class RAR_1_0DConfigBeanTest exte
 
     protected void XsetUp() throws Exception {
         File docDir = new File(BASEDIR, "src/test/data/connector_1_0");
-        j2eeDD = new File(docDir, "ra.xml").toURL();
+        j2eeDD = new File(docDir, "ra.xml").toURI().toURL();
         xmlOptions = new XmlOptions();
         xmlOptions.setLoadLineNumbers();
         errors = new ArrayList();



Mime
View raw message