You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2011/05/08 07:39:10 UTC
svn commit: r1100681 - in
/geronimo/server/branches/3.0-osgi/framework/modules:
geronimo-deployment/src/main/java/org/apache/geronimo/deployment/
geronimo-kernel/src/main/java/org/apache/geronimo/gbean/
geronimo-kernel/src/main/java/org/apache/geronimo...
Author: djencks
Date: Sun May 8 05:39:09 2011
New Revision: 1100681
URL: http://svn.apache.org/viewvc?rev=1100681&view=rev
Log:
Change how gbean bundle/classloader is determined so each gbeam records the symbolic name of the correct bundle
Modified:
geronimo/server/branches/3.0-osgi/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java
geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java
geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationExtender.java
geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/ConfigTest.java
geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/SimpleGBeanTest.java
geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/JavaCompGBeanTest.java
geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/KernelContextGBeanTest.java
geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/binding/GBeanBindingTest.java
Modified: geronimo/server/branches/3.0-osgi/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java?rev=1100681&r1=1100680&r2=1100681&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java (original)
+++ geronimo/server/branches/3.0-osgi/framework/modules/geronimo-deployment/src/main/java/org/apache/geronimo/deployment/DeploymentContext.java Sun May 8 05:39:09 2011
@@ -552,9 +552,11 @@ public class DeploymentContext {
// environment.addDynamicImportPackage("*");
// }
// }// else {
- LinkedHashSet<String> imports = getImports(gbeans);
- environment.addImportPackages(imports);
- environment.addDynamicImportPackage("*");
+// if (addGBeanImports()) {
+// LinkedHashSet<String> imports = getImports(gbeans);
+// environment.addImportPackages(imports);
+// }
+// environment.addDynamicImportPackage("*");
osgiMetaDataBuilder = new OSGiMetaDataBuilder(bundleContext, new DummyExportPackagesSelector());
// }
Modified: geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java?rev=1100681&r1=1100680&r2=1100681&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java (original)
+++ geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfo.java Sun May 8 05:39:09 2011
@@ -17,8 +17,6 @@
package org.apache.geronimo.gbean;
-import java.io.IOException;
-import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -78,39 +76,40 @@ public final class GBeanInfo implements
private final Map<String, GReferenceInfo> referencesByName;
private final Set<String> interfaces;
private final int priority;
+ private final String bundleSymbolicName;
private final boolean osgiService;
private final String[] serviceInterfaces;
- /**
- * @deprecated use GBeanInfoBuilder
- */
- public GBeanInfo(String name, String className, String j2eeType, Collection attributes, GConstructorInfo constructor, Collection operations, Set references, Set interfaces) {
- this(null, name, className, j2eeType, attributes, constructor, operations, references, interfaces, DEFAULT_NOTIFICATIONS, PRIORITY_NORMAL, false, null);
- }
-
- /**
- * @deprecated use GBeanInfoBuilder
- */
- public GBeanInfo(String className, String j2eeType, Collection attributes, GConstructorInfo constructor, Collection operations, Set references, Set interfaces) {
- this(null, className, className, j2eeType, attributes, constructor, operations, references, interfaces, DEFAULT_NOTIFICATIONS, PRIORITY_NORMAL, false, null);
- }
-
- /**
- * @deprecated use GBeanInfoBuilder
- */
- public GBeanInfo(String className, String j2eeType, Collection attributes, GConstructorInfo constructor, Collection operations, Set references, Set interfaces, Set notifications) {
- this(null, className, className, j2eeType, attributes, constructor, operations, references, interfaces, notifications, PRIORITY_NORMAL, false, null);
- }
-
- /**
- * @deprecated use GBeanInfoBuilder
- */
- public GBeanInfo(String name, String className, String j2eeType, Collection attributes, GConstructorInfo constructor, Collection operations, Set references, Set interfaces, Set notifications) {
- this(null, name, className, j2eeType, attributes, constructor, operations, references, interfaces, notifications, PRIORITY_NORMAL, false, null);
- }
+// /**
+// * @deprecated use GBeanInfoBuilder
+// */
+// public GBeanInfo(String name, String className, String j2eeType, Collection attributes, GConstructorInfo constructor, Collection operations, Set references, Set interfaces) {
+// this(null, name, className, j2eeType, attributes, constructor, operations, references, interfaces, DEFAULT_NOTIFICATIONS, PRIORITY_NORMAL, null, false, null);
+// }
+//
+// /**
+// * @deprecated use GBeanInfoBuilder
+// */
+// public GBeanInfo(String className, String j2eeType, Collection attributes, GConstructorInfo constructor, Collection operations, Set references, Set interfaces) {
+// this(null, className, className, j2eeType, attributes, constructor, operations, references, interfaces, DEFAULT_NOTIFICATIONS, PRIORITY_NORMAL, null, false, null);
+// }
+//
+// /**
+// * @deprecated use GBeanInfoBuilder
+// */
+// public GBeanInfo(String className, String j2eeType, Collection attributes, GConstructorInfo constructor, Collection operations, Set references, Set interfaces, Set notifications) {
+// this(null, className, className, j2eeType, attributes, constructor, operations, references, interfaces, notifications, PRIORITY_NORMAL, null, false, null);
+// }
+//
+// /**
+// * @deprecated use GBeanInfoBuilder
+// */
+// public GBeanInfo(String name, String className, String j2eeType, Collection attributes, GConstructorInfo constructor, Collection operations, Set references, Set interfaces, Set notifications) {
+// this(null, name, className, j2eeType, attributes, constructor, operations, references, interfaces, notifications, PRIORITY_NORMAL, null, false, null);
+// }
- public GBeanInfo(String sourceClass, String name, String className, String j2eeType, Collection attributes, GConstructorInfo constructor, Collection operations, Set references, Set interfaces, int priority, boolean osgiService, String[] serviceInterfaces) {
- this(sourceClass, name, className, j2eeType, attributes, constructor, operations, references, interfaces, DEFAULT_NOTIFICATIONS, priority, osgiService, serviceInterfaces);
+ public GBeanInfo(String sourceClass, String name, String className, String j2eeType, Collection attributes, GConstructorInfo constructor, Collection operations, Set references, Set interfaces, int priority, String bundleSymbolicName, boolean osgiService, String[] serviceInterfaces) {
+ this(sourceClass, name, className, j2eeType, attributes, constructor, operations, references, interfaces, DEFAULT_NOTIFICATIONS, priority, bundleSymbolicName, osgiService, serviceInterfaces);
}
GBeanInfo(String sourceClass,
@@ -124,6 +123,7 @@ public final class GBeanInfo implements
Set<String> interfaces,
Set<String> notifications,
int priority,
+ String bundleSymbolicName,
boolean osgiService,
String[] serviceInterfaces) {
this.sourceClass = sourceClass;
@@ -175,6 +175,7 @@ public final class GBeanInfo implements
this.notifications = Collections.unmodifiableSet(new HashSet(notifications));
}
this.priority = priority;
+ this.bundleSymbolicName = bundleSymbolicName;
this.osgiService = osgiService;
this.serviceInterfaces = serviceInterfaces == null? new String[0]: serviceInterfaces;
}
@@ -273,6 +274,10 @@ public final class GBeanInfo implements
return priority;
}
+ public String getBundleSymbolicName() {
+ return bundleSymbolicName;
+ }
+
public boolean isOsgiService() {
return osgiService;
}
Modified: geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java?rev=1100681&r1=1100680&r2=1100681&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java (original)
+++ geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/GBeanInfoBuilder.java Sun May 8 05:39:09 2011
@@ -19,7 +19,6 @@ package org.apache.geronimo.gbean;
import java.beans.Introspector;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
@@ -33,11 +32,13 @@ import org.apache.geronimo.kernel.ClassL
import org.apache.geronimo.kernel.Kernel;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleReference;
/**
* @version $Rev$ $Date$
*/
public class GBeanInfoBuilder {
+
public static GBeanInfoBuilder createStatic(Class gbeanType) {
if (gbeanType == null) throw new NullPointerException("gbeanType is null");
return createStatic(gbeanType, gbeanType.getName(), gbeanType, null, null);
@@ -135,6 +136,8 @@ public class GBeanInfoBuilder {
private int priority = GBeanInfo.PRIORITY_NORMAL;
+ private String bundleSymbolicName;
+
private boolean osgiService;
private Set<String> serviceInterfaces = new HashSet<String>();
@@ -177,6 +180,11 @@ public class GBeanInfoBuilder {
this.name = name;
this.gbeanType = gbeanType;
this.sourceClass = sourceClass;
+ ClassLoader cl = gbeanType.getClassLoader();
+ if (cl instanceof BundleReference) {
+ Bundle bundle = ((BundleReference)cl).getBundle();
+ this.bundleSymbolicName = bundle.getSymbolicName();
+ }
if (source != null) {
for (Iterator i = source.getAttributes().iterator(); i.hasNext();) {
@@ -523,7 +531,7 @@ public class GBeanInfoBuilder {
referenceInfos.add(new GReferenceInfo(referenceName, referenceType, proxyType, setterName, namingType));
}
- return new GBeanInfo(sourceClass, name, gbeanType.getName(), j2eeType, attributes.values(), constructor, operations.values(), referenceInfos, interfaces, priority, osgiService, serviceInterfaces.toArray(new String[serviceInterfaces.size()]));
+ return new GBeanInfo(sourceClass, name, gbeanType.getName(), j2eeType, attributes.values(), constructor, operations.values(), referenceInfos, interfaces, priority, bundleSymbolicName, osgiService, serviceInterfaces.toArray(new String[serviceInterfaces.size()]));
}
private Map getConstructorTypes() throws InvalidConfigurationException {
Modified: geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java?rev=1100681&r1=1100680&r2=1100681&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java (original)
+++ geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/gbean/runtime/GBeanInstance.java Sun May 8 05:39:09 2011
@@ -300,7 +300,7 @@ public final class GBeanInstance impleme
// rebuild the gbean info based on the current attributes, operations, and references because
// the above code add new attributes and operations
- this.gbeanInfo = rebuildGBeanInfo(gbeanInfo.getConstructor(), gbeanInfo.getJ2eeType(), gbeanInfo.getPriority(), gbeanInfo.isOsgiService(), gbeanInfo.getServiceInterfaces());
+ this.gbeanInfo = rebuildGBeanInfo(gbeanInfo.getConstructor(), gbeanInfo.getJ2eeType(), gbeanInfo.getPriority(), gbeanInfo.getBundleSymbolicName(), gbeanInfo.isOsgiService(), gbeanInfo.getServiceInterfaces());
objectRecipe = newObjectRecipe(gbeanData);
@@ -1258,6 +1258,7 @@ public final class GBeanInstance impleme
private GBeanInfo rebuildGBeanInfo(GConstructorInfo constructor,
String j2eeType,
int priority,
+ String bundleSymbolicName,
boolean osgiService,
String[] serviceInterfaces) {
Set<GAttributeInfo> attributeInfos = new HashSet<GAttributeInfo>();
@@ -1290,6 +1291,7 @@ public final class GBeanInstance impleme
referenceInfos,
interfaceInfos,
priority,
+ bundleSymbolicName,
osgiService,
serviceInterfaces);
}
Modified: geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationExtender.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationExtender.java?rev=1100681&r1=1100680&r2=1100681&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationExtender.java (original)
+++ geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationExtender.java Sun May 8 05:39:09 2011
@@ -51,6 +51,7 @@ public class ConfigurationExtender {
private static final Logger logger = LoggerFactory.getLogger(ConfigurationExtender.class);
private final Map<Long, GetConfiguration> configurationMap = new ConcurrentHashMap<Long, GetConfiguration>();
+ private final Map<String, Bundle> bundleMap = new ConcurrentHashMap<String, Bundle>();
private final Executor executor = Executors.newCachedThreadPool();
@@ -104,12 +105,13 @@ public class ConfigurationExtender {
return null;
}
}
+ bundleMap.put(bundle.getSymbolicName(), bundle);
if (bundle.getState() == Bundle.RESOLVED) {
return loadConfiguration(bundle);
} else if (bundle.getState() == Bundle.ACTIVE) {
return startConfiguration(bundle);
}
- return null;
+ return bundle;
}
@Override
@@ -118,11 +120,14 @@ public class ConfigurationExtender {
@Override
public void removedBundle(Bundle bundle, BundleEvent bundleEvent, Object o) {
- if (bundleEvent.getType() == BundleEvent.STOPPED) {
- stopConfiguration(bundle, (GetConfiguration)o);
- } else if (bundleEvent.getType() == BundleEvent.UNRESOLVED) {
- unloadConfiguration(bundle, (GetConfiguration)o);
+ if (o instanceof GetConfiguration) {
+ if (bundleEvent.getType() == BundleEvent.STOPPED) {
+ stopConfiguration(bundle, (GetConfiguration)o);
+ } else if (bundleEvent.getType() == BundleEvent.UNRESOLVED) {
+ unloadConfiguration(bundle, (GetConfiguration)o);
+ }
}
+ bundleMap.remove(bundle.getSymbolicName());
}
}
@@ -196,7 +201,7 @@ public class ConfigurationExtender {
ConfigurationData data = ConfigurationUtil.readConfigurationData(in);
data.setBundle(bundle);
Configuration configuration = new Configuration(data, manageableAttributeStore);
- ConfigurationUtil.loadConfigurationGBeans(configuration, kernel);
+ ConfigurationUtil.loadConfigurationGBeans(configuration, kernel, bundleMap);
this.configuration = configuration;
} catch (IOException e) {
logger.error("Could not read the config.ser file from bundle " + bundle.getLocation(), e);
Modified: geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java?rev=1100681&r1=1100680&r2=1100681&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java (original)
+++ geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationUtil.java Sun May 8 05:39:09 2011
@@ -35,10 +35,11 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.osgi.framework.Bundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.geronimo.gbean.AbstractName;
-import org.apache.geronimo.gbean.AbstractNameQuery;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GReferenceInfo;
import org.apache.geronimo.gbean.InvalidConfigurationException;
@@ -51,11 +52,6 @@ import org.apache.geronimo.kernel.Kernel
import org.apache.geronimo.kernel.basic.BasicKernel;
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.ArtifactResolver;
-import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
-import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
-import org.apache.geronimo.kernel.repository.Maven2Repository;
-import org.osgi.framework.BundleContext;
/**
* @version $Rev:386276 $ $Date$
@@ -326,16 +322,6 @@ public final class ConfigurationUtil {
/**
- * Gets a reference or proxy to the ConfigurationManager running in the specified kernel.
- *
- * @return The ConfigurationManager
- * @throws IllegalStateException Occurs if a ConfigurationManager cannot be identified
- */
-// public static ConfigurationManager getConfigurationManager(Kernel kernel) throws GBeanNotFoundException {
-// return kernel.getGBean(ConfigurationManager.class);
-// }
-
- /**
* Gets a reference or proxy to an EditableConfigurationManager running in the specified kernel, if there is one.
*
* @return The EdtiableConfigurationManager, or none if there is not one available.
@@ -364,7 +350,7 @@ public final class ConfigurationUtil {
// }
// public static void releaseConfigurationManager(Kernel kernel, ConfigurationManager configurationManager) {
-// kernel.getProxyManager().destroyProxy(configurationManager);
+// kernel.getProxyManager().destroyProxy(configurationManager// }
// }
static void preprocessGBeanData(Configuration configuration, GBeanData gbeanData) throws InvalidConfigException {
@@ -429,7 +415,7 @@ public final class ConfigurationUtil {
// gbeanData.addDependency(configuration.getAbstractName());
}
- public static void loadConfigurationGBeans(Configuration configuration, Kernel kernel) throws InvalidConfigException {
+ public static void loadConfigurationGBeans(Configuration configuration, Kernel kernel, Map<String, Bundle> bundleMap) throws InvalidConfigException {
List<GBeanData> gbeans = new ArrayList<GBeanData>(configuration.getGBeans().values());
Collections.sort(gbeans, new GBeanData.PriorityComparator());
@@ -444,9 +430,16 @@ public final class ConfigurationUtil {
// preprocess the gbeanData (resolve references, set base url, declare dependency, etc.)
preprocessGBeanData(configuration, gbeanData);
+ GBeanInfo info = gbeanData.getGBeanInfo();
+ String bundleSymbolicName = info.getBundleSymbolicName();
+ Bundle bundle = bundleMap.get(bundleSymbolicName);
+ if (bundle == null) {
+ log.warn("No bundle with symbolic name " + bundleSymbolicName + " found for gbean " + gbeanData.getAbstractName());
+ throw new InvalidConfigException("No bundle with symbolic name " + bundleSymbolicName + " found for gbean " + gbeanData.getAbstractName());
+ }
try {
- kernel.loadGBean(gbeanData, configuration.getBundle());
+ kernel.loadGBean(gbeanData, bundle);
loaded.add(gbeanData.getAbstractName());
} catch (GBeanAlreadyExistsException e) {
throw new InvalidConfigException(e);
@@ -458,7 +451,7 @@ public final class ConfigurationUtil {
for (Configuration childConfiguration : configuration.getChildren()) {
- ConfigurationUtil.loadConfigurationGBeans(childConfiguration, kernel);
+ ConfigurationUtil.loadConfigurationGBeans(childConfiguration, kernel, bundleMap);
}
} catch (Throwable e) {
for (AbstractName gbeanName : loaded) {
Modified: geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/ConfigTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/ConfigTest.java?rev=1100681&r1=1100680&r2=1100681&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/ConfigTest.java (original)
+++ geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/ConfigTest.java Sun May 8 05:39:09 2011
@@ -17,6 +17,8 @@
package org.apache.geronimo.kernel;
+import java.util.Collections;
+
import junit.framework.TestCase;
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -27,9 +29,8 @@ import org.apache.geronimo.kernel.config
import org.apache.geronimo.kernel.config.ConfigurationUtil;
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
-import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
import org.apache.geronimo.kernel.osgi.MockBundleContext;
+import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
@@ -47,7 +48,7 @@ public class ConfigTest extends TestCase
// load -- config should be running and gbean registered but not started
Configuration configuration = new Configuration(configurationData, null);
- ConfigurationUtil.loadConfigurationGBeans(configuration, kernel);
+ ConfigurationUtil.loadConfigurationGBeans(configuration, kernel, Collections.<String, Bundle>singletonMap(null, bundleContext.getBundle()));
// assertNull(configuration);
// start -- gbeans should now be started
@@ -104,7 +105,7 @@ public class ConfigTest extends TestCase
// load -- config should be running and gbean registered but not started
Configuration configuration = new Configuration(configurationData, null);
- ConfigurationUtil.loadConfigurationGBeans(configuration, kernel);
+ ConfigurationUtil.loadConfigurationGBeans(configuration, kernel, Collections.<String, Bundle>singletonMap(null, bundleContext.getBundle()));
// assertNull(configuration);
@@ -137,7 +138,7 @@ public class ConfigTest extends TestCase
assertTrue(kernel.isLoaded(gbeanName1));
assertTrue(kernel.isLoaded(gbeanName2));
assertEquals(State.STOPPED_INDEX, kernel.getGBeanState(gbeanName1));
-// assertEquals(State.STOPPED_INDEX, kernel.getGBeanState(gbeanName2));
+ assertEquals(State.STOPPED_INDEX, kernel.getGBeanState(gbeanName2));
// restart -- gbeans should now be started
Modified: geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/SimpleGBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/SimpleGBeanTest.java?rev=1100681&r1=1100680&r2=1100681&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/SimpleGBeanTest.java (original)
+++ geronimo/server/branches/3.0-osgi/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/SimpleGBeanTest.java Sun May 8 05:39:09 2011
@@ -16,6 +16,8 @@
*/
package org.apache.geronimo.kernel;
+import java.util.Collections;
+
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
@@ -27,7 +29,7 @@ import org.apache.geronimo.kernel.config
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.osgi.MockBundleContext;
import junit.framework.TestCase;
-import org.osgi.framework.BundleEvent;
+import org.osgi.framework.Bundle;
/**
* @version $Rev$ $Date$
@@ -57,7 +59,7 @@ public class SimpleGBeanTest extends Tes
mockBean1.setAttribute("value", "1234");
Configuration configuration = new Configuration(configurationData, null);
// load and start the configuration
- ConfigurationUtil.loadConfigurationGBeans(configuration, kernel);
+ ConfigurationUtil.loadConfigurationGBeans(configuration, kernel, Collections.<String, Bundle>singletonMap(null, bundleContext.getBundle()));
ConfigurationUtil.startConfigurationGBeans(configuration, kernel);
// bundleContext.bundleEvent(BundleEvent.RESOLVED, bundleContext.getBundle());
// bundleContext.bundleEvent(BundleEvent.STARTED, bundleContext.getBundle());
Modified: geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/JavaCompGBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/JavaCompGBeanTest.java?rev=1100681&r1=1100680&r2=1100681&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/JavaCompGBeanTest.java (original)
+++ geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/JavaCompGBeanTest.java Sun May 8 05:39:09 2011
@@ -16,6 +16,7 @@
*/
package org.apache.geronimo.gjndi;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -23,19 +24,16 @@ import java.util.Map;
import javax.naming.InitialContext;
import javax.naming.NameNotFoundException;
import javax.naming.NotContextException;
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.basic.BasicKernel;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationData;
import org.apache.geronimo.kernel.config.ConfigurationUtil;
import org.apache.geronimo.kernel.osgi.MockBundleContext;
import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
-import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
import org.apache.geronimo.naming.java.RootContext;
import org.apache.geronimo.naming.java.javaURLContextFactory;
import org.apache.xbean.naming.context.ImmutableContext;
+import org.osgi.framework.Bundle;
/**
* @version $Rev$ $Date$
@@ -109,7 +107,7 @@ public class JavaCompGBeanTest extends A
configurationData.addGBean("JavaComp", JavaCompContextGBean.class);
Configuration configuration = new Configuration(configurationData, null);
- ConfigurationUtil.loadConfigurationGBeans(configuration, kernel);
+ ConfigurationUtil.loadConfigurationGBeans(configuration, kernel, Collections.<String, Bundle>singletonMap(null, bundleContext.getBundle()));
ConfigurationUtil.startConfigurationGBeans(configuration, kernel);
}
Modified: geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/KernelContextGBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/KernelContextGBeanTest.java?rev=1100681&r1=1100680&r2=1100681&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/KernelContextGBeanTest.java (original)
+++ geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/KernelContextGBeanTest.java Sun May 8 05:39:09 2011
@@ -23,13 +23,11 @@ import java.util.Map;
import javax.naming.Context;
import javax.naming.InitialContext;
-import javax.sql.DataSource;
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.gbean.AbstractNameQuery;
import org.apache.geronimo.gbean.GBeanData;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.annotation.AnnotationGBeanInfoBuilder;
import org.apache.geronimo.gjndi.binding.ResourceBinding;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.basic.BasicKernel;
@@ -38,10 +36,9 @@ import org.apache.geronimo.kernel.config
import org.apache.geronimo.kernel.config.ConfigurationUtil;
import org.apache.geronimo.kernel.osgi.MockBundleContext;
import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
-import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
import org.apache.geronimo.naming.java.RootContext;
import org.apache.xbean.naming.context.ImmutableContext;
+import org.osgi.framework.Bundle;
/**
* @version $Rev$ $Date$
@@ -79,7 +76,7 @@ public class KernelContextGBeanTest exte
test.setAttribute("bindings", testBindings);
Configuration configuration = new Configuration(configurationData, null);
- ConfigurationUtil.loadConfigurationGBeans(configuration, kernel);
+ ConfigurationUtil.loadConfigurationGBeans(configuration, kernel, Collections.<String, Bundle>singletonMap(null, bundleContext.getBundle()));
ConfigurationUtil.startConfigurationGBeans(configuration, kernel);
InitialContext ctx = new InitialContext();
@@ -118,7 +115,7 @@ public class KernelContextGBeanTest exte
public void testGBeanFormatBinding() throws Exception {
setUpJcaContext();
Configuration configuration = new Configuration(configurationData, null);
- ConfigurationUtil.loadConfigurationGBeans(configuration, kernel);
+ ConfigurationUtil.loadConfigurationGBeans(configuration, kernel, Collections.<String, Bundle>singletonMap(null, bundleContext.getBundle()));
ConfigurationUtil.startConfigurationGBeans(configuration, kernel);
InitialContext ctx = new InitialContext();
Modified: geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/binding/GBeanBindingTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/binding/GBeanBindingTest.java?rev=1100681&r1=1100680&r2=1100681&view=diff
==============================================================================
--- geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/binding/GBeanBindingTest.java (original)
+++ geronimo/server/branches/3.0-osgi/framework/modules/geronimo-naming/src/test/java/org/apache/geronimo/gjndi/binding/GBeanBindingTest.java Sun May 8 05:39:09 2011
@@ -21,7 +21,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-import javax.naming.InitialContext;
import javax.sql.DataSource;
import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.gbean.AbstractNameQuery;
@@ -29,15 +28,13 @@ import org.apache.geronimo.gbean.GBeanDa
import org.apache.geronimo.gjndi.AbstractContextTest;
import org.apache.geronimo.gjndi.GlobalContextGBean;
import org.apache.geronimo.gjndi.WritableContextGBean;
-import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.basic.BasicKernel;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationData;
import org.apache.geronimo.kernel.config.ConfigurationUtil;
import org.apache.geronimo.kernel.osgi.MockBundleContext;
import org.apache.geronimo.kernel.repository.Artifact;
-import org.apache.geronimo.kernel.repository.DefaultArtifactManager;
-import org.apache.geronimo.kernel.repository.DefaultArtifactResolver;
+import org.osgi.framework.Bundle;
/**
* @version $Rev$ $Date$
@@ -148,7 +145,7 @@ public class GBeanBindingTest extends Ab
DataSource.class.getName()));
Configuration configuration = new Configuration(configurationData, null);
- ConfigurationUtil.loadConfigurationGBeans(configuration, kernel);
+ ConfigurationUtil.loadConfigurationGBeans(configuration, kernel, Collections.<String, Bundle>singletonMap(null, bundleContext.getBundle()));
ConfigurationUtil.startConfigurationGBeans(configuration, kernel);
DataSource ds1 = (DataSource) kernel.getGBean(ds1Name);