Author: kkolinko Date: Mon Jun 23 16:09:38 2014 New Revision: 1604845 URL: http://svn.apache.org/r1604845 Log: Mode test for adding duplicates from setUp() into a test method. Add two additional tests. It is backport of r1604217.
Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java?rev=1604845&r1=1604844&r2=1604845&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java Mon Jun 23 16:09:38 2014 @@ -43,7 +43,6 @@ public class TestMapper extends LoggingB mapper.addHost("fwehoihoihwfeo", new String[0], "blah5"); mapper.addHost("owefojiwefoi", new String[0], "blah6"); mapper.addHost("iowejoiejfoiew", new String[0], "blah7"); - mapper.addHost("iowejoiejfoiew", new String[0], "blah17"); mapper.addHost("ohewoihfewoih", new String[0], "blah8"); mapper.addHost("fewohfoweoih", new String[0], "blah9"); mapper.addHost("ttthtiuhwoih", new String[0], "blah10"); @@ -88,8 +87,16 @@ public class TestMapper extends LoggingB @Test public void testAddHost() throws Exception { + // Try to add duplicates + // Duplicate Host name + mapper.addHost("iowejoiejfoiew", new String[0], "blah17"); + // Alias conflicting with existing Host + mapper.addHostAlias("iowejoiejfoiew", "qwigqwiwoih"); + // Redundancy. Alias name = Host name. No error here. + mapper.addHostAlias("qwigqwiwoih", "qwigqwiwoih"); + // Check we have the right number - // (added 17 including one host alias but one is a duplicate) + // (added 16 including one host alias. Three duplicates do not increase the count.) assertEquals(16, mapper.hosts.length); // Make sure adding a duplicate *does not* overwrite @@ -105,6 +112,9 @@ public class TestMapper extends LoggingB assertTrue(previous.compareTo(current) < 0); } + final int qwigPos = 8; + assertEquals("blah14", mapper.hosts[qwigPos].object); + // Check that host alias has the same data Mapper.Host host = mapper.hosts[iowPos]; Mapper.Host alias = mapper.hosts[iowPos + 1]; --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org