1 package org.apache.turbine.pipeline;
2
3
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
20 * under the License.
21 */
22
23
24 import java.io.StringWriter;
25
26 import org.junit.Test;
27 import static org.junit.Assert.assertEquals;
28
29 /**
30 * Tests TurbinePipeline.
31 *
32 * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
33 * @version $Id: PipelineTest.java 1606111 2014-06-27 14:46:47Z gk $
34 */
35 public class PipelineTest
36 {
37
38
39 /**
40 * Tests the Pipeline.
41 */
42 @Test public void testPipeline() throws Exception
43 {
44
45 // Make sure Valves are getting added properly to the
46 // Pipeline.
47 StringWriter writer = new StringWriter();
48 Pipeline pipeline = new TurbinePipeline();
49
50 SimpleValve valve = new SimpleValve();
51 valve.setWriter(writer);
52 valve.setValue("foo");
53 pipeline.addValve(valve);
54 valve = new SimpleValve();
55 valve.setWriter(writer);
56 valve.setValue("bar");
57 pipeline.addValve(valve);
58
59 pipeline.invoke(new DefaultPipelineData());
60
61 assertEquals("foobar", writer.toString());
62 }
63 }