public class TestThread extends Thread {
protected DataSource d;
protected String query = null;
+ @Override
public void run() {
long max = -1, totalmax=0, totalcmax=0, cmax = -1, nroffetch = 0, totalruntime = 0;
try {
protected long sleep = 10;
protected boolean async = false;
long minwait = Long.MAX_VALUE, maxwait = -1, totalwait=0, totalcmax=0, cmax = -1, nroffetch = 0, totalruntime = 0;
+ @Override
public void run() {
try {
long now = System.currentTimeMillis();
}
+ @Override
protected void tearDown() throws Exception {
try {datasource.close();}catch(Exception ignore){}
try {tDatasource.close();}catch(Exception ignore){}
protected long sleep = 10;
protected boolean async = false;
long minwait = Long.MAX_VALUE, maxwait = -1, totalwait=0, totalcmax=0, cmax = -1, nroffetch = 0, totalruntime = 0;
+ @Override
public void run() {
try {
long now = System.currentTimeMillis();
public class TestAsyncQueue extends TestCase {
protected FairBlockingQueue<Object> queue = null;
+ @Override
protected void setUp() throws Exception {
super.setUp();
this.queue = new FairBlockingQueue<Object>();
}
+ @Override
protected void tearDown() throws Exception {
this.queue = null;
super.tearDown();
this.setDaemon(false);
this.setName(TestAsyncQueue.class.getName()+"-OfferThread");
}
+ @Override
public void run() {
try {
sleep(delay);
return null;
}
+ @Override
public boolean isResponseBodyOK() {
if (getResponseBody() == null) {
return false;
}
private static final class Bug46243Client extends SimpleHttpClient {
+ @Override
public boolean isResponseBodyOK() {
// Don't care about the body in this test
return true;
private static final long serialVersionUID = 1L;
+ @Override
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException {
res.getWriter().write("Hello world");
private static final String JNDI_ENV_NAME = "test";
+ @Override
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException {
private static final long serialVersionUID = 1L;
+ @Override
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException {
URL url = req.getServletContext().getResource("/WEB-INF/web.xml");
return getPort();
}
+ @Override
public void setUp() throws Exception {
tempDir = new File("output/tmp");
tempDir.mkdir();
tomcat.setPort(port);
}
+ @Override
public void tearDown() throws Exception {
tomcat.stop();
ExpandWar.delete(tempDir);
for (int i = 0; i < status.length; i++) {
final int j = i;
t[j] = new Thread() {
+ @Override
public void run() {
status[j].stop();
}
for (int i = 0; i < status.length; i++) {
final int j = i;
t[j] = new Thread() {
+ @Override
public void run() {
status[j].start();
}
channel = new GroupChannel();
((ReceiverBase)channel.getChannelReceiver()).setAutoBind(100);
interceptor = new NonBlockingCoordinator() {
+ @Override
public void fireInterceptorEvent(InterceptorEvent event) {
status = event.getEventTypeDesc();
int type = event.getEventType();
this.channel = channel;
}
+ @Override
public void run() {
System.out.println("Shutting down...");
SystemExit exit = new SystemExit(5000);
public SystemExit(long delay) {
this.delay = delay;
}
+ @Override
public void run () {
try {
Thread.sleep(delay);
// Default constructor
}
+ @Override
public byte[] getMessage() {
if ( message == null ) {
message = outdata;
return message;
}
+ @Override
public void setMessage(byte[] data) {
this.message = data;
}
this.channel = channel;
}
+ @Override
public void run() {
System.out.println("Shutting down...");
SystemExit exit = new SystemExit(5000);
public SystemExit(long delay) {
this.delay = delay;
}
+ @Override
public void run () {
try {
Thread.sleep(delay);
}
+ @Override
public void run() {
System.out.println("Shutting down...");
//create an exit thread that forces a shutdown if the JVM wont exit cleanly
this.delay = delay;
}
+ @Override
public void run() {
try {
Thread.sleep(delay);
if (DEBUG) {
table.addMouseListener(new MouseAdapter() {
+ @Override
public void mouseClicked(MouseEvent e) {
printDebugData(table);
}
}
if ( "random".equals(e.getActionCommand()) ) {
Thread t = new Thread() {
+ @Override
public void run() {
for (int i = 0; i < 5; i++) {
String key = random(5,0,0,true,true,null);
super();
}
+ @Override
public Component getTableCellRendererComponent
(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column) {
this.channel = channel;
}
+ @Override
public void run() {
System.out.println("Shutting down...");
try {
*/
public class TestChannelOptionFlag extends TestCase {
GroupChannel channel = null;
+ @Override
protected void setUp() throws Exception {
super.setUp();
channel = new GroupChannel();
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
if ( channel != null ) try {channel.stop(Channel.DEFAULT);}catch ( Exception ignore) { /* Ignore */ }
public class TestChannelStartStop extends TestCase {
GroupChannel channel = null;
int udpPort = 45543;
+ @Override
protected void setUp() throws Exception {
super.setUp();
channel = new GroupChannel();
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
try {channel.stop(Channel.DEFAULT);}catch (Exception ignore){ /* Ignore */ }
GroupChannel channel2;
Listener listener1;
int threadCounter = 0;
+ @Override
protected void setUp() throws Exception {
super.setUp();
channel1 = new GroupChannel();
channel2.start(Channel.DEFAULT);
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
channel1.stop(Channel.DEFAULT);
Thread[] threads = new Thread[threadCount];
for (int x=0; x<threads.length; x++ ) {
threads[x] = new Thread() {
+ @Override
public void run() {
try {
long start = System.currentTimeMillis();
Thread[] threads = new Thread[threadCount];
for (int x=0; x<threads.length; x++ ) {
threads[x] = new Thread() {
+ @Override
public void run() {
try {
long start = System.currentTimeMillis();
GroupChannel channel2;
Listener listener1;
int threadCounter = 0;
+ @Override
protected void setUp() throws Exception {
super.setUp();
channel1 = new GroupChannel();
channel2.start(Channel.DEFAULT);
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
channel1.stop(Channel.DEFAULT);
Thread[] threads = new Thread[threadCount];
for (int x=0; x<threads.length; x++ ) {
threads[x] = new Thread() {
+ @Override
public void run() {
try {
long start = System.currentTimeMillis();
GroupChannel channel1;
GroupChannel channel2;
Listener listener1;
+ @Override
protected void setUp() throws Exception {
super.setUp();
channel1 = new GroupChannel();
channel2.start(Channel.DEFAULT);
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
channel1.stop(Channel.DEFAULT);
GroupChannel channel2;
Listener listener1;
int threadCounter = 0;
+ @Override
protected void setUp() throws Exception {
super.setUp();
channel1 = new GroupChannel();
channel2.start(Channel.DEFAULT);
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
channel1.stop(Channel.DEFAULT);
Thread[] threads = new Thread[threadCount];
for (int x=0; x<threads.length; x++ ) {
threads[x] = new Thread() {
+ @Override
public void run() {
try {
long start = System.currentTimeMillis();
Thread[] threads = new Thread[threadCount];
for (int x=0; x<threads.length; x++ ) {
threads[x] = new Thread() {
+ @Override
public void run() {
try {
long start = System.currentTimeMillis();
NonBlockingCoordinator[] coordinators = null;
int channelCount = 10;
Thread[] threads = null;
+ @Override
protected void setUp() throws Exception {
System.out.println("Setup");
super.setUp();
channels[i].addInterceptor(new TcpFailureDetector());
final int j = i;
threads[i] = new Thread() {
+ @Override
public void run() {
try {
channels[j].start(Channel.DEFAULT);
System.out.println("Coordinator[2b] is:" + member);
}
+ @Override
protected void tearDown() throws Exception {
System.out.println("tearDown");
super.tearDown();
TestListener[] test = null;
int channelCount = 2;
Thread[] threads = null;
+ @Override
protected void setUp() throws Exception {
System.out.println("Setup");
super.setUp();
channels[i].addChannelListener(test[i]);
final int j = i;
threads[i] = new Thread() {
+ @Override
public void run() {
try {
channels[j].start(Channel.DEFAULT);
}
+ @Override
protected void tearDown() throws Exception {
System.out.println("tearDown");
super.tearDown();
int cnt = 1;
ChannelMessage hold = null;
Member[] dest = null;
+ @Override
public synchronized void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException {
if ( hold == null ) {
//System.out.println("Skipping message:"+msg);
private ManagedChannel[] channels = new ManagedChannel[count];
private TestMsgListener[] listeners = new TestMsgListener[count];
+ @Override
protected void setUp() throws Exception {
super.setUp();
for (int i = 0; i < channels.length; i++) {
sendMessages(2000,15000);
}
+ @Override
protected void tearDown() throws Exception {
for (int i = 0; i < channels.length; i++) {
channels[i].stop(Channel.DEFAULT);
import junit.framework.TestCase;
public class TestSerialization extends TestCase {
+ @Override
protected void setUp() throws Exception {
super.setUp();
}
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
private ManagedChannel[] channels = new ManagedChannel[count];
private TestMbrListener[] listeners = new TestMbrListener[count];
+ @Override
protected void setUp() throws Exception {
super.setUp();
for (int i = 0; i < channels.length; i++) {
for (int i=0; i<channels.length; i++ ) {
final Channel channel = channels[i];
Thread t = new Thread() {
+ @Override
public void run() {
try {
channel.start(Channel.DEFAULT);
for (int i=listeners.length-1; i>=0; i-- ) assertEquals("Checking member arrival length",0,listeners[i].members.size());
}
+ @Override
protected void tearDown() throws Exception {
for (int i = 0; i < channels.length; i++) {
private ManagedChannel[] channels = new ManagedChannel[count];
private TestMbrListener[] listeners = new TestMbrListener[count];
+ @Override
protected void setUp() throws Exception {
super.setUp();
for (int i = 0; i < channels.length; i++) {
for (int i=0; i<channels.length; i++ ) {
final Channel channel = channels[i];
Thread t = new Thread() {
+ @Override
public void run() {
try {
channel.start(Channel.DEFAULT);
for (int i=listeners.length-1; i>=0; i-- ) assertEquals("Checking member arrival length",channels.length-1,listeners[i].members.size());
}
+ @Override
protected void tearDown() throws Exception {
for (int i = 0; i < channels.length; i++) {
MemberImpl m1, m2, p1,p2;
byte[] payload = null;
int udpPort = 3445;
+ @Override
protected void setUp() throws Exception {
super.setUp();
payload = new byte[333];
return result;
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
private ManagedChannel channel2 = null;
private TestMbrListener mbrlist1 = null;
private TestMbrListener mbrlist2 = null;
+ @Override
protected void setUp() throws Exception {
super.setUp();
channel1 = new GroupChannel();
}
+ @Override
protected void tearDown() throws Exception {
tcpFailureDetector1 = null;
tcpFailureDetector2 = null;
socket.setReceiveBufferSize(43800);
InputStream in = socket.getInputStream();
Thread t = new Thread() {
+ @Override
public void run() {
while ( true ) {
try {
socket.setReceiveBufferSize(size);
InputStream in = socket.getInputStream();
Thread t = new Thread() {
+ @Override
public void run() {
while ( true ) {
try {
InputStream in = socket.getInputStream();
MyDataReader reader = new MyDataReader(50000);
Thread t = new Thread() {
+ @Override
public void run() {
while ( true ) {
try {
private static class GetDateBenchmarkTest_Sync implements Runnable {
+ @Override
public String toString() {
return "Syncs";
}
private static class GetDateBenchmarkTest_Local implements Runnable {
+ @Override
public String toString() {
return "ThreadLocals";
}
private ThreadLocal<Long> currentMillisLocal = new ThreadLocal<Long>() {
+ @Override
protected Long initialValue() {
return Long.valueOf(0);
}
private static class GetDateBenchmarkTest_LocalMutableLong implements
Runnable {
+ @Override
public String toString() {
return "ThreadLocals with a mutable Long";
}
}
private ThreadLocal<MutableLong> currentMillisLocal = new ThreadLocal<MutableLong>() {
+ @Override
protected MutableLong initialValue() {
return new MutableLong();
}
private static class GetDateBenchmarkTest_LocalStruct implements Runnable {
+ @Override
public String toString() {
return "single ThreadLocal";
}
}
private ThreadLocal<Struct> currentStruct = new ThreadLocal<Struct>() {
+ @Override
protected Struct initialValue() {
return new Struct();
}
private static class TimeDateElementBenchmarkTest_Sync extends
TimeDateElementBenchmarkTestBase implements Runnable {
+ @Override
public String toString() {
return "Syncs";
}
private static class TimeDateElementBenchmarkTest_Local extends
TimeDateElementBenchmarkTestBase implements Runnable {
+ @Override
public String toString() {
return "ThreadLocals";
}
private ThreadLocal<String> currentDateStringLocal = new ThreadLocal<String>();
private ThreadLocal<Date> currentDateLocal = new ThreadLocal<Date>() {
+ @Override
protected Date initialValue() {
return new Date();
}
};
private ThreadLocal<SimpleDateFormat> dayFormatterLocal = new ThreadLocal<SimpleDateFormat>() {
+ @Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("dd");
}
};
private ThreadLocal<SimpleDateFormat> monthFormatterLocal = new ThreadLocal<SimpleDateFormat>() {
+ @Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("MM");
}
};
private ThreadLocal<SimpleDateFormat> yearFormatterLocal = new ThreadLocal<SimpleDateFormat>() {
+ @Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("yyyy");
}
};
private ThreadLocal<SimpleDateFormat> timeFormatterLocal = new ThreadLocal<SimpleDateFormat>() {
+ @Override
protected SimpleDateFormat initialValue() {
return new SimpleDateFormat("hh:mm:ss");
}
private static class TimeDateElementBenchmarkTest_LocalStruct extends
TimeDateElementBenchmarkTestBase implements Runnable {
+ @Override
public String toString() {
return "single ThreadLocal";
}
}
private ThreadLocal<Struct> structLocal = new ThreadLocal<Struct>() {
+ @Override
protected Struct initialValue() {
return new Struct();
}
private static class TimeDateElementBenchmarkTest_LocalStruct_SBuilder extends
TimeDateElementBenchmarkTestBase implements Runnable {
+ @Override
public String toString() {
return "single ThreadLocal, with StringBuilder";
}
}
private ThreadLocal<Struct> structLocal = new ThreadLocal<Struct>() {
+ @Override
protected Struct initialValue() {
return new Struct();
}
this.cookieValue = cookieValue;
}
+ @Override
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException {
try {
*/
public class TestCookiesNoFwdStrictSysProps extends CookiesBaseTest {
+ @Override
public void testCookiesInstance() throws Exception {
System.setProperty("org.apache.catalina.STRICT_SERVLET_COMPLIANCE",