You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2015/01/22 20:48:32 UTC

svn commit: r1654030 - in /tomcat/trunk/test: org/apache/catalina/webresources/TestResourceJars.java webresources/non-static-resources.jar

Author: markt
Date: Thu Jan 22 19:48:32 2015
New Revision: 1654030

URL: http://svn.apache.org/r1654030
Log:
Add currently failing test for issue that came up via Servlet EG / Stackoverflow.

Added:
    tomcat/trunk/test/org/apache/catalina/webresources/TestResourceJars.java   (with props)
    tomcat/trunk/test/webresources/non-static-resources.jar   (with props)

Added: tomcat/trunk/test/org/apache/catalina/webresources/TestResourceJars.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/webresources/TestResourceJars.java?rev=1654030&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/webresources/TestResourceJars.java (added)
+++ tomcat/trunk/test/org/apache/catalina/webresources/TestResourceJars.java Thu Jan 22 19:48:32 2015
@@ -0,0 +1,52 @@
+/*
+ * 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.webresources;
+
+import java.io.File;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import org.apache.catalina.WebResource;
+import org.apache.catalina.WebResourceSet;
+
+public class TestResourceJars {
+
+    @Ignore // This test currenty fails. A fix is in hand...
+    @Test
+    public void testNonStaticResources() {
+        File empty = new File("test/webresources/dir3");
+        File jar = new File("test/webresources/non-static-resources.jar");
+
+        TesterWebResourceRoot root = new TesterWebResourceRoot();
+
+        // Use empty dir for root of web app.
+        WebResourceSet webResourceSet = new DirResourceSet(root, "/", empty.getAbsolutePath(), "/");
+        root.setMainResources(webResourceSet);
+
+        // If this JAR was in a web application, this is equivalent to how it
+        // would be added
+        JarResourceSet test =
+                new JarResourceSet(root, "/", jar.getAbsolutePath(), "/META-INF/resources");
+        root.addJarResources(test);
+
+        WebResource resource = root.getClassLoaderResource("/org/apache/tomcat/unittest/foo.txt");
+
+        Assert.assertFalse(resource.exists());
+    }
+}

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

Added: tomcat/trunk/test/webresources/non-static-resources.jar
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webresources/non-static-resources.jar?rev=1654030&view=auto
==============================================================================
Binary file - no diff available.

Propchange: tomcat/trunk/test/webresources/non-static-resources.jar
------------------------------------------------------------------------------
    svn:mime-type = application/java-archive



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