Skip to content

Commit cfa3744

Browse files
committed
Removed some Servlet 3.0 API calls from the old PrettyFaces code
1 parent b7e780b commit cfa3744

4 files changed

Lines changed: 1 addition & 116 deletions

File tree

‎config-prettyfaces/src/main/java/org/ocpsoft/rewrite/prettyfaces/PrettyFacesRewriteLifecycleListener.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void beforeInboundLifecycle(final HttpServletRewrite event)
5050
}
5151

5252
HttpServletRequest request = event.getRequest();
53-
ServletContext servletContext = request.getServletContext();
53+
ServletContext servletContext = event.getServletContext();
5454

5555
reloader.reloadIfNecessary(servletContext);
5656
if (request.getAttribute(PrettyContext.CONFIG_KEY) == null)

‎config-prettyfaces/src/test/java/com/ocpsoft/pretty/faces/config/MockFacesServletRegistration.java‎

Lines changed: 0 additions & 82 deletions
This file was deleted.

‎config-prettyfaces/src/test/java/com/ocpsoft/pretty/faces/config/PrettyConfiguratorTest.java‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,11 @@
1818
import java.io.IOException;
1919
import java.io.InputStream;
2020
import java.net.URL;
21-
import java.util.HashMap;
22-
import java.util.Map;
2321

2422
import javax.servlet.ServletContext;
2523

2624
import org.easymock.EasyMock;
2725
import org.junit.Assert;
28-
import org.junit.BeforeClass;
2926
import org.junit.Test;
3027
import org.xml.sax.SAXException;
3128

@@ -38,27 +35,16 @@
3835
*/
3936
public class PrettyConfiguratorTest
4037
{
41-
private final static Map servlets = new HashMap<String, MockFacesServletRegistration>();
42-
4338
final ClassLoader mockResourceLoader = new MockClassLoader(mockPrettyConfigURL());
4439
final ClassLoader mockEmptyResourceLoader = new MockClassLoader();
4540

46-
@BeforeClass
47-
@SuppressWarnings("unchecked")
48-
public static void beforeClass()
49-
{
50-
servlets.put("Faces Servlet", new MockFacesServletRegistration());
51-
}
52-
5341
@Test
5442
public void testMETAINFConfiguration() throws SAXException, IOException
5543
{
5644
final ServletContext servletContext = EasyMock.createNiceMock(ServletContext.class);
5745

5846
EasyMock.expect(servletContext.getMajorVersion()).andReturn(3).anyTimes();
59-
EasyMock.expect(servletContext.getServletRegistrations()).andReturn(servlets).anyTimes();
6047
EasyMock.expect(servletContext.getInitParameter(PrettyContext.CONFIG_KEY)).andReturn(null).anyTimes();
61-
EasyMock.expect(servletContext.getClassLoader()).andReturn(mockResourceLoader).anyTimes();
6248
EasyMock.expect(servletContext.getResourceAsStream(DefaultXMLConfigurationProvider.DEFAULT_PRETTY_FACES_CONFIG)).andReturn(null).anyTimes();
6349

6450
final PrettyConfigurator configurator = new PrettyConfigurator(servletContext);
@@ -70,14 +56,11 @@ public void testMETAINFConfiguration() throws SAXException, IOException
7056
}
7157

7258
@Test
73-
@SuppressWarnings("unchecked")
7459
public void testInitParameterLocationConfiguration() throws SAXException, IOException
7560
{
7661
final ServletContext servletContext = EasyMock.createNiceMock(ServletContext.class);
7762

7863
EasyMock.expect(servletContext.getMajorVersion()).andReturn(3).anyTimes();
79-
EasyMock.expect(servletContext.getServletRegistrations()).andReturn(servlets).anyTimes();
80-
EasyMock.expect(servletContext.getClassLoader()).andReturn(mockEmptyResourceLoader).anyTimes();
8164
EasyMock.expect(servletContext.getInitParameter(PrettyContext.CONFIG_KEY)).andReturn("car.xml, cdr.xml").anyTimes();
8265
EasyMock.expect(servletContext.getInitParameter(ClassLoaderConfigurationProvider.CLASSPATH_CONFIG_ENABLED)).andReturn("false").anyTimes();
8366
EasyMock.expect(servletContext.getResourceAsStream("car.xml")).andReturn(mockPrettyConfigInputStream()).anyTimes();

‎config-prettyfaces/src/test/java/com/ocpsoft/pretty/faces/config/spi/ParentingPostProcessorTest.java‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,16 @@
2222
import java.util.ArrayList;
2323
import java.util.Collections;
2424
import java.util.Enumeration;
25-
import java.util.HashMap;
26-
import java.util.Map;
2725

2826
import javax.servlet.ServletContext;
2927

3028
import org.easymock.EasyMock;
31-
import org.junit.BeforeClass;
3229
import org.junit.Test;
3330
import org.xml.sax.SAXException;
3431

3532
import com.ocpsoft.pretty.PrettyContext;
3633
import com.ocpsoft.pretty.faces.config.DigesterPrettyConfigParser;
3734
import com.ocpsoft.pretty.faces.config.MockClassLoader;
38-
import com.ocpsoft.pretty.faces.config.MockFacesServletRegistration;
3935
import com.ocpsoft.pretty.faces.config.PrettyConfig;
4036
import com.ocpsoft.pretty.faces.config.PrettyConfigBuilder;
4137
import com.ocpsoft.pretty.faces.config.PrettyConfigurator;
@@ -45,17 +41,8 @@
4541
*/
4642
public class ParentingPostProcessorTest
4743
{
48-
@SuppressWarnings("rawtypes")
49-
private final static Map servlets = new HashMap<String, MockFacesServletRegistration>();
5044
final ClassLoader mockResourceLoader = new MockClassLoader();
5145

52-
@BeforeClass
53-
@SuppressWarnings("unchecked")
54-
public static void beforeClass()
55-
{
56-
servlets.put("Faces Servlet", new MockFacesServletRegistration());
57-
}
58-
5946
private final Enumeration<String> initParameterNames = Collections.enumeration(new ArrayList<String>());
6047

6148
@Test
@@ -74,14 +61,11 @@ public void testParseParentIds() throws Exception
7461
}
7562

7663
@Test
77-
@SuppressWarnings("unchecked")
7864
public void testParentIdInheritsPatterns() throws SAXException, IOException
7965
{
8066
final ServletContext servletContext = EasyMock.createNiceMock(ServletContext.class);
8167

8268
EasyMock.expect(servletContext.getMajorVersion()).andReturn(3).anyTimes();
83-
EasyMock.expect(servletContext.getServletRegistrations()).andReturn(servlets).anyTimes();
84-
EasyMock.expect(servletContext.getClassLoader()).andReturn(mockResourceLoader).anyTimes();
8569
EasyMock.expect(servletContext.getInitParameterNames()).andReturn(initParameterNames).anyTimes();
8670
EasyMock.expect(servletContext.getInitParameter(PrettyContext.CONFIG_KEY)).andReturn(null).anyTimes();
8771
EasyMock.expect(servletContext.getInitParameter(ClassLoaderConfigurationProvider.CLASSPATH_CONFIG_ENABLED))

0 commit comments

Comments
 (0)