01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * 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: package org.apache.cocoon;
18:
19: /**
20: * HtmlUnit TestCase for memory leak in internal requests (Bugzilla #26186).
21: *
22: * @version $Id: $
23: */
24: public class Bug26186InternalRequestMemoryLeakTestCase extends
25: HtmlUnitTestCase {
26: static final String pageurl = "/samples/blocks/xsp/java/resolver";
27:
28: public void testMemoryLeak() throws Exception {
29: final int iterations = Integer
30: .parseInt(System
31: .getProperty("htmlunit.test.Bug26186InternalRequestMemoryLeak.iterations"));
32:
33: final String phrase = "An XSP Page using a source";
34: for (int i = 0; i < iterations; i++) {
35: loadResponse(pageurl);
36: assertEquals("Status code", 200, response.getStatusCode());
37: assertTrue("Content should contain: " + phrase, response
38: .getContentAsString().indexOf(phrase) != -1);
39:
40: if ((i + 1) % 100 == 0) {
41: logger.info("Memory leak checking " + (i + 1) + " of "
42: + iterations + " iterations");
43: }
44: }
45: }
46: }
|