INCOMAPTIBLE: Update dependency servlet-api to 3.1
INCOMAPTIBLE: Remove dependency on fulcrum-upload. 
All FileItems are now Parts.
Require Java-8


git-svn-id: https://svn.apache.org/repos/asf/turbine/fulcrum/trunk/parser@1837188 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/test/org/apache/fulcrum/parser/ParameterParserTest.java b/src/test/org/apache/fulcrum/parser/ParameterParserTest.java
index 8c78338..02470d4 100644
--- a/src/test/org/apache/fulcrum/parser/ParameterParserTest.java
+++ b/src/test/org/apache/fulcrum/parser/ParameterParserTest.java
@@ -1,11 +1,5 @@
 package org.apache.fulcrum.parser;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -25,13 +19,20 @@
  * under the License.
  */
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Collection;
 import java.util.Iterator;
 
+import javax.servlet.http.Part;
+
 import org.apache.avalon.framework.component.ComponentException;
-import org.apache.commons.fileupload.FileItem;
-import org.apache.commons.fileupload.FileItemFactory;
-import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.fulcrum.parser.ValueParser.URLCaseFolding;
 import org.apache.fulcrum.testcontainer.BaseUnit4Test;
 import org.junit.Before;
@@ -62,7 +63,7 @@
             fail(e.getMessage());
         }
     }
-    
+
     @Test
     public void testConfiguredUrlCaseFolding() throws Exception
     {
@@ -76,7 +77,7 @@
     public void testConfiguredParameterEncoding() throws Exception {
         assertEquals("utf-8", parserService.getParameterEncoding());
     }
-    
+
     /**
      * Simple test to verify that URL Case Folding works properly
      *
@@ -93,22 +94,81 @@
     /**
      * This Test method checks the DefaultParameterParser which carries two Sets inside it.
      * The suggested problem was that pp.keySet() returns both Keys, but pp.getStrings("key")
-     * only checks for keys which are not FileItems.
+     * only checks for keys which are not Parts.
      *
      * @throws Exception
      */
     @Test
     public void testAddPathInfo() throws Exception
     {
-        FileItemFactory factory = new DiskFileItemFactory(10240, null);
-
         assertEquals("keySet() is not empty!", 0, parameterParser.keySet().size());
 
-        FileItem test = factory.createItem("upload-field", "application/octet-stream", false, null);
+        Part test = new Part()
+        {
+
+            @Override
+            public void write(String fileName) throws IOException
+            {
+            }
+
+            @Override
+            public String getSubmittedFileName()
+            {
+                return null;
+            }
+
+            @Override
+            public long getSize()
+            {
+                return 0;
+            }
+
+            @Override
+            public String getName()
+            {
+                return "upload-field";
+            }
+
+            @Override
+            public InputStream getInputStream() throws IOException
+            {
+                return null;
+            }
+
+            @Override
+            public Collection<String> getHeaders(String name)
+            {
+                return null;
+            }
+
+            @Override
+            public Collection<String> getHeaderNames()
+            {
+                return null;
+            }
+
+            @Override
+            public String getHeader(String name)
+            {
+                return null;
+            }
+
+            @Override
+            public String getContentType()
+            {
+                return "application/octet-stream";
+            }
+
+            @Override
+            public void delete() throws IOException
+            {
+            }
+        };
+
         // Push this into the parser using DefaultParameterParser's add() method.
         ((DefaultParameterParser) parameterParser).add("upload-field", test);
 
-        assertEquals("FileItem not found in keySet()!", 1, parameterParser.keySet().size());
+        assertEquals("Part not found in keySet()!", 1, parameterParser.keySet().size());
 
         Iterator<String> it = parameterParser.keySet().iterator();
         assertTrue(it.hasNext());
@@ -125,8 +185,8 @@
         assertTrue(parameterParser.containsKey("upload-field"));
         assertTrue(parameterParser.containsKey("other-field"));
 
-        // The following will actually cause a ClassCastException because getStrings() (and others) are not catering for FileItems.
-        assertNull("The returned should be null because a FileItem is not a String", parameterParser.getStrings("upload-field"));
+        // The following will actually cause a ClassCastException because getStrings() (and others) are not catering for Parts.
+        assertNull("The returned should be null because a Part is not a String", parameterParser.getStrings("upload-field"));
         assertFalse(parameterParser.containsKey("missing-field"));
     }
 }