001package org.apache.turbine.pipeline; 002 003 004/* 005 * Licensed to the Apache Software Foundation (ASF) under one 006 * or more contributor license agreements. See the NOTICE file 007 * distributed with this work for additional information 008 * regarding copyright ownership. The ASF licenses this file 009 * to you under the Apache License, Version 2.0 (the 010 * "License"); you may not use this file except in compliance 011 * with the License. You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, 016 * software distributed under the License is distributed on an 017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 018 * KIND, either express or implied. See the License for the 019 * specific language governing permissions and limitations 020 * under the License. 021 */ 022 023 024import java.io.StringWriter; 025 026import org.junit.Test; 027import static org.junit.Assert.assertEquals; 028 029/** 030 * Tests TurbinePipeline. 031 * 032 * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a> 033 * @version $Id: PipelineTest.java 1606111 2014-06-27 14:46:47Z gk $ 034 */ 035public class PipelineTest 036{ 037 038 039 /** 040 * Tests the Pipeline. 041 */ 042 @Test public void testPipeline() throws Exception 043 { 044 045 // Make sure Valves are getting added properly to the 046 // Pipeline. 047 StringWriter writer = new StringWriter(); 048 Pipeline pipeline = new TurbinePipeline(); 049 050 SimpleValve valve = new SimpleValve(); 051 valve.setWriter(writer); 052 valve.setValue("foo"); 053 pipeline.addValve(valve); 054 valve = new SimpleValve(); 055 valve.setWriter(writer); 056 valve.setValue("bar"); 057 pipeline.addValve(valve); 058 059 pipeline.invoke(new DefaultPipelineData()); 060 061 assertEquals("foobar", writer.toString()); 062 } 063}