clean up tests

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1089 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Greg Wilkins 2009-11-24 00:00:17 +00:00
parent a142187a7b
commit d2898371e3
8 changed files with 62 additions and 11 deletions

View File

@ -23,4 +23,8 @@ public class HttpStatusCodeTest extends TestCase
assertNull("Invalid code: 190", HttpStatus.getCode(190));
}
public void testHttpMethod()
{
assertEquals("GET",HttpMethods.GET_BUFFER.toString());
}
}

View File

@ -16,3 +16,5 @@ confidentialPort: Port to use for confidential redirections.
confidentialScheme: Scheme to use for confidential redirections.
integralPort: Port to use for integral redirections.
integralScheme: Scheme to use for integral redirections.
lowResourcesConnections: The number of connections, which if exceeded represents low resources
lowResourcesMaxIdleTime: The period in ms that a connection may be idle when the connector has low resources, before it is closed.

View File

@ -1,3 +1 @@
SelectChannelConnector: HTTP connector using NIO ByteChannels and Selectors
lowResourcesConnections: The number of connections, which if exceeded represents low resources
lowResourcesMaxIdleTime: The period in ms that a connection may be idle when the connector has low resources, before it is closed.

View File

@ -256,22 +256,42 @@ public abstract class AbstractConnector extends HttpBuffers implements Connector
/* ------------------------------------------------------------ */
/**
* @return Returns the maxIdleTime.
* @return Returns the maxIdleTime when resources are low.
*/
public int getLowResourceMaxIdleTime()
public int getLowResourcesMaxIdleTime()
{
return _lowResourceMaxIdleTime;
}
/* ------------------------------------------------------------ */
/**
* @param maxIdleTime The maxIdleTime to set.
* @param maxIdleTime The maxIdleTime to set when resources are low.
*/
public void setLowResourceMaxIdleTime(int maxIdleTime)
public void setLowResourcesMaxIdleTime(int maxIdleTime)
{
_lowResourceMaxIdleTime = maxIdleTime;
}
/* ------------------------------------------------------------ */
/**
* @return Returns the maxIdleTime when resources are low.
* @deprecated
*/
public final int getLowResourceMaxIdleTime()
{
return getLowResourcesMaxIdleTime();
}
/* ------------------------------------------------------------ */
/**
* @param maxIdleTime The maxIdleTime to set when resources are low.
* @deprecated
*/
public final void setLowResourceMaxIdleTime(int maxIdleTime)
{
setLowResourcesMaxIdleTime(maxIdleTime);
}
/* ------------------------------------------------------------ */
/**
* @return Returns the soLingerTime.

View File

@ -247,6 +247,7 @@ public class SelectChannelConnector extends AbstractNIOConnector
/**
* @return the lowResourcesMaxIdleTime
*/
@Override
public int getLowResourcesMaxIdleTime()
{
return _lowResourcesMaxIdleTime;
@ -261,10 +262,10 @@ public class SelectChannelConnector extends AbstractNIOConnector
* @see {@link #setMaxIdleTime(long)}
*/
@Override
public void setLowResourceMaxIdleTime(int lowResourcesMaxIdleTime)
public void setLowResourcesMaxIdleTime(int lowResourcesMaxIdleTime)
{
_lowResourcesMaxIdleTime=lowResourcesMaxIdleTime;
super.setLowResourceMaxIdleTime(lowResourcesMaxIdleTime);
super.setLowResourcesMaxIdleTime(lowResourcesMaxIdleTime);
}

View File

@ -135,9 +135,6 @@ public class StringMap extends AbstractMap implements Externalizable
return oldValue;
}
if (_ignoreCase)
key=key.toUpperCase();
Node node = _root;
int ni=-1;
Node prev = null;

View File

@ -294,5 +294,28 @@ public class StringMapTest extends TestCase
assertEquals("{abc=0}",m1.toString());
assertTrue(m5.toString().indexOf("abc=2")>0);
}
public void testIgnoreCase()
{
StringMap map = new StringMap(true);
map.put("POST","1");
map.put("HEAD","2");
map.put("PUT","3");
map.put("OPTIONS","4");
map.put("DELETE","5");
map.put("TRACE","6");
map.put("CONNECT","7");
map.put("Upgrade","8");
assertEquals("1",map.get("POST"));
assertEquals("1",map.get("pOST"));
assertEquals("1",map.get("Post"));
assertEquals("8",map.get("UPGRADE"));
assertEquals("8",map.get("Upgrade"));
assertEquals("8",map.get("upgrade"));
}
}

View File

@ -5,9 +5,11 @@ import java.util.List;
import junit.framework.TestCase;
import org.eclipse.jetty.http.HttpHeaderValues;
import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.ByteArrayBuffer;
import org.eclipse.jetty.io.ByteArrayEndPoint;
import org.eclipse.jetty.io.BufferCache.CachedBuffer;
import org.eclipse.jetty.util.StringUtil;
@ -34,6 +36,10 @@ public class WebSocketParserTest extends TestCase
_endp.setIn(_in);
}
public void testCache() throws Exception
{
assertEquals(HttpHeaderValues.UPGRADE_ORDINAL ,((CachedBuffer)HttpHeaderValues.CACHE.lookup("Upgrade")).getOrdinal());
}
public void testOneUtf8() throws Exception
{