Author: violetagg
Date: Mon Jul  8 11:25:51 2013
New Revision: 1500663

URL: http://svn.apache.org/r1500663
Log:
Provide test case for 
META-INF/services/javax.servlet.ServletContainerInitializer that contains 
multiple SCIs and comments.

Added:
    
tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer1.java
   (with props)
    
tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer2.java
   (with props)
Modified:
    tomcat/trunk/test/org/apache/catalina/startup/TestContextConfig.java
    tomcat/trunk/test/webapp-fragments/WEB-INF/lib/resources.jar

Modified: tomcat/trunk/test/org/apache/catalina/startup/TestContextConfig.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestContextConfig.java?rev=1500663&r1=1500662&r2=1500663&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/startup/TestContextConfig.java 
(original)
+++ tomcat/trunk/test/org/apache/catalina/startup/TestContextConfig.java Mon 
Jul  8 11:25:51 2013
@@ -146,6 +146,19 @@ public class TestContextConfig extends T
                 "envEntry1: 1 envEntry2: 2 envEntry3: 33 envEntry4: 4");
     }
 
+    @Test
+    public void testBug55210() throws Exception {
+        Tomcat tomcat = getTomcatInstance();
+
+        File appDir = new File("test/webapp-fragments");
+        tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
+
+        tomcat.start();
+
+        assertPageContains("/test/TesterServlet1", "OK");
+        assertPageContains("/test/TesterServlet2", "OK");
+    }
+
     private static class CustomDefaultServletSCI
             implements ServletContainerInitializer {
 

Added: 
tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer1.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer1.java?rev=1500663&view=auto
==============================================================================
--- 
tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer1.java
 (added)
+++ 
tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer1.java
 Mon Jul  8 11:25:51 2013
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.catalina.startup;
+
+import java.util.Set;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletContainerInitializer;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+
+public class TesterServletContainerInitializer1 implements
+        ServletContainerInitializer {
+
+    @Override
+    public void onStartup(Set<Class<?>> c, ServletContext ctx)
+            throws ServletException {
+        Servlet s = new TesterServlet();
+        ServletRegistration.Dynamic r = ctx.addServlet("TesterServlet1", s);
+        r.addMapping("/TesterServlet1");
+    }
+
+}

Propchange: 
tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer1.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer2.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer2.java?rev=1500663&view=auto
==============================================================================
--- 
tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer2.java
 (added)
+++ 
tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer2.java
 Mon Jul  8 11:25:51 2013
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.catalina.startup;
+
+import java.util.Set;
+
+import javax.servlet.Servlet;
+import javax.servlet.ServletContainerInitializer;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRegistration;
+
+public class TesterServletContainerInitializer2 implements
+        ServletContainerInitializer {
+
+    @Override
+    public void onStartup(Set<Class<?>> c, ServletContext ctx)
+            throws ServletException {
+        Servlet s = new TesterServlet();
+        ServletRegistration.Dynamic r = ctx.addServlet("TesterServlet2", s);
+        r.addMapping("/TesterServlet2");
+    }
+
+}

Propchange: 
tomcat/trunk/test/org/apache/catalina/startup/TesterServletContainerInitializer2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tomcat/trunk/test/webapp-fragments/WEB-INF/lib/resources.jar
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-fragments/WEB-INF/lib/resources.jar?rev=1500663&r1=1500662&r2=1500663&view=diff
==============================================================================
Binary files - no diff available.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to