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.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 598476 2007-11-27 00:39:21Z ate $
33: */
34: public class TestPipeline extends TestCase {
35: private Engine engine;
36: private SpringEngineHelper engineHelper;
37:
38: /**
39: * Tests
40: *
41: * @throws Exception
42: */
43: public void testPipeline() throws Exception {
44: assertNotNull(engine);
45: Pipeline pipeline = engine.getPipeline();
46: assertNotNull(pipeline);
47: Valve[] valves = pipeline.getValves();
48: HashMap valvesMap = new HashMap(valves.length);
49: for (int i = 0; i < valves.length; i++) {
50: valvesMap.put(valves[i].toString(), valves[i]);
51: }
52: assertNotNull("CapabilityValveImpl", valvesMap
53: .get("CapabilityValveImpl"));
54: assertNotNull("PortalURLValveImpl", valvesMap
55: .get("PortalURLValveImpl"));
56: assertNotNull("SecurityValve", valvesMap.get("SecurityValve"));
57: assertNotNull("LocalizationValve", valvesMap
58: .get("LocalizationValve"));
59: assertNotNull("PasswordCredentialValve", valvesMap
60: .get("PasswordCredentialValve"));
61: assertNotNull("LoginValidationValve", valvesMap
62: .get("LoginValidationValve"));
63: assertNotNull("ProfilerValve", valvesMap.get("ProfilerValve"));
64: assertNotNull("ContainerValve", valvesMap.get("ContainerValve"));
65: assertNotNull("ActionValveImpl", valvesMap
66: .get("ActionValveImpl"));
67: assertNotNull("ResourceValveImpl", valvesMap
68: .get("ResourceValveImpl"));
69: assertNotNull("DecorationValve", valvesMap
70: .get("DecorationValve"));
71: assertNotNull("HeaderAggregatorValve", valvesMap
72: .get("HeaderAggregatorValve"));
73: assertNotNull("AggregatorValve", valvesMap
74: .get("AggregatorValve"));
75: assertNotNull("CleanupValveImpl", valvesMap
76: .get("CleanupValveImpl"));
77:
78: assertNotNull(engine.getPipeline("action-pipeline"));
79: assertNotNull(engine.getPipeline("portlet-pipeline"));
80: }
81:
82: protected void setUp() throws Exception {
83: Map context = new HashMap();
84: engineHelper = new SpringEngineHelper(context);
85: engineHelper.setUp();
86: this .engine = (Engine) context
87: .get(SpringEngineHelper.ENGINE_ATTR);
88: }
89:
90: protected void tearDown() throws Exception {
91: engineHelper.tearDown();
92: }
93: }
|