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.pluto.internal.impl;
18:
19: import java.util.Properties;
20:
21: import org.apache.pluto.util.PlutoTestCase;
22:
23: /**
24: * Test Class
25: *
26: * @version 1.0
27: * @since June 1, 2005
28: */
29: public class EnvironmentTest extends PlutoTestCase {
30:
31: private Properties props;
32:
33: public void setUp() throws Exception {
34: props = new Properties();
35: props
36: .load(Environment.class
37: .getResourceAsStream("/org/apache/pluto/environment.properties"));
38: }
39:
40: public void testContainerMajorVersion() {
41: assertEquals("1", Environment.getPortletContainerMajorVersion());
42: }
43:
44: public void testContainerMinorVersion() {
45: assertTrue(Environment.getPortletContainerVersion().endsWith(
46: Environment.getPortletContainerMinorVersion()));
47: }
48:
49: public void testContainerVersion() {
50: assertEquals(props.getProperty("pluto.container.version"),
51: Environment.getPortletContainerVersion());
52: }
53:
54: public void testContainerName() {
55: assertEquals(props.getProperty("pluto.container.name"),
56: Environment.getPortletContainerName());
57: }
58:
59: public void testSpecVersion() {
60: assertEquals(Integer.parseInt(props
61: .getProperty("javax.portlet.version.major")),
62: Environment.getMajorSpecificationVersion());
63: }
64:
65: public void testSpecMinorVersion() {
66: assertEquals(Integer.parseInt(props
67: .getProperty("javax.portlet.version.minor")),
68: Environment.getMinorSpecificationVersion());
69: }
70:
71: public void testServerInfo() {
72: assertContains("Server Info does not contain container name.",
73: props.getProperty("pluto.container.name"), Environment
74: .getServerInfo());
75: assertContains("Server Info does not contain container name.",
76: props.getProperty("pluto.container.version"),
77: Environment.getServerInfo());
78: }
79: }
|