01: // Copyright 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.internal.test;
16:
17: import static org.apache.tapestry.ioc.IOCConstants.PERTHREAD_SCOPE;
18:
19: import org.apache.tapestry.MarkupWriter;
20: import org.apache.tapestry.ioc.annotations.InjectService;
21: import org.apache.tapestry.ioc.annotations.Scope;
22: import org.apache.tapestry.services.MarkupWriterFactory;
23:
24: @Scope(PERTHREAD_SCOPE)
25: public class TestableMarkupWriterFactoryImpl implements
26: TestableMarkupWriterFactory {
27: private final MarkupWriterFactory _delegate;
28:
29: private MarkupWriter _lastCreated;
30:
31: public TestableMarkupWriterFactoryImpl(
32: @InjectService("MarkupWriterFactory")
33: MarkupWriterFactory delegate) {
34: _delegate = delegate;
35: }
36:
37: public MarkupWriter getLatestMarkupWriter() {
38: return _lastCreated;
39: }
40:
41: public MarkupWriter newMarkupWriter() {
42: MarkupWriter result = _delegate.newMarkupWriter();
43:
44: _lastCreated = result;
45:
46: return result;
47: }
48: }
|