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 2009/12/18 00:42:27 UTC

svn commit: r892003 [3/3] - in /geronimo/server/trunk/plugins/tomcat: geronimo-tomcat7-builder/src/main/java/org/apache/geronimo/tomcat/deployment/ geronimo-tomcat7-clustering-builder-wadi/src/test/java/org/apache/geronimo/tomcat/cluster/wadi/builder/ ...

Propchange: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/BundleDirContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/BundleDirContext.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/BundleDirContext.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Dec 17 23:42:20 2009
@@ -0,0 +1 @@
+/tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/BaseDirContext.java:742915

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java?rev=892003&r1=892002&r2=892003&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java Thu Dec 17 23:42:20 2009
@@ -57,6 +57,7 @@
 import org.apache.geronimo.webservices.POJOWebServiceServlet;
 import org.apache.geronimo.webservices.WebServiceContainer;
 import org.apache.geronimo.webservices.WebServiceContainerInvoker;
+import org.osgi.framework.Bundle;
 
 
 /**
@@ -85,7 +86,11 @@
     private ConfigurationFactory configurationFactory;
     private String policyContextId;
 
+    public GeronimoStandardContext() {
+    }
+
     public void setContextProperties(TomcatContext ctx) throws DeploymentException {
+        setResources(new BundleDirContext(ctx.getBundle(), ctx.getModulePath()));
 
         // Create ReadOnlyContext
         javax.naming.Context enc = ctx.getJndiContext();

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java?rev=892003&r1=892002&r2=892003&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContainer.java Thu Dec 17 23:42:20 2009
@@ -167,7 +167,7 @@
             Context defaultContext;
             ObjectName objName = objectName == null ? null : ObjectName.getInstance(objectName);
             for (Container host : hosts) {
-                defaultContext = createContext("", docBase, classLoader);
+                defaultContext = createContext("", classLoader);
                 if (objName != null) {
                     defaultContext.setName(objName.getKeyProperty(NameFactory.J2EE_NAME));
                 }
@@ -271,7 +271,7 @@
      * @see org.apache.catalina.Host
      */
     public void addContext(TomcatContext contextInfo) throws Exception {
-        Context context = createContext(contextInfo.getContextPath(), contextInfo.getDocBase(), contextInfo.getClassLoader());
+        Context context = createContext(contextInfo.getContextPath(), contextInfo.getClassLoader());
 
         // Set the context for the Tomcat implementation
         contextInfo.setContext(context);
@@ -426,15 +426,13 @@
         webServices.remove(contextPath);
     }
 
-    public Context createContext(String path, String docBase, ClassLoader cl) {
+    public Context createContext(String path, ClassLoader cl) {
 
         if( log.isDebugEnabled() )
-            log.debug("Creating context '" + path + "' with docBase '" +
-                       docBase + "'");
+            log.debug("Creating context '" + path);
 
         GeronimoStandardContext context = new GeronimoStandardContext();
 
-        context.setDocBase(docBase);
         context.setPath(path);
 
         if (cl != null)

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java?rev=892003&r1=892002&r2=892003&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatContext.java Thu Dec 17 23:42:20 2009
@@ -31,6 +31,7 @@
 import org.apache.geronimo.connector.outbound.connectiontracking.TrackedConnectionAssociator;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.tomcat.util.SecurityHolder;
+import org.osgi.framework.Bundle;
 
 /**
  * @version $Rev$ $Date$
@@ -83,4 +84,8 @@
     Map getWebServices();
 
     InstanceManager getInstanceManager();
+
+    Bundle getBundle();
+
+    String getModulePath();
 }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java?rev=892003&r1=892002&r2=892003&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/main/java/org/apache/geronimo/tomcat/TomcatWebAppContext.java Thu Dec 17 23:42:20 2009
@@ -49,6 +49,11 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
 import org.apache.geronimo.j2ee.RuntimeCustomizer;
 import org.apache.geronimo.j2ee.annotation.Holder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
@@ -79,10 +84,15 @@
  *
  * @version $Rev$ $Date$
  */
+
+@GBean(name = "Tomcat WebApplication Context",
+        j2eeType = NameFactory.WEB_MODULE)
 public class TomcatWebAppContext implements GBeanLifecycle, TomcatContext, WebModule, StatisticsProvider {
 
     private static final Logger log = LoggerFactory.getLogger(TomcatWebAppContext.class);
-
+    public static final String GBEAN_REF_CLUSTERED_VALVE_RETRIEVER = "ClusteredValveRetriever";
+    public static final String GBEAN_REF_MANAGER_RETRIEVER = "ManagerRetriever";
+ 
     protected final TomcatContainer container;
     private final ClassLoader classLoader;
     private final Bundle bundle;
@@ -110,6 +120,7 @@
     private final String objectName;
     private final String originalSpecDD;
     private final URL configurationBaseURL;
+    private final String modulePath;
     private final Holder holder;
     private final RuntimeCustomizer contextCustomizer;
     private String displayName;
@@ -118,48 +129,50 @@
     private final String j2EEServer;
     private final String j2EEApplication;
 
-//  statistics
+    //  statistics
     private ModuleStats statsProvider;
     private boolean reset = true;
 
     private final Valve clusteredValve;
 
     public TomcatWebAppContext(
-            ClassLoader classLoader,
-            Bundle bundle,
-            String objectName,
-            String originalSpecDD,
-            URL configurationBaseUrl,
-            SecurityHolder securityHolder,
-            String virtualServer,
-            Map componentContext,
-            Set unshareableResources,
-            Set applicationManagedSecurityResources,
-            TransactionManager transactionManager,
-            TrackedConnectionAssociator trackedConnectionAssociator,
-            TomcatContainer container,
-            RunAsSource runAsSource,
-            ConfigurationFactory configurationFactory,
-            ObjectRetriever tomcatRealm,
-            ObjectRetriever clusteredValveRetriever,
-            ValveGBean tomcatValveChain,
-            LifecycleListenerGBean lifecycleListenerChain,
-            CatalinaClusterGBean cluster,
-            ObjectRetriever managerRetriever,
-            boolean crossContext,
-            String workDir,
-            boolean disableCookies,
-            String displayName,
-            Map webServices,
-            Holder holder,
-            RuntimeCustomizer contextCustomizer,
-            J2EEServer server,
-            J2EEApplication application,
-            Kernel kernel)
+            @ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader,
+            @ParamSpecial(type = SpecialAttributeType.bundle) Bundle bundle,
+            @ParamSpecial(type = SpecialAttributeType.objectName) String objectName,
+            @ParamAttribute(name = "deploymentDescriptor") String originalSpecDD,
+            @ParamAttribute(name = "configurationBaseUrl") URL configurationBaseUrl,
+            @ParamAttribute(name = "modulePath")String modulePath,
+            @ParamAttribute(name = "securityHolder") SecurityHolder securityHolder,
+            @ParamAttribute(name = "virtualServer") String virtualServer,
+            @ParamAttribute(name = "componentContext") Map<String, Object> componentContext,
+            @ParamAttribute(name = "unshareableResources") Set<String> unshareableResources,
+            @ParamAttribute(name = "applicationManagedSecurityResources") Set<String> applicationManagedSecurityResources,
+            @ParamReference(name = "TransactionManager") TransactionManager transactionManager,
+            @ParamReference(name = "TrackedConnectionAssociator") TrackedConnectionAssociator trackedConnectionAssociator,
+            @ParamReference(name = "TomcatContainer") TomcatContainer container,
+            @ParamReference(name = "RunAsSource") RunAsSource runAsSource,
+            @ParamReference(name = "ConfigurationFactory") ConfigurationFactory configurationFactory,
+            @ParamReference(name = "TomcatRealm") ObjectRetriever tomcatRealm,
+            @ParamReference(name = GBEAN_REF_CLUSTERED_VALVE_RETRIEVER) ObjectRetriever clusteredValveRetriever,
+            @ParamReference(name = "TomcatValveChain") ValveGBean tomcatValveChain,
+            @ParamReference(name = "LifecycleListenerChain") LifecycleListenerGBean lifecycleListenerChain,
+            @ParamReference(name = "Cluster") CatalinaClusterGBean cluster,
+            @ParamReference(name = GBEAN_REF_MANAGER_RETRIEVER) ObjectRetriever managerRetriever,
+            @ParamAttribute(name = "crossContext") boolean crossContext,
+            @ParamAttribute(name = "workDir") String workDir,
+            @ParamAttribute(name = "disableCookies") boolean disableCookies,
+            @ParamAttribute(name = "displayName") String displayName,
+            @ParamAttribute(name = "webServices") Map webServices,
+            @ParamAttribute(name = "holder") Holder holder,
+            @ParamReference(name = "ContextCustomizer") RuntimeCustomizer contextCustomizer,
+            @ParamReference(name = "J2EEServer") J2EEServer server,
+            @ParamReference(name = "J2EEApplication") J2EEApplication application,
+            @ParamSpecial(type = SpecialAttributeType.kernel) Kernel kernel)
             throws Exception {
         assert classLoader != null;
         assert bundle != null;
         assert configurationBaseUrl != null;
+        assert modulePath != null;
         assert transactionManager != null;
         assert trackedConnectionAssociator != null;
         assert componentContext != null;
@@ -172,16 +185,17 @@
         }
 
         this.objectName = objectName;
-        URI root;
-//        TODO is there a simpler way to do this?
-        if (configurationBaseUrl.getProtocol().equalsIgnoreCase("file")) {
-            root = new URI("file", configurationBaseUrl.getPath(), null);
-        } else {
-            root = URI.create(configurationBaseUrl.toString());
-        }
-        this.setDocBase(root.getPath());
+//        URI root;
+////        TODO is there a simpler way to do this?
+//        if (configurationBaseUrl.getProtocol().equalsIgnoreCase("file")) {
+//            root = new URI("file", configurationBaseUrl.getPath(), null);
+//        } else {
+//            root = URI.create(configurationBaseUrl.toString());
+//        }
+//        this.setDocBase(root.getPath());
         this.container = container;
         this.bundle = bundle;
+        this.modulePath = modulePath;
         this.originalSpecDD = originalSpecDD;
 
         this.virtualServer = virtualServer;
@@ -196,33 +210,33 @@
 
         this.server = server;
         if (securityHolder != null) {
-            securityHolder.setRunAsSource(runAsSource == null? RunAsSource.NULL: runAsSource);
+            securityHolder.setRunAsSource(runAsSource == null ? RunAsSource.NULL : runAsSource);
             securityHolder.setConfigurationFactory(configurationFactory);
         }
 
 
         this.configurationBaseURL = configurationBaseUrl;
 
-        this.holder = holder == null? new Holder(): holder;
+        this.holder = holder == null ? new Holder() : holder;
         this.contextCustomizer = contextCustomizer;
 
-        if (tomcatRealm != null){
-            realm = (Realm)tomcatRealm.getInternalObject();
-            if (realm == null){
+        if (tomcatRealm != null) {
+            realm = (Realm) tomcatRealm.getInternalObject();
+            if (realm == null) {
                 throw new IllegalArgumentException("tomcatRealm must be an instance of org.apache.catalina.Realm.");
             }
-        } else{
+        } else {
             realm = null;
         }
 
         this.displayName = displayName;
 
         //Add the valve list
-        if (tomcatValveChain != null){
+        if (tomcatValveChain != null) {
             ArrayList<Valve> chain = new ArrayList<Valve>();
             ValveGBean valveGBean = tomcatValveChain;
-            while(valveGBean != null){
-                chain.add((Valve)valveGBean.getInternalObject());
+            while (valveGBean != null) {
+                chain.add((Valve) valveGBean.getInternalObject());
                 valveGBean = valveGBean.getNextValve();
             }
             valveChain = chain;
@@ -231,11 +245,11 @@
         }
 
         //Add the Lifecycle Listener list
-        if (lifecycleListenerChain != null){
+        if (lifecycleListenerChain != null) {
             ArrayList<LifecycleListener> chain = new ArrayList<LifecycleListener>();
             LifecycleListenerGBean listenerGBean = lifecycleListenerChain;
-            while(listenerGBean != null){
-                chain.add((LifecycleListener)listenerGBean.getInternalObject());
+            while (listenerGBean != null) {
+                chain.add((LifecycleListener) listenerGBean.getInternalObject());
                 listenerGBean = listenerGBean.getNextListener();
             }
             listenerChain = chain;
@@ -338,7 +352,7 @@
     }
 
     public String getServer() {
-        return server == null? null: server.getObjectName();
+        return server == null ? null : server.getObjectName();
     }
 
     public String getDocBase() {
@@ -438,7 +452,7 @@
         return workDir;
     }
 
-    public Map getWebServices(){
+    public Map getWebServices() {
         return webServices;
     }
 
@@ -446,11 +460,19 @@
         return new TomcatInstanceManager(holder, classLoader, componentContext);
     }
 
+    public Bundle getBundle() {
+        return bundle;
+    }
+
+    public String getModulePath() {
+        return modulePath;
+    }
+
     public RuntimeCustomizer getRuntimeCustomizer() {
         return contextCustomizer;
     }
 
-    public String[] getServlets(){
+    public String[] getServlets() {
         String[] result = null;
         if ((context != null) && (context instanceof StandardContext)) {
             result = ((StandardContext) context).getServlets();
@@ -459,7 +481,7 @@
         return result;
     }
 
-    public String getDisplayName(){
+    public String getDisplayName() {
         return displayName;
     }
 
@@ -504,21 +526,20 @@
     }
 
     public String[] getJavaVMs() {
-        return server == null? new String[0]: server.getJavaVMs();
+        return server == null ? new String[0] : server.getJavaVMs();
     }
 
     public String getDeploymentDescriptor() {
         return originalSpecDD;
     }
 
-//  JSR 77 statistics - The static values are initialized at the time of
+    //  JSR 77 statistics - The static values are initialized at the time of
     // creration, getStats return fresh value everytime
     public Stats getStats() {
         if (reset) {
             reset = false;
             return statsProvider.getStats();
-        }
-        else return statsProvider.updateStats();
+        } else return statsProvider.updateStats();
     }
 
     public void resetStats() {
@@ -540,7 +561,7 @@
         }
         DirContextURLStreamHandler.bind(classLoader, resources);
         if (context instanceof StandardContext)
-            statsProvider =  new ModuleStats((StandardContext)context);
+            statsProvider = new ModuleStats((StandardContext) context);
 
         log.debug("TomcatWebAppContext started for " + path);
     }
@@ -566,90 +587,4 @@
         log.warn("TomcatWebAppContext failed");
     }
 
-    public static final GBeanInfo GBEAN_INFO;
-    public static final String GBEAN_REF_CLUSTERED_VALVE_RETRIEVER = "ClusteredValveRetriever";
-    public static final String GBEAN_REF_MANAGER_RETRIEVER = "ManagerRetriever";
-
-    static {
-        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic("Tomcat WebApplication Context", TomcatWebAppContext.class, NameFactory.WEB_MODULE);
-
-        infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
-        infoBuilder.addAttribute("bundle", Bundle.class, false);
-        infoBuilder.addAttribute("objectName", String.class, false);
-        infoBuilder.addAttribute("deploymentDescriptor", String.class, true);
-        infoBuilder.addAttribute("configurationBaseUrl", URL.class, true);
-
-        infoBuilder.addAttribute("contextPath", String.class, true);
-
-        infoBuilder.addAttribute("securityHolder", SecurityHolder.class, true);
-        infoBuilder.addAttribute("virtualServer", String.class, true);
-        infoBuilder.addAttribute("componentContext", Map.class, true);
-        infoBuilder.addAttribute("unshareableResources", Set.class, true);
-        infoBuilder.addAttribute("applicationManagedSecurityResources", Set.class, true);
-        infoBuilder.addReference("TransactionManager", TransactionManager.class, NameFactory.JTA_RESOURCE);
-        infoBuilder.addReference("TrackedConnectionAssociator", TrackedConnectionAssociator.class, NameFactory.JCA_CONNECTION_TRACKER);
-
-        infoBuilder.addReference("Container", TomcatContainer.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
-        infoBuilder.addReference("RunAsSource", RunAsSource.class, SecurityNames.JACC_MANAGER);
-        infoBuilder.addReference("ConfigurationFactory", ConfigurationFactory.class);
-        infoBuilder.addReference("TomcatRealm", ObjectRetriever.class);
-        infoBuilder.addReference(GBEAN_REF_CLUSTERED_VALVE_RETRIEVER, ObjectRetriever.class);
-        infoBuilder.addReference("TomcatValveChain", ValveGBean.class);
-        infoBuilder.addReference("LifecycleListenerChain", LifecycleListenerGBean.class, LifecycleListenerGBean.J2EE_TYPE);
-        infoBuilder.addReference("Cluster", CatalinaClusterGBean.class, CatalinaClusterGBean.J2EE_TYPE);
-        infoBuilder.addReference(GBEAN_REF_MANAGER_RETRIEVER, ObjectRetriever.class);
-        infoBuilder.addAttribute("crossContext", boolean.class, true);
-        infoBuilder.addAttribute("workDir", String.class, true);
-        infoBuilder.addAttribute("disableCookies", boolean.class, true);
-        infoBuilder.addAttribute("webServices", Map.class, true);
-        infoBuilder.addAttribute("holder", Holder.class, true);
-        infoBuilder.addReference("ContextCustomizer", RuntimeCustomizer.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
-        infoBuilder.addReference("J2EEServer", J2EEServer.class);
-        infoBuilder.addReference("J2EEApplication", J2EEApplication.class);
-        infoBuilder.addAttribute("kernel", Kernel.class, false);
-        infoBuilder.addAttribute("displayName", String.class, true);
-
-        infoBuilder.addInterface(WebModule.class);
-
-        infoBuilder.setConstructor(new String[] {
-                "classLoader",
-                "bundle",
-                "objectName",
-                "deploymentDescriptor",
-                "configurationBaseUrl",
-                "securityHolder",
-                "virtualServer",
-                "componentContext",
-                "unshareableResources",
-                "applicationManagedSecurityResources",
-                "TransactionManager",
-                "TrackedConnectionAssociator",
-                "Container",
-                "RunAsSource",
-                "ConfigurationFactory",
-                "TomcatRealm",
-                GBEAN_REF_CLUSTERED_VALVE_RETRIEVER,
-                "TomcatValveChain",
-                "LifecycleListenerChain",
-                "Cluster",
-                GBEAN_REF_MANAGER_RETRIEVER,
-                "crossContext",
-                "workDir",
-                "disableCookies",
-                "displayName",
-                "webServices",
-                "holder",
-                "ContextCustomizer",
-                "J2EEServer",
-                "J2EEApplication",
-                "kernel"
-                }
-        );
-
-        GBEAN_INFO = infoBuilder.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java?rev=892003&r1=892002&r2=892003&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/AbstractWebModuleTest.java Thu Dec 17 23:42:20 2009
@@ -43,6 +43,7 @@
 import org.apache.geronimo.tomcat.connector.Http11ConnectorGBean;
 import org.apache.geronimo.tomcat.util.SecurityHolder;
 import org.apache.geronimo.transaction.manager.TransactionManagerImpl;
+import org.osgi.framework.Bundle;
 
 import javax.transaction.TransactionManager;
 import java.io.File;
@@ -70,14 +71,19 @@
 
     protected static final String POLICY_CONTEXT_ID = "securetest";
     protected GenericSecurityRealm realm;
+    private Bundle bundle;
 
-    protected TomcatWebAppContext setUpInsecureAppContext(URI relativeWebAppRoot, URL configurationBaseURL, SecurityHolder securityHolder, RunAsSource runAsSource, ObjectRetriever tomcatRealm, ValveGBean valveChain) throws Exception {
-
+    protected TomcatWebAppContext setUpInsecureAppContext(String relativeWebAppRoot, URL configurationBaseURL, SecurityHolder securityHolder, RunAsSource runAsSource, ObjectRetriever tomcatRealm, ValveGBean valveChain) throws Exception {
+        configurationBaseURL = cl.getResource("deployables/");
+        URI locationURI = configurationBaseURL.toURI().resolve(relativeWebAppRoot);
+        MockBundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(), locationURI.toString(), new HashMap<Artifact, ConfigurationData>(), null);
+        bundle = bundleContext.getBundle();
         TomcatWebAppContext app = new TomcatWebAppContext(cl,
-                new MockBundle(cl, "", 0L),
+                bundle,
                 null,
                 null,
-                new URL(configurationBaseURL, relativeWebAppRoot.getPath()),
+                locationURI.toURL(),
+                "",
                 securityHolder,
                 null,
                 Collections.EMPTY_MAP,
@@ -113,7 +119,7 @@
         ApplicationPolicyConfigurationManager jacc = setUpJACC(roleDesignates, principalRoleMap, componentPermissions, POLICY_CONTEXT_ID);
         securityHolder.setConfigurationFactory(this.realm);
         URL configurationBaseURL = new File(BASEDIR, "src/test/resources/deployables/war3/WEB-INF/web.xml").toURL();
-        return setUpInsecureAppContext(new File(BASEDIR, "src/test/resources/deployables/war3/").toURI(),
+        return setUpInsecureAppContext("war3",
                 configurationBaseURL,
                 securityHolder,
                 jacc,
@@ -189,8 +195,9 @@
         engine.doStart();
 
         ServerInfo serverInfo = new BasicServerInfo(".");
+        MockBundleContext bundleContext = new MockBundleContext(getClass().getClassLoader(), "", new HashMap<Artifact, ConfigurationData>(), null);
         container = new TomcatContainer(cl,
-            new MockBundleContext(getClass().getClassLoader(), "", new HashMap<Artifact, ConfigurationData>(), null),
+                bundleContext,
             new File(BASEDIR, "target/var/catalina").toString(), null, null, null, engine, null, serverInfo, null, null);
         container.doStart();
 

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/ApplicationTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/ApplicationTest.java?rev=892003&r1=892002&r2=892003&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/ApplicationTest.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/ApplicationTest.java Thu Dec 17 23:42:20 2009
@@ -30,8 +30,8 @@
     private File basedir = new File(System.getProperty("basedir"));
     
     public void testApplication() throws Exception {
-        setUpInsecureAppContext(new File(basedir, "src/test/resources/deployables/war1/").toURI(),
-                new File(basedir, "src/test/resources/deployables/war1/WEB-INF/web.xml").toURL(),
+        setUpInsecureAppContext("war1",
+                null,
                 null,
                 null,
                 null,

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/BasicTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/BasicTest.java?rev=892003&r1=892002&r2=892003&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/BasicTest.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/BasicTest.java Thu Dec 17 23:42:20 2009
@@ -29,6 +29,6 @@
 public class BasicTest extends TestCase {
     
     public void testTomcatWebAppContext() throws Exception {
-        GBeanInfo gBeanInfo = TomcatWebAppContext.getGBeanInfo();
+        TomcatWebAppContext.class.getName();
     }
 }

Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/StatTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/StatTest.java?rev=892003&r1=892002&r2=892003&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/StatTest.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat7/src/test/java/org/apache/geronimo/tomcat/StatTest.java Thu Dec 17 23:42:20 2009
@@ -35,8 +35,7 @@
 
     public void testStats() throws Exception {
         TomcatWebAppContext webModule;
-        webModule = setUpInsecureAppContext(new File(BASEDIR, "src/test/resources/deployables/war1/").toURI(), new File(
-                BASEDIR, "src/test/resources/deployables/war1/WEB-INF/web.xml").toURL(), null, null, null, null);
+        webModule = setUpInsecureAppContext("war1", null, null, null, null, null);
             HttpURLConnection connection = (HttpURLConnection) new URL(connector.getConnectUrl() + "/test/hello.txt")
                     .openConnection();
             BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));