View | Details | Raw Unified | Return to bug 57154
Collapse All | Expand All

(-)java/org/apache/catalina/core/StandardContext.java (-1 / +4 lines)
Lines 120-125 import org.apache.juli.logging.LogFactory; Link Here
120
import org.apache.naming.ContextBindings;
120
import org.apache.naming.ContextBindings;
121
import org.apache.naming.resources.BaseDirContext;
121
import org.apache.naming.resources.BaseDirContext;
122
import org.apache.naming.resources.DirContextURLStreamHandler;
122
import org.apache.naming.resources.DirContextURLStreamHandler;
123
import org.apache.naming.resources.EmptyDirContext;
123
import org.apache.naming.resources.FileDirContext;
124
import org.apache.naming.resources.FileDirContext;
124
import org.apache.naming.resources.ProxyDirContext;
125
import org.apache.naming.resources.ProxyDirContext;
125
import org.apache.naming.resources.WARDirContext;
126
import org.apache.naming.resources.WARDirContext;
Lines 5316-5322 public class StandardContext extends ContainerBase Link Here
5316
            if (log.isDebugEnabled())
5317
            if (log.isDebugEnabled())
5317
                log.debug("Configuring default Resources");
5318
                log.debug("Configuring default Resources");
5318
            try {
5319
            try {
5319
                if ((getDocBase() != null) && (getDocBase().endsWith(".war")) &&
5320
                if (getDocBase() == null)
5321
                    setResources(new EmptyDirContext());
5322
                else if ((getDocBase() != null) && (getDocBase().endsWith(".war")) &&
5320
                        (!(new File(getBasePath())).isDirectory()))
5323
                        (!(new File(getBasePath())).isDirectory()))
5321
                    setResources(new WARDirContext());
5324
                    setResources(new WARDirContext());
5322
                else
5325
                else
(-)java/org/apache/naming/resources/EmptyDirContext.java (+403 lines)
Line 0 Link Here
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one or more
3
 * contributor license agreements.  See the NOTICE file distributed with
4
 * this work for additional information regarding copyright ownership.
5
 * The ASF licenses this file to You under the Apache License, Version 2.0
6
 * (the "License"); you may not use this file except in compliance with
7
 * the License.  You may obtain a copy of the License at
8
 *
9
 *      http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
package org.apache.naming.resources;
19
20
import javax.naming.Binding;
21
import javax.naming.CompositeName;
22
import javax.naming.Context;
23
import javax.naming.Name;
24
import javax.naming.NameClassPair;
25
import javax.naming.NameNotFoundException;
26
import javax.naming.NameParser;
27
import javax.naming.NamingEnumeration;
28
import javax.naming.NamingException;
29
import javax.naming.directory.Attributes;
30
import javax.naming.directory.BasicAttributes;
31
import javax.naming.directory.DirContext;
32
import javax.naming.directory.ModificationItem;
33
import javax.naming.directory.SearchControls;
34
import javax.naming.directory.SearchResult;
35
import java.util.Enumeration;
36
import java.util.Hashtable;
37
import java.util.Vector;
38
39
/**
40
 * A {@link DirContext} implementation that is not backed by a file system
41
 * and behaves as if it has no resources available. This is primarily used in
42
 * embedded mode when the web application is configured entirely
43
 * programmatically and does not use any static resources from the file system.
44
 * EmptyDirContext is implemented as a read only context.
45
 *
46
 * @author Huxing Zhang (huxing.zhx@alibaba-inc.com)
47
 */
48
public class EmptyDirContext implements DirContext {
49
50
    /**
51
     * Static field to avoid useless object creation
52
     */
53
    private static final Attributes emptyAttributes = new BasicAttributes();
54
55
    private static final NameNotFoundException nameNotFoundException = new NameNotFoundException();
56
57
    private static final Name emptyName = new CompositeName();
58
59
    private static final Hashtable<?, ?> emptyEnv = new Hashtable();
60
61
    private static final String emptyString = "";
62
63
    /**
64
     * Non-static field to avoid useless object creation
65
     */
66
    private final NamingEnumeration emptyEnum = new EmptyNamingEnumImpl();
67
68
    private final NameParser nameParser = new NameParserImpl();
69
70
    @Override
71
    public Attributes getAttributes(Name name) throws NamingException {
72
        return emptyAttributes;
73
    }
74
75
    @Override
76
    public Attributes getAttributes(String name) throws NamingException {
77
        return emptyAttributes;
78
    }
79
80
    @Override
81
    public Attributes getAttributes(Name name, String[] attrIds) throws NamingException {
82
        return emptyAttributes;
83
    }
84
85
    @Override
86
    public Attributes getAttributes(String name, String[] attrIds) throws NamingException {
87
        return emptyAttributes;
88
    }
89
90
    @Override
91
    public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException {
92
        // no op
93
    }
94
95
    @Override
96
    public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException {
97
        // no op
98
    }
99
100
    @Override
101
    public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException {
102
        // no op
103
    }
104
105
    @Override
106
    public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException {
107
        // no op
108
    }
109
110
    @Override
111
    public void bind(Name name, Object obj, Attributes attrs) throws NamingException {
112
        // no op
113
    }
114
115
    @Override
116
    public void bind(String name, Object obj, Attributes attrs) throws NamingException {
117
        // no op
118
    }
119
120
    @Override
121
    public void rebind(Name name, Object obj, Attributes attrs) throws NamingException {
122
        // no op
123
    }
124
125
    @Override
126
    public void rebind(String name, Object obj, Attributes attrs) throws NamingException {
127
        // no op
128
    }
129
130
    @Override
131
    public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException {
132
        return this;
133
    }
134
135
    @Override
136
    public DirContext createSubcontext(String name, Attributes attrs) throws NamingException {
137
        return this;
138
    }
139
140
    @Override
141
    public DirContext getSchema(Name name) throws NamingException {
142
        return this;
143
    }
144
145
    @Override
146
    public DirContext getSchema(String name) throws NamingException {
147
        return this;
148
    }
149
150
    @Override
151
    public DirContext getSchemaClassDefinition(Name name) throws NamingException {
152
        return this;
153
    }
154
155
    @Override
156
    public DirContext getSchemaClassDefinition(String name) throws NamingException {
157
        return this;
158
    }
159
160
    @Override
161
    @SuppressWarnings("unchecked")
162
    public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes,
163
            String[] attributesToReturn) throws NamingException {
164
        return (NamingEnumeration<SearchResult>) emptyEnum;
165
    }
166
167
    @Override
168
    @SuppressWarnings("unchecked")
169
    public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes,
170
            String[] attributesToReturn) throws NamingException {
171
        return (NamingEnumeration<SearchResult>) emptyEnum;
172
    }
173
174
    @Override
175
    @SuppressWarnings("unchecked")
176
    public NamingEnumeration<SearchResult> search(Name name, Attributes matchingAttributes)
177
            throws NamingException {
178
        return (NamingEnumeration<SearchResult>) emptyEnum;
179
    }
180
181
    @Override
182
    @SuppressWarnings("unchecked")
183
    public NamingEnumeration<SearchResult> search(String name, Attributes matchingAttributes)
184
            throws NamingException {
185
        return (NamingEnumeration<SearchResult>) emptyEnum;
186
    }
187
188
    @Override
189
    @SuppressWarnings("unchecked")
190
    public NamingEnumeration<SearchResult> search(Name name, String filter, SearchControls cons)
191
            throws NamingException {
192
        return (NamingEnumeration<SearchResult>) emptyEnum;
193
    }
194
195
    @Override
196
    @SuppressWarnings("unchecked")
197
    public NamingEnumeration<SearchResult> search(String name, String filter, SearchControls cons)
198
            throws NamingException {
199
        return (NamingEnumeration<SearchResult>) emptyEnum;
200
    }
201
202
    @Override
203
    @SuppressWarnings("unchecked")
204
    public NamingEnumeration<SearchResult> search(Name name, String filterExpr,
205
            Object[] filterArgs, SearchControls cons) throws NamingException {
206
        return (NamingEnumeration<SearchResult>) emptyEnum;
207
    }
208
209
    @Override
210
    @SuppressWarnings("unchecked")
211
    public NamingEnumeration<SearchResult> search(String name, String filterExpr,
212
            Object[] filterArgs, SearchControls cons) throws NamingException {
213
        return (NamingEnumeration<SearchResult>) emptyEnum;
214
    }
215
216
    @Override
217
    public Object lookup(Name name) throws NamingException {
218
        throw nameNotFoundException;
219
    }
220
221
    @Override
222
    public Object lookup(String name) throws NamingException {
223
        throw nameNotFoundException;
224
    }
225
226
    @Override
227
    public void bind(Name name, Object obj) throws NamingException {
228
        // no op
229
    }
230
231
    @Override
232
    public void bind(String name, Object obj) throws NamingException {
233
        // no op
234
    }
235
236
    @Override
237
    public void rebind(Name name, Object obj) throws NamingException {
238
        // no op
239
    }
240
241
    @Override
242
    public void rebind(String name, Object obj) throws NamingException {
243
        // no op
244
    }
245
246
    @Override
247
    public void unbind(Name name) throws NamingException {
248
        // no op
249
    }
250
251
    @Override
252
    public void unbind(String name) throws NamingException {
253
        // no op
254
    }
255
256
    @Override
257
    public void rename(Name oldName, Name newName) throws NamingException {
258
        // no op
259
    }
260
261
    @Override
262
    public void rename(String oldName, String newName) throws NamingException {
263
        // no op
264
    }
265
266
    @Override
267
    @SuppressWarnings("unchecked")
268
    public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
269
        return (NamingEnumeration<NameClassPair>) emptyEnum;
270
    }
271
272
    @Override
273
    @SuppressWarnings("unchecked")
274
    public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
275
        return (NamingEnumeration<NameClassPair>) emptyEnum;
276
    }
277
278
    @Override
279
    @SuppressWarnings("unchecked")
280
    public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
281
        return (NamingEnumeration<Binding>) emptyEnum;
282
    }
283
284
    @Override
285
    @SuppressWarnings("unchecked")
286
    public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
287
        return (NamingEnumeration<Binding>) emptyEnum;
288
    }
289
290
    @Override
291
    public void destroySubcontext(Name name) throws NamingException {
292
        // no op
293
    }
294
295
    @Override
296
    public void destroySubcontext(String name) throws NamingException {
297
        // no op
298
    }
299
300
    @Override
301
    public Context createSubcontext(Name name) throws NamingException {
302
        return this;
303
    }
304
305
    @Override
306
    public Context createSubcontext(String name) throws NamingException {
307
        return this;
308
    }
309
310
    @Override
311
    public Object lookupLink(Name name) throws NamingException {
312
        throw nameNotFoundException;
313
    }
314
315
    @Override
316
    public Object lookupLink(String name) throws NamingException {
317
        throw nameNotFoundException;
318
    }
319
320
    @Override
321
    public NameParser getNameParser(Name name) throws NamingException {
322
        return nameParser;
323
    }
324
325
    @Override
326
    public NameParser getNameParser(String name) throws NamingException {
327
        return nameParser;
328
    }
329
330
    @Override
331
    public Name composeName(Name name, Name prefix) throws NamingException {
332
        return emptyName;
333
    }
334
335
    @Override
336
    public String composeName(String name, String prefix) throws NamingException {
337
        return emptyString;
338
    }
339
340
    @Override
341
    public Object addToEnvironment(String propName, Object propVal) throws NamingException {
342
        return null;
343
    }
344
345
    @Override
346
    public Object removeFromEnvironment(String propName) throws NamingException {
347
        return null;
348
    }
349
350
    @Override
351
    public Hashtable<?, ?> getEnvironment() throws NamingException {
352
        return emptyEnv;
353
    }
354
355
    @Override
356
    public void close() throws NamingException {
357
        // NO OP
358
    }
359
360
    @Override
361
    public String getNameInNamespace() throws NamingException {
362
        return emptyString;
363
    }
364
365
    class EmptyNamingEnumImpl<T> implements NamingEnumeration<T> {
366
367
        Enumeration<T> elements = new Vector<T>().elements();
368
369
        @Override
370
        public T next() throws NamingException {
371
            return nextElement();
372
        }
373
374
        @Override
375
        public boolean hasMore() throws NamingException {
376
            return hasMoreElements();
377
        }
378
379
        @Override
380
        public void close() throws NamingException {
381
            elements = null;
382
        }
383
384
        @Override
385
        public boolean hasMoreElements() {
386
            return elements.hasMoreElements();
387
        }
388
389
        @Override
390
        public T nextElement() {
391
            return elements.nextElement();
392
        }
393
    }
394
395
    class NameParserImpl implements NameParser {
396
397
        @Override
398
        public Name parse(String name) throws NamingException {
399
            return emptyName;
400
        }
401
    }
402
403
}
(-)test/javax/servlet/http/TestHttpServlet.java (-4 / +3 lines)
Lines 38-46 public class TestHttpServlet extends TomcatBaseTest { Link Here
38
    public void testBug53454() throws Exception {
38
    public void testBug53454() throws Exception {
39
        Tomcat tomcat = getTomcatInstance();
39
        Tomcat tomcat = getTomcatInstance();
40
40
41
        // Must have a real docBase - just use temp
41
        // No file system docBase required
42
        StandardContext ctx = (StandardContext)
42
        StandardContext ctx = (StandardContext)
43
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
43
            tomcat.addContext("", null);
44
44
45
        // Map the test Servlet
45
        // Map the test Servlet
46
        LargeBodyServlet largeBodyServlet = new LargeBodyServlet();
46
        LargeBodyServlet largeBodyServlet = new LargeBodyServlet();
Lines 82-89 public class TestHttpServlet extends TomcatBaseTest { Link Here
82
        Tomcat tomcat = getTomcatInstance();
82
        Tomcat tomcat = getTomcatInstance();
83
83
84
        // No file system docBase required
84
        // No file system docBase required
85
        StandardContext ctx = (StandardContext) tomcat.addContext("",
85
        StandardContext ctx = (StandardContext) tomcat.addContext("", null);
86
                System.getProperty("java.io.tmpdir"));
87
86
88
        Bug57602ServletOuter outer = new Bug57602ServletOuter();
87
        Bug57602ServletOuter outer = new Bug57602ServletOuter();
89
        Tomcat.addServlet(ctx, "Bug57602ServletOuter", outer);
88
        Tomcat.addServlet(ctx, "Bug57602ServletOuter", outer);
(-)test/org/apache/catalina/authenticator/TestDigestAuthenticator.java (-3 / +2 lines)
Lines 269-277 public class TestDigestAuthenticator extends TomcatBaseTest { Link Here
269
        // Configure a context with digest auth and a single protected resource
269
        // Configure a context with digest auth and a single protected resource
270
        Tomcat tomcat = getTomcatInstance();
270
        Tomcat tomcat = getTomcatInstance();
271
271
272
        // Must have a real docBase - just use temp
272
        // No file system docBase required
273
        Context ctxt = tomcat.addContext(CONTEXT_PATH,
273
        Context ctxt = tomcat.addContext(CONTEXT_PATH, null);
274
                System.getProperty("java.io.tmpdir"));
275
274
276
        // Add protected servlet
275
        // Add protected servlet
277
        Tomcat.addServlet(ctxt, "TesterServlet", new TesterServlet());
276
        Tomcat.addServlet(ctxt, "TesterServlet", new TesterServlet());
(-)test/org/apache/catalina/authenticator/TestFormAuthenticator.java (-2 / +2 lines)
Lines 656-663 public class TestFormAuthenticator extends TomcatBaseTest { Link Here
656
656
657
            Tomcat tomcat = getTomcatInstance();
657
            Tomcat tomcat = getTomcatInstance();
658
658
659
            Context ctx = tomcat.addContext(
659
            // No file system docBase required
660
                    "", System.getProperty("java.io.tmpdir"));
660
            Context ctx = tomcat.addContext("", null);
661
            Tomcat.addServlet(ctx, "SelectedMethods",
661
            Tomcat.addServlet(ctx, "SelectedMethods",
662
                    new SelectedMethodsServlet());
662
                    new SelectedMethodsServlet());
663
            ctx.addServletMapping("/test", "SelectedMethods");
663
            ctx.addServletMapping("/test", "SelectedMethods");
(-)test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java (-6 / +4 lines)
Lines 505-513 public class TestNonLoginAndBasicAuthenticator extends TomcatBaseTest { Link Here
505
505
506
    private void setUpNonLogin() throws Exception {
506
    private void setUpNonLogin() throws Exception {
507
507
508
        // Must have a real docBase for webapps - just use temp
508
        // No file system docBase required
509
        nonloginContext = tomcat.addContext(CONTEXT_PATH_NOLOGIN,
509
        nonloginContext = tomcat.addContext(CONTEXT_PATH_NOLOGIN, null);
510
                System.getProperty("java.io.tmpdir"));
511
        nonloginContext.setSessionTimeout(LONG_SESSION_TIMEOUT_MINS);
510
        nonloginContext.setSessionTimeout(LONG_SESSION_TIMEOUT_MINS);
512
511
513
        // Add protected servlet to the context
512
        // Add protected servlet to the context
Lines 542-550 public class TestNonLoginAndBasicAuthenticator extends TomcatBaseTest { Link Here
542
541
543
    private void setUpLogin() throws Exception {
542
    private void setUpLogin() throws Exception {
544
543
545
        // Must have a real docBase for webapps - just use temp
544
        // No file system docBase required
546
        basicContext = tomcat.addContext(CONTEXT_PATH_LOGIN,
545
        basicContext = tomcat.addContext(CONTEXT_PATH_LOGIN, null);
547
                System.getProperty("java.io.tmpdir"));
548
        basicContext.setSessionTimeout(SHORT_SESSION_TIMEOUT_MINS);
546
        basicContext.setSessionTimeout(SHORT_SESSION_TIMEOUT_MINS);
549
547
550
        // Add protected servlet to the context
548
        // Add protected servlet to the context
(-)test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java (-6 / +4 lines)
Lines 479-487 public class TestSSOnonLoginAndBasicAuthenticator extends TomcatBaseTest { Link Here
479
479
480
    private void setUpNonLogin() throws Exception {
480
    private void setUpNonLogin() throws Exception {
481
481
482
        // Must have a real docBase for webapps - just use temp
482
        // No file system docBase required
483
        nonloginContext = tomcat.addContext(CONTEXT_PATH_NOLOGIN,
483
        nonloginContext = tomcat.addContext(CONTEXT_PATH_NOLOGIN, null);
484
                System.getProperty("java.io.tmpdir"));
485
        nonloginContext.setSessionTimeout(LONG_SESSION_TIMEOUT_MINS);
484
        nonloginContext.setSessionTimeout(LONG_SESSION_TIMEOUT_MINS);
486
485
487
        // Add protected servlet to the context
486
        // Add protected servlet to the context
Lines 518-526 public class TestSSOnonLoginAndBasicAuthenticator extends TomcatBaseTest { Link Here
518
517
519
    private void setUpLogin() throws Exception {
518
    private void setUpLogin() throws Exception {
520
519
521
        // Must have a real docBase for webapps - just use temp
520
        // No file system docBase required
522
        basicContext = tomcat.addContext(CONTEXT_PATH_LOGIN,
521
        basicContext = tomcat.addContext(CONTEXT_PATH_LOGIN, null);
523
                System.getProperty("java.io.tmpdir"));
524
        basicContext.setSessionTimeout(SHORT_SESSION_TIMEOUT_MINS);
522
        basicContext.setSessionTimeout(SHORT_SESSION_TIMEOUT_MINS);
525
523
526
        // Add protected servlet to the context
524
        // Add protected servlet to the context
(-)test/org/apache/catalina/authenticator/TestSSOnonLoginAndDigestAuthenticator.java (-6 / +4 lines)
Lines 329-337 public class TestSSOnonLoginAndDigestAuthenticator extends TomcatBaseTest { Link Here
329
329
330
    private void setUpNonLogin(Tomcat tomcat) throws Exception {
330
    private void setUpNonLogin(Tomcat tomcat) throws Exception {
331
331
332
        // Must have a real docBase for webapps - just use temp
332
        // No file system docBase required
333
        Context ctxt = tomcat.addContext(CONTEXT_PATH_NOLOGIN,
333
        Context ctxt = tomcat.addContext(CONTEXT_PATH_NOLOGIN, null);
334
                System.getProperty("java.io.tmpdir"));
335
        ctxt.setSessionTimeout(LONG_TIMEOUT_SECS);
334
        ctxt.setSessionTimeout(LONG_TIMEOUT_SECS);
336
335
337
        // Add protected servlet
336
        // Add protected servlet
Lines 363-371 public class TestSSOnonLoginAndDigestAuthenticator extends TomcatBaseTest { Link Here
363
362
364
    private void setUpDigest(Tomcat tomcat) throws Exception {
363
    private void setUpDigest(Tomcat tomcat) throws Exception {
365
364
366
        // Must have a real docBase for webapps - just use temp
365
        // No file system docBase required
367
        Context ctxt = tomcat.addContext(CONTEXT_PATH_DIGEST,
366
        Context ctxt = tomcat.addContext(CONTEXT_PATH_DIGEST, null);
368
                System.getProperty("java.io.tmpdir"));
369
        ctxt.setSessionTimeout(SHORT_TIMEOUT_SECS);
367
        ctxt.setSessionTimeout(SHORT_TIMEOUT_SECS);
370
368
371
        // Add protected servlet
369
        // Add protected servlet
(-)test/org/apache/catalina/comet/TestCometProcessor.java (-5 / +10 lines)
Lines 57-63 public class TestCometProcessor extends TomcatBaseTest { Link Here
57
57
58
        // Setup Tomcat instance
58
        // Setup Tomcat instance
59
        Tomcat tomcat = getTomcatInstance();
59
        Tomcat tomcat = getTomcatInstance();
60
        Context root = tomcat.addContext("", TEMP_DIR);
60
        // No file system docBase required
61
        Context root = tomcat.addContext("", null);
61
        Tomcat.addServlet(root, "comet", new SimpleCometServlet());
62
        Tomcat.addServlet(root, "comet", new SimpleCometServlet());
62
        root.addServletMapping("/comet", "comet");
63
        root.addServletMapping("/comet", "comet");
63
        Tomcat.addServlet(root, "hello", new HelloWorldServlet());
64
        Tomcat.addServlet(root, "hello", new HelloWorldServlet());
Lines 124-130 public class TestCometProcessor extends TomcatBaseTest { Link Here
124
125
125
        // Setup Tomcat instance
126
        // Setup Tomcat instance
126
        Tomcat tomcat = getTomcatInstance();
127
        Tomcat tomcat = getTomcatInstance();
127
        Context root = tomcat.addContext("", TEMP_DIR);
128
        // No file system docBase required
129
        Context root = tomcat.addContext("", null);
128
        Tomcat.addServlet(root, "comet", new CometCloseServlet());
130
        Tomcat.addServlet(root, "comet", new CometCloseServlet());
129
        root.addServletMapping("/comet", "comet");
131
        root.addServletMapping("/comet", "comet");
130
        Tomcat.addServlet(root, "hello", new HelloWorldServlet());
132
        Tomcat.addServlet(root, "hello", new HelloWorldServlet());
Lines 195-201 public class TestCometProcessor extends TomcatBaseTest { Link Here
195
197
196
        // Setup Tomcat instance
198
        // Setup Tomcat instance
197
        Tomcat tomcat = getTomcatInstance();
199
        Tomcat tomcat = getTomcatInstance();
198
        Context root = tomcat.addContext("", TEMP_DIR);
200
        // No file system docBase required
201
        Context root = tomcat.addContext("", null);
199
        Tomcat.addServlet(root, "comet", new ConnectionCloseServlet());
202
        Tomcat.addServlet(root, "comet", new ConnectionCloseServlet());
200
        root.addServletMapping("/comet", "comet");
203
        root.addServletMapping("/comet", "comet");
201
        Tomcat.addServlet(root, "hello", new HelloWorldServlet());
204
        Tomcat.addServlet(root, "hello", new HelloWorldServlet());
Lines 268-274 public class TestCometProcessor extends TomcatBaseTest { Link Here
268
271
269
        // Setup Tomcat instance
272
        // Setup Tomcat instance
270
        Tomcat tomcat = getTomcatInstance();
273
        Tomcat tomcat = getTomcatInstance();
271
        Context root = tomcat.addContext("", TEMP_DIR);
274
        // No file system docBase required
275
        Context root = tomcat.addContext("", null);
272
        Wrapper w = Tomcat.addServlet(root, "comet", new SimpleCometServlet());
276
        Wrapper w = Tomcat.addServlet(root, "comet", new SimpleCometServlet());
273
        if (initParam != null) {
277
        if (initParam != null) {
274
            w.addInitParameter(initParam, "true");
278
            w.addInitParameter(initParam, "true");
Lines 363-369 public class TestCometProcessor extends TomcatBaseTest { Link Here
363
        // Setup Tomcat instance
367
        // Setup Tomcat instance
364
        SimpleCometServlet servlet = new SimpleCometServlet();
368
        SimpleCometServlet servlet = new SimpleCometServlet();
365
        Tomcat tomcat = getTomcatInstance();
369
        Tomcat tomcat = getTomcatInstance();
366
        Context root = tomcat.addContext("", TEMP_DIR);
370
        // No file system docBase required
371
        Context root = tomcat.addContext("", null);
367
        Tomcat.addServlet(root, "comet", servlet);
372
        Tomcat.addServlet(root, "comet", servlet);
368
        root.addServletMapping("/", "comet");
373
        root.addServletMapping("/", "comet");
369
        tomcat.start();
374
        tomcat.start();
(-)test/org/apache/catalina/connector/TestConnector.java (-1 / +2 lines)
Lines 39-45 public class TestConnector extends TomcatBaseTest { Link Here
39
    public void testStop() throws Exception {
39
    public void testStop() throws Exception {
40
        Tomcat tomcat = getTomcatInstance();
40
        Tomcat tomcat = getTomcatInstance();
41
41
42
        Context root = tomcat.addContext("", TEMP_DIR);
42
        // No file system docBase required
43
        Context root = tomcat.addContext("", null);
43
        Wrapper w =
44
        Wrapper w =
44
            Tomcat.addServlet(root, "tester", new TesterServlet());
45
            Tomcat.addServlet(root, "tester", new TesterServlet());
45
        w.setAsyncSupported(true);
46
        w.setAsyncSupported(true);
(-)test/org/apache/catalina/connector/TestCoyoteAdapter.java (-12 / +8 lines)
Lines 131-139 public class TestCoyoteAdapter extends TomcatBaseTest { Link Here
131
        // Setup Tomcat instance
131
        // Setup Tomcat instance
132
        Tomcat tomcat = getTomcatInstance();
132
        Tomcat tomcat = getTomcatInstance();
133
133
134
        // Must have a real docBase - just use temp
134
        // No file system docBase required
135
        Context ctx =
135
        Context ctx = tomcat.addContext("", null);
136
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
137
136
138
        Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
137
        Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
139
        ctx.addServletMapping("/", "servlet");
138
        ctx.addServletMapping("/", "servlet");
Lines 185-193 public class TestCoyoteAdapter extends TomcatBaseTest { Link Here
185
        // Setup Tomcat instance
184
        // Setup Tomcat instance
186
        Tomcat tomcat = getTomcatInstance();
185
        Tomcat tomcat = getTomcatInstance();
187
186
188
        // Must have a real docBase - just use temp
187
        // No file system docBase required
189
        Context ctx =
188
        Context ctx = tomcat.addContext("/testapp", null);
190
            tomcat.addContext("/testapp", System.getProperty("java.io.tmpdir"));
191
189
192
        Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
190
        Tomcat.addServlet(ctx, "servlet", new PathParamServlet());
193
        ctx.addServletMapping("*.txt", "servlet");
191
        ctx.addServletMapping("*.txt", "servlet");
Lines 236-244 public class TestCoyoteAdapter extends TomcatBaseTest { Link Here
236
234
237
        tomcat.getConnector().setURIEncoding(encoding);
235
        tomcat.getConnector().setURIEncoding(encoding);
238
236
239
        // Must have a real docBase - just use temp
237
        // No file system docBase required
240
        Context ctx =
238
        Context ctx = tomcat.addContext("", null);
241
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
242
239
243
        PathInfoServlet servlet = new PathInfoServlet();
240
        PathInfoServlet servlet = new PathInfoServlet();
244
        Tomcat.addServlet(ctx, "servlet", servlet);
241
        Tomcat.addServlet(ctx, "servlet", servlet);
Lines 278-286 public class TestCoyoteAdapter extends TomcatBaseTest { Link Here
278
        // Setup Tomcat instance
275
        // Setup Tomcat instance
279
        Tomcat tomcat = getTomcatInstance();
276
        Tomcat tomcat = getTomcatInstance();
280
277
281
        // Must have a real docBase - just use temp
278
        // No file system docBase required
282
        Context ctx =
279
        Context ctx = tomcat.addContext("", null);
283
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
284
280
285
        AsyncServlet servlet = new AsyncServlet();
281
        AsyncServlet servlet = new AsyncServlet();
286
        Wrapper w = Tomcat.addServlet(ctx, "async", servlet);
282
        Wrapper w = Tomcat.addServlet(ctx, "async", servlet);
(-)test/org/apache/catalina/connector/TestInputBuffer.java (-1 / +2 lines)
Lines 42-48 public class TestInputBuffer extends TomcatBaseTest { Link Here
42
    @Test
42
    @Test
43
    public void testUtf8Body() throws Exception {
43
    public void testUtf8Body() throws Exception {
44
        Tomcat tomcat = getTomcatInstance();
44
        Tomcat tomcat = getTomcatInstance();
45
        Context root = tomcat.addContext("", TEMP_DIR);
45
        // No file system docBase required
46
        Context root = tomcat.addContext("", null);
46
        Tomcat.addServlet(root, "Echo", new Utf8Echo());
47
        Tomcat.addServlet(root, "Echo", new Utf8Echo());
47
        root.addServletMapping("/test", "Echo");
48
        root.addServletMapping("/test", "Echo");
48
49
(-)test/org/apache/catalina/connector/TestKeepAliveCount.java (-1 / +2 lines)
Lines 56-62 public class TestKeepAliveCount extends TomcatBaseTest { Link Here
56
            if (init) return;
56
            if (init) return;
57
57
58
            Tomcat tomcat = getTomcatInstance();
58
            Tomcat tomcat = getTomcatInstance();
59
            Context root = tomcat.addContext("", TEMP_DIR);
59
            // No file system docBase required
60
            Context root = tomcat.addContext("", null);
60
            Tomcat.addServlet(root, "Simple", new SimpleServlet());
61
            Tomcat.addServlet(root, "Simple", new SimpleServlet());
61
            root.addServletMapping("/test", "Simple");
62
            root.addServletMapping("/test", "Simple");
62
            tomcat.getConnector().setProperty("maxKeepAliveRequests", "5");
63
            tomcat.getConnector().setProperty("maxKeepAliveRequests", "5");
(-)test/org/apache/catalina/connector/TestMaxConnections.java (-1 / +2 lines)
Lines 70-76 public class TestMaxConnections extends TomcatBaseTest { Link Here
70
70
71
    private synchronized void init() throws Exception {
71
    private synchronized void init() throws Exception {
72
        Tomcat tomcat = getTomcatInstance();
72
        Tomcat tomcat = getTomcatInstance();
73
        Context root = tomcat.addContext("", SimpleHttpClient.TEMP_DIR);
73
        // No file system docBase required
74
        Context root = tomcat.addContext("", null);
74
        Tomcat.addServlet(root, "Simple", new SimpleServlet());
75
        Tomcat.addServlet(root, "Simple", new SimpleServlet());
75
        root.addServletMapping("/test", "Simple");
76
        root.addServletMapping("/test", "Simple");
76
        tomcat.getConnector().setProperty("maxKeepAliveRequests", "1");
77
        tomcat.getConnector().setProperty("maxKeepAliveRequests", "1");
(-)test/org/apache/catalina/connector/TestOutputBuffer.java (-2 / +4 lines)
Lines 39-45 public class TestOutputBuffer extends TomcatBaseTest{ Link Here
39
    public void testWriteSpeed() throws Exception {
39
    public void testWriteSpeed() throws Exception {
40
        Tomcat tomcat = getTomcatInstance();
40
        Tomcat tomcat = getTomcatInstance();
41
41
42
        Context root = tomcat.addContext("", TEMP_DIR);
42
        // No file system docBase required
43
        Context root = tomcat.addContext("", null);
43
44
44
        for (int i = 1; i <= WritingServlet.EXPECTED_CONTENT_LENGTH; i*=10) {
45
        for (int i = 1; i <= WritingServlet.EXPECTED_CONTENT_LENGTH; i*=10) {
45
            WritingServlet servlet = new WritingServlet(i);
46
            WritingServlet servlet = new WritingServlet(i);
Lines 74-80 public class TestOutputBuffer extends TomcatBaseTest{ Link Here
74
    public void testBug52577() throws Exception {
75
    public void testBug52577() throws Exception {
75
        Tomcat tomcat = getTomcatInstance();
76
        Tomcat tomcat = getTomcatInstance();
76
77
77
        Context root = tomcat.addContext("", TEMP_DIR);
78
        // No file system docBase required
79
        Context root = tomcat.addContext("", null);
78
80
79
        Bug52577Servlet bug52577 = new Bug52577Servlet();
81
        Bug52577Servlet bug52577 = new Bug52577Servlet();
80
        Tomcat.addServlet(root, "bug52577", bug52577);
82
        Tomcat.addServlet(root, "bug52577", bug52577);
(-)test/org/apache/catalina/connector/TestRequest.java (-17 / +16 lines)
Lines 175-181 public class TestRequest extends TomcatBaseTest { Link Here
175
            if (init) return;
175
            if (init) return;
176
176
177
            Tomcat tomcat = getTomcatInstance();
177
            Tomcat tomcat = getTomcatInstance();
178
            Context root = tomcat.addContext("", TEMP_DIR);
178
            // No file system docBase required
179
            Context root = tomcat.addContext("", null);
179
            Tomcat.addServlet(root, "Bug37794", new Bug37794Servlet());
180
            Tomcat.addServlet(root, "Bug37794", new Bug37794Servlet());
180
            root.addServletMapping("/test", "Bug37794");
181
            root.addServletMapping("/test", "Bug37794");
181
182
Lines 272-280 public class TestRequest extends TomcatBaseTest { Link Here
272
        // Setup Tomcat instance
273
        // Setup Tomcat instance
273
        Tomcat tomcat = getTomcatInstance();
274
        Tomcat tomcat = getTomcatInstance();
274
275
275
        // Must have a real docBase - just use temp
276
        // No file system docBase required
276
        Context ctx =
277
        Context ctx = tomcat.addContext("", null);
277
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
278
278
279
        // Add the Servlet
279
        // Add the Servlet
280
        Tomcat.addServlet(ctx, "servlet", new EchoQueryStringServlet());
280
        Tomcat.addServlet(ctx, "servlet", new EchoQueryStringServlet());
Lines 317-325 public class TestRequest extends TomcatBaseTest { Link Here
317
        // Setup Tomcat instance
317
        // Setup Tomcat instance
318
        Tomcat tomcat = getTomcatInstance();
318
        Tomcat tomcat = getTomcatInstance();
319
319
320
        // Must have a real docBase - just use temp
320
        // No file system docBase required
321
        Context ctx =
321
        Context ctx = tomcat.addContext("", null);
322
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
323
322
324
        LoginConfig config = new LoginConfig();
323
        LoginConfig config = new LoginConfig();
325
        config.setAuthMethod("BASIC");
324
        config.setAuthMethod("BASIC");
Lines 371-378 public class TestRequest extends TomcatBaseTest { Link Here
371
    @Test
370
    @Test
372
    public void testBug49424NoChunking() throws Exception {
371
    public void testBug49424NoChunking() throws Exception {
373
        Tomcat tomcat = getTomcatInstance();
372
        Tomcat tomcat = getTomcatInstance();
374
        Context root = tomcat.addContext("",
373
        // No file system docBase required
375
                System.getProperty("java.io.tmpdir"));
374
        Context root = tomcat.addContext("", null);
376
        Tomcat.addServlet(root, "Bug37794", new Bug37794Servlet());
375
        Tomcat.addServlet(root, "Bug37794", new Bug37794Servlet());
377
        root.addServletMapping("/", "Bug37794");
376
        root.addServletMapping("/", "Bug37794");
378
        tomcat.start();
377
        tomcat.start();
Lines 385-392 public class TestRequest extends TomcatBaseTest { Link Here
385
    @Test
384
    @Test
386
    public void testBug49424WithChunking() throws Exception {
385
    public void testBug49424WithChunking() throws Exception {
387
        Tomcat tomcat = getTomcatInstance();
386
        Tomcat tomcat = getTomcatInstance();
388
        Context root = tomcat.addContext("",
387
        // No file system docBase required
389
                System.getProperty("java.io.tmpdir"));
388
        Context root = tomcat.addContext("", null);
390
        Tomcat.addServlet(root, "Bug37794", new Bug37794Servlet());
389
        Tomcat.addServlet(root, "Bug37794", new Bug37794Servlet());
391
        root.addServletMapping("/", "Bug37794");
390
        root.addServletMapping("/", "Bug37794");
392
        tomcat.start();
391
        tomcat.start();
Lines 477-484 public class TestRequest extends TomcatBaseTest { Link Here
477
    @Test
476
    @Test
478
    public void testBug54984() throws Exception {
477
    public void testBug54984() throws Exception {
479
        Tomcat tomcat = getTomcatInstance();
478
        Tomcat tomcat = getTomcatInstance();
480
        Context root = tomcat.addContext("",
479
        // No file system docBase required
481
                System.getProperty("java.io.tmpdir"));
480
        Context root = tomcat.addContext("", null);
482
        root.setAllowCasualMultipartParsing(true);
481
        root.setAllowCasualMultipartParsing(true);
483
        Tomcat.addServlet(root, "Bug54984", new Bug54984Servlet());
482
        Tomcat.addServlet(root, "Bug54984", new Bug54984Servlet());
484
        root.addServletMapping("/", "Bug54984");
483
        root.addServletMapping("/", "Bug54984");
Lines 555-561 public class TestRequest extends TomcatBaseTest { Link Here
555
            if (init) return;
554
            if (init) return;
556
555
557
            Tomcat tomcat = getTomcatInstance();
556
            Tomcat tomcat = getTomcatInstance();
558
            Context root = tomcat.addContext("", TEMP_DIR);
557
            // No file system docBase required
558
            Context root = tomcat.addContext("", null);
559
            Tomcat.addServlet(root, "EchoParameters", new EchoParametersServlet());
559
            Tomcat.addServlet(root, "EchoParameters", new EchoParametersServlet());
560
            root.addServletMapping("/echo", "EchoParameters");
560
            root.addServletMapping("/echo", "EchoParameters");
561
            tomcat.start();
561
            tomcat.start();
Lines 818-826 public class TestRequest extends TomcatBaseTest { Link Here
818
        // Setup Tomcat instance
818
        // Setup Tomcat instance
819
        Tomcat tomcat = getTomcatInstance();
819
        Tomcat tomcat = getTomcatInstance();
820
820
821
        // Must have a real docBase - just use temp
821
        // No file system docBase required
822
        Context ctx = tomcat.addContext(deployPath,
822
        Context ctx = tomcat.addContext(deployPath, null);
823
                System.getProperty("java.io.tmpdir"));
824
823
825
        Tomcat.addServlet(ctx, "servlet", new Bug56501Servelet());
824
        Tomcat.addServlet(ctx, "servlet", new Bug56501Servelet());
826
        ctx.addServletMapping("/*", "servlet");
825
        ctx.addServletMapping("/*", "servlet");
(-)test/org/apache/catalina/connector/TestResponse.java (-9 / +6 lines)
Lines 51-59 public class TestResponse extends TomcatBaseTest { Link Here
51
        // Setup Tomcat instance
51
        // Setup Tomcat instance
52
        Tomcat tomcat = getTomcatInstance();
52
        Tomcat tomcat = getTomcatInstance();
53
53
54
        // Must have a real docBase - just use temp
54
        // No file system docBase required
55
        File docBase = new File(System.getProperty("java.io.tmpdir"));
55
        Context ctx = tomcat.addContext("", null);
56
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
57
56
58
        Tomcat.addServlet(ctx, "servlet", new Bug49598Servlet());
57
        Tomcat.addServlet(ctx, "servlet", new Bug49598Servlet());
59
        ctx.addServletMapping("/", "servlet");
58
        ctx.addServletMapping("/", "servlet");
Lines 108-116 public class TestResponse extends TomcatBaseTest { Link Here
108
        // Setup Tomcat instance
107
        // Setup Tomcat instance
109
        Tomcat tomcat = getTomcatInstance();
108
        Tomcat tomcat = getTomcatInstance();
110
109
111
        // Must have a real docBase - just use temp
110
        // No file system docBase required
112
        File docBase = new File(System.getProperty("java.io.tmpdir"));
111
        Context ctx = tomcat.addContext("", null);
113
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
114
112
115
        Tomcat.addServlet(ctx, "servlet", new CharsetServlet());
113
        Tomcat.addServlet(ctx, "servlet", new CharsetServlet());
116
        ctx.addServletMapping("/", "servlet");
114
        ctx.addServletMapping("/", "servlet");
Lines 148-156 public class TestResponse extends TomcatBaseTest { Link Here
148
        // Setup Tomcat instance
146
        // Setup Tomcat instance
149
        Tomcat tomcat = getTomcatInstance();
147
        Tomcat tomcat = getTomcatInstance();
150
148
151
        // Must have a real docBase - just use temp
149
        // No file system docBase required
152
        File docBase = new File(System.getProperty("java.io.tmpdir"));
150
        Context ctx = tomcat.addContext("", null);
153
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
154
151
155
        Tomcat.addServlet(ctx, "servlet", new Bug52811Servlet());
152
        Tomcat.addServlet(ctx, "servlet", new Bug52811Servlet());
156
        ctx.addServletMapping("/", "servlet");
153
        ctx.addServletMapping("/", "servlet");
(-)test/org/apache/catalina/core/TestApplicationContext.java (-2 / +4 lines)
Lines 171-180 public class TestApplicationContext extends TomcatBaseTest { Link Here
171
        foo2.addLifecycleListener(new SetIdListener("foo2"));
171
        foo2.addLifecycleListener(new SetIdListener("foo2"));
172
        tomcat.getHost().addChild(foo2);
172
        tomcat.getHost().addChild(foo2);
173
173
174
        Context bar = tomcat.addContext("/bar", System.getProperty("java.io.tmpdir"));
174
        // No file system docBase required
175
        Context bar = tomcat.addContext("/bar", null);
175
        bar.addLifecycleListener(new SetIdListener("bar"));
176
        bar.addLifecycleListener(new SetIdListener("bar"));
176
177
177
        Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir"));
178
        // No file system docBase required
179
        Context ctx = tomcat.addContext("", null);
178
        ctx.addLifecycleListener(new SetIdListener("ROOT"));
180
        ctx.addLifecycleListener(new SetIdListener("ROOT"));
179
        ctx.setCrossContext(true);
181
        ctx.setCrossContext(true);
180
182
(-)test/org/apache/catalina/core/TestApplicationFilterConfig.java (-3 / +2 lines)
Lines 37-45 public class TestApplicationFilterConfig extends TomcatBaseTest { Link Here
37
    public void testBug54170() throws Exception {
37
    public void testBug54170() throws Exception {
38
        Tomcat tomcat = getTomcatInstance();
38
        Tomcat tomcat = getTomcatInstance();
39
39
40
        // Must have a real docBase - just use temp
40
        // No file system docBase required
41
        Context ctx =
41
        Context ctx = tomcat.addContext("", null);
42
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
43
42
44
        Tomcat.addServlet(ctx, "HelloWorld", new HelloWorldServlet());
43
        Tomcat.addServlet(ctx, "HelloWorld", new HelloWorldServlet());
45
        ctx.addServletMapping("/", "HelloWorld");
44
        ctx.addServletMapping("/", "HelloWorld");
(-)test/org/apache/catalina/core/TestAsyncContextImpl.java (-76 / +41 lines)
Lines 87-95 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
87
        // Setup Tomcat instance
87
        // Setup Tomcat instance
88
        Tomcat tomcat = getTomcatInstance();
88
        Tomcat tomcat = getTomcatInstance();
89
89
90
        // Must have a real docBase - just use temp
90
        // No file system docBase required
91
        Context ctx =
91
        Context ctx = tomcat.addContext("", null);
92
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
93
92
94
        Bug49528Servlet servlet = new Bug49528Servlet();
93
        Bug49528Servlet servlet = new Bug49528Servlet();
95
94
Lines 125-133 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
125
        // Setup Tomcat instance
124
        // Setup Tomcat instance
126
        Tomcat tomcat = getTomcatInstance();
125
        Tomcat tomcat = getTomcatInstance();
127
126
128
        // Must have a real docBase - just use temp
127
        // No file system docBase required
129
        Context ctx =
128
        Context ctx = tomcat.addContext("", null);
130
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
131
129
132
        Bug49567Servlet servlet = new Bug49567Servlet();
130
        Bug49567Servlet servlet = new Bug49567Servlet();
133
131
Lines 168-176 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
168
        tomcat.getConnector().setAttribute(
166
        tomcat.getConnector().setAttribute(
169
                "connectionTimeout", Integer.valueOf(3000));
167
                "connectionTimeout", Integer.valueOf(3000));
170
168
171
        // Must have a real docBase - just use temp
169
        // No file system docBase required
172
        Context ctx =
170
        Context ctx = tomcat.addContext("", null);
173
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
174
171
175
        AsyncStartNoCompleteServlet servlet =
172
        AsyncStartNoCompleteServlet servlet =
176
            new AsyncStartNoCompleteServlet();
173
            new AsyncStartNoCompleteServlet();
Lines 208-216 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
208
        // Setup Tomcat instance
205
        // Setup Tomcat instance
209
        Tomcat tomcat = getTomcatInstance();
206
        Tomcat tomcat = getTomcatInstance();
210
207
211
        // Must have a real docBase - just use temp
208
        // No file system docBase required
212
        Context ctx =
209
        Context ctx = tomcat.addContext("", null);
213
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
214
210
215
        AsyncStartWithCompleteServlet servlet =
211
        AsyncStartWithCompleteServlet servlet =
216
            new AsyncStartWithCompleteServlet();
212
            new AsyncStartWithCompleteServlet();
Lines 466-475 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
466
        // Setup Tomcat instance
462
        // Setup Tomcat instance
467
        Tomcat tomcat = getTomcatInstance();
463
        Tomcat tomcat = getTomcatInstance();
468
464
469
        // Must have a real docBase - just use temp
465
        // No file system docBase required
470
        File docBase = new File(System.getProperty("java.io.tmpdir"));
466
        Context ctx = tomcat.addContext("", null);
471
472
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
473
467
474
        TimeoutServlet timeout = new TimeoutServlet(completeOnTimeout, dispatchUrl);
468
        TimeoutServlet timeout = new TimeoutServlet(completeOnTimeout, dispatchUrl);
475
469
Lines 624-633 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
624
        // Setup Tomcat instance
618
        // Setup Tomcat instance
625
        Tomcat tomcat = getTomcatInstance();
619
        Tomcat tomcat = getTomcatInstance();
626
620
627
        // Must have a real docBase - just use temp
621
        // No file system docBase required
628
        File docBase = new File(System.getProperty("java.io.tmpdir"));
622
        Context ctx = tomcat.addContext("", null);
629
630
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
631
623
632
        DispatchingServlet dispatch = new DispatchingServlet(false, false);
624
        DispatchingServlet dispatch = new DispatchingServlet(false, false);
633
        Wrapper wrapper = Tomcat.addServlet(ctx, "dispatch", dispatch);
625
        Wrapper wrapper = Tomcat.addServlet(ctx, "dispatch", dispatch);
Lines 745-754 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
745
        // Setup Tomcat instance
737
        // Setup Tomcat instance
746
        Tomcat tomcat = getTomcatInstance();
738
        Tomcat tomcat = getTomcatInstance();
747
739
748
        // Must have a real docBase - just use temp
740
        // No file system docBase required
749
        File docBase = new File(System.getProperty("java.io.tmpdir"));
741
        Context ctx = tomcat.addContext("", null);
750
751
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
752
742
753
        TrackingServlet tracking = new TrackingServlet();
743
        TrackingServlet tracking = new TrackingServlet();
754
        Wrapper wrapper = Tomcat.addServlet(ctx, "tracking", tracking);
744
        Wrapper wrapper = Tomcat.addServlet(ctx, "tracking", tracking);
Lines 969-978 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
969
        // Setup Tomcat instance
959
        // Setup Tomcat instance
970
        Tomcat tomcat = getTomcatInstance();
960
        Tomcat tomcat = getTomcatInstance();
971
961
972
        // Must have a real docBase - just use temp
962
        // No file system docBase required
973
        File docBase = new File(System.getProperty("java.io.tmpdir"));
963
        Context ctx = tomcat.addContext("", null);
974
975
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
976
964
977
        DispatchingServlet dispatch =
965
        DispatchingServlet dispatch =
978
            new DispatchingServlet(true, completeOnError);
966
            new DispatchingServlet(true, completeOnError);
Lines 1050-1059 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
1050
        // Setup Tomcat instance
1038
        // Setup Tomcat instance
1051
        Tomcat tomcat = getTomcatInstance();
1039
        Tomcat tomcat = getTomcatInstance();
1052
1040
1053
        // Must have a real docBase - just use temp
1041
        // No file system docBase required
1054
        File docBase = new File(System.getProperty("java.io.tmpdir"));
1042
        Context ctx = tomcat.addContext("", null);
1055
1056
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
1057
1043
1058
        AsyncStartRunnable servlet = new AsyncStartRunnable();
1044
        AsyncStartRunnable servlet = new AsyncStartRunnable();
1059
        Wrapper wrapper = Tomcat.addServlet(ctx, "servlet", servlet);
1045
        Wrapper wrapper = Tomcat.addServlet(ctx, "servlet", servlet);
Lines 1119-1127 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
1119
        // Setup Tomcat instance
1105
        // Setup Tomcat instance
1120
        Tomcat tomcat = getTomcatInstance();
1106
        Tomcat tomcat = getTomcatInstance();
1121
1107
1122
        // Must have a real docBase - just use temp
1108
        // No file system docBase required
1123
        Context ctx =
1109
        Context ctx = tomcat.addContext("", null);
1124
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
1125
1110
1126
        Bug50753Servlet servlet = new Bug50753Servlet();
1111
        Bug50753Servlet servlet = new Bug50753Servlet();
1127
1112
Lines 1184-1193 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
1184
        // Setup Tomcat instance
1169
        // Setup Tomcat instance
1185
        Tomcat tomcat = getTomcatInstance();
1170
        Tomcat tomcat = getTomcatInstance();
1186
1171
1187
        // Must have a real docBase - just use temp
1172
        // No file system docBase required
1188
        File docBase = new File(System.getProperty("java.io.tmpdir"));
1173
        Context ctx = tomcat.addContext("", null);
1189
1190
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
1191
1174
1192
        ErrorServlet error = new ErrorServlet();
1175
        ErrorServlet error = new ErrorServlet();
1193
        Tomcat.addServlet(ctx, "error", error);
1176
        Tomcat.addServlet(ctx, "error", error);
Lines 1220-1229 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
1220
        // Setup Tomcat instance
1203
        // Setup Tomcat instance
1221
        Tomcat tomcat = getTomcatInstance();
1204
        Tomcat tomcat = getTomcatInstance();
1222
1205
1223
        // Must have a real docBase - just use temp
1206
        // No file system docBase required
1224
        File docBase = new File(System.getProperty("java.io.tmpdir"));
1207
        Context ctx = tomcat.addContext("", null);
1225
1226
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
1227
1208
1228
        AsyncStatusServlet asyncStatusServlet =
1209
        AsyncStatusServlet asyncStatusServlet =
1229
            new AsyncStatusServlet(HttpServletResponse.SC_BAD_REQUEST);
1210
            new AsyncStatusServlet(HttpServletResponse.SC_BAD_REQUEST);
Lines 1300-1309 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
1300
        // Setup Tomcat instance
1281
        // Setup Tomcat instance
1301
        Tomcat tomcat = getTomcatInstance();
1282
        Tomcat tomcat = getTomcatInstance();
1302
1283
1303
        // Must have a real docBase - just use temp
1284
        // No file system docBase required
1304
        File docBase = new File(System.getProperty("java.io.tmpdir"));
1285
        Context ctx = tomcat.addContext("", null);
1305
1306
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
1307
1286
1308
        AsyncErrorServlet asyncErrorServlet =
1287
        AsyncErrorServlet asyncErrorServlet =
1309
            new AsyncErrorServlet(HttpServletResponse.SC_BAD_REQUEST, threaded);
1288
            new AsyncErrorServlet(HttpServletResponse.SC_BAD_REQUEST, threaded);
Lines 1419-1428 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
1419
        // Setup Tomcat instance
1398
        // Setup Tomcat instance
1420
        Tomcat tomcat = getTomcatInstance();
1399
        Tomcat tomcat = getTomcatInstance();
1421
1400
1422
        // Must have a real docBase - just use temp
1401
        // No file system docBase required
1423
        File docBase = new File(System.getProperty("java.io.tmpdir"));
1402
        Context ctx = tomcat.addContext("", null);
1424
1425
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
1426
        Wrapper a = Tomcat.addServlet(ctx, "ServletA", new Bug53337ServletA());
1403
        Wrapper a = Tomcat.addServlet(ctx, "ServletA", new Bug53337ServletA());
1427
        a.setAsyncSupported(true);
1404
        a.setAsyncSupported(true);
1428
        Wrapper b = Tomcat.addServlet(ctx, "ServletB", new Bug53337ServletB());
1405
        Wrapper b = Tomcat.addServlet(ctx, "ServletB", new Bug53337ServletB());
Lines 1500-1509 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
1500
        // Setup Tomcat instance
1477
        // Setup Tomcat instance
1501
        Tomcat tomcat = getTomcatInstance();
1478
        Tomcat tomcat = getTomcatInstance();
1502
1479
1503
        // Must have a real docBase - just use temp
1480
        // No file system docBase required
1504
        File docBase = new File(System.getProperty("java.io.tmpdir"));
1481
        Context ctx = tomcat.addContext("", null);
1505
1506
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
1507
        Bug53843ServletA servletA = new Bug53843ServletA();
1482
        Bug53843ServletA servletA = new Bug53843ServletA();
1508
        Wrapper a = Tomcat.addServlet(ctx, "ServletA", servletA);
1483
        Wrapper a = Tomcat.addServlet(ctx, "ServletA", servletA);
1509
        a.setAsyncSupported(true);
1484
        a.setAsyncSupported(true);
Lines 1614-1623 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
1614
        // Setup Tomcat instance
1589
        // Setup Tomcat instance
1615
        Tomcat tomcat = getTomcatInstance();
1590
        Tomcat tomcat = getTomcatInstance();
1616
1591
1617
        // Must have a real docBase - just use temp
1592
        // No file system docBase required
1618
        File docBase = new File(System.getProperty("java.io.tmpdir"));
1593
        Context ctx = tomcat.addContext("", null);
1619
1620
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
1621
1594
1622
        TimeoutServlet timeout = new TimeoutServlet(null, null);
1595
        TimeoutServlet timeout = new TimeoutServlet(null, null);
1623
        Wrapper w1 = Tomcat.addServlet(ctx, "time", timeout);
1596
        Wrapper w1 = Tomcat.addServlet(ctx, "time", timeout);
Lines 1745-1754 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
1745
        // Setup Tomcat instance
1718
        // Setup Tomcat instance
1746
        Tomcat tomcat = getTomcatInstance();
1719
        Tomcat tomcat = getTomcatInstance();
1747
1720
1748
        // Must have a real docBase - just use temp
1721
        // No file system docBase required
1749
        File docBase = new File(System.getProperty("java.io.tmpdir"));
1722
        Context ctx = tomcat.addContext("", null);
1750
1751
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
1752
1723
1753
        Bug54178ServletA bug54178ServletA = new Bug54178ServletA();
1724
        Bug54178ServletA bug54178ServletA = new Bug54178ServletA();
1754
        Wrapper wrapper =
1725
        Wrapper wrapper =
Lines 1850-1859 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
1850
        // Setup Tomcat instance
1821
        // Setup Tomcat instance
1851
        Tomcat tomcat = getTomcatInstance();
1822
        Tomcat tomcat = getTomcatInstance();
1852
1823
1853
        // Must have a real docBase - just use temp
1824
        // No file system docBase required
1854
        File docBase = new File(System.getProperty("java.io.tmpdir"));
1825
        Context ctx = tomcat.addContext("", null);
1855
1856
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
1857
1826
1858
        NonAsyncServlet nonAsyncServlet = new NonAsyncServlet();
1827
        NonAsyncServlet nonAsyncServlet = new NonAsyncServlet();
1859
        Wrapper wrapper = Tomcat.addServlet(ctx, "nonAsyncServlet",
1828
        Wrapper wrapper = Tomcat.addServlet(ctx, "nonAsyncServlet",
Lines 2002-2011 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
2002
        // Setup Tomcat instance
1971
        // Setup Tomcat instance
2003
        Tomcat tomcat = getTomcatInstance();
1972
        Tomcat tomcat = getTomcatInstance();
2004
1973
2005
        // Must have a real docBase - just use temp
1974
        // No file system docBase required
2006
        File docBase = new File(System.getProperty("java.io.tmpdir"));
1975
        Context ctx = tomcat.addContext(contextPath, null);
2007
2008
        Context ctx = tomcat.addContext(contextPath, docBase.getAbsolutePath());
2009
1976
2010
        DispatchingGenericServlet dispatch = new DispatchingGenericServlet();
1977
        DispatchingGenericServlet dispatch = new DispatchingGenericServlet();
2011
        Wrapper wrapper = Tomcat.addServlet(ctx, "dispatch", dispatch);
1978
        Wrapper wrapper = Tomcat.addServlet(ctx, "dispatch", dispatch);
Lines 2054-2062 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
2054
        // Setup Tomcat instance
2021
        // Setup Tomcat instance
2055
        Tomcat tomcat = getTomcatInstance();
2022
        Tomcat tomcat = getTomcatInstance();
2056
2023
2057
        // Must have a real docBase - just use temp
2024
        // No file system docBase required
2058
        File docBase = new File(System.getProperty("java.io.tmpdir"));
2025
        Context ctx = tomcat.addContext("", null);
2059
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
2060
2026
2061
        AsyncISEServlet servlet = new AsyncISEServlet();
2027
        AsyncISEServlet servlet = new AsyncISEServlet();
2062
2028
Lines 2125-2132 public class TestAsyncContextImpl extends TomcatBaseTest { Link Here
2125
        Tomcat tomcat = getTomcatInstance();
2091
        Tomcat tomcat = getTomcatInstance();
2126
2092
2127
        // No file system docBase required
2093
        // No file system docBase required
2128
        File docBase = new File(System.getProperty("java.io.tmpdir"));
2094
        Context ctx = tomcat.addContext("", null);
2129
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
2130
2095
2131
        Servlet stage1 = new DispatchingServletTracking("/stage2", true);
2096
        Servlet stage1 = new DispatchingServletTracking("/stage2", true);
2132
        Wrapper wrapper1 = Tomcat.addServlet(ctx, "stage1", stage1);
2097
        Wrapper wrapper1 = Tomcat.addServlet(ctx, "stage1", stage1);
(-)test/org/apache/catalina/core/TestNamingContextListener.java (-6 / +4 lines)
Lines 48-56 public class TestNamingContextListener extends TomcatBaseTest { Link Here
48
    public void testBug49132() throws Exception {
48
    public void testBug49132() throws Exception {
49
        Tomcat tomcat = getTomcatInstance();
49
        Tomcat tomcat = getTomcatInstance();
50
50
51
        // Must have a real docBase - just use temp
51
        // No file system docBase required
52
        org.apache.catalina.Context ctx =
52
        org.apache.catalina.Context ctx = tomcat.addContext("", null);
53
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
54
53
55
        // Enable JNDI - it is disabled by default
54
        // Enable JNDI - it is disabled by default
56
        tomcat.enableNaming();
55
        tomcat.enableNaming();
Lines 96-104 public class TestNamingContextListener extends TomcatBaseTest { Link Here
96
    public void testBug54096() throws Exception {
95
    public void testBug54096() throws Exception {
97
        Tomcat tomcat = getTomcatInstance();
96
        Tomcat tomcat = getTomcatInstance();
98
97
99
        // Must have a real docBase - just use temp
98
        // No file system docBase required
100
        org.apache.catalina.Context ctx =
99
        org.apache.catalina.Context ctx = tomcat.addContext("", null);
101
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
102
100
103
        // Enable JNDI - it is disabled by default
101
        // Enable JNDI - it is disabled by default
104
        tomcat.enableNaming();
102
        tomcat.enableNaming();
(-)test/org/apache/catalina/core/TestStandardContext.java (-6 / +4 lines)
Lines 418-426 public class TestStandardContext extends TomcatBaseTest { Link Here
418
        // Set up a container
418
        // Set up a container
419
        Tomcat tomcat = getTomcatInstance();
419
        Tomcat tomcat = getTomcatInstance();
420
420
421
        // Must have a real docBase - just use temp
421
        // No file system docBase required
422
        File docBase = new File(System.getProperty("java.io.tmpdir"));
422
        Context ctx = tomcat.addContext("", null);
423
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
424
423
425
        // Setup realm
424
        // Setup realm
426
        MapRealm realm = new MapRealm();
425
        MapRealm realm = new MapRealm();
Lines 501-509 public class TestStandardContext extends TomcatBaseTest { Link Here
501
        // Set up a container
500
        // Set up a container
502
        Tomcat tomcat = getTomcatInstance();
501
        Tomcat tomcat = getTomcatInstance();
503
502
504
        // Must have a real docBase - just use temp
503
        // No file system docBase required
505
        File docBase = new File(System.getProperty("java.io.tmpdir"));
504
        Context ctx = tomcat.addContext("", null);
506
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
507
505
508
        // Add ServletContainerInitializer
506
        // Add ServletContainerInitializer
509
        Bug51376SCI sci = new Bug51376SCI(loadOnStartUp);
507
        Bug51376SCI sci = new Bug51376SCI(loadOnStartUp);
(-)test/org/apache/catalina/core/TestStandardContextValve.java (-6 / +4 lines)
Lines 43-51 public class TestStandardContextValve extends TomcatBaseTest { Link Here
43
        // Set up a container
43
        // Set up a container
44
        Tomcat tomcat = getTomcatInstance();
44
        Tomcat tomcat = getTomcatInstance();
45
45
46
        // Must have a real docBase - just use temp
46
        // No file system docBase required
47
        File docBase = new File(System.getProperty("java.io.tmpdir"));
47
        Context ctx = tomcat.addContext("", null);
48
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
49
48
50
        // Traces order of events across multiple components
49
        // Traces order of events across multiple components
51
        StringBuilder trace = new StringBuilder();
50
        StringBuilder trace = new StringBuilder();
Lines 90-98 public class TestStandardContextValve extends TomcatBaseTest { Link Here
90
        // Set up a container
89
        // Set up a container
91
        Tomcat tomcat = getTomcatInstance();
90
        Tomcat tomcat = getTomcatInstance();
92
91
93
        // Must have a real docBase - just use temp
92
        // No file system docBase required
94
        File docBase = new File(System.getProperty("java.io.tmpdir"));
93
        Context ctx = tomcat.addContext("", null);
95
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
96
94
97
        // Traces order of events across multiple components
95
        // Traces order of events across multiple components
98
        StringBuilder trace = new StringBuilder();
96
        StringBuilder trace = new StringBuilder();
(-)test/org/apache/catalina/core/TestStandardHostValve.java (-3 / +2 lines)
Lines 45-53 public class TestStandardHostValve extends TomcatBaseTest { Link Here
45
        // Set up a container
45
        // Set up a container
46
        Tomcat tomcat = getTomcatInstance();
46
        Tomcat tomcat = getTomcatInstance();
47
47
48
        // Must have a real docBase - just use temp
48
        // No file system docBase required
49
        File docBase = new File(System.getProperty("java.io.tmpdir"));
49
        Context ctx = tomcat.addContext("", null);
50
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
51
50
52
        // Add the error page
51
        // Add the error page
53
        Tomcat.addServlet(ctx, "error", new ErrorServlet());
52
        Tomcat.addServlet(ctx, "error", new ErrorServlet());
(-)test/org/apache/catalina/core/TestStandardWrapper.java (-12 / +8 lines)
Lines 199-207 public class TestStandardWrapper extends TomcatBaseTest { Link Here
199
        // Setup Tomcat instance
199
        // Setup Tomcat instance
200
        Tomcat tomcat = getTomcatInstance();
200
        Tomcat tomcat = getTomcatInstance();
201
201
202
        // Must have a real docBase - just use temp
202
        // No file system docBase required
203
        Context ctx =
203
        Context ctx = tomcat.addContext("", null);
204
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
205
204
206
        Servlet s = new DenyAllServlet();
205
        Servlet s = new DenyAllServlet();
207
        ServletContainerInitializer sci = new SCI(s, useCreateServlet);
206
        ServletContainerInitializer sci = new SCI(s, useCreateServlet);
Lines 228-236 public class TestStandardWrapper extends TomcatBaseTest { Link Here
228
        // Setup Tomcat instance
227
        // Setup Tomcat instance
229
        Tomcat tomcat = getTomcatInstance();
228
        Tomcat tomcat = getTomcatInstance();
230
229
231
        // Must have a real docBase - just use temp
230
        // No file system docBase required
232
        Context ctx =
231
        Context ctx = tomcat.addContext("", null);
233
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
234
232
235
        Wrapper wrapper = Tomcat.addServlet(ctx, "servlet", servletClassName);
233
        Wrapper wrapper = Tomcat.addServlet(ctx, "servlet", servletClassName);
236
        wrapper.setAsyncSupported(true);
234
        wrapper.setAsyncSupported(true);
Lines 366-374 public class TestStandardWrapper extends TomcatBaseTest { Link Here
366
364
367
        Tomcat tomcat = getTomcatInstance();
365
        Tomcat tomcat = getTomcatInstance();
368
366
369
        // Must have a real docBase - just use temp
367
        // No file system docBase required
370
        StandardContext ctx = (StandardContext)
368
        StandardContext ctx = (StandardContext) tomcat.addContext("", null);
371
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
372
369
373
        Tomcat.addServlet(ctx, "Bug51445", new Bug51445Servlet());
370
        Tomcat.addServlet(ctx, "Bug51445", new Bug51445Servlet());
374
        ctx.addServletMapping("/", "Bug51445");
371
        ctx.addServletMapping("/", "Bug51445");
Lines 410-418 public class TestStandardWrapper extends TomcatBaseTest { Link Here
410
407
411
        Tomcat tomcat = getTomcatInstance();
408
        Tomcat tomcat = getTomcatInstance();
412
409
413
        // Must have a real docBase - just use temp
410
        // No file system docBase required
414
        StandardContext ctx = (StandardContext)
411
        StandardContext ctx = (StandardContext) tomcat.addContext("", null);
415
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
416
412
417
        StandardWrapper wrapper = new StandardWrapper();
413
        StandardWrapper wrapper = new StandardWrapper();
418
        wrapper.setServletName("Bug51445");
414
        wrapper.setServletName("Bug51445");
(-)test/org/apache/catalina/filters/TestAddCharSetFilter.java (-3 / +2 lines)
Lines 91-99 public class TestAddCharSetFilter extends TomcatBaseTest { Link Here
91
        // Setup Tomcat instance
91
        // Setup Tomcat instance
92
        Tomcat tomcat = getTomcatInstance();
92
        Tomcat tomcat = getTomcatInstance();
93
93
94
        // Must have a real docBase - just use temp
94
        // No file system docBase required
95
        Context ctx =
95
        Context ctx = tomcat.addContext("", null);
96
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
97
96
98
        // Add the Servlet
97
        // Add the Servlet
99
        CharsetServlet servlet = new CharsetServlet(mode);
98
        CharsetServlet servlet = new CharsetServlet(mode);
(-)test/org/apache/catalina/loader/TestWebappClassLoaderExecutorMemoryLeak.java (-3 / +2 lines)
Lines 41-49 public class TestWebappClassLoaderExecutorMemoryLeak extends TomcatBaseTest { Link Here
41
    public void testTimerThreadLeak() throws Exception {
41
    public void testTimerThreadLeak() throws Exception {
42
        Tomcat tomcat = getTomcatInstance();
42
        Tomcat tomcat = getTomcatInstance();
43
43
44
        // Must have a real docBase - just use temp
44
        // No file system docBase required
45
        Context ctx = tomcat.addContext("",
45
        Context ctx = tomcat.addContext("", null);
46
                System.getProperty("java.io.tmpdir"));
47
46
48
        if (ctx instanceof StandardContext) {
47
        if (ctx instanceof StandardContext) {
49
            ((StandardContext) ctx).setClearReferencesStopThreads(true);
48
            ((StandardContext) ctx).setClearReferencesStopThreads(true);
(-)test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java (-3 / +2 lines)
Lines 40-48 public class TestWebappClassLoaderMemoryLeak extends TomcatBaseTest { Link Here
40
    public void testTimerThreadLeak() throws Exception {
40
    public void testTimerThreadLeak() throws Exception {
41
        Tomcat tomcat = getTomcatInstance();
41
        Tomcat tomcat = getTomcatInstance();
42
42
43
        // Must have a real docBase - just use temp
43
        // No file system docBase required
44
        Context ctx =
44
        Context ctx = tomcat.addContext("", null);
45
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
46
45
47
        if (ctx instanceof StandardContext) {
46
        if (ctx instanceof StandardContext) {
48
            ((StandardContext) ctx).setClearReferencesStopTimerThreads(true);
47
            ((StandardContext) ctx).setClearReferencesStopTimerThreads(true);
(-)test/org/apache/catalina/loader/TestWebappClassLoaderThreadLocalMemoryLeak.java (-6 / +4 lines)
Lines 64-72 public class TestWebappClassLoaderThreadLocalMemoryLeak extends TomcatBaseTest { Link Here
64
        tomcat.getServer().addLifecycleListener(
64
        tomcat.getServer().addLifecycleListener(
65
                new JreMemoryLeakPreventionListener());
65
                new JreMemoryLeakPreventionListener());
66
66
67
        // Must have a real docBase - just use temp
67
        // No file system docBase required
68
        Context ctx = tomcat.addContext("",
68
        Context ctx = tomcat.addContext("", null);
69
                System.getProperty("java.io.tmpdir"));
70
69
71
        Tomcat.addServlet(ctx, "leakServlet1",
70
        Tomcat.addServlet(ctx, "leakServlet1",
72
                "org.apache.tomcat.unittest.TesterLeakingServlet1");
71
                "org.apache.tomcat.unittest.TesterLeakingServlet1");
Lines 121-129 public class TestWebappClassLoaderThreadLocalMemoryLeak extends TomcatBaseTest { Link Here
121
        tomcat.getServer().addLifecycleListener(
120
        tomcat.getServer().addLifecycleListener(
122
                new JreMemoryLeakPreventionListener());
121
                new JreMemoryLeakPreventionListener());
123
122
124
        // Must have a real docBase - just use temp
123
        // No file system docBase required
125
        Context ctx = tomcat.addContext("",
124
        Context ctx = tomcat.addContext("", null);
126
                System.getProperty("java.io.tmpdir"));
127
125
128
        Tomcat.addServlet(ctx, "leakServlet2",
126
        Tomcat.addServlet(ctx, "leakServlet2",
129
                "org.apache.tomcat.unittest.TesterLeakingServlet2");
127
                "org.apache.tomcat.unittest.TesterLeakingServlet2");
(-)test/org/apache/catalina/session/TestPersistentManager.java (-3 / +2 lines)
Lines 168-176 public class TestPersistentManager extends TomcatBaseTest { Link Here
168
168
169
        // Setup Tomcat instance
169
        // Setup Tomcat instance
170
        Tomcat tomcat = getTomcatInstance();
170
        Tomcat tomcat = getTomcatInstance();
171
        // Must have a real docBase - just use temp
171
        // No file system docBase required
172
        Context ctx = tomcat.addContext("",
172
        Context ctx = tomcat.addContext("", null);
173
                System.getProperty("java.io.tmpdir"));
174
173
175
        Tomcat.addServlet(ctx, "DummyServlet", new DummyServlet());
174
        Tomcat.addServlet(ctx, "DummyServlet", new DummyServlet());
176
        ctx.addServletMapping("/dummy", "DummyServlet");
175
        ctx.addServletMapping("/dummy", "DummyServlet");
(-)test/org/apache/catalina/session/TestStandardSession.java (-2 / +2 lines)
Lines 53-60 public class TestStandardSession extends TomcatBaseTest { Link Here
53
        // Setup Tomcat instance
53
        // Setup Tomcat instance
54
        Tomcat tomcat = getTomcatInstance();
54
        Tomcat tomcat = getTomcatInstance();
55
55
56
        // Must have a real docBase - just use temp
56
        // No file system docBase required
57
        Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir"));
57
        Context ctx = tomcat.addContext("", null);
58
58
59
        Tomcat.addServlet(ctx, "bug56578", new Bug56578Servlet());
59
        Tomcat.addServlet(ctx, "bug56578", new Bug56578Servlet());
60
        ctx.addServletMapping("/bug56578", "bug56578");
60
        ctx.addServletMapping("/bug56578", "bug56578");
(-)test/org/apache/catalina/startup/TestListener.java (-4 / +4 lines)
Lines 42-49 public class TestListener extends TomcatBaseTest { Link Here
42
    public void testServletContainerInitializer() throws Exception {
42
    public void testServletContainerInitializer() throws Exception {
43
        Tomcat tomcat = getTomcatInstance();
43
        Tomcat tomcat = getTomcatInstance();
44
44
45
        Context context = tomcat.addContext("",
45
        // No file system docBase required
46
                System.getProperty("java.io.tmpdir"));
46
        Context context = tomcat.addContext("", null);
47
47
48
        context.addServletContainerInitializer(new SCI(), null);
48
        context.addServletContainerInitializer(new SCI(), null);
49
        tomcat.start();
49
        tomcat.start();
Lines 59-66 public class TestListener extends TomcatBaseTest { Link Here
59
    public void testServletContextListener() throws Exception {
59
    public void testServletContextListener() throws Exception {
60
        Tomcat tomcat = getTomcatInstance();
60
        Tomcat tomcat = getTomcatInstance();
61
61
62
        Context context = tomcat.addContext("",
62
        // No file system docBase required
63
                System.getProperty("java.io.tmpdir"));
63
        Context context = tomcat.addContext("", null);
64
64
65
        // SCL2 pretends to be in web.xml, and tries to install a
65
        // SCL2 pretends to be in web.xml, and tries to install a
66
        // ServletContainerInitializer.
66
        // ServletContainerInitializer.
(-)test/org/apache/catalina/startup/TestTomcat.java (-15 / +10 lines)
Lines 245-253 public class TestTomcat extends TomcatBaseTest { Link Here
245
    public void testProgrammatic() throws Exception {
245
    public void testProgrammatic() throws Exception {
246
        Tomcat tomcat = getTomcatInstance();
246
        Tomcat tomcat = getTomcatInstance();
247
247
248
        // Must have a real docBase - just use temp
248
        // No file system docBase required
249
        org.apache.catalina.Context ctx =
249
        org.apache.catalina.Context ctx = tomcat.addContext("", null);
250
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
251
        // You can customize the context by calling
250
        // You can customize the context by calling
252
        // its API
251
        // its API
253
252
Lines 294-302 public class TestTomcat extends TomcatBaseTest { Link Here
294
    public void testSession() throws Exception {
293
    public void testSession() throws Exception {
295
        Tomcat tomcat = getTomcatInstance();
294
        Tomcat tomcat = getTomcatInstance();
296
295
297
        // Must have a real docBase - just use temp
296
        // No file system docBase required
298
        org.apache.catalina.Context ctx =
297
        org.apache.catalina.Context ctx = tomcat.addContext("", null);
299
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
300
        // You can customize the context by calling
298
        // You can customize the context by calling
301
        // its API
299
        // its API
302
300
Lines 327-335 public class TestTomcat extends TomcatBaseTest { Link Here
327
    public void testEnableNaming() throws Exception {
325
    public void testEnableNaming() throws Exception {
328
        Tomcat tomcat = getTomcatInstance();
326
        Tomcat tomcat = getTomcatInstance();
329
327
330
        // Must have a real docBase - just use temp
328
        // No file system docBase required
331
        org.apache.catalina.Context ctx =
329
        org.apache.catalina.Context ctx = tomcat.addContext("", null);
332
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
333
330
334
        // You can customise the context by calling its API
331
        // You can customise the context by calling its API
335
332
Lines 358-366 public class TestTomcat extends TomcatBaseTest { Link Here
358
    public void testEnableNamingGlobal() throws Exception {
355
    public void testEnableNamingGlobal() throws Exception {
359
        Tomcat tomcat = getTomcatInstance();
356
        Tomcat tomcat = getTomcatInstance();
360
357
361
        // Must have a real docBase - just use temp
358
        // No file system docBase required
362
        org.apache.catalina.Context ctx =
359
        org.apache.catalina.Context ctx = tomcat.addContext("", null);
363
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
364
360
365
        // You can customise the context by calling its API
361
        // You can customise the context by calling its API
366
362
Lines 438-446 public class TestTomcat extends TomcatBaseTest { Link Here
438
    public void testBug53301() throws Exception {
434
    public void testBug53301() throws Exception {
439
        Tomcat tomcat = getTomcatInstance();
435
        Tomcat tomcat = getTomcatInstance();
440
436
441
        // Must have a real docBase - just use temp
437
        // No file system docBase required
442
        org.apache.catalina.Context ctx =
438
        org.apache.catalina.Context ctx = tomcat.addContext("", null);
443
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
444
439
445
        InitCount initCount = new InitCount();
440
        InitCount initCount = new InitCount();
446
        Tomcat.addServlet(ctx, "initCount", initCount);
441
        Tomcat.addServlet(ctx, "initCount", initCount);
(-)test/org/apache/catalina/startup/TestTomcatClassLoader.java (-6 / +4 lines)
Lines 40-48 public class TestTomcatClassLoader extends TomcatBaseTest { Link Here
40
    public void testDefaultClassLoader() throws Exception {
40
    public void testDefaultClassLoader() throws Exception {
41
        Tomcat tomcat = getTomcatInstance();
41
        Tomcat tomcat = getTomcatInstance();
42
42
43
        // Must have a real docBase - just use temp
43
        // No file system docBase required
44
        Context ctx =
44
        Context ctx = tomcat.addContext("", null);
45
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
46
45
47
        Tomcat.addServlet(ctx, "ClassLoaderReport", new ClassLoaderReport(null));
46
        Tomcat.addServlet(ctx, "ClassLoaderReport", new ClassLoaderReport(null));
48
        ctx.addServletMapping("/", "ClassLoaderReport");
47
        ctx.addServletMapping("/", "ClassLoaderReport");
Lines 64-72 public class TestTomcatClassLoader extends TomcatBaseTest { Link Here
64
        Tomcat tomcat = getTomcatInstance();
63
        Tomcat tomcat = getTomcatInstance();
65
        tomcat.getServer().setParentClassLoader(cl);
64
        tomcat.getServer().setParentClassLoader(cl);
66
65
67
        // Must have a real docBase - just use temp
66
        // No file system docBase required
68
        Context ctx =
67
        Context ctx = tomcat.addContext("", null);
69
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
70
68
71
        Tomcat.addServlet(ctx, "ClassLoaderReport", new ClassLoaderReport(cl));
69
        Tomcat.addServlet(ctx, "ClassLoaderReport", new ClassLoaderReport(cl));
72
        ctx.addServletMapping("/", "ClassLoaderReport");
70
        ctx.addServletMapping("/", "ClassLoaderReport");
(-)test/org/apache/catalina/valves/TestErrorReportValve.java (-16 / +10 lines)
Lines 41-49 public class TestErrorReportValve extends TomcatBaseTest { Link Here
41
    public void testBug53071() throws Exception {
41
    public void testBug53071() throws Exception {
42
        Tomcat tomcat = getTomcatInstance();
42
        Tomcat tomcat = getTomcatInstance();
43
43
44
        // Must have a real docBase - just use temp
44
        // No file system docBase required
45
        Context ctx =
45
        Context ctx = tomcat.addContext("", null);
46
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
47
46
48
        Tomcat.addServlet(ctx, "errorServlet", new ErrorServlet());
47
        Tomcat.addServlet(ctx, "errorServlet", new ErrorServlet());
49
        ctx.addServletMapping("/", "errorServlet");
48
        ctx.addServletMapping("/", "errorServlet");
Lines 75-83 public class TestErrorReportValve extends TomcatBaseTest { Link Here
75
    public void testBug54220DoNotSetNotFound() throws Exception {
74
    public void testBug54220DoNotSetNotFound() throws Exception {
76
        Tomcat tomcat = getTomcatInstance();
75
        Tomcat tomcat = getTomcatInstance();
77
76
78
        // Must have a real docBase - just use temp
77
        // No file system docBase required
79
        Context ctx =
78
        Context ctx = tomcat.addContext("", null);
80
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
81
79
82
        Tomcat.addServlet(ctx, "bug54220", new Bug54220Servlet(false));
80
        Tomcat.addServlet(ctx, "bug54220", new Bug54220Servlet(false));
83
        ctx.addServletMapping("/", "bug54220");
81
        ctx.addServletMapping("/", "bug54220");
Lines 96-104 public class TestErrorReportValve extends TomcatBaseTest { Link Here
96
    public void testBug54220SetNotFound() throws Exception {
94
    public void testBug54220SetNotFound() throws Exception {
97
        Tomcat tomcat = getTomcatInstance();
95
        Tomcat tomcat = getTomcatInstance();
98
96
99
        // Must have a real docBase - just use temp
97
        // No file system docBase required
100
        Context ctx =
98
        Context ctx = tomcat.addContext("", null);
101
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
102
99
103
        Tomcat.addServlet(ctx, "bug54220", new Bug54220Servlet(true));
100
        Tomcat.addServlet(ctx, "bug54220", new Bug54220Servlet(true));
104
        ctx.addServletMapping("/", "bug54220");
101
        ctx.addServletMapping("/", "bug54220");
Lines 141-149 public class TestErrorReportValve extends TomcatBaseTest { Link Here
141
    public void testBug54536() throws Exception {
138
    public void testBug54536() throws Exception {
142
        Tomcat tomcat = getTomcatInstance();
139
        Tomcat tomcat = getTomcatInstance();
143
140
144
        // Must have a real docBase - just use temp
141
        // No file system docBase required
145
        Context ctx =
142
        Context ctx = tomcat.addContext("", null);
146
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
147
143
148
        Tomcat.addServlet(ctx, "bug54536", new Bug54536Servlet());
144
        Tomcat.addServlet(ctx, "bug54536", new Bug54536Servlet());
149
        ctx.addServletMapping("/", "bug54536");
145
        ctx.addServletMapping("/", "bug54536");
Lines 178-187 public class TestErrorReportValve extends TomcatBaseTest { Link Here
178
        // Setup Tomcat instance
174
        // Setup Tomcat instance
179
        Tomcat tomcat = getTomcatInstance();
175
        Tomcat tomcat = getTomcatInstance();
180
176
181
        // Must have a real docBase - just use temp
177
        // No file system docBase required
182
        File docBase = new File(System.getProperty("java.io.tmpdir"));
178
        Context ctx = tomcat.addContext("", null);
183
184
        Context ctx = tomcat.addContext("", docBase.getAbsolutePath());
185
179
186
        Bug56042Servlet bug56042Servlet = new Bug56042Servlet();
180
        Bug56042Servlet bug56042Servlet = new Bug56042Servlet();
187
        Wrapper wrapper =
181
        Wrapper wrapper =
(-)test/org/apache/catalina/websocket/TestWebSocket.java (-18 / +12 lines)
Lines 68-76 public class TestWebSocket extends TomcatBaseTest { Link Here
68
    @Test
68
    @Test
69
    public void testSimple() throws Exception {
69
    public void testSimple() throws Exception {
70
        Tomcat tomcat = getTomcatInstance();
70
        Tomcat tomcat = getTomcatInstance();
71
        // Must have a real docBase - just use temp
71
        // No file system docBase required
72
        Context ctx = tomcat.addContext("",
72
        Context ctx = tomcat.addContext("", null);
73
                System.getProperty("java.io.tmpdir"));
74
        ctx.addApplicationListener(new ApplicationListener(
73
        ctx.addApplicationListener(new ApplicationListener(
75
                TesterEchoServer.Config.class.getName(), false));
74
                TesterEchoServer.Config.class.getName(), false));
76
75
Lines 114-122 public class TestWebSocket extends TomcatBaseTest { Link Here
114
    @Test
113
    @Test
115
    public void testDetectWrongVersion() throws Exception {
114
    public void testDetectWrongVersion() throws Exception {
116
        Tomcat tomcat = getTomcatInstance();
115
        Tomcat tomcat = getTomcatInstance();
117
        // Must have a real docBase - just use temp
116
        // No file system docBase required
118
        Context ctx = tomcat.addContext("",
117
        Context ctx = tomcat.addContext("", null);
119
                System.getProperty("java.io.tmpdir"));
120
        ctx.addApplicationListener(new ApplicationListener(
118
        ctx.addApplicationListener(new ApplicationListener(
121
                TesterEchoServer.Config.class.getName(), false));
119
                TesterEchoServer.Config.class.getName(), false));
122
120
Lines 157-165 public class TestWebSocket extends TomcatBaseTest { Link Here
157
    @Test
155
    @Test
158
    public void testNoConnection() throws Exception {
156
    public void testNoConnection() throws Exception {
159
        Tomcat tomcat = getTomcatInstance();
157
        Tomcat tomcat = getTomcatInstance();
160
        // Must have a real docBase - just use temp
158
        // No file system docBase required
161
        Context ctx = tomcat.addContext("",
159
        Context ctx = tomcat.addContext("", null);
162
                System.getProperty("java.io.tmpdir"));
163
        ctx.addApplicationListener(new ApplicationListener(
160
        ctx.addApplicationListener(new ApplicationListener(
164
                TesterEchoServer.Config.class.getName(), false));
161
                TesterEchoServer.Config.class.getName(), false));
165
162
Lines 191-199 public class TestWebSocket extends TomcatBaseTest { Link Here
191
    @Test
188
    @Test
192
    public void testNoUpgrade() throws Exception {
189
    public void testNoUpgrade() throws Exception {
193
        Tomcat tomcat = getTomcatInstance();
190
        Tomcat tomcat = getTomcatInstance();
194
        // Must have a real docBase - just use temp
191
        // No file system docBase required
195
        Context ctx = tomcat.addContext("",
192
        Context ctx = tomcat.addContext("", null);
196
                System.getProperty("java.io.tmpdir"));
197
        ctx.addApplicationListener(new ApplicationListener(
193
        ctx.addApplicationListener(new ApplicationListener(
198
                TesterEchoServer.Config.class.getName(), false));
194
                TesterEchoServer.Config.class.getName(), false));
199
195
Lines 226-234 public class TestWebSocket extends TomcatBaseTest { Link Here
226
    @Test
222
    @Test
227
    public void testKey() throws Exception {
223
    public void testKey() throws Exception {
228
        Tomcat tomcat = getTomcatInstance();
224
        Tomcat tomcat = getTomcatInstance();
229
        // Must have a real docBase - just use temp
225
        // No file system docBase required
230
        Context ctx = tomcat.addContext("",
226
        Context ctx = tomcat.addContext("", null);
231
                System.getProperty("java.io.tmpdir"));
232
        ctx.addApplicationListener(new ApplicationListener(
227
        ctx.addApplicationListener(new ApplicationListener(
233
                TesterEchoServer.Config.class.getName(), false));
228
                TesterEchoServer.Config.class.getName(), false));
234
229
Lines 283-291 public class TestWebSocket extends TomcatBaseTest { Link Here
283
        Tomcat tomcat = getTomcatInstance();
278
        Tomcat tomcat = getTomcatInstance();
284
        tomcat.enableNaming();
279
        tomcat.enableNaming();
285
280
286
        // Must have a real docBase - just use temp
281
        // No file system docBase required
287
        Context ctx =
282
        Context ctx = tomcat.addContext("", null);
288
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
289
283
290
        Tomcat.addServlet(ctx, "Bug53339", new Bug53339Servlet());
284
        Tomcat.addServlet(ctx, "Bug53339", new Bug53339Servlet());
291
        ctx.addServletMapping("/*", "Bug53339");
285
        ctx.addServletMapping("/*", "Bug53339");
(-)test/org/apache/coyote/ajp/TestAbstractAjpProcessor.java (-9 / +9 lines)
Lines 75-82 public class TestAbstractAjpProcessor extends TomcatBaseTest { Link Here
75
        Tomcat tomcat = getTomcatInstance();
75
        Tomcat tomcat = getTomcatInstance();
76
        tomcat.getConnector().setProperty("packetSize", Integer.toString(ajpPacketSize));
76
        tomcat.getConnector().setProperty("packetSize", Integer.toString(ajpPacketSize));
77
77
78
        // Must have a real docBase - just use temp
78
        // No file system docBase required
79
        Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir"));
79
        Context ctx = tomcat.addContext("", null);
80
80
81
        Tomcat.addServlet(ctx, "snoop", new SnoopServlet());
81
        Tomcat.addServlet(ctx, "snoop", new SnoopServlet());
82
        ctx.addServletMapping("/", "snoop");
82
        ctx.addServletMapping("/", "snoop");
Lines 452-459 public class TestAbstractAjpProcessor extends TomcatBaseTest { Link Here
452
        tomcat.getConnector().setProperty("requiredSecret", "RIGHTSECRET");
452
        tomcat.getConnector().setProperty("requiredSecret", "RIGHTSECRET");
453
        tomcat.start();
453
        tomcat.start();
454
454
455
        // Must have a real docBase - just use temp
455
        // No file system docBase required
456
        Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir"));
456
        Context ctx = tomcat.addContext("", null);
457
457
458
        Tomcat.addServlet(ctx, "helloWorld", new HelloWorldServlet());
458
        Tomcat.addServlet(ctx, "helloWorld", new HelloWorldServlet());
459
        ctx.addServletMapping("/", "helloWorld");
459
        ctx.addServletMapping("/", "helloWorld");
Lines 512-519 public class TestAbstractAjpProcessor extends TomcatBaseTest { Link Here
512
        tomcat.getConnector().setProperty("connectionTimeout", "-1");
512
        tomcat.getConnector().setProperty("connectionTimeout", "-1");
513
        tomcat.start();
513
        tomcat.start();
514
514
515
        // Must have a real docBase - just use temp
515
        // No file system docBase required
516
        Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir"));
516
        Context ctx = tomcat.addContext("", null);
517
        Tomcat.addServlet(ctx, "helloWorld", new HelloWorldServlet());
517
        Tomcat.addServlet(ctx, "helloWorld", new HelloWorldServlet());
518
        ctx.addServletMapping("/", "helloWorld");
518
        ctx.addServletMapping("/", "helloWorld");
519
519
Lines 622-629 public class TestAbstractAjpProcessor extends TomcatBaseTest { Link Here
622
622
623
        Tomcat tomcat = getTomcatInstance();
623
        Tomcat tomcat = getTomcatInstance();
624
624
625
        // Must have a real docBase - just use temp
625
        // No file system docBase required
626
        Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir"));
626
        Context ctx = tomcat.addContext("", null);
627
        Tomcat.addServlet(ctx, "bug55453", new Tester304WithBodyServlet());
627
        Tomcat.addServlet(ctx, "bug55453", new Tester304WithBodyServlet());
628
        ctx.addServletMapping("/", "bug55453");
628
        ctx.addServletMapping("/", "bug55453");
629
629
Lines 661-667 public class TestAbstractAjpProcessor extends TomcatBaseTest { Link Here
661
        tomcat.getConnector().setProperty("packetSize", Integer.toString(ajpPacketSize));
661
        tomcat.getConnector().setProperty("packetSize", Integer.toString(ajpPacketSize));
662
662
663
        // No file system docBase required
663
        // No file system docBase required
664
        Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir"));
664
        Context ctx = tomcat.addContext("", null);
665
665
666
        FixedResponseSizeServlet servlet = new FixedResponseSizeServlet(15000, 16000);
666
        FixedResponseSizeServlet servlet = new FixedResponseSizeServlet(15000, 16000);
667
        Tomcat.addServlet(ctx, "FixedResponseSizeServlet", servlet);
667
        Tomcat.addServlet(ctx, "FixedResponseSizeServlet", servlet);
(-)test/org/apache/coyote/http11/TestAbstractHttp11Processor.java (-19 / +14 lines)
Lines 61-68 public class TestAbstractHttp11Processor extends TomcatBaseTest { Link Here
61
    public void testResponseWithErrorChunked() throws Exception {
61
    public void testResponseWithErrorChunked() throws Exception {
62
        Tomcat tomcat = getTomcatInstance();
62
        Tomcat tomcat = getTomcatInstance();
63
63
64
        // Must have a real docBase - just use temp
64
        // No file system docBase required
65
        Context ctxt = tomcat.addContext("", System.getProperty("java.io.tmpdir"));
65
        Context ctxt = tomcat.addContext("", null);
66
66
67
        // Add protected servlet
67
        // Add protected servlet
68
        Tomcat.addServlet(ctxt, "ChunkedResponseWithErrorServlet",
68
        Tomcat.addServlet(ctxt, "ChunkedResponseWithErrorServlet",
Lines 350-358 public class TestAbstractHttp11Processor extends TomcatBaseTest { Link Here
350
    public void testPipelining() throws Exception {
350
    public void testPipelining() throws Exception {
351
        Tomcat tomcat = getTomcatInstance();
351
        Tomcat tomcat = getTomcatInstance();
352
352
353
        // Must have a real docBase - just use temp
353
        // No file system docBase required
354
        Context ctxt = tomcat.addContext("",
354
        Context ctxt = tomcat.addContext("", null);
355
                System.getProperty("java.io.tmpdir"));
356
355
357
        // Add protected servlet
356
        // Add protected servlet
358
        Tomcat.addServlet(ctxt, "TesterServlet", new TesterServlet());
357
        Tomcat.addServlet(ctxt, "TesterServlet", new TesterServlet());
Lines 411-419 public class TestAbstractHttp11Processor extends TomcatBaseTest { Link Here
411
    public void testChunking11NoContentLength() throws Exception {
410
    public void testChunking11NoContentLength() throws Exception {
412
        Tomcat tomcat = getTomcatInstance();
411
        Tomcat tomcat = getTomcatInstance();
413
412
414
        // Must have a real docBase - just use temp
413
        // No file system docBase required
415
        Context ctxt = tomcat.addContext("",
414
        Context ctxt = tomcat.addContext("", null);
416
                System.getProperty("java.io.tmpdir"));
417
415
418
        Tomcat.addServlet(ctxt, "NoContentLengthFlushingServlet",
416
        Tomcat.addServlet(ctxt, "NoContentLengthFlushingServlet",
419
                new NoContentLengthFlushingServlet());
417
                new NoContentLengthFlushingServlet());
Lines 440-448 public class TestAbstractHttp11Processor extends TomcatBaseTest { Link Here
440
438
441
        Tomcat tomcat = getTomcatInstance();
439
        Tomcat tomcat = getTomcatInstance();
442
440
443
        // Must have a real docBase - just use temp
441
        // No file system docBase required
444
        Context ctxt = tomcat.addContext("",
442
        Context ctxt = tomcat.addContext("", null);
445
                System.getProperty("java.io.tmpdir"));
446
443
447
        Tomcat.addServlet(ctxt, "NoContentLengthConnectionCloseFlushingServlet",
444
        Tomcat.addServlet(ctxt, "NoContentLengthConnectionCloseFlushingServlet",
448
                new NoContentLengthConnectionCloseFlushingServlet());
445
                new NoContentLengthConnectionCloseFlushingServlet());
Lines 482-490 public class TestAbstractHttp11Processor extends TomcatBaseTest { Link Here
482
    private void doTestBug53677(boolean flush) throws Exception {
479
    private void doTestBug53677(boolean flush) throws Exception {
483
        Tomcat tomcat = getTomcatInstance();
480
        Tomcat tomcat = getTomcatInstance();
484
481
485
        // Must have a real docBase - just use temp
482
        // No file system docBase required
486
        Context ctxt = tomcat.addContext("",
483
        Context ctxt = tomcat.addContext("", null);
487
                System.getProperty("java.io.tmpdir"));
488
484
489
        Tomcat.addServlet(ctxt, "LargeHeaderServlet",
485
        Tomcat.addServlet(ctxt, "LargeHeaderServlet",
490
                new LargeHeaderServlet(flush));
486
                new LargeHeaderServlet(flush));
Lines 520-528 public class TestAbstractHttp11Processor extends TomcatBaseTest { Link Here
520
        tomcat.getConnector().setProperty("processorCache", "1");
516
        tomcat.getConnector().setProperty("processorCache", "1");
521
        tomcat.getConnector().setProperty("maxThreads", "1");
517
        tomcat.getConnector().setProperty("maxThreads", "1");
522
518
523
        // Must have a real docBase - just use temp
519
        // No file system docBase required
524
        Context ctxt = tomcat.addContext("",
520
        Context ctxt = tomcat.addContext("", null);
525
                System.getProperty("java.io.tmpdir"));
526
521
527
        Tomcat.addServlet(ctxt, "async", new Bug55772Servlet());
522
        Tomcat.addServlet(ctxt, "async", new Bug55772Servlet());
528
        ctxt.addServletMapping("/*", "async");
523
        ctxt.addServletMapping("/*", "async");
Lines 613-620 public class TestAbstractHttp11Processor extends TomcatBaseTest { Link Here
613
    private void doTestNon2xxResponseAndExpectation(boolean useExpectation) throws Exception {
608
    private void doTestNon2xxResponseAndExpectation(boolean useExpectation) throws Exception {
614
        Tomcat tomcat = getTomcatInstance();
609
        Tomcat tomcat = getTomcatInstance();
615
610
616
        // Must have a real docBase - just use temp
611
        // No file system docBase required
617
        Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir"));
612
        Context ctx = tomcat.addContext("", null);
618
613
619
        Tomcat.addServlet(ctx, "echo", new EchoBodyServlet());
614
        Tomcat.addServlet(ctx, "echo", new EchoBodyServlet());
620
        ctx.addServletMapping("/echo", "echo");
615
        ctx.addServletMapping("/echo", "echo");
(-)test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java (-15 / +10 lines)
Lines 101-109 public class TestChunkedInputFilter extends TomcatBaseTest { Link Here
101
        // Setup Tomcat instance
101
        // Setup Tomcat instance
102
        Tomcat tomcat = getTomcatInstance();
102
        Tomcat tomcat = getTomcatInstance();
103
103
104
        // Must have a real docBase - just use temp
104
        // No file system docBase required
105
        Context ctx =
105
        Context ctx = tomcat.addContext("", null);
106
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
107
106
108
        // Configure allowed trailer headers
107
        // Configure allowed trailer headers
109
        tomcat.getConnector().setProperty("allowedTrailerHeaders", "X-Trailer1,X-Trailer2");
108
        tomcat.getConnector().setProperty("allowedTrailerHeaders", "X-Trailer1,X-Trailer2");
Lines 168-176 public class TestChunkedInputFilter extends TomcatBaseTest { Link Here
168
        // Setup Tomcat instance
167
        // Setup Tomcat instance
169
        Tomcat tomcat = getTomcatInstance();
168
        Tomcat tomcat = getTomcatInstance();
170
169
171
        // Must have a real docBase - just use temp
170
        // No file system docBase required
172
        Context ctx =
171
        Context ctx = tomcat.addContext("", null);
173
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
174
172
175
        Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet(false));
173
        Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet(false));
176
        ctx.addServletMapping("/", "servlet");
174
        ctx.addServletMapping("/", "servlet");
Lines 232-240 public class TestChunkedInputFilter extends TomcatBaseTest { Link Here
232
        tomcat.getConnector().setProperty(
230
        tomcat.getConnector().setProperty(
233
                "maxExtensionSize", Integer.toString(EXT_SIZE_LIMIT));
231
                "maxExtensionSize", Integer.toString(EXT_SIZE_LIMIT));
234
232
235
        // Must have a real docBase - just use temp
233
        // No file system docBase required
236
        Context ctx =
234
        Context ctx = tomcat.addContext("", null);
237
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
238
235
239
        Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet(ok));
236
        Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet(ok));
240
        ctx.addServletMapping("/", "servlet");
237
        ctx.addServletMapping("/", "servlet");
Lines 281-289 public class TestChunkedInputFilter extends TomcatBaseTest { Link Here
281
        // Setup Tomcat instance
278
        // Setup Tomcat instance
282
        Tomcat tomcat = getTomcatInstance();
279
        Tomcat tomcat = getTomcatInstance();
283
280
284
        // Must have a real docBase - just use temp
281
        // No file system docBase required
285
        Context ctx =
282
        Context ctx = tomcat.addContext("", null);
286
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
287
283
288
        Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet(true));
284
        Tomcat.addServlet(ctx, "servlet", new EchoHeaderServlet(true));
289
        ctx.addServletMapping("/", "servlet");
285
        ctx.addServletMapping("/", "servlet");
Lines 381-389 public class TestChunkedInputFilter extends TomcatBaseTest { Link Here
381
        // Setup Tomcat instance
377
        // Setup Tomcat instance
382
        Tomcat tomcat = getTomcatInstance();
378
        Tomcat tomcat = getTomcatInstance();
383
379
384
        // Must have a real docBase - just use temp
380
        // No file system docBase required
385
        Context ctx = tomcat.addContext("",
381
        Context ctx = tomcat.addContext("", null);
386
                System.getProperty("java.io.tmpdir"));
387
382
388
        BodyReadServlet servlet = new BodyReadServlet(expectPass, readLimit);
383
        BodyReadServlet servlet = new BodyReadServlet(expectPass, readLimit);
389
        Tomcat.addServlet(ctx, "servlet", servlet);
384
        Tomcat.addServlet(ctx, "servlet", servlet);
(-)test/org/apache/naming/resources/TestNamingContext.java (-19 / +14 lines)
Lines 62-71 public class TestNamingContext extends TomcatBaseTest { Link Here
62
    public void doTestLookup(boolean useSingletonResource) throws Exception {
62
    public void doTestLookup(boolean useSingletonResource) throws Exception {
63
        Tomcat tomcat = getTomcatInstance();
63
        Tomcat tomcat = getTomcatInstance();
64
        tomcat.enableNaming();
64
        tomcat.enableNaming();
65
        
65
66
        // Must have a real docBase - just use temp
66
        // No file system docBase required
67
        StandardContext ctx = (StandardContext)
67
        StandardContext ctx = (StandardContext) tomcat.addContext("", null);
68
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
69
        
68
        
70
        // Create the resource
69
        // Create the resource
71
        ContextResource cr = new ContextResource();
70
        ContextResource cr = new ContextResource();
Lines 255-264 public class TestNamingContext extends TomcatBaseTest { Link Here
255
    public void testListBindings() throws Exception {
254
    public void testListBindings() throws Exception {
256
        Tomcat tomcat = getTomcatInstance();
255
        Tomcat tomcat = getTomcatInstance();
257
        tomcat.enableNaming();
256
        tomcat.enableNaming();
258
        
257
259
        // Must have a real docBase - just use temp
258
        // No file system docBase required
260
        StandardContext ctx = (StandardContext)
259
        StandardContext ctx = (StandardContext) tomcat.addContext("", null);
261
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
262
        
260
        
263
        // Create the resource
261
        // Create the resource
264
        ContextResource cr = new ContextResource();
262
        ContextResource cr = new ContextResource();
Lines 307-316 public class TestNamingContext extends TomcatBaseTest { Link Here
307
    public void testBeanFactory() throws Exception {
305
    public void testBeanFactory() throws Exception {
308
        Tomcat tomcat = getTomcatInstance();
306
        Tomcat tomcat = getTomcatInstance();
309
        tomcat.enableNaming();
307
        tomcat.enableNaming();
310
        
308
311
        // Must have a real docBase - just use temp
309
        // No file system docBase required
312
        StandardContext ctx = (StandardContext)
310
        StandardContext ctx = (StandardContext) tomcat.addContext("", null);
313
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
314
        
311
        
315
        // Create the resource
312
        // Create the resource
316
        ContextResource cr = new ContextResource();
313
        ContextResource cr = new ContextResource();
Lines 367-376 public class TestNamingContext extends TomcatBaseTest { Link Here
367
            throws Exception {
364
            throws Exception {
368
        Tomcat tomcat = getTomcatInstance();
365
        Tomcat tomcat = getTomcatInstance();
369
        tomcat.enableNaming();
366
        tomcat.enableNaming();
370
        
367
371
        // Must have a real docBase - just use temp
368
        // No file system docBase required
372
        StandardContext ctx = (StandardContext)
369
        StandardContext ctx = (StandardContext) tomcat.addContext("", null);
373
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
374
        
370
        
375
        ctx.setJndiExceptionOnFailedWrite(exceptionOnFailedWrite);
371
        ctx.setJndiExceptionOnFailedWrite(exceptionOnFailedWrite);
376
372
Lines 427-435 public class TestNamingContext extends TomcatBaseTest { Link Here
427
        Tomcat tomcat = getTomcatInstance();
423
        Tomcat tomcat = getTomcatInstance();
428
        tomcat.enableNaming();
424
        tomcat.enableNaming();
429
425
430
        // Must have a real docBase - just use temp
426
        // No file system docBase required
431
        StandardContext ctx = (StandardContext)
427
        StandardContext ctx = (StandardContext) tomcat.addContext("", null);
432
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
433
428
434
        // Create the resource
429
        // Create the resource
435
        ContextEnvironment env = new ContextEnvironment();
430
        ContextEnvironment env = new ContextEnvironment();
(-)test/org/apache/naming/resources/TestProxyDirContext.java (-3 / +2 lines)
Lines 39-47 public class TestProxyDirContext extends TomcatBaseTest { Link Here
39
    public void testLookupException() throws Exception {
39
    public void testLookupException() throws Exception {
40
        Tomcat tomcat = getTomcatInstance();
40
        Tomcat tomcat = getTomcatInstance();
41
41
42
        // Must have a real docBase - just use temp
42
        // No file system docBase required
43
        StandardContext ctx = (StandardContext)
43
        StandardContext ctx = (StandardContext) tomcat.addContext("", null);
44
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
45
        ctx.setCacheTTL(500);
44
        ctx.setCacheTTL(500);
46
        tomcat.start();
45
        tomcat.start();
47
46
(-)test/org/apache/tomcat/util/http/CookiesBaseTest.java (-3 / +2 lines)
Lines 67-75 public abstract class CookiesBaseTest extends TomcatBaseTest { Link Here
67
67
68
68
69
    public static void addServlets(Tomcat tomcat) {
69
    public static void addServlets(Tomcat tomcat) {
70
        // Must have a real docBase - just use temp
70
        // No file system docBase required
71
        Context ctx =
71
        Context ctx = tomcat.addContext("", null);
72
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
73
72
74
        Tomcat.addServlet(ctx, "invalid", new CookieServlet("na;me", "value"));
73
        Tomcat.addServlet(ctx, "invalid", new CookieServlet("na;me", "value"));
75
        ctx.addServletMapping("/invalid", "invalid");
74
        ctx.addServletMapping("/invalid", "invalid");
(-)test/org/apache/tomcat/util/http/TestBug49158.java (-3 / +2 lines)
Lines 60-68 public class TestBug49158 extends CookiesBaseTest { Link Here
60
    }
60
    }
61
61
62
    public static void addServlets(Tomcat tomcat) {
62
    public static void addServlets(Tomcat tomcat) {
63
        // Must have a real docBase - just use temp
63
        // No file system docBase required
64
        Context ctx =
64
        Context ctx = tomcat.addContext("", null);
65
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
66
65
67
        Tomcat.addServlet(ctx, path, new TestBug49158Servlet());
66
        Tomcat.addServlet(ctx, path, new TestBug49158Servlet());
68
        ctx.addServletMapping("/"+path, path);
67
        ctx.addServletMapping("/"+path, path);
(-)test/org/apache/tomcat/util/http/mapper/TestMapperWebapps.java (-3 / +2 lines)
Lines 45-53 public class TestMapperWebapps extends TomcatBaseTest{ Link Here
45
        Tomcat tomcat = getTomcatInstance();
45
        Tomcat tomcat = getTomcatInstance();
46
        tomcat.enableNaming();
46
        tomcat.enableNaming();
47
47
48
        // Must have a real docBase - just use temp
48
        // No file system docBase required
49
        Context ctx =
49
        Context ctx = tomcat.addContext("", null);
50
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
51
50
52
        Tomcat.addServlet(ctx, "Bug53356", new Bug53356Servlet());
51
        Tomcat.addServlet(ctx, "Bug53356", new Bug53356Servlet());
53
        ctx.addServletMapping("", "Bug53356");
52
        ctx.addServletMapping("", "Bug53356");
(-)test/org/apache/tomcat/util/net/TesterSupport.java (-3 / +2 lines)
Lines 194-202 public final class TesterSupport { Link Here
194
        TesterSupport.initSsl(tomcat);
194
        TesterSupport.initSsl(tomcat);
195
195
196
        // Need a web application with a protected and unprotected URL
196
        // Need a web application with a protected and unprotected URL
197
        // Must have a real docBase - just use temp
197
        // No file system docBase required
198
        Context ctx =
198
        Context ctx = tomcat.addContext("", null);
199
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
200
199
201
        Tomcat.addServlet(ctx, "simple", new SimpleServlet());
200
        Tomcat.addServlet(ctx, "simple", new SimpleServlet());
202
        ctx.addServletMapping("/unprotected", "simple");
201
        ctx.addServletMapping("/unprotected", "simple");
(-)test/org/apache/tomcat/websocket/TestWebSocketFrameClient.java (-7 / +4 lines)
Lines 42-50 public class TestWebSocketFrameClient extends TomcatBaseTest { Link Here
42
    public void testConnectToServerEndpoint() throws Exception {
42
    public void testConnectToServerEndpoint() throws Exception {
43
43
44
        Tomcat tomcat = getTomcatInstance();
44
        Tomcat tomcat = getTomcatInstance();
45
        // Must have a real docBase - just use temp
45
        // No file system docBase required
46
        Context ctx =
46
        Context ctx = tomcat.addContext("", null);
47
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
48
        ctx.addApplicationListener(TesterFirehoseServer.Config.class.getName());
47
        ctx.addApplicationListener(TesterFirehoseServer.Config.class.getName());
49
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
48
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
50
        ctx.addServletMapping("/", "default");
49
        ctx.addServletMapping("/", "default");
Lines 85-97 public class TestWebSocketFrameClient extends TomcatBaseTest { Link Here
85
84
86
        Tomcat tomcat = getTomcatInstance();
85
        Tomcat tomcat = getTomcatInstance();
87
        // No file system docBase required
86
        // No file system docBase required
88
        Context ctx =
87
        Context ctx = tomcat.addContext("", null);
89
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
90
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
88
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
91
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
89
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
92
        ctx.addServletMapping("/", "default");
90
        ctx.addServletMapping("/", "default");
93
        Context ctx2 =
91
        Context ctx2 = tomcat.addContext("/foo", null);
94
            tomcat.addContext("/foo", System.getProperty("java.io.tmpdir"));
95
        ctx2.addApplicationListener(TesterEchoServer.Config.class.getName());
92
        ctx2.addApplicationListener(TesterEchoServer.Config.class.getName());
96
        Tomcat.addServlet(ctx2, "default", new DefaultServlet());
93
        Tomcat.addServlet(ctx2, "default", new DefaultServlet());
97
        ctx2.addServletMapping("/", "default");
94
        ctx2.addServletMapping("/", "default");
(-)test/org/apache/tomcat/websocket/TestWebSocketFrameClientSSL.java (-6 / +4 lines)
Lines 49-57 public class TestWebSocketFrameClientSSL extends TomcatBaseTest { Link Here
49
    public void testConnectToServerEndpointSSL() throws Exception {
49
    public void testConnectToServerEndpointSSL() throws Exception {
50
50
51
        Tomcat tomcat = getTomcatInstance();
51
        Tomcat tomcat = getTomcatInstance();
52
        // Must have a real docBase - just use temp
52
        // No file system docBase required
53
        Context ctx =
53
        Context ctx = tomcat.addContext("", null);
54
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
55
        ctx.addApplicationListener(TesterFirehoseServer.Config.class.getName());
54
        ctx.addApplicationListener(TesterFirehoseServer.Config.class.getName());
56
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
55
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
57
        ctx.addServletMapping("/", "default");
56
        ctx.addServletMapping("/", "default");
Lines 107-115 public class TestWebSocketFrameClientSSL extends TomcatBaseTest { Link Here
107
                getTomcatInstance().getConnector().getProtocol().equals("HTTP/1.1"));
106
                getTomcatInstance().getConnector().getProtocol().equals("HTTP/1.1"));
108
107
109
        Tomcat tomcat = getTomcatInstance();
108
        Tomcat tomcat = getTomcatInstance();
110
        // Must have a real docBase - just use temp
109
        // No file system docBase required
111
        Context ctx =
110
        Context ctx = tomcat.addContext("", null);
112
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
113
        ctx.addApplicationListener(TesterFirehoseServer.Config.class.getName());
111
        ctx.addApplicationListener(TesterFirehoseServer.Config.class.getName());
114
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
112
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
115
        ctx.addServletMapping("/", "default");
113
        ctx.addServletMapping("/", "default");
(-)test/org/apache/tomcat/websocket/TestWsPingPongMessages.java (-3 / +2 lines)
Lines 46-54 public class TestWsPingPongMessages extends TomcatBaseTest { Link Here
46
    @Test
46
    @Test
47
    public void testPingPongMessages() throws Exception {
47
    public void testPingPongMessages() throws Exception {
48
        Tomcat tomcat = getTomcatInstance();
48
        Tomcat tomcat = getTomcatInstance();
49
        // Must have a real docBase - just use temp
49
        // No file system docBase required
50
        Context ctx = tomcat.addContext("",
50
        Context ctx = tomcat.addContext("", null);
51
                System.getProperty("java.io.tmpdir"));
52
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
51
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
53
52
54
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
53
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
(-)test/org/apache/tomcat/websocket/TestWsRemoteEndpoint.java (-3 / +2 lines)
Lines 82-90 public class TestWsRemoteEndpoint extends TomcatBaseTest { Link Here
82
82
83
    private void doTestWriter(Class<?> clazz, boolean useWriter) throws Exception {
83
    private void doTestWriter(Class<?> clazz, boolean useWriter) throws Exception {
84
        Tomcat tomcat = getTomcatInstance();
84
        Tomcat tomcat = getTomcatInstance();
85
        // Must have a real docBase - just use temp
85
        // No file system docBase required
86
        Context ctx =
86
        Context ctx = tomcat.addContext("", null);
87
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
88
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
87
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
89
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
88
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
90
        ctx.addServletMapping("/", "default");
89
        ctx.addServletMapping("/", "default");
(-)test/org/apache/tomcat/websocket/TestWsSubprotocols.java (-3 / +2 lines)
Lines 49-57 public class TestWsSubprotocols extends TomcatBaseTest { Link Here
49
    @Test
49
    @Test
50
    public void testWsSubprotocols() throws Exception {
50
    public void testWsSubprotocols() throws Exception {
51
        Tomcat tomcat = getTomcatInstance();
51
        Tomcat tomcat = getTomcatInstance();
52
        // Must have a real docBase - just use temp
52
        // No file system docBase required
53
        Context ctx = tomcat.addContext("",
53
        Context ctx = tomcat.addContext("", null);
54
                System.getProperty("java.io.tmpdir"));
55
        ctx.addApplicationListener(Config.class.getName());
54
        ctx.addApplicationListener(Config.class.getName());
56
55
57
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
56
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
(-)test/org/apache/tomcat/websocket/TestWsWebSocketContainer.java (-33 / +22 lines)
Lines 82-90 public class TestWsWebSocketContainer extends TomcatBaseTest { Link Here
82
    @Test
82
    @Test
83
    public void testConnectToServerEndpoint() throws Exception {
83
    public void testConnectToServerEndpoint() throws Exception {
84
        Tomcat tomcat = getTomcatInstance();
84
        Tomcat tomcat = getTomcatInstance();
85
        // Must have a real docBase - just use temp
85
        // No file system docBase required
86
        Context ctx =
86
        Context ctx = tomcat.addContext("", null);
87
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
88
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
87
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
89
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
88
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
90
        ctx.addServletMapping("/", "default");
89
        ctx.addServletMapping("/", "default");
Lines 121-129 public class TestWsWebSocketContainer extends TomcatBaseTest { Link Here
121
    @Test(expected=javax.websocket.DeploymentException.class)
120
    @Test(expected=javax.websocket.DeploymentException.class)
122
    public void testConnectToServerEndpointInvalidScheme() throws Exception {
121
    public void testConnectToServerEndpointInvalidScheme() throws Exception {
123
        Tomcat tomcat = getTomcatInstance();
122
        Tomcat tomcat = getTomcatInstance();
124
        // Must have a real docBase - just use temp
123
        // No file system docBase required
125
        Context ctx =
124
        Context ctx = tomcat.addContext("", null);
126
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
127
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
125
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
128
126
129
        tomcat.start();
127
        tomcat.start();
Lines 140-148 public class TestWsWebSocketContainer extends TomcatBaseTest { Link Here
140
    @Test(expected=javax.websocket.DeploymentException.class)
138
    @Test(expected=javax.websocket.DeploymentException.class)
141
    public void testConnectToServerEndpointNoHost() throws Exception {
139
    public void testConnectToServerEndpointNoHost() throws Exception {
142
        Tomcat tomcat = getTomcatInstance();
140
        Tomcat tomcat = getTomcatInstance();
143
        // Must have a real docBase - just use temp
141
        // No file system docBase required
144
        Context ctx =
142
        Context ctx = tomcat.addContext("", null);
145
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
146
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
143
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
147
144
148
        tomcat.start();
145
        tomcat.start();
Lines 207-215 public class TestWsWebSocketContainer extends TomcatBaseTest { Link Here
207
            boolean isTextMessage, boolean pass) throws Exception {
204
            boolean isTextMessage, boolean pass) throws Exception {
208
205
209
        Tomcat tomcat = getTomcatInstance();
206
        Tomcat tomcat = getTomcatInstance();
210
        // Must have a real docBase - just use temp
207
        // No file system docBase required
211
        Context ctx =
208
        Context ctx = tomcat.addContext("", null);
212
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
213
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
209
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
214
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
210
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
215
        ctx.addServletMapping("/", "default");
211
        ctx.addServletMapping("/", "default");
Lines 316-324 public class TestWsWebSocketContainer extends TomcatBaseTest { Link Here
316
            throws Exception {
312
            throws Exception {
317
313
318
        Tomcat tomcat = getTomcatInstance();
314
        Tomcat tomcat = getTomcatInstance();
319
        // Must have a real docBase - just use temp
315
        // No file system docBase required
320
        Context ctx =
316
        Context ctx = tomcat.addContext("", null);
321
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
322
        ctx.addApplicationListener(BlockingConfig.class.getName());
317
        ctx.addApplicationListener(BlockingConfig.class.getName());
323
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
318
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
324
        ctx.addServletMapping("/", "default");
319
        ctx.addServletMapping("/", "default");
Lines 404-412 public class TestWsWebSocketContainer extends TomcatBaseTest { Link Here
404
399
405
        Tomcat tomcat = getTomcatInstance();
400
        Tomcat tomcat = getTomcatInstance();
406
401
407
        // Must have a real docBase - just use temp
402
        // No file system docBase required
408
        Context ctx =
403
        Context ctx = tomcat.addContext("", null);
409
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
410
        ctx.addApplicationListener(ConstantTxConfig.class.getName());
404
        ctx.addApplicationListener(ConstantTxConfig.class.getName());
411
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
405
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
412
        ctx.addServletMapping("/", "default");
406
        ctx.addServletMapping("/", "default");
Lines 588-596 public class TestWsWebSocketContainer extends TomcatBaseTest { Link Here
588
    @Test
582
    @Test
589
    public void testGetOpenSessions() throws Exception {
583
    public void testGetOpenSessions() throws Exception {
590
        Tomcat tomcat = getTomcatInstance();
584
        Tomcat tomcat = getTomcatInstance();
591
        // Must have a real docBase - just use temp
585
        // No file system docBase required
592
        Context ctx =
586
        Context ctx = tomcat.addContext("", null);
593
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
594
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
587
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
595
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
588
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
596
        ctx.addServletMapping("/", "default");
589
        ctx.addServletMapping("/", "default");
Lines 637-645 public class TestWsWebSocketContainer extends TomcatBaseTest { Link Here
637
    public void testSessionExpiryContainer() throws Exception {
630
    public void testSessionExpiryContainer() throws Exception {
638
631
639
        Tomcat tomcat = getTomcatInstance();
632
        Tomcat tomcat = getTomcatInstance();
640
        // Must have a real docBase - just use temp
633
        // No file system docBase required
641
        Context ctx =
634
        Context ctx = tomcat.addContext("", null);
642
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
643
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
635
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
644
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
636
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
645
        ctx.addServletMapping("/", "default");
637
        ctx.addServletMapping("/", "default");
Lines 695-703 public class TestWsWebSocketContainer extends TomcatBaseTest { Link Here
695
    public void testSessionExpirySession() throws Exception {
687
    public void testSessionExpirySession() throws Exception {
696
688
697
        Tomcat tomcat = getTomcatInstance();
689
        Tomcat tomcat = getTomcatInstance();
698
        // Must have a real docBase - just use temp
690
        // No file system docBase required
699
        Context ctx =
691
        Context ctx = tomcat.addContext("", null);
700
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
701
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
692
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
702
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
693
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
703
        ctx.addServletMapping("/", "default");
694
        ctx.addServletMapping("/", "default");
Lines 781-789 public class TestWsWebSocketContainer extends TomcatBaseTest { Link Here
781
    public void testConnectToServerEndpointSSL() throws Exception {
772
    public void testConnectToServerEndpointSSL() throws Exception {
782
773
783
        Tomcat tomcat = getTomcatInstance();
774
        Tomcat tomcat = getTomcatInstance();
784
        // Must have a real docBase - just use temp
775
        // No file system docBase required
785
        Context ctx =
776
        Context ctx = tomcat.addContext("", null);
786
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
787
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
777
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
788
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
778
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
789
        ctx.addServletMapping("/", "default");
779
        ctx.addServletMapping("/", "default");
Lines 868-876 public class TestWsWebSocketContainer extends TomcatBaseTest { Link Here
868
            throws Exception {
858
            throws Exception {
869
859
870
        Tomcat tomcat = getTomcatInstance();
860
        Tomcat tomcat = getTomcatInstance();
871
        // Must have a real docBase - just use temp
861
        // No file system docBase required
872
        Context ctx =
862
        Context ctx = tomcat.addContext("", null);
873
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
874
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
863
        ctx.addApplicationListener(TesterEchoServer.Config.class.getName());
875
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
864
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
876
        ctx.addServletMapping("/", "default");
865
        ctx.addServletMapping("/", "default");
(-)test/org/apache/tomcat/websocket/pojo/TestEncodingDecoding.java (-10 / +8 lines)
Lines 68-75 public class TestEncodingDecoding extends TomcatBaseTest { Link Here
68
    @Test
68
    @Test
69
    public void testProgrammaticEndPoints() throws Exception{
69
    public void testProgrammaticEndPoints() throws Exception{
70
        Tomcat tomcat = getTomcatInstance();
70
        Tomcat tomcat = getTomcatInstance();
71
        // Must have a real docBase - just use temp
71
        // No file system docBase required
72
        Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir"));
72
        Context ctx = tomcat.addContext("", null);
73
        ctx.addApplicationListener(
73
        ctx.addApplicationListener(
74
                ProgramaticServerEndpointConfig.class.getName());
74
                ProgramaticServerEndpointConfig.class.getName());
75
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
75
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
Lines 118-126 public class TestEncodingDecoding extends TomcatBaseTest { Link Here
118
        ServerConfigListener.setPojoClazz(Server.class);
118
        ServerConfigListener.setPojoClazz(Server.class);
119
119
120
        Tomcat tomcat = getTomcatInstance();
120
        Tomcat tomcat = getTomcatInstance();
121
        // Must have a real docBase - just use temp
121
        // No file system docBase required
122
        Context ctx =
122
        Context ctx = tomcat.addContext("", null);
123
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
124
        ctx.addApplicationListener(ServerConfigListener.class.getName());
123
        ctx.addApplicationListener(ServerConfigListener.class.getName());
125
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
124
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
126
        ctx.addServletMapping("/", "default");
125
        ctx.addServletMapping("/", "default");
Lines 178-186 public class TestEncodingDecoding extends TomcatBaseTest { Link Here
178
        ServerConfigListener.setPojoClazz(GenericsServer.class);
177
        ServerConfigListener.setPojoClazz(GenericsServer.class);
179
178
180
        Tomcat tomcat = getTomcatInstance();
179
        Tomcat tomcat = getTomcatInstance();
181
        // Must have a real docBase - just use temp
180
        // No file system docBase required
182
        Context ctx =
181
        Context ctx = tomcat.addContext("", null);
183
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
184
        ctx.addApplicationListener(ServerConfigListener.class.getName());
182
        ctx.addApplicationListener(ServerConfigListener.class.getName());
185
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
183
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
186
        ctx.addServletMapping("/", "default");
184
        ctx.addServletMapping("/", "default");
Lines 608-615 public class TestEncodingDecoding extends TomcatBaseTest { Link Here
608
    @Test
606
    @Test
609
    public void testUnsupportedObject() throws Exception{
607
    public void testUnsupportedObject() throws Exception{
610
        Tomcat tomcat = getTomcatInstance();
608
        Tomcat tomcat = getTomcatInstance();
611
        // Must have a real docBase - just use temp
609
        // No file system docBase required
612
        Context ctx = tomcat.addContext("", System.getProperty("java.io.tmpdir"));
610
        Context ctx = tomcat.addContext("", null);
613
        ctx.addApplicationListener(ProgramaticServerEndpointConfig.class.getName());
611
        ctx.addApplicationListener(ProgramaticServerEndpointConfig.class.getName());
614
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
612
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
615
        ctx.addServletMapping("/", "default");
613
        ctx.addServletMapping("/", "default");
(-)test/org/apache/tomcat/websocket/pojo/TestPojoEndpointBase.java (-6 / +4 lines)
Lines 52-60 public class TestPojoEndpointBase extends TomcatBaseTest { Link Here
52
        ServerConfigListener.setPojoClazz(Bug54716.class);
52
        ServerConfigListener.setPojoClazz(Bug54716.class);
53
53
54
        Tomcat tomcat = getTomcatInstance();
54
        Tomcat tomcat = getTomcatInstance();
55
        // Must have a real docBase - just use temp
55
        // No file system docBase required
56
        Context ctx =
56
        Context ctx = tomcat.addContext("", null);
57
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
58
        ctx.addApplicationListener(ServerConfigListener.class.getName());
57
        ctx.addApplicationListener(ServerConfigListener.class.getName());
59
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
58
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
60
        ctx.addServletMapping("/", "default");
59
        ctx.addServletMapping("/", "default");
Lines 84-92 public class TestPojoEndpointBase extends TomcatBaseTest { Link Here
84
        ServerConfigListener.setPojoClazz(OnOpenServerEndpoint.class);
83
        ServerConfigListener.setPojoClazz(OnOpenServerEndpoint.class);
85
84
86
        Tomcat tomcat = getTomcatInstance();
85
        Tomcat tomcat = getTomcatInstance();
87
        // Must have a real docBase - just use temp
86
        // No file system docBase required
88
        Context ctx =
87
        Context ctx = tomcat.addContext("", null);
89
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
90
        ctx.addApplicationListener(ServerConfigListener.class.getName());
88
        ctx.addApplicationListener(ServerConfigListener.class.getName());
91
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
89
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
92
        ctx.addServletMapping("/", "default");
90
        ctx.addServletMapping("/", "default");
(-)test/org/apache/tomcat/websocket/pojo/TestPojoMethodMapping.java (-3 / +2 lines)
Lines 55-63 public class TestPojoMethodMapping extends TomcatBaseTest { Link Here
55
        ServerConfigListener.setPojoClazz(Server.class);
55
        ServerConfigListener.setPojoClazz(Server.class);
56
56
57
        Tomcat tomcat = getTomcatInstance();
57
        Tomcat tomcat = getTomcatInstance();
58
        // Must have a real docBase - just use temp
58
        // No file system docBase required
59
        Context ctx =
59
        Context ctx = tomcat.addContext("", null);
60
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
61
        ctx.addApplicationListener(ServerConfigListener.class.getName());
60
        ctx.addApplicationListener(ServerConfigListener.class.getName());
62
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
61
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
63
        ctx.addServletMapping("/", "default");
62
        ctx.addServletMapping("/", "default");
(-)test/org/apache/tomcat/websocket/server/TestWsServerContainer.java (-3 / +2 lines)
Lines 38-46 public class TestWsServerContainer extends TomcatBaseTest { Link Here
38
    @Test
38
    @Test
39
    public void testBug54807() throws Exception {
39
    public void testBug54807() throws Exception {
40
        Tomcat tomcat = getTomcatInstance();
40
        Tomcat tomcat = getTomcatInstance();
41
        // Must have a real docBase - just use temp
41
        // No file system docBase required
42
        Context ctx =
42
        Context ctx = tomcat.addContext("", null);
43
            tomcat.addContext("", System.getProperty("java.io.tmpdir"));
44
        ctx.addApplicationListener(Bug54807Config.class.getName());
43
        ctx.addApplicationListener(Bug54807Config.class.getName());
45
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
44
        Tomcat.addServlet(ctx, "default", new DefaultServlet());
46
        ctx.addServletMapping("/", "default");
45
        ctx.addServletMapping("/", "default");

Return to bug 57154