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  package org.apache.jetspeed.pipeline;
18  
19  import java.util.HashMap;
20  import java.util.Map;
21  
22  import junit.framework.TestCase;
23  
24  import org.apache.jetspeed.engine.Engine;
25  import org.apache.jetspeed.pipeline.valve.Valve;
26  import org.apache.jetspeed.testhelpers.SpringEngineHelper;
27  
28  /***
29   * TestPipeline
30   *
31   * @author <a href="taylor@apache.org">David Sean Taylor</a>
32   * @version $Id: TestPipeline.java 544402 2007-06-05 06:20:00Z taylor $
33   */
34  public class TestPipeline extends TestCase
35  {
36       private Engine engine;
37      private SpringEngineHelper engineHelper;
38  
39      /***
40       * Tests
41       *
42       * @throws Exception
43       */
44      public void testPipeline() throws Exception
45      {
46          assertNotNull(engine);
47          Pipeline pipeline = engine.getPipeline();
48          assertNotNull(pipeline);
49          Valve[] valves = pipeline.getValves();
50          assertEquals("CapabilityValveImpl", valves[0].toString());
51          assertEquals("PortalURLValveImpl", valves[1].toString());
52          assertEquals("SecurityValve", valves[2].toString());
53          assertEquals("LocalizationValve", valves[3].toString());
54          assertEquals("PasswordCredentialValve", valves[4].toString());
55          assertEquals("LoginValidationValve", valves[5].toString());
56          assertEquals("ProfilerValve", valves[6].toString());
57          assertEquals("ContainerValve", valves[7].toString());
58          assertEquals("ActionValveImpl", valves[8].toString());
59          assertEquals("ResourceValveImpl", valves[9].toString());
60          assertEquals("DecorationValve", valves[10].toString());
61          assertEquals("HeaderAggregatorValve", valves[11].toString());
62          assertEquals("AggregatorValve", valves[12].toString());
63          assertEquals("CleanupValveImpl", valves[13].toString());
64          
65          
66          assertNotNull(engine.getPipeline("action-pipeline"));
67          assertNotNull(engine.getPipeline("portlet-pipeline"));
68      }
69  
70      protected void setUp() throws Exception
71      {
72          Map context = new HashMap();
73          engineHelper = new SpringEngineHelper(context);
74          engineHelper.setUp();
75          this.engine = (Engine)context.get(SpringEngineHelper.ENGINE_ATTR);
76      }
77  
78      protected void tearDown() throws Exception
79      {
80          engineHelper.tearDown();
81      }
82  }