You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ri...@apache.org on 2009/10/21 16:16:22 UTC
svn commit: r828025 - in /geronimo/server/trunk/plugins/jetty7:
geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/
geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/
geronimo-jetty7/ geronimo-jetty7/s...
Author: rickmcguire
Date: Wed Oct 21 14:16:21 2009
New Revision: 828025
URL: http://svn.apache.org/viewvc?rev=828025&view=rev
Log:
Some jetty7 conversion work
Modified:
geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java
geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java
geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/pom.xml
geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java
geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java
geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/AbstractWebModuleTest.java
geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/ClassLoaderTest.java
geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/GBeanInfoTest.java
Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java?rev=828025&r1=828024&r2=828025&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/main/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilder.java Wed Oct 21 14:16:21 2009
@@ -97,6 +97,7 @@
import org.apache.geronimo.xbeans.javaee.WelcomeFileListType;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.XmlObject;
+import org.osgi.framework.Bundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -361,16 +362,16 @@
return JettyWebAppType.Factory.newInstance();
}
- public void initContext(EARContext earContext, Module module, ClassLoader cl) throws DeploymentException {
+ public void initContext(EARContext earContext, Module module, Bundle bundle) throws DeploymentException {
JettyWebAppType gerWebApp = (JettyWebAppType) module.getVendorDD();
boolean hasSecurityRealmName = gerWebApp.isSetSecurityRealmName();
basicInitContext(earContext, module, gerWebApp, hasSecurityRealmName);
for (ModuleBuilderExtension mbe : moduleBuilderExtensions) {
- mbe.initContext(earContext, module, cl);
+ mbe.initContext(earContext, module, bundle);
}
}
- public void addGBeans(EARContext earContext, Module module, ClassLoader cl, Collection repository) throws DeploymentException {
+ public void addGBeans(EARContext earContext, Module module, Bundle bundle, Collection repository) throws DeploymentException {
EARContext moduleContext = module.getEarContext();
AbstractName moduleName = moduleContext.getModuleName();
WebModule webModule = (WebModule) module;
@@ -539,7 +540,7 @@
//TODO this may definitely not be the best place for this!
for (ModuleBuilderExtension mbe : moduleBuilderExtensions) {
- mbe.addGBeans(earContext, module, cl, repository);
+ mbe.addGBeans(earContext, module, bundle, repository);
}
//not truly metadata complete until MBEs have run
@@ -1046,19 +1047,19 @@
GBeanData servletData;
Map<String, String> initParams = new HashMap<String, String>();
if (servletType.isSetServletClass()) {
- ClassLoader webClassLoader = moduleContext.getClassLoader();
+ Bundle webBundle = moduleContext.getBundle();
String servletClassName = servletType.getServletClass().getStringValue().trim();
Class servletClass;
try {
- servletClass = webClassLoader.loadClass(servletClassName);
+ servletClass = webBundle.loadClass(servletClassName);
} catch (ClassNotFoundException e) {
- throw new DeploymentException("Could not load servlet class " + servletClassName, e); // TODO identify web app in message
+ throw new DeploymentException("Could not load servlet class " + servletClassName + " from bundle " + webBundle, e);
}
Class baseServletClass;
try {
- baseServletClass = webClassLoader.loadClass(Servlet.class.getName());
+ baseServletClass = webBundle.loadClass(Servlet.class.getName());
} catch (ClassNotFoundException e) {
- throw new DeploymentException("Could not load javax.servlet.Servlet in web classloader", e); // TODO identify web app in message
+ throw new DeploymentException("Could not load javax.servlet.Servlet in bundle " + webBundle, e);
}
if (baseServletClass.isAssignableFrom(servletClass)) {
servletData = new GBeanData(servletAbstractName, ServletHolderWrapper.class);
Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java?rev=828025&r1=828024&r2=828025&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7-builder/src/test/java/org/apache/geronimo/jetty7/deployment/JettyModuleBuilderTest.java Wed Oct 21 14:16:21 2009
@@ -58,6 +58,7 @@
import org.apache.geronimo.kernel.config.NoSuchConfigException;
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.kernel.mock.MockConfigStore;
+import org.apache.geronimo.kernel.osgi.MockBundle;
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.repository.ArtifactManager;
import org.apache.geronimo.kernel.repository.ArtifactResolver;
@@ -89,7 +90,7 @@
protected Kernel kernel;
private AbstractName tmName;
private AbstractName ctcName;
- private ClassLoader cl;
+ private Bundle bundle;
private JettyModuleBuilder builder;
private Artifact webModuleArtifact = new Artifact("foo", "bar", "1", "car");
private Environment defaultEnvironment = new Environment();
@@ -162,9 +163,9 @@
EARContext earContext = createEARContext(outputPath, defaultEnvironment, repository, configStore, moduleName);
module.setEarContext(earContext);
module.setRootEarContext(earContext);
- builder.initContext(earContext, module, cl);
+ builder.initContext(earContext, module, bundle);
// earContext.initializeConfiguration();
- builder.addGBeans(earContext, module, cl, Collections.EMPTY_SET);
+ builder.addGBeans(earContext, module, bundle, Collections.EMPTY_SET);
ConfigurationData configurationData = earContext.getConfigurationData();
earContext.close();
module.close();
@@ -187,7 +188,7 @@
ConfigurationModuleType.WAR,
naming,
configurationManager,
- repositories,
+ bundle.getBundleContext(),
new AbstractNameQuery(serverName),
moduleName,
new AbstractNameQuery(tmName),
@@ -217,28 +218,27 @@
protected void setUp() throws Exception {
super.setUp();
- cl = this.getClass().getClassLoader();
+ bundle = new MockBundle(getClass().getClassLoader(), "test", 100);
setUpSecurityService();
((SchemaTypeImpl) GerSecurityDocument.type).addSubstitutionGroupMember(org.apache.geronimo.xbeans.geronimo.security.GerSecurityDocument.type.getDocumentElementName());
- kernel = KernelFactory.newInstance().createKernel("test");
+ kernel = KernelFactory.newInstance(bundle.getBundleContext()).createKernel("test");
kernel.boot();
ConfigurationData bootstrap = new ConfigurationData(baseId, naming);
- GBeanData serverInfo = bootstrap.addGBean("ServerInfo", BasicServerInfo.GBEAN_INFO);
+ GBeanData serverInfo = bootstrap.addGBean("ServerInfo", BasicServerInfo.class);
serverInfo.setAttribute("baseDirectory", ".");
AbstractName configStoreName = bootstrap.addGBean("MockConfigurationStore", MockConfigStore.GBEAN_INFO).getAbstractName();
GBeanData artifactManagerData = bootstrap.addGBean("ArtifactManager", DefaultArtifactManager.GBEAN_INFO);
-// GBeanData artifactResolverData = bootstrap.addGBean("ArtifactResolver", DefaultArtifactResolver.class);
- GBeanData artifactResolverData = bootstrap.addGBean("ArtifactResolver", DefaultArtifactResolver.GBEAN_INFO);
+ GBeanData artifactResolverData = bootstrap.addGBean("ArtifactResolver", DefaultArtifactResolver.class);
artifactResolverData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
- GBeanData configurationManagerData = bootstrap.addGBean("ConfigurationManager", KernelConfigurationManager.GBEAN_INFO);
+ GBeanData configurationManagerData = bootstrap.addGBean("ConfigurationManager", KernelConfigurationManager.class);
configurationManagerData.setReferencePattern("ArtifactManager", artifactManagerData.getAbstractName());
configurationManagerData.setReferencePattern("ArtifactResolver", artifactResolverData.getAbstractName());
configurationManagerData.setReferencePattern("Stores", configStoreName);
Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/pom.xml?rev=828025&r1=828024&r2=828025&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/pom.xml (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/pom.xml Wed Oct 21 14:16:21 2009
@@ -51,6 +51,14 @@
</dependency>
<dependency>
+ <groupId>org.apache.geronimo.framework</groupId>
+ <artifactId>geronimo-kernel</artifactId>
+ <version>${version}</version>
+ <classifier>tests</classifier>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.configs</groupId>
<artifactId>transaction-1_6</artifactId>
<version>${version}</version>
@@ -96,7 +104,7 @@
<artifactId>jetty-servlet</artifactId>
</dependency>
</dependencies>
-
+
<build>
<plugins>
<plugin>
@@ -114,6 +122,6 @@
</plugin>
</plugins>
</build>
-
+
</project>
Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java?rev=828025&r1=828024&r2=828025&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java Wed Oct 21 14:16:21 2009
@@ -58,6 +58,8 @@
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.security.SecurityHandler;
+import org.osgi.framework.BundleContext;
+
/**
* @version $Rev$ $Date$
*/
@@ -71,6 +73,7 @@
private final Server server;
private final Map<String, EJBWebServiceContext> webServices = new HashMap<String, EJBWebServiceContext>();
private final String objectName;
+ private final BundleContext bundleContext;
private final WebManager manager;
private final String jettyHome;
private final ServerInfo serverInfo;
@@ -84,10 +87,12 @@
private boolean statsOn = false;
public JettyContainerImpl(@ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+ @ParamSpecial(type = SpecialAttributeType.bundleContext) BundleContext bundleContext,
@ParamReference(name = "WebManager") WebManager manager,
@ParamAttribute(name = "jettyHome") String jettyHome,
@ParamReference(name = "ServerInfo") ServerInfo serverInfo) {
this.objectName = objectName;
+ this.bundleContext = bundleContext;
this.jettyHome = jettyHome;
this.serverInfo = serverInfo;
@@ -294,4 +299,13 @@
}
}
+ /**
+ * Returns the configuration BundleContext associated with
+ * this network container.
+ *
+ * @return The BundleContext instance for the container's configuration.
+ */
+ public BundleContext getBundleContext() {
+ return bundleContext;
+ }
}
Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java?rev=828025&r1=828024&r2=828025&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyManagerImpl.java Wed Oct 21 14:16:21 2009
@@ -259,13 +259,13 @@
gbeanData.setAttribute(connectorAttribute.getAttributeName(), connectorAttribute.getValue());
}
}
-
+
// provide a reference to KeystoreManager gbean for HTTPS connectors
if (connectorType.equals(HTTPS_NIO) || connectorType.equals(HTTPS_BIO)) {
AbstractNameQuery query = new AbstractNameQuery(KeystoreManager.class.getName());
gbeanData.setReferencePattern("KeystoreManager", query);
}
-
+
try {
ConfigurationManager mgr = ConfigurationUtil.getConfigurationManager(kernel);
if (mgr != null && mgr instanceof EditableConfigurationManager) {
@@ -277,12 +277,15 @@
} catch (InvalidConfigException e) {
log.error("Unable to add GBean", e);
return null;
+ } catch (GBeanNotFoundException e) {
+ log.error("Unable to add GBean", e);
+ return null;
}
return name;
}
-
+
public ConnectorType getConnectorType(AbstractName connectorName) {
- ConnectorType connectorType = null;
+ ConnectorType connectorType = null;
try {
GBeanInfo info = kernel.getGBeanInfo(connectorName);
boolean found = false;
@@ -308,7 +311,7 @@
} catch (Exception e) {
log.error("Failed to get connector type", e);
}
-
+
return connectorType;
}
@@ -380,7 +383,7 @@
throw (IllegalArgumentException) new IllegalArgumentException("Unable to look up connectors for Jetty container '" + containerName + "'").initCause(e);
}
}
-
+
private static void addCommonConnectorAttributes(List<ConnectorAttribute> connectorAttributes) {
connectorAttributes.add(new ConnectorAttribute<String>("host", "0.0.0.0", Messages.getString("JettyManagerImpl.30"), String.class, true)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
connectorAttributes.add(new ConnectorAttribute<Integer>("port", 8080, Messages.getString("JettyManagerImpl.32"), Integer.class, true)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -393,7 +396,7 @@
connectorAttributes.add(new ConnectorAttribute<Integer>("redirectPort", 8443, Messages.getString("JettyManagerImpl.42"), Integer.class)); //$NON-NLS-1$ //$NON-NLS-2$
//connectorAttributes.add(new ConnectorAttribute<Integer>("maxIdleTimeMs", 30000, " The time in milliseconds that a connection can be idle before being closed.", Integer.class));
}
-
+
private static void addSslConnectorAttributes(List<ConnectorAttribute> connectorAttributes) {
//connectorAttributes.add(new ConnectorAttribute<Boolean>("clientAuthRequested", false, "clientAuthRequested", Boolean.class));
connectorAttributes.add(new ConnectorAttribute<Boolean>("clientAuthRequired", false, Messages.getString("JettyManagerImpl.44"), Boolean.class)); //$NON-NLS-1$ //$NON-NLS-2$
@@ -414,7 +417,7 @@
}
public void updateConnectorConfig(AbstractName connectorName) throws Exception {
- // do nothing for Jetty, only tomcat needs this to update server.xml file.
+ // do nothing for Jetty, only tomcat needs this to update server.xml file.
}
}
Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/AbstractWebModuleTest.java?rev=828025&r1=828024&r2=828025&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/AbstractWebModuleTest.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/AbstractWebModuleTest.java Wed Oct 21 14:16:21 2009
@@ -41,6 +41,9 @@
import org.apache.geronimo.jetty7.security.SecurityHandlerFactory;
import org.apache.geronimo.jetty7.security.ServerAuthenticationGBean;
import org.apache.geronimo.jetty7.handler.GeronimoUserIdentity;
+import org.apache.geronimo.kernel.config.ConfigurationData;
+import org.apache.geronimo.kernel.osgi.MockBundleContext;
+import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.security.SecurityServiceImpl;
import org.apache.geronimo.security.ContextManager;
import org.apache.geronimo.security.deploy.SubjectInfo;
@@ -223,7 +226,9 @@
configurationBaseURL = cl.getResource("deployables/");
ServerInfo serverInfo = new BasicServerInfo(".");
- container = new JettyContainerImpl("test:name=JettyContainer", null, new File(BASEDIR, "target/var/jetty").toString(), serverInfo);
+ container = new JettyContainerImpl("test:name=JettyContainer",
+ new MockBundleContext(getClass().getClassLoader(), "", new HashMap<Artifact, ConfigurationData>(), null),
+ null, new File(BASEDIR, "target/var/jetty").toString(), serverInfo);
container.doStart();
connector = new HTTPSocketConnector(container, null);
connector.setPort(5678);
Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/ClassLoaderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/ClassLoaderTest.java?rev=828025&r1=828024&r2=828025&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/ClassLoaderTest.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/ClassLoaderTest.java Wed Oct 21 14:16:21 2009
@@ -26,7 +26,7 @@
import org.apache.geronimo.testsupport.TestSupport;
-import org.apache.geronimo.kernel.config.MultiParentClassLoader;
+// import org.apache.geronimo.kernel.config.MultiParentClassLoader;
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.repository.ClassLoadingRules;
@@ -36,6 +36,9 @@
* javax.* class loading are honored.
*
* @version $Rev$ $Date$
+/**
+ * \
+ *
*/
public class ClassLoaderTest extends TestSupport {
Artifact configId = new Artifact("foo", "bar", "1", "car");
@@ -61,58 +64,58 @@
* parent ClassLoader. This should work.
*/
public void testFalseNonexistantJavaxClass() {
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- try {
- cl.loadClass("javax.foo.Foo");
- } catch(ClassNotFoundException e) {
- fail("Should be able to load a javax.* class that is not defined by my parent CL");
- }
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// try {
+// cl.loadClass("javax.foo.Foo");
+// } catch(ClassNotFoundException e) {
+// fail("Should be able to load a javax.* class that is not defined by my parent CL");
+// }
}
/**
* Tries to load a javax.* class that's not available from the
* parent ClassLoader. This should work.
*/
- public void testTrueNonexistantJavaxClass() {
- clRules.setInverseClassLoading(true);
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- try {
- cl.loadClass("javax.foo.Foo");
- } catch(ClassNotFoundException e) {
- fail("Should be able to load a javax.* class that is not defined by my parent CL");
- }
- }
+// public void testTrueNonexistantJavaxClass() {
+// clRules.setInverseClassLoading(true);
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// try {
+// cl.loadClass("javax.foo.Foo");
+// } catch(ClassNotFoundException e) {
+// fail("Should be able to load a javax.* class that is not defined by my parent CL");
+// }
+// }
/**
* Tries to load a javax.* class that is avialable from the parent ClassLoader,
* when there's a different definition available from this ClassLoader too.
* This should always load the parent's copy.
*/
- public void testFalseExistantJavaxClass() {
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- try {
- Class cls = cl.loadClass("javax.servlet.Servlet");
- assertTrue("Loaded wrong class first; expected to find parent CL's copy of javax.servlet.Servlet",cls.getDeclaredMethods().length > 0);
- } catch(ClassNotFoundException e) {
- fail("Problem with test; expecting to have javax.servlet.* on the ClassPath");
- }
- }
+// public void testFalseExistantJavaxClass() {
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// try {
+// Class cls = cl.loadClass("javax.servlet.Servlet");
+// assertTrue("Loaded wrong class first; expected to find parent CL's copy of javax.servlet.Servlet",cls.getDeclaredMethods().length > 0);
+// } catch(ClassNotFoundException e) {
+// fail("Problem with test; expecting to have javax.servlet.* on the ClassPath");
+// }
+// }
/**
* Tries to load a javax.* class that is avialable from the parent ClassLoader,
* when there's a different definition available from this ClassLoader too.
* This should always load the parent's copy.
*/
- public void testTrueExistantJavaxClass() {
- clRules.setInverseClassLoading(true);
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- try {
- Class cls = cl.loadClass("javax.servlet.Servlet");
- assertTrue("Loaded wrong class first; expected to find parent CL's copy of javax.servlet.Servlet",cls.getDeclaredMethods().length > 0);
- } catch(ClassNotFoundException e) {
- fail("Problem with test; expecting to have javax.servlet.* on the ClassPath");
- }
- }
+// public void testTrueExistantJavaxClass() {
+// clRules.setInverseClassLoading(true);
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// try {
+// Class cls = cl.loadClass("javax.servlet.Servlet");
+// assertTrue("Loaded wrong class first; expected to find parent CL's copy of javax.servlet.Servlet",cls.getDeclaredMethods().length > 0);
+// } catch(ClassNotFoundException e) {
+// fail("Problem with test; expecting to have javax.servlet.* on the ClassPath");
+// }
+// }
/**
* Tries to load a non-javax.* class that is aailable form the parent
@@ -121,15 +124,15 @@
* contextPriorityClassLoader is set to false (as here) and the child's
* copy when the contextPriorityClassLoader is set to true.
*/
- public void xtestFalseExistantNonJavaxClass() {
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- try {
- Class cls = cl.loadClass("mx4j.MBeanDescription");
- assertTrue("Should not have overriden parent CL definition of class mx4j.MBeanDescription", cls.getDeclaredMethods().length > 0);
- } catch(ClassNotFoundException e) {
- fail("Problem with test; expecting to have mx4j.* on the ClassPath");
- }
- }
+// public void xtestFalseExistantNonJavaxClass() {
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// try {
+// Class cls = cl.loadClass("mx4j.MBeanDescription");
+// assertTrue("Should not have overriden parent CL definition of class mx4j.MBeanDescription", cls.getDeclaredMethods().length > 0);
+// } catch(ClassNotFoundException e) {
+// fail("Problem with test; expecting to have mx4j.* on the ClassPath");
+// }
+// }
/**
* Tries to load a non-javax.* class that is aailable form the parent
@@ -138,72 +141,72 @@
* contextPriorityClassLoader is set to false and the child's copy when
* the contextPriorityClassLoader is set to true (as here).
*/
- public void xtestTrueExistantNonJavaxClass() {
- clRules.setInverseClassLoading(true);
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- try {
- Class cls = cl.loadClass("mx4j.MBeanDescription");
- assertTrue("Should be able to override a class that is not in java.*, javax.*, etc.", cls.getDeclaredMethods().length == 0);
- } catch(ClassNotFoundException e) {
- fail("Problem with test; expecting to have mx4j.* on the ClassPath");
- }
- }
+// public void xtestTrueExistantNonJavaxClass() {
+// clRules.setInverseClassLoading(true);
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// try {
+// Class cls = cl.loadClass("mx4j.MBeanDescription");
+// assertTrue("Should be able to override a class that is not in java.*, javax.*, etc.", cls.getDeclaredMethods().length == 0);
+// } catch(ClassNotFoundException e) {
+// fail("Problem with test; expecting to have mx4j.* on the ClassPath");
+// }
+// }
/**
* Tries to load a javax.* class that's not available from the
* parent ClassLoader. This should work.
*/
- public void testFalseNonexistantJavaxResource() {
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- URL url = cl.getResource("javax/foo/Foo.class");
- if(url == null) {
- fail("Should be able to load a javax.* class that is not defined by my parent CL");
- }
- assertEquals(url.getProtocol(), "file");
- }
+// public void testFalseNonexistantJavaxResource() {
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// URL url = cl.getResource("javax/foo/Foo.class");
+// if(url == null) {
+// fail("Should be able to load a javax.* class that is not defined by my parent CL");
+// }
+// assertEquals(url.getProtocol(), "file");
+// }
/**
* Tries to load a javax.* class that's not available from the
* parent ClassLoader. This should work.
*/
- public void testTrueNonexistantJavaxResource() {
- clRules.setInverseClassLoading(true);
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- URL url = cl.getResource("javax/foo/Foo.class");
- if(url == null) {
- fail("Should be able to load a javax.* class that is not defined by my parent CL");
- }
- assertEquals(url.getProtocol(), "file");
- }
+// public void testTrueNonexistantJavaxResource() {
+// clRules.setInverseClassLoading(true);
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// URL url = cl.getResource("javax/foo/Foo.class");
+// if(url == null) {
+// fail("Should be able to load a javax.* class that is not defined by my parent CL");
+// }
+// assertEquals(url.getProtocol(), "file");
+// }
/**
* Tries to load a javax.* class that is avialable from the parent ClassLoader,
* when there's a different definition available from this ClassLoader too.
* This should always load the parent's copy.
*/
- public void testFalseExistantJavaxResource() {
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- URL url = cl.getResource("javax/servlet/Servlet.class");
- if(url == null) {
- fail("Problem with test; expecting to have javax.servlet.* on the ClassPath");
- }
- assertEquals("Loaded wrong class first; expected to find parent CL's copy of javax.servlet.Servlet", url.getProtocol(), "jar");
- }
+// public void testFalseExistantJavaxResource() {
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// URL url = cl.getResource("javax/servlet/Servlet.class");
+// if(url == null) {
+// fail("Problem with test; expecting to have javax.servlet.* on the ClassPath");
+// }
+// assertEquals("Loaded wrong class first; expected to find parent CL's copy of javax.servlet.Servlet", url.getProtocol(), "jar");
+// }
/**
* Tries to load a javax.* class that is avialable from the parent ClassLoader,
* when there's a different definition available from this ClassLoader too.
* This should always load the parent's copy.
*/
- public void testTrueExistantJavaxResource() {
- clRules.setInverseClassLoading(true);
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- URL url = cl.getResource("javax/servlet/Servlet.class");
- if(url == null) {
- fail("Problem with test; expecting to have javax.servlet.* on the ClassPath");
- }
- assertEquals("Loaded wrong class first; expected to find parent CL's copy of javax.servlet.Servlet",url.getProtocol(),"jar");
- }
+// public void testTrueExistantJavaxResource() {
+// clRules.setInverseClassLoading(true);
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// URL url = cl.getResource("javax/servlet/Servlet.class");
+// if(url == null) {
+// fail("Problem with test; expecting to have javax.servlet.* on the ClassPath");
+// }
+// assertEquals("Loaded wrong class first; expected to find parent CL's copy of javax.servlet.Servlet",url.getProtocol(),"jar");
+// }
/**
* Tries to load a non-javax.* class that is aailable form the parent
@@ -212,14 +215,14 @@
* contextPriorityClassLoader is set to false (as here) and the child's
* copy when the contextPriorityClassLoader is set to true.
*/
- public void xtestFalseExistantNonJavaxResource() {
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- URL url = cl.getResource("mx4j/MBeanDescription.class");
- if(url == null) {
- fail("Problem with test; expecting to have mx4j.* on the ClassPath");
- }
- assertEquals("Should not have overriden parent CL definition of class mx4j.MBeanDescription", url.getProtocol(), "jar");
- }
+// public void xtestFalseExistantNonJavaxResource() {
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// URL url = cl.getResource("mx4j/MBeanDescription.class");
+// if(url == null) {
+// fail("Problem with test; expecting to have mx4j.* on the ClassPath");
+// }
+// assertEquals("Should not have overriden parent CL definition of class mx4j.MBeanDescription", url.getProtocol(), "jar");
+// }
/**
* Tries to load a non-javax.* class that is aailable form the parent
@@ -228,14 +231,14 @@
* contextPriorityClassLoader is set to false and the child's copy when
* the contextPriorityClassLoader is set to true (as here).
*/
- public void testTrueExistantNonJavaxResource() {
- clRules.setInverseClassLoading(true);
- clRules.getHiddenRule().setClassPrefixes(Collections.<String>emptySet());
- cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
- URL url = cl.getResource("mx4j/MBeanDescription.class");
- if(url == null) {
- fail("Problem with test; expecting to have mx4j.* on the ClassPath");
- }
- assertEquals("Should be able to override a class that is not in java.*, javax.*, etc.", url.getProtocol(), "file");
- }
+// public void testTrueExistantNonJavaxResource() {
+// clRules.setInverseClassLoading(true);
+// clRules.getHiddenRule().setClassPrefixes(Collections.<String>emptySet());
+// cl = new MultiParentClassLoader(configId, urls, getClass().getClassLoader(), clRules);
+// URL url = cl.getResource("mx4j/MBeanDescription.class");
+// if(url == null) {
+// fail("Problem with test; expecting to have mx4j.* on the ClassPath");
+// }
+// assertEquals("Should be able to override a class that is not in java.*, javax.*, etc.", url.getProtocol(), "file");
+// }
}
Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/GBeanInfoTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/GBeanInfoTest.java?rev=828025&r1=828024&r2=828025&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/GBeanInfoTest.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/GBeanInfoTest.java Wed Oct 21 14:16:21 2009
@@ -36,6 +36,6 @@
public void testJettyContainerImpl() throws Exception {
new AnnotationGBeanInfoFactory().getGBeanInfo(JettyContainerImpl.class);
ServerInfo serverInfo = new BasicServerInfo(".");
- new JettyContainerImpl(null, null, null, serverInfo);
+ new JettyContainerImpl(null, null, null, null, serverInfo);
}
}