001 // Copyright 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry.portlet; 016 017 import static org.easymock.EasyMock.expect; 018 019 import java.util.List; 020 021 import org.testng.annotations.Test; 022 023 import javax.portlet.PortletConfig; 024 025 /** 026 * Tests for {@link org.apache.tapestry.portlet.PortletWebActivator}. 027 * 028 * @author Howard M. Lewis Ship 029 * @since 4.0 030 */ 031 @Test 032 public class TestPortletWebActivator extends BasePortletWebTestCase 033 { 034 public void testGetActivatorName() 035 { 036 PortletConfig config = newMock(PortletConfig.class); 037 038 expect(config.getPortletName()).andReturn("portlet"); 039 040 replay(); 041 042 PortletWebActivator pwa = new PortletWebActivator(config); 043 044 assertEquals("portlet", pwa.getActivatorName()); 045 046 verify(); 047 } 048 049 public void testGetInitParameterNames() 050 { 051 PortletConfig config = newMock(PortletConfig.class); 052 053 expect(config.getInitParameterNames()).andReturn(newEnumeration()); 054 055 replay(); 056 057 PortletWebActivator pwa = new PortletWebActivator(config); 058 059 List l = pwa.getInitParameterNames(); 060 061 checkList(l); 062 063 verify(); 064 } 065 066 public void testGetInitParameterValue() 067 { 068 String value = "William Orbit"; 069 070 PortletConfig config = newMock(PortletConfig.class); 071 072 expect(config.getInitParameter("artist")).andReturn(value); 073 074 replay(); 075 076 PortletWebActivator pwa = new PortletWebActivator(config); 077 078 assertSame(value, pwa.getInitParameterValue("artist")); 079 080 verify(); 081 } 082 }