Author: kkolinko Date: Thu Jan 7 15:30:36 2016 New Revision: 1723576 URL: http://svn.apache.org/viewvc?rev=1723576&view=rev Log: Add testcase for BZ 52028 For https://bz.apache.org/bugzilla/show_bug.cgi?id=52028
Added: tomcat/tc6.0.x/branches/tomcat6-testing_20160106/test/org/apache/catalina/connector/ tomcat/tc6.0.x/branches/tomcat6-testing_20160106/test/org/apache/catalina/connector/TestConnector.java - copied, changed from r1723488, tomcat/tc7.0.x/trunk/test/org/apache/catalina/connector/TestConnector.java Copied: tomcat/tc6.0.x/branches/tomcat6-testing_20160106/test/org/apache/catalina/connector/TestConnector.java (from r1723488, tomcat/tc7.0.x/trunk/test/org/apache/catalina/connector/TestConnector.java) URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/branches/tomcat6-testing_20160106/test/org/apache/catalina/connector/TestConnector.java?p2=tomcat/tc6.0.x/branches/tomcat6-testing_20160106/test/org/apache/catalina/connector/TestConnector.java&p1=tomcat/tc7.0.x/trunk/test/org/apache/catalina/connector/TestConnector.java&r1=1723488&r2=1723576&rev=1723576&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/catalina/connector/TestConnector.java (original) +++ tomcat/tc6.0.x/branches/tomcat6-testing_20160106/test/org/apache/catalina/connector/TestConnector.java Thu Jan 7 15:30:36 2016 @@ -16,19 +16,12 @@ */ package org.apache.catalina.connector; -import java.net.SocketTimeoutException; +import org.junit.Test; -import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import org.junit.Test; - -import org.apache.catalina.Context; -import org.apache.catalina.Wrapper; -import org.apache.catalina.startup.TesterServlet; -import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.Embedded; import org.apache.catalina.startup.TomcatBaseTest; -import org.apache.tomcat.util.buf.ByteChunk; /** * Test cases for {@link Connector}. @@ -36,61 +29,17 @@ import org.apache.tomcat.util.buf.ByteCh public class TestConnector extends TomcatBaseTest { @Test - public void testStop() throws Exception { - Tomcat tomcat = getTomcatInstance(); - - // No file system docBase required - Context root = tomcat.addContext("", null); - Wrapper w = - Tomcat.addServlet(root, "tester", new TesterServlet()); - w.setAsyncSupported(true); - root.addServletMapping("/", "tester"); - - Connector connector = tomcat.getConnector(); - - tomcat.start(); - - ByteChunk bc = new ByteChunk(); - int rc = getUrl("http://localhost:" + getPort() + "/", bc, null, null); - - assertEquals(200, rc); - assertEquals("OK", bc.toString()); - - rc = -1; - bc.recycle(); - - connector.stop(); - - try { - rc = getUrl("http://localhost:" + getPort() + "/", bc, 1000, - null, null); - } catch (SocketTimeoutException ste) { - // May also see this with NIO - // Make sure the test passes if we do - rc = 503; - } - assertEquals(503, rc); - } - - - @Test public void testPort() throws Exception { - Tomcat tomcat = getTomcatInstance(); + Embedded tomcat = getTomcatInstance(); - Connector connector1 = tomcat.getConnector(); + // Connector connector1 = tomcat.getConnector(); + Connector connector1 = tomcat.findConnectors()[0]; connector1.setPort(0); - Connector connector2 = new Connector(); - connector2.setPort(0); - - tomcat.getService().addConnector(connector2); - tomcat.start(); int localPort1 = connector1.getLocalPort(); - int localPort2 = connector2.getLocalPort(); assertTrue(localPort1 > 0); - assertTrue(localPort2 > 0); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org