cleaned up some unit tests
This commit is contained in:
parent
470e63b77b
commit
a36342438c
|
@ -79,7 +79,6 @@ public class LikeJettyXml
|
|||
server.setConnectors(new Connector[]
|
||||
{ connector });
|
||||
|
||||
/*
|
||||
SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
|
||||
ssl_connector.setPort(8443);
|
||||
SslContextFactory cf = ssl_connector.getSslContextFactory();
|
||||
|
@ -98,12 +97,9 @@ public class LikeJettyXml
|
|||
"SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
|
||||
"SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA"
|
||||
});
|
||||
cf.setProtocol("TLSv1.1");
|
||||
cf.addExcludeProtocols(new String[]{"TLSv1","SSLv3"});
|
||||
ssl_connector.setStatsOn(true);
|
||||
server.addConnector(ssl_connector);
|
||||
ssl_connector.open();
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -642,8 +642,8 @@ public class HttpParser implements Parser
|
|||
break;
|
||||
|
||||
case HttpTokens.NO_CONTENT:
|
||||
_handler.headerComplete();
|
||||
_state=_persistent||(_responseStatus>=100&&_responseStatus<200)?STATE_END:STATE_SEEKING_EOF;
|
||||
_handler.headerComplete();
|
||||
_handler.messageComplete(_contentPosition);
|
||||
break;
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@ public class HttpParserTest
|
|||
|
||||
io.setInput(http);
|
||||
|
||||
System.err.println(tst);
|
||||
// System.err.println(tst);
|
||||
parser.parse();
|
||||
assertEquals(tst,"GET", f0);
|
||||
assertEquals(tst,"/", f1);
|
||||
|
|
|
@ -702,8 +702,8 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
|
|||
(isOpen()?",open":"") +
|
||||
(isInputShutdown()?",ishut":"") +
|
||||
(isOutputShutdown()?",oshut":"") +
|
||||
(_readBlocked?"":",RB") +
|
||||
(_writeBlocked?"":",WB") +
|
||||
(_readBlocked?",RB":"") +
|
||||
(_writeBlocked?",WB":"") +
|
||||
(_writable?"":",!W") +
|
||||
","+_interestOps +
|
||||
((_key==null || !_key.isValid())?"!":(
|
||||
|
|
|
@ -507,7 +507,15 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog
|
|||
buf.append("Async");
|
||||
|
||||
long responseLength = response.getContentCount();
|
||||
if (responseLength >= 0)
|
||||
if (responseLength == 0)
|
||||
{
|
||||
System.err.println("Content-Length: "+response.getHeader("Content-Length")+" "+request.getConnection()+" "+request.getConnection().getEndPoint());
|
||||
new Throwable().printStackTrace();
|
||||
System.exit(1);
|
||||
buf.append(' ');
|
||||
buf.append('0');
|
||||
}
|
||||
else if (responseLength >= 0)
|
||||
{
|
||||
buf.append(' ');
|
||||
if (responseLength > 99999)
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
package org.eclipse.jetty.http;
|
||||
package org.eclipse.jetty.util.ssl;
|
||||
|
||||
import static junit.framework.Assert.assertTrue;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.KeyStore;
|
||||
|
||||
import org.eclipse.jetty.http.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.ssl.SslContextFactory;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
import org.eclipse.jetty.util.log.StdErrLog;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
|
@ -108,7 +113,7 @@ public class SslContextFactoryTest
|
|||
assertTrue(cf.getSslContext()!=null);
|
||||
}
|
||||
|
||||
@Test(expected = java.security.UnrecoverableKeyException.class)
|
||||
@Test
|
||||
public void testResourceTsResourceKsWrongPW() throws Exception
|
||||
{
|
||||
Resource keystoreResource = Resource.newSystemResource("keystore");
|
||||
|
@ -121,10 +126,18 @@ public class SslContextFactoryTest
|
|||
cf.setKeyManagerPassword("wrong_keypwd");
|
||||
cf.setTrustStorePassword("storepwd");
|
||||
|
||||
cf.start();
|
||||
try
|
||||
{
|
||||
((StdErrLog)Log.getLogger(AbstractLifeCycle.class)).setHideStacks(true);
|
||||
cf.start();
|
||||
Assert.fail();
|
||||
}
|
||||
catch(java.security.UnrecoverableKeyException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = java.io.IOException.class)
|
||||
@Test
|
||||
public void testResourceTsWrongPWResourceKs() throws Exception
|
||||
{
|
||||
Resource keystoreResource = Resource.newSystemResource("keystore");
|
||||
|
@ -137,6 +150,14 @@ public class SslContextFactoryTest
|
|||
cf.setKeyManagerPassword("keypwd");
|
||||
cf.setTrustStorePassword("wrong_storepwd");
|
||||
|
||||
cf.start();
|
||||
try
|
||||
{
|
||||
((StdErrLog)Log.getLogger(AbstractLifeCycle.class)).setHideStacks(true);
|
||||
cf.start();
|
||||
Assert.fail();
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Loading…
Reference in New Issue