324601 replace asserts with junit asserts
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2259 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
ee2d8e635e
commit
3c4a816760
|
@ -27,6 +27,8 @@ import org.eclipse.jetty.client.HttpClient;
|
|||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -65,9 +67,9 @@ public abstract class AbstractClientCrossContextSessionTest
|
|||
exchangeA.setURL("http://localhost:" + port + contextA + servletMapping);
|
||||
client.send(exchangeA);
|
||||
exchangeA.waitForDone();
|
||||
assert exchangeA.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchangeA.getResponseStatus());
|
||||
String sessionCookie = exchangeA.getResponseFields().getStringField("Set-Cookie");
|
||||
assert sessionCookie != null;
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
|
@ -78,7 +80,7 @@ public abstract class AbstractClientCrossContextSessionTest
|
|||
exchangeB.getRequestFields().add("Cookie", sessionCookie);
|
||||
client.send(exchangeB);
|
||||
exchangeB.waitForDone();
|
||||
assert exchangeB.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchangeB.getResponseStatus());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -104,7 +106,7 @@ public abstract class AbstractClientCrossContextSessionTest
|
|||
|
||||
// Check that we don't see things put in session by contextB
|
||||
Object objectB = session.getAttribute("B");
|
||||
assert objectB == null;
|
||||
assertTrue(objectB == null);
|
||||
System.out.println("A: session.getAttributeNames() = " + Collections.list(session.getAttributeNames()));
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +124,7 @@ public abstract class AbstractClientCrossContextSessionTest
|
|||
|
||||
// Check that we don't see things put in session by contextA
|
||||
Object objectA = session.getAttribute("A");
|
||||
assert objectA == null;
|
||||
assertTrue(objectA == null);
|
||||
System.out.println("B: session.getAttributeNames() = " + Collections.list(session.getAttributeNames()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ import org.eclipse.jetty.client.ContentExchange;
|
|||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -61,14 +63,14 @@ public abstract class AbstractImmortalSessionTest
|
|||
exchange.setURL("http://localhost:" + port + contextPath + servletMapping + "?action=set&value=" + value);
|
||||
client.send(exchange);
|
||||
exchange.waitForDone();
|
||||
assert exchange.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus());
|
||||
String sessionCookie = exchange.getResponseFields().getStringField("Set-Cookie");
|
||||
assert sessionCookie != null;
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
String response = exchange.getResponseContent();
|
||||
assert response.trim().equals(String.valueOf(value));
|
||||
assertEquals(response.trim(),String.valueOf(value));
|
||||
|
||||
// Let's wait for the scavenger to run, waiting 2.5 times the scavenger period
|
||||
Thread.sleep(scavengePeriod * 2500L);
|
||||
|
@ -80,9 +82,9 @@ public abstract class AbstractImmortalSessionTest
|
|||
exchange.getRequestFields().add("Cookie", sessionCookie);
|
||||
client.send(exchange);
|
||||
exchange.waitForDone();
|
||||
assert exchange.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus());
|
||||
response = exchange.getResponseContent();
|
||||
assert response.trim().equals(String.valueOf(value));
|
||||
assertEquals(response.trim(),String.valueOf(value));
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -31,6 +31,8 @@ import org.eclipse.jetty.client.ContentExchange;
|
|||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -78,9 +80,9 @@ public abstract class AbstractLightLoadTest
|
|||
exchange1.setURL( urls[0] + "?action=init" );
|
||||
client.send( exchange1 );
|
||||
exchange1.waitForDone();
|
||||
assert exchange1.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange1.getResponseStatus());
|
||||
String sessionCookie = exchange1.getResponseFields().getStringField( "Set-Cookie" );
|
||||
assert sessionCookie != null;
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
|
@ -116,10 +118,10 @@ public abstract class AbstractLightLoadTest
|
|||
exchange2.getRequestFields().add( "Cookie", sessionCookie );
|
||||
client.send( exchange2 );
|
||||
exchange2.waitForDone();
|
||||
assert exchange2.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange2.getResponseStatus());
|
||||
String response = exchange2.getResponseContent();
|
||||
System.out.println( "get = " + response );
|
||||
assert response.trim().equals( String.valueOf( clientsCount * requestsCount ) );
|
||||
assertEquals(response.trim(), String.valueOf( clientsCount * requestsCount ) );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -192,7 +194,7 @@ public abstract class AbstractLightLoadTest
|
|||
exchange.getRequestFields().add( "Cookie", sessionCookie );
|
||||
client.send( exchange );
|
||||
exchange.waitForDone();
|
||||
assert exchange.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus());
|
||||
}
|
||||
|
||||
// Wait for all workers to be done
|
||||
|
|
|
@ -163,7 +163,7 @@ public abstract class AbstractLocalSessionScavengingTest
|
|||
else if ("check".equals(action))
|
||||
{
|
||||
HttpSession session = request.getSession(false);
|
||||
assert session == null;
|
||||
assertTrue(session == null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ import org.eclipse.jetty.client.HttpClient;
|
|||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* AbstractNewSessionTest
|
||||
|
@ -71,9 +73,9 @@ public abstract class AbstractNewSessionTest
|
|||
exchange.setURL("http://localhost:" + port + contextPath + servletMapping + "?action=create");
|
||||
client.send(exchange);
|
||||
exchange.waitForDone();
|
||||
assert exchange.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus());
|
||||
String sessionCookie = exchange.getResponseFields().getStringField("Set-Cookie");
|
||||
assert sessionCookie != null;
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
|
@ -88,7 +90,7 @@ public abstract class AbstractNewSessionTest
|
|||
exchange.getRequestFields().add("Cookie", sessionCookie);
|
||||
client.send(exchange);
|
||||
exchange.waitForDone();
|
||||
assert exchange.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -117,7 +119,7 @@ public abstract class AbstractNewSessionTest
|
|||
}
|
||||
else
|
||||
{
|
||||
assert false;
|
||||
assertTrue(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ import org.eclipse.jetty.client.ContentExchange;
|
|||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* AbstractOrphanedSessionTest
|
||||
|
@ -73,9 +75,9 @@ public abstract class AbstractOrphanedSessionTest
|
|||
exchange1.setURL("http://localhost:" + port1 + contextPath + servletMapping + "?action=init");
|
||||
client.send(exchange1);
|
||||
exchange1.waitForDone();
|
||||
assert exchange1.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange1.getResponseStatus());
|
||||
String sessionCookie = exchange1.getResponseFields().getStringField("Set-Cookie");
|
||||
assert sessionCookie != null;
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
|
@ -94,7 +96,7 @@ public abstract class AbstractOrphanedSessionTest
|
|||
exchange2.getRequestFields().add("Cookie", sessionCookie);
|
||||
client.send(exchange2);
|
||||
exchange2.waitForDone();
|
||||
assert exchange2.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange2.getResponseStatus());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -126,7 +128,7 @@ public abstract class AbstractOrphanedSessionTest
|
|||
else if ("check".equals(action))
|
||||
{
|
||||
HttpSession session = request.getSession(false);
|
||||
assert session == null;
|
||||
assertTrue(session == null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@ import org.eclipse.jetty.client.ContentExchange;
|
|||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -58,7 +60,7 @@ public abstract class AbstractReentrantRequestSessionTest
|
|||
exchange.setURL("http://localhost:" + port + contextPath + servletMapping + "?action=reenter&port=" + port + "&path=" + contextPath + servletMapping);
|
||||
client.send(exchange);
|
||||
exchange.waitForDone();
|
||||
assert exchange.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -106,7 +108,7 @@ public abstract class AbstractReentrantRequestSessionTest
|
|||
exchange.setURL("http://localhost:" + port + path + "?action=none");
|
||||
client.send(exchange);
|
||||
exchange.waitForDone();
|
||||
assert exchange.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -30,6 +30,8 @@ import org.eclipse.jetty.client.HttpClient;
|
|||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* AbstractServerCrossContextSessionTest
|
||||
|
@ -67,7 +69,7 @@ public abstract class AbstractServerCrossContextSessionTest
|
|||
exchange.setURL("http://localhost:" + port + contextA + servletMapping);
|
||||
client.send(exchange);
|
||||
exchange.waitForDone();
|
||||
assert exchange.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange.getResponseStatus());
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -100,7 +102,7 @@ public abstract class AbstractServerCrossContextSessionTest
|
|||
|
||||
// Check that we don't see things put in session by contextB
|
||||
Object objectB = session.getAttribute("B");
|
||||
assert objectB == null;
|
||||
assertTrue(objectB == null);
|
||||
System.out.println("A: session.getAttributeNames() = " + Collections.list(session.getAttributeNames()));
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +117,7 @@ public abstract class AbstractServerCrossContextSessionTest
|
|||
|
||||
// Be sure nothing from contextA is present
|
||||
Object objectA = session.getAttribute("A");
|
||||
assert objectA == null;
|
||||
assertTrue(objectA == null);
|
||||
|
||||
// Add something, so in contextA we can check if it is visible (it must not).
|
||||
session.setAttribute("B", "B");
|
||||
|
|
|
@ -27,6 +27,8 @@ import org.eclipse.jetty.client.ContentExchange;
|
|||
import org.eclipse.jetty.client.HttpClient;
|
||||
import org.eclipse.jetty.http.HttpMethods;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* AbstractSessionMigrationTest
|
||||
|
@ -66,9 +68,9 @@ public abstract class AbstractSessionMigrationTest
|
|||
exchange1.setURL("http://localhost:" + port1 + contextPath + servletMapping + "?action=set&value=" + value);
|
||||
client.send(exchange1);
|
||||
exchange1.waitForDone();
|
||||
assert exchange1.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange1.getResponseStatus());
|
||||
String sessionCookie = exchange1.getResponseFields().getStringField("Set-Cookie");
|
||||
assert sessionCookie != null;
|
||||
assertTrue(sessionCookie != null);
|
||||
// Mangle the cookie, replacing Path with $Path, etc.
|
||||
sessionCookie = sessionCookie.replaceFirst("(\\W)(P|p)ath=", "$1\\$Path=");
|
||||
|
||||
|
@ -80,10 +82,9 @@ public abstract class AbstractSessionMigrationTest
|
|||
exchange2.getRequestFields().add("Cookie", sessionCookie);
|
||||
client.send(exchange2);
|
||||
exchange2.waitForDone();
|
||||
assert exchange2.getResponseStatus() == HttpServletResponse.SC_OK;
|
||||
assertEquals(HttpServletResponse.SC_OK,exchange2.getResponseStatus());
|
||||
String response = exchange2.getResponseContent();
|
||||
assert response.trim().equals(String.valueOf(value));
|
||||
}
|
||||
assertEquals(response.trim(),String.valueOf(value)); }
|
||||
finally
|
||||
{
|
||||
client.stop();
|
||||
|
|
|
@ -54,9 +54,9 @@ public class WebAppObjectInSessionServlet extends HttpServlet
|
|||
Object staticAttribute = session.getAttribute("staticAttribute");
|
||||
Assert.assertTrue(staticAttribute instanceof TestSharedStatic);
|
||||
// Object objectAttribute = session.getAttribute("objectAttribute");
|
||||
// assert objectAttribute instanceof TestSharedNonStatic;
|
||||
// assertTrue(objectAttribute instanceof TestSharedNonStatic);
|
||||
// Object sessionAttribute = session.getAttribute("sessionAttribute");
|
||||
// assert sessionAttribute instanceof HttpSession;
|
||||
// assertTrue(sessionAttribute instanceof HttpSession);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
Loading…
Reference in New Issue