You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2017/11/13 10:49:15 UTC
svn commit: r1815079 [4/6] - in /tomcat/trunk:
modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/pool/
modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/ test/javax/el/
test/javax/servlet/jsp/ test/org/apache/catalina/ant/ test/org/apach...
Modified: tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestOrderInterceptor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestOrderInterceptor.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestOrderInterceptor.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestOrderInterceptor.java Mon Nov 13 10:49:13 2017
@@ -21,10 +21,8 @@ import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
-
import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -93,7 +91,7 @@ public class TestOrderInterceptor {
}
Thread.sleep(5000);
for ( int i=0; i<test.length; i++ ) {
- assertFalse(test[i].fail);
+ Assert.assertFalse(test[i].fail);
}
}
@@ -127,12 +125,12 @@ public class TestOrderInterceptor {
threads[i].join();
}
if (!exceptionQueue.isEmpty()) {
- fail("Exception while sending in threads: "
+ Assert.fail("Exception while sending in threads: "
+ exceptionQueue.remove().toString());
}
Thread.sleep(5000);
for ( int i=0; i<test.length; i++ ) {
- assertFalse(test[i].fail);
+ Assert.assertFalse(test[i].fail);
}
}
Modified: tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestTcpFailureDetector.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestTcpFailureDetector.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestTcpFailureDetector.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestTcpFailureDetector.java Mon Nov 13 10:49:13 2017
@@ -18,10 +18,8 @@ package org.apache.catalina.tribes.group
import java.util.ArrayList;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -71,16 +69,16 @@ public class TestTcpFailureDetector {
channel1.start(Channel.DEFAULT);
channel2.start(Channel.DEFAULT);
//Thread.sleep(1000);
- assertEquals("Expecting member count to be equal",mbrlist1.members.size(),mbrlist2.members.size());
+ Assert.assertEquals("Expecting member count to be equal",mbrlist1.members.size(),mbrlist2.members.size());
channel2.stop(Channel.SND_RX_SEQ);
ByteMessage msg = new ByteMessage(new byte[1024]);
try {
channel1.send(channel1.getMembers(), msg, 0);
- fail("Message send should have failed.");
+ Assert.fail("Message send should have failed.");
} catch ( ChannelException x ) {
// Ignore
}
- assertEquals("Expecting member count to not be equal",mbrlist1.members.size()+1,mbrlist2.members.size());
+ Assert.assertEquals("Expecting member count to not be equal",mbrlist1.members.size()+1,mbrlist2.members.size());
channel1.stop(Channel.DEFAULT);
channel2.stop(Channel.DEFAULT);
}
@@ -96,7 +94,7 @@ public class TestTcpFailureDetector {
channel2.stop(Channel.SND_RX_SEQ);
channel2.start(Channel.MBR_TX_SEQ);
//Thread.sleep(1000);
- assertEquals("Expecting member count to not be equal",mbrlist1.members.size()+1,mbrlist2.members.size());
+ Assert.assertEquals("Expecting member count to not be equal",mbrlist1.members.size()+1,mbrlist2.members.size());
channel1.stop(Channel.DEFAULT);
channel2.stop(Channel.DEFAULT);
}
@@ -108,15 +106,15 @@ public class TestTcpFailureDetector {
channel1.start(Channel.DEFAULT);
channel2.start(Channel.DEFAULT);
//Thread.sleep(1000);
- assertEquals("Expecting member count to be equal",mbrlist1.members.size(),mbrlist2.members.size());
+ Assert.assertEquals("Expecting member count to be equal",mbrlist1.members.size(),mbrlist2.members.size());
channel2.stop(Channel.MBR_TX_SEQ);
ByteMessage msg = new ByteMessage(new byte[1024]);
try {
Thread.sleep(5000);
- assertEquals("Expecting member count to be equal",mbrlist1.members.size(),mbrlist2.members.size());
+ Assert.assertEquals("Expecting member count to be equal",mbrlist1.members.size(),mbrlist2.members.size());
channel1.send(channel1.getMembers(), msg, 0);
} catch ( ChannelException x ) {
- fail("Message send should have succeeded.");
+ Assert.fail("Message send should have succeeded.");
}
channel1.stop(Channel.DEFAULT);
channel2.stop(Channel.DEFAULT);
Modified: tomcat/trunk/test/org/apache/catalina/tribes/io/TestXByteBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/io/TestXByteBuffer.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/io/TestXByteBuffer.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/io/TestXByteBuffer.java Mon Nov 13 10:49:13 2017
@@ -16,10 +16,7 @@
*/
package org.apache.catalina.tribes.io;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
+import org.junit.Assert;
import org.junit.Test;
public class TestXByteBuffer {
@@ -27,7 +24,7 @@ public class TestXByteBuffer {
@Test
public void testEmptyArray() throws Exception {
Object obj = XByteBuffer.deserialize(new byte[0]);
- assertNull(obj);
+ Assert.assertNull(obj);
}
@Test
@@ -35,7 +32,7 @@ public class TestXByteBuffer {
String test = "This is as test.";
byte[] msg = XByteBuffer.serialize(test);
Object obj = XByteBuffer.deserialize(msg);
- assertTrue(obj instanceof String);
- assertEquals(test, obj);
+ Assert.assertTrue(obj instanceof String);
+ Assert.assertEquals(test, obj);
}
}
Modified: tomcat/trunk/test/org/apache/catalina/tribes/membership/TestMemberImplSerialization.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/membership/TestMemberImplSerialization.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/membership/TestMemberImplSerialization.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/membership/TestMemberImplSerialization.java Mon Nov 13 10:49:13 2017
@@ -18,9 +18,7 @@ package org.apache.catalina.tribes.membe
import java.util.Arrays;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -51,13 +49,13 @@ public class TestMemberImplSerialization
@Test
public void testCompare() throws Exception {
- assertTrue(m1.equals(m2));
- assertTrue(m2.equals(m1));
- assertTrue(p1.equals(m2));
- assertFalse(m1.equals(p2));
- assertFalse(m1.equals(p2));
- assertFalse(m2.equals(p2));
- assertFalse(p1.equals(p2));
+ Assert.assertTrue(m1.equals(m2));
+ Assert.assertTrue(m2.equals(m1));
+ Assert.assertTrue(p1.equals(m2));
+ Assert.assertFalse(m1.equals(p2));
+ Assert.assertFalse(m1.equals(p2));
+ Assert.assertFalse(m2.equals(p2));
+ Assert.assertFalse(p1.equals(p2));
}
@Test
@@ -68,8 +66,8 @@ public class TestMemberImplSerialization
Member a1 = MemberImpl.getMember(md1);
Member a2 = MemberImpl.getMember(md2);
- assertTrue(a1.getUdpPort()==a2.getUdpPort());
- assertTrue(a1.getUdpPort()==udpPort);
+ Assert.assertTrue(a1.getUdpPort()==a2.getUdpPort());
+ Assert.assertTrue(a1.getUdpPort()==udpPort);
}
@Test
@@ -77,23 +75,23 @@ public class TestMemberImplSerialization
Member m = m1;
byte[] md1 = m.getData(false,true);
byte[] mda1 = m.getData(false,false);
- assertTrue(Arrays.equals(md1,mda1));
- assertTrue(md1==mda1);
+ Assert.assertTrue(Arrays.equals(md1,mda1));
+ Assert.assertTrue(md1==mda1);
mda1 = m.getData(true,true);
Member ma1 = MemberImpl.getMember(mda1);
- assertTrue(compareMembers(m,ma1));
+ Assert.assertTrue(compareMembers(m,ma1));
mda1 = p1.getData(false);
- assertFalse(Arrays.equals(md1,mda1));
+ Assert.assertFalse(Arrays.equals(md1,mda1));
ma1 = MemberImpl.getMember(mda1);
- assertTrue(compareMembers(p1,ma1));
+ Assert.assertTrue(compareMembers(p1,ma1));
md1 = m.getData(true,true);
Thread.sleep(50);
mda1 = m.getData(true,true);
Member a1 = MemberImpl.getMember(md1);
Member a2 = MemberImpl.getMember(mda1);
- assertTrue(a1.equals(a2));
- assertFalse(Arrays.equals(md1,mda1));
+ Assert.assertTrue(a1.equals(a2));
+ Assert.assertFalse(Arrays.equals(md1,mda1));
}
Modified: tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestChannelConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestChannelConfig.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestChannelConfig.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestChannelConfig.java Mon Nov 13 10:49:13 2017
@@ -16,8 +16,7 @@
*/
package org.apache.catalina.tribes.test.channel;
-import static org.junit.Assert.assertEquals;
-
+import org.junit.Assert;
import org.junit.Test;
import org.apache.catalina.ha.session.BackupManager;
@@ -32,7 +31,7 @@ public class TestChannelConfig {
SimpleTcpCluster cluster = new SimpleTcpCluster();
cluster.setChannelSendOptions(Channel.SEND_OPTIONS_ASYNCHRONOUS | Channel.SEND_OPTIONS_MULTICAST);
- assertEquals(Channel.SEND_OPTIONS_ASYNCHRONOUS | Channel.SEND_OPTIONS_MULTICAST, cluster.getChannelSendOptions());
+ Assert.assertEquals(Channel.SEND_OPTIONS_ASYNCHRONOUS | Channel.SEND_OPTIONS_MULTICAST, cluster.getChannelSendOptions());
}
@Test
@@ -40,7 +39,7 @@ public class TestChannelConfig {
SimpleTcpCluster cluster = new SimpleTcpCluster();
cluster.setChannelSendOptions("multicast");
- assertEquals(Channel.SEND_OPTIONS_MULTICAST, cluster.getChannelSendOptions());
+ Assert.assertEquals(Channel.SEND_OPTIONS_MULTICAST, cluster.getChannelSendOptions());
}
@Test
@@ -48,7 +47,7 @@ public class TestChannelConfig {
SimpleTcpCluster cluster = new SimpleTcpCluster();
cluster.setChannelSendOptions("async, multicast");
- assertEquals(Channel.SEND_OPTIONS_ASYNCHRONOUS | Channel.SEND_OPTIONS_MULTICAST, cluster.getChannelSendOptions());
+ Assert.assertEquals(Channel.SEND_OPTIONS_ASYNCHRONOUS | Channel.SEND_OPTIONS_MULTICAST, cluster.getChannelSendOptions());
}
@Test
@@ -57,7 +56,7 @@ public class TestChannelConfig {
String options = "multicast, async";
SimpleTcpCluster cluster = new SimpleTcpCluster();
cluster.setChannelSendOptions(options);
- assertEquals(options, cluster.getChannelSendOptionsName());
+ Assert.assertEquals(options, cluster.getChannelSendOptionsName());
}
@Test
@@ -65,7 +64,7 @@ public class TestChannelConfig {
BackupManager manager = new BackupManager();
manager.setMapSendOptions("async, multicast");
- assertEquals(Channel.SEND_OPTIONS_ASYNCHRONOUS | Channel.SEND_OPTIONS_MULTICAST, manager.getMapSendOptions());
+ Assert.assertEquals(Channel.SEND_OPTIONS_ASYNCHRONOUS | Channel.SEND_OPTIONS_MULTICAST, manager.getMapSendOptions());
}
}
\ No newline at end of file
Modified: tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestDataIntegrity.java Mon Nov 13 10:49:13 2017
@@ -20,9 +20,8 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.Random;
-import static org.junit.Assert.assertEquals;
-
import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -84,7 +83,7 @@ public class TestDataIntegrity {
long start = System.currentTimeMillis();
while ( (System.currentTimeMillis()-start)<15000 && msgCount*threadCount!=listener1.count) Thread.sleep(500);
System.err.println("Finished NO_ACK ["+listener1.count+"]");
- assertEquals("Checking success messages.",msgCount*threadCount,listener1.count);
+ Assert.assertEquals("Checking success messages.",msgCount*threadCount,listener1.count);
}
@Test
@@ -111,7 +110,7 @@ public class TestDataIntegrity {
long start = System.currentTimeMillis();
while ( (System.currentTimeMillis()-start)<25000 && msgCount*threadCount!=listener1.count) Thread.sleep(500);
System.err.println("Finished ASYNC MULTI THREAD ["+listener1.count+"]");
- assertEquals("Checking success messages.",msgCount*threadCount,listener1.count);
+ Assert.assertEquals("Checking success messages.",msgCount*threadCount,listener1.count);
}
@Test
@@ -122,7 +121,7 @@ public class TestDataIntegrity {
long start = System.currentTimeMillis();
while ( (System.currentTimeMillis()-start)<5000 && msgCount!=listener1.count) Thread.sleep(500);
System.err.println("Finished ASYNC");
- assertEquals("Checking success messages.",msgCount,listener1.count);
+ Assert.assertEquals("Checking success messages.",msgCount,listener1.count);
}
@Test
@@ -131,7 +130,7 @@ public class TestDataIntegrity {
for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(),Channel.SEND_OPTIONS_USE_ACK);
Thread.sleep(250);
System.err.println("Finished ACK");
- assertEquals("Checking success messages.",msgCount,listener1.count);
+ Assert.assertEquals("Checking success messages.",msgCount,listener1.count);
}
@Test
@@ -140,7 +139,7 @@ public class TestDataIntegrity {
for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(),Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK);
Thread.sleep(250);
System.err.println("Finished SYNC_ACK");
- assertEquals("Checking success messages.",msgCount,listener1.count);
+ Assert.assertEquals("Checking success messages.",msgCount,listener1.count);
}
public static class Listener implements ChannelListener {
Modified: tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestMulticastPackages.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestMulticastPackages.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestMulticastPackages.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestMulticastPackages.java Mon Nov 13 10:49:13 2017
@@ -22,9 +22,8 @@ import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import static org.junit.Assert.assertEquals;
-
import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -91,7 +90,7 @@ public class TestMulticastPackages {
channel1.send(new Member[] {channel2.getLocalMember(false)}, Data.createRandomData(1024),Channel.SEND_OPTIONS_MULTICAST);
Thread.sleep(500);
System.err.println("Finished Single package NO_ACK ["+listener1.count+"]");
- assertEquals("Checking success messages.",1,listener1.count.get());
+ Assert.assertEquals("Checking success messages.",1,listener1.count.get());
}
@@ -140,7 +139,7 @@ public class TestMulticastPackages {
System.out.println("Sent "+counter.get()+ " messages. Received "+listener1.count+" Highest msg received:"+listener1.maxIdx);
System.out.print("Missing messages:");
printMissingMsgs(listener1.nrs,counter.get());
- assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get());
+ Assert.assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get());
}
@Test
@@ -151,7 +150,7 @@ public class TestMulticastPackages {
long start = System.currentTimeMillis();
while ( (System.currentTimeMillis()-start)<5000 && msgCount!=listener1.count.get()) Thread.sleep(500);
System.err.println("Finished ASYNC");
- assertEquals("Checking success messages.",msgCount,listener1.count.get());
+ Assert.assertEquals("Checking success messages.",msgCount,listener1.count.get());
}
@Test
@@ -160,7 +159,7 @@ public class TestMulticastPackages {
for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_USE_ACK|Channel.SEND_OPTIONS_MULTICAST);
Thread.sleep(250);
System.err.println("Finished ACK");
- assertEquals("Checking success messages.",msgCount,listener1.count.get());
+ Assert.assertEquals("Checking success messages.",msgCount,listener1.count.get());
}
@Test
@@ -169,7 +168,7 @@ public class TestMulticastPackages {
for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK|Channel.SEND_OPTIONS_MULTICAST);
Thread.sleep(250);
System.err.println("Finished SYNC_ACK");
- assertEquals("Checking success messages.",msgCount,listener1.count.get());
+ Assert.assertEquals("Checking success messages.",msgCount,listener1.count.get());
}
public static class Listener implements ChannelListener {
Modified: tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java Mon Nov 13 10:49:13 2017
@@ -21,10 +21,8 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.Random;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -71,7 +69,7 @@ public class TestRemoteProcessException
Channel.SEND_OPTIONS_SYNCHRONIZED_ACK
| Channel.SEND_OPTIONS_USE_ACK);
if (error) {
- fail("A ChannelException was expected");
+ Assert.fail("A ChannelException was expected");
}
} catch (ChannelException e) {
if (!error) {
@@ -86,10 +84,10 @@ public class TestRemoteProcessException
// as it is being re-sent. Thus the listener1 count is off by +2.
final int duplicate = 2;
- assertEquals("Checking failure messages.", errC + duplicate,
+ Assert.assertEquals("Checking failure messages.", errC + duplicate,
listener1.errCnt);
- assertEquals("Checking success messages.", nerrC, listener1.noErrCnt);
- assertEquals("Checking all messages.", msgCount + duplicate,
+ Assert.assertEquals("Checking success messages.", nerrC, listener1.noErrCnt);
+ Assert.assertEquals("Checking all messages.", msgCount + duplicate,
listener1.noErrCnt + listener1.errCnt);
System.out.println("Listener 1 stats:");
listener1.printStats(System.out);
Modified: tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java (original)
+++ tomcat/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java Mon Nov 13 10:49:13 2017
@@ -22,9 +22,8 @@ import java.util.Random;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
-import static org.junit.Assert.assertEquals;
-
import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -91,7 +90,7 @@ public class TestUdpPackages {
channel1.send(new Member[] {channel2.getLocalMember(false)}, Data.createRandomData(1024),Channel.SEND_OPTIONS_UDP);
Thread.sleep(500);
System.err.println("Finished Single package NO_ACK ["+listener1.count+"]");
- assertEquals("Checking success messages.",1,listener1.count.get());
+ Assert.assertEquals("Checking success messages.",1,listener1.count.get());
}
@Test
@@ -132,7 +131,7 @@ public class TestUdpPackages {
System.out.println("Sent "+counter.get()+ " messages. Received "+listener1.count+" Highest msg received:"+listener1.maxIdx);
System.out.print("Missing messages:");
printMissingMsgs(listener1.nrs,counter.get());
- assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get());
+ Assert.assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get());
}
public static void printMissingMsgs(int[] msgs, int maxIdx) {
@@ -180,7 +179,7 @@ public class TestUdpPackages {
System.out.println("Sent "+counter.get()+ " messages. Received "+listener1.count+" Highest msg received:"+listener1.maxIdx);
System.out.print("Missing messages:");
printMissingMsgs(listener1.nrs,counter.get());
- assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get());
+ Assert.assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get());
}
@Test
@@ -191,7 +190,7 @@ public class TestUdpPackages {
long start = System.currentTimeMillis();
while ( (System.currentTimeMillis()-start)<5000 && msgCount!=listener1.count.get()) Thread.sleep(500);
System.err.println("Finished ASYNC");
- assertEquals("Checking success messages.",msgCount,listener1.count.get());
+ Assert.assertEquals("Checking success messages.",msgCount,listener1.count.get());
}
@Test
@@ -200,7 +199,7 @@ public class TestUdpPackages {
for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_USE_ACK|Channel.SEND_OPTIONS_UDP);
Thread.sleep(250);
System.err.println("Finished ACK");
- assertEquals("Checking success messages.",msgCount,listener1.count.get());
+ Assert.assertEquals("Checking success messages.",msgCount,listener1.count.get());
}
@Test
@@ -209,7 +208,7 @@ public class TestUdpPackages {
for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK|Channel.SEND_OPTIONS_UDP);
Thread.sleep(250);
System.err.println("Finished SYNC_ACK");
- assertEquals("Checking success messages.",msgCount,listener1.count.get());
+ Assert.assertEquals("Checking success messages.",msgCount,listener1.count.get());
}
public static class Listener implements ChannelListener {
Modified: tomcat/trunk/test/org/apache/catalina/util/TestContextName.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/util/TestContextName.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/util/TestContextName.java (original)
+++ tomcat/trunk/test/org/apache/catalina/util/TestContextName.java Mon Nov 13 10:49:13 2017
@@ -16,8 +16,7 @@
*/
package org.apache.catalina.util;
-import static org.junit.Assert.assertEquals;
-
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -75,132 +74,132 @@ public class TestContextName {
@Test
public void testGetBaseName() {
- assertEquals("ROOT", cn1.getBaseName());
- assertEquals("ROOT", cn2.getBaseName());
- assertEquals("ROOT", cn3.getBaseName());
- assertEquals("foo", cn4.getBaseName());
- assertEquals("foo#bar", cn5.getBaseName());
- assertEquals("ROOT##A", cn6.getBaseName());
- assertEquals("ROOT##B", cn7.getBaseName());
- assertEquals("ROOT##C", cn8.getBaseName());
- assertEquals("foo##D", cn9.getBaseName());
- assertEquals("foo#bar##E", cn10.getBaseName());
- assertEquals("ROOT", cn11.getBaseName());
- assertEquals("foo", cn12.getBaseName());
- assertEquals("foo#bar", cn13.getBaseName());
- assertEquals("ROOT##A", cn14.getBaseName());
- assertEquals("foo##D", cn15.getBaseName());
- assertEquals("foo#bar##E", cn16.getBaseName());
- assertEquals("ROOT", cn17.getBaseName());
- assertEquals("ROOT#bar", cn18.getBaseName());
- assertEquals("ROOT#bar##A", cn19.getBaseName());
- assertEquals("ROOT##A", cn20.getBaseName());
- assertEquals("foo.war", cn21.getBaseName());
- assertEquals("foo", cn22.getBaseName());
+ Assert.assertEquals("ROOT", cn1.getBaseName());
+ Assert.assertEquals("ROOT", cn2.getBaseName());
+ Assert.assertEquals("ROOT", cn3.getBaseName());
+ Assert.assertEquals("foo", cn4.getBaseName());
+ Assert.assertEquals("foo#bar", cn5.getBaseName());
+ Assert.assertEquals("ROOT##A", cn6.getBaseName());
+ Assert.assertEquals("ROOT##B", cn7.getBaseName());
+ Assert.assertEquals("ROOT##C", cn8.getBaseName());
+ Assert.assertEquals("foo##D", cn9.getBaseName());
+ Assert.assertEquals("foo#bar##E", cn10.getBaseName());
+ Assert.assertEquals("ROOT", cn11.getBaseName());
+ Assert.assertEquals("foo", cn12.getBaseName());
+ Assert.assertEquals("foo#bar", cn13.getBaseName());
+ Assert.assertEquals("ROOT##A", cn14.getBaseName());
+ Assert.assertEquals("foo##D", cn15.getBaseName());
+ Assert.assertEquals("foo#bar##E", cn16.getBaseName());
+ Assert.assertEquals("ROOT", cn17.getBaseName());
+ Assert.assertEquals("ROOT#bar", cn18.getBaseName());
+ Assert.assertEquals("ROOT#bar##A", cn19.getBaseName());
+ Assert.assertEquals("ROOT##A", cn20.getBaseName());
+ Assert.assertEquals("foo.war", cn21.getBaseName());
+ Assert.assertEquals("foo", cn22.getBaseName());
}
@Test
public void testGetPath() {
- assertEquals("", cn1.getPath());
- assertEquals("", cn2.getPath());
- assertEquals("", cn3.getPath());
- assertEquals("/foo", cn4.getPath());
- assertEquals("/foo/bar", cn5.getPath());
- assertEquals("", cn6.getPath());
- assertEquals("", cn7.getPath());
- assertEquals("", cn8.getPath());
- assertEquals("/foo", cn9.getPath());
- assertEquals("/foo/bar", cn10.getPath());
- assertEquals("", cn11.getPath());
- assertEquals("/foo", cn12.getPath());
- assertEquals("/foo/bar", cn13.getPath());
- assertEquals("", cn14.getPath());
- assertEquals("/foo", cn15.getPath());
- assertEquals("/foo/bar", cn16.getPath());
- assertEquals("", cn17.getPath());
- assertEquals("/ROOT/bar", cn18.getPath());
- assertEquals("/ROOT/bar", cn19.getPath());
- assertEquals("", cn20.getPath());
- assertEquals("/foo.war", cn21.getPath());
- assertEquals("/foo", cn22.getPath());
+ Assert.assertEquals("", cn1.getPath());
+ Assert.assertEquals("", cn2.getPath());
+ Assert.assertEquals("", cn3.getPath());
+ Assert.assertEquals("/foo", cn4.getPath());
+ Assert.assertEquals("/foo/bar", cn5.getPath());
+ Assert.assertEquals("", cn6.getPath());
+ Assert.assertEquals("", cn7.getPath());
+ Assert.assertEquals("", cn8.getPath());
+ Assert.assertEquals("/foo", cn9.getPath());
+ Assert.assertEquals("/foo/bar", cn10.getPath());
+ Assert.assertEquals("", cn11.getPath());
+ Assert.assertEquals("/foo", cn12.getPath());
+ Assert.assertEquals("/foo/bar", cn13.getPath());
+ Assert.assertEquals("", cn14.getPath());
+ Assert.assertEquals("/foo", cn15.getPath());
+ Assert.assertEquals("/foo/bar", cn16.getPath());
+ Assert.assertEquals("", cn17.getPath());
+ Assert.assertEquals("/ROOT/bar", cn18.getPath());
+ Assert.assertEquals("/ROOT/bar", cn19.getPath());
+ Assert.assertEquals("", cn20.getPath());
+ Assert.assertEquals("/foo.war", cn21.getPath());
+ Assert.assertEquals("/foo", cn22.getPath());
}
@Test
public void testGetVersion() {
- assertEquals("", cn1.getVersion());
- assertEquals("", cn2.getVersion());
- assertEquals("", cn3.getVersion());
- assertEquals("", cn4.getVersion());
- assertEquals("", cn5.getVersion());
- assertEquals("A", cn6.getVersion());
- assertEquals("B", cn7.getVersion());
- assertEquals("C", cn8.getVersion());
- assertEquals("D", cn9.getVersion());
- assertEquals("E", cn10.getVersion());
- assertEquals("", cn11.getVersion());
- assertEquals("", cn12.getVersion());
- assertEquals("", cn13.getVersion());
- assertEquals("A", cn14.getVersion());
- assertEquals("D", cn15.getVersion());
- assertEquals("E", cn16.getVersion());
- assertEquals("", cn17.getVersion());
- assertEquals("", cn18.getVersion());
- assertEquals("A", cn19.getVersion());
- assertEquals("A", cn20.getVersion());
- assertEquals("", cn21.getVersion());
- assertEquals("", cn22.getVersion());
+ Assert.assertEquals("", cn1.getVersion());
+ Assert.assertEquals("", cn2.getVersion());
+ Assert.assertEquals("", cn3.getVersion());
+ Assert.assertEquals("", cn4.getVersion());
+ Assert.assertEquals("", cn5.getVersion());
+ Assert.assertEquals("A", cn6.getVersion());
+ Assert.assertEquals("B", cn7.getVersion());
+ Assert.assertEquals("C", cn8.getVersion());
+ Assert.assertEquals("D", cn9.getVersion());
+ Assert.assertEquals("E", cn10.getVersion());
+ Assert.assertEquals("", cn11.getVersion());
+ Assert.assertEquals("", cn12.getVersion());
+ Assert.assertEquals("", cn13.getVersion());
+ Assert.assertEquals("A", cn14.getVersion());
+ Assert.assertEquals("D", cn15.getVersion());
+ Assert.assertEquals("E", cn16.getVersion());
+ Assert.assertEquals("", cn17.getVersion());
+ Assert.assertEquals("", cn18.getVersion());
+ Assert.assertEquals("A", cn19.getVersion());
+ Assert.assertEquals("A", cn20.getVersion());
+ Assert.assertEquals("", cn21.getVersion());
+ Assert.assertEquals("", cn22.getVersion());
}
@Test
public void testGetName() {
- assertEquals("", cn1.getName());
- assertEquals("", cn2.getName());
- assertEquals("", cn3.getName());
- assertEquals("/foo", cn4.getName());
- assertEquals("/foo/bar", cn5.getName());
- assertEquals("##A", cn6.getName());
- assertEquals("##B", cn7.getName());
- assertEquals("##C", cn8.getName());
- assertEquals("/foo##D", cn9.getName());
- assertEquals("/foo/bar##E", cn10.getName());
- assertEquals("", cn11.getName());
- assertEquals("/foo", cn12.getName());
- assertEquals("/foo/bar", cn13.getName());
- assertEquals("##A", cn14.getName());
- assertEquals("/foo##D", cn15.getName());
- assertEquals("/foo/bar##E", cn16.getName());
- assertEquals("", cn17.getName());
- assertEquals("/ROOT/bar", cn18.getName());
- assertEquals("/ROOT/bar##A", cn19.getName());
- assertEquals("##A", cn20.getName());
- assertEquals("/foo.war", cn21.getName());
- assertEquals("/foo", cn22.getName());
+ Assert.assertEquals("", cn1.getName());
+ Assert.assertEquals("", cn2.getName());
+ Assert.assertEquals("", cn3.getName());
+ Assert.assertEquals("/foo", cn4.getName());
+ Assert.assertEquals("/foo/bar", cn5.getName());
+ Assert.assertEquals("##A", cn6.getName());
+ Assert.assertEquals("##B", cn7.getName());
+ Assert.assertEquals("##C", cn8.getName());
+ Assert.assertEquals("/foo##D", cn9.getName());
+ Assert.assertEquals("/foo/bar##E", cn10.getName());
+ Assert.assertEquals("", cn11.getName());
+ Assert.assertEquals("/foo", cn12.getName());
+ Assert.assertEquals("/foo/bar", cn13.getName());
+ Assert.assertEquals("##A", cn14.getName());
+ Assert.assertEquals("/foo##D", cn15.getName());
+ Assert.assertEquals("/foo/bar##E", cn16.getName());
+ Assert.assertEquals("", cn17.getName());
+ Assert.assertEquals("/ROOT/bar", cn18.getName());
+ Assert.assertEquals("/ROOT/bar##A", cn19.getName());
+ Assert.assertEquals("##A", cn20.getName());
+ Assert.assertEquals("/foo.war", cn21.getName());
+ Assert.assertEquals("/foo", cn22.getName());
}
@Test
public void testGetDisplayName() {
- assertEquals("/", cn1.getDisplayName());
- assertEquals("/", cn2.getDisplayName());
- assertEquals("/", cn3.getDisplayName());
- assertEquals("/foo", cn4.getDisplayName());
- assertEquals("/foo/bar", cn5.getDisplayName());
- assertEquals("/##A", cn6.getDisplayName());
- assertEquals("/##B", cn7.getDisplayName());
- assertEquals("/##C", cn8.getDisplayName());
- assertEquals("/foo##D", cn9.getDisplayName());
- assertEquals("/foo/bar##E", cn10.getDisplayName());
- assertEquals("/", cn11.getDisplayName());
- assertEquals("/foo", cn12.getDisplayName());
- assertEquals("/foo/bar", cn13.getDisplayName());
- assertEquals("/##A", cn14.getDisplayName());
- assertEquals("/foo##D", cn15.getDisplayName());
- assertEquals("/foo/bar##E", cn16.getDisplayName());
- assertEquals("/", cn17.getDisplayName());
- assertEquals("/ROOT/bar", cn18.getDisplayName());
- assertEquals("/ROOT/bar##A", cn19.getDisplayName());
- assertEquals("/##A", cn20.getDisplayName());
- assertEquals("/foo.war", cn21.getDisplayName());
- assertEquals("/foo", cn22.getDisplayName());
+ Assert.assertEquals("/", cn1.getDisplayName());
+ Assert.assertEquals("/", cn2.getDisplayName());
+ Assert.assertEquals("/", cn3.getDisplayName());
+ Assert.assertEquals("/foo", cn4.getDisplayName());
+ Assert.assertEquals("/foo/bar", cn5.getDisplayName());
+ Assert.assertEquals("/##A", cn6.getDisplayName());
+ Assert.assertEquals("/##B", cn7.getDisplayName());
+ Assert.assertEquals("/##C", cn8.getDisplayName());
+ Assert.assertEquals("/foo##D", cn9.getDisplayName());
+ Assert.assertEquals("/foo/bar##E", cn10.getDisplayName());
+ Assert.assertEquals("/", cn11.getDisplayName());
+ Assert.assertEquals("/foo", cn12.getDisplayName());
+ Assert.assertEquals("/foo/bar", cn13.getDisplayName());
+ Assert.assertEquals("/##A", cn14.getDisplayName());
+ Assert.assertEquals("/foo##D", cn15.getDisplayName());
+ Assert.assertEquals("/foo/bar##E", cn16.getDisplayName());
+ Assert.assertEquals("/", cn17.getDisplayName());
+ Assert.assertEquals("/ROOT/bar", cn18.getDisplayName());
+ Assert.assertEquals("/ROOT/bar##A", cn19.getDisplayName());
+ Assert.assertEquals("/##A", cn20.getDisplayName());
+ Assert.assertEquals("/foo.war", cn21.getDisplayName());
+ Assert.assertEquals("/foo", cn22.getDisplayName());
}
@Test
@@ -236,10 +235,10 @@ public class TestContextName {
}
private void doCompare(ContextName cn1, ContextName cn2) {
- assertEquals(cn1.getBaseName(), cn2.getBaseName());
- assertEquals(cn1.getDisplayName(), cn2.getDisplayName());
- assertEquals(cn1.getName(), cn2.getName());
- assertEquals(cn1.getPath(), cn2.getPath());
- assertEquals(cn1.getVersion(), cn2.getVersion());
+ Assert.assertEquals(cn1.getBaseName(), cn2.getBaseName());
+ Assert.assertEquals(cn1.getDisplayName(), cn2.getDisplayName());
+ Assert.assertEquals(cn1.getName(), cn2.getName());
+ Assert.assertEquals(cn1.getPath(), cn2.getPath());
+ Assert.assertEquals(cn1.getVersion(), cn2.getVersion());
}
}
Modified: tomcat/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java (original)
+++ tomcat/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java Mon Nov 13 10:49:13 2017
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.catalina.valves;
import java.io.IOException;
@@ -24,12 +23,6 @@ import java.util.List;
import javax.servlet.ServletException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
import org.junit.Assert;
import org.junit.Test;
@@ -112,20 +105,20 @@ public class TestRemoteIpValve {
public void testListToCommaDelimitedString() {
List<String> elements = Arrays.asList("element1", "element2", "element3");
String actual = RemoteIpValve.listToCommaDelimitedString(elements);
- assertEquals("element1, element2, element3", actual);
+ Assert.assertEquals("element1, element2, element3", actual);
}
@Test
public void testListToCommaDelimitedStringEmptyList() {
List<String> elements = new ArrayList<>();
String actual = RemoteIpValve.listToCommaDelimitedString(elements);
- assertEquals("", actual);
+ Assert.assertEquals("", actual);
}
@Test
public void testCommaDelimitedListToStringArrayNullList() {
String actual = RemoteIpValve.listToCommaDelimitedString(null);
- assertEquals("", actual);
+ Assert.assertEquals("", actual);
}
@Test
@@ -149,22 +142,22 @@ public class TestRemoteIpValve {
// VERIFY
String actualXForwardedFor = request.getHeader("x-forwarded-for");
- assertNull("x-forwarded-for must be null", actualXForwardedFor);
+ Assert.assertNull("x-forwarded-for must be null", actualXForwardedFor);
String actualXForwardedBy = request.getHeader("x-forwarded-by");
- assertNull("x-forwarded-by must be null", actualXForwardedBy);
+ Assert.assertNull("x-forwarded-by must be null", actualXForwardedBy);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "192.168.0.10", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "192.168.0.10", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "remote-host-original-value", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "remote-host-original-value", actualRemoteHost);
String actualPostInvokeRemoteAddr = request.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
}
@@ -191,22 +184,22 @@ public class TestRemoteIpValve {
// VERIFY
String actualXForwardedFor = remoteAddrAndHostTrackerValve.getForwardedFor();
- assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
+ Assert.assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
String actualXForwardedBy = remoteAddrAndHostTrackerValve.getForwardedBy();
- assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy);
+ Assert.assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
String actualPostInvokeRemoteAddr = request.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
}
@Test
@@ -233,22 +226,22 @@ public class TestRemoteIpValve {
// VERIFY
String actualXForwardedFor = remoteAddrAndHostTrackerValve.getForwardedFor();
- assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
+ Assert.assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
String actualXForwardedBy = remoteAddrAndHostTrackerValve.getForwardedBy();
- assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy);
+ Assert.assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
String actualPostInvokeRemoteAddr = request.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
}
@Test
@@ -274,22 +267,22 @@ public class TestRemoteIpValve {
// VERIFY
String actualXForwardedFor = remoteAddrAndHostTrackerValve.getForwardedFor();
- assertNull("all proxies are internal, x-forwarded-for must be null", actualXForwardedFor);
+ Assert.assertNull("all proxies are internal, x-forwarded-for must be null", actualXForwardedFor);
String actualXForwardedBy = request.getHeader("x-forwarded-by");
- assertNull("all proxies are internal, x-forwarded-by must be null", actualXForwardedBy);
+ Assert.assertNull("all proxies are internal, x-forwarded-by must be null", actualXForwardedBy);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
String actualPostInvokeRemoteAddr = request.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
}
@Test
@@ -317,22 +310,22 @@ public class TestRemoteIpValve {
// VERIFY
String actualXForwardedFor = remoteAddrAndHostTrackerValve.getForwardedFor();
- assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
+ Assert.assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
String actualXForwardedBy = remoteAddrAndHostTrackerValve.getForwardedBy();
- assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy);
+ Assert.assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
String actualPostInvokeRemoteAddr = request.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
}
@Test
@@ -358,25 +351,25 @@ public class TestRemoteIpValve {
// VERIFY
String actualXForwardedFor = remoteAddrAndHostTrackerValve.getForwardedFor();
- assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
+ Assert.assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "209.244.0.3", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "209.244.0.3", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "209.244.0.3", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "209.244.0.3", actualRemoteHost);
String actualPostInvokeRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "209.244.0.3", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "209.244.0.3", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
boolean isSecure = remoteAddrAndHostTrackerValve.isSecure();
- assertTrue("request from internal proxy should be marked secure", isSecure);
+ Assert.assertTrue("request from internal proxy should be marked secure", isSecure);
String scheme = remoteAddrAndHostTrackerValve.getScheme();
- assertEquals("Scheme should be marked to https.","https",scheme);
+ Assert.assertEquals("Scheme should be marked to https.","https",scheme);
request = new MockRequest();
request.setCoyoteRequest(new org.apache.coyote.Request());
@@ -390,25 +383,25 @@ public class TestRemoteIpValve {
// VERIFY
actualXForwardedFor = remoteAddrAndHostTrackerValve.getForwardedFor();
- assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
+ Assert.assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor);
actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "209.244.0.3", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "209.244.0.3", actualRemoteAddr);
actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "209.244.0.3", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "209.244.0.3", actualRemoteHost);
actualPostInvokeRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "209.244.0.3", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "209.244.0.3", actualPostInvokeRemoteAddr);
actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
isSecure = remoteAddrAndHostTrackerValve.isSecure();
- assertTrue("request from internal proxy should be marked secure", isSecure);
+ Assert.assertTrue("request from internal proxy should be marked secure", isSecure);
scheme = remoteAddrAndHostTrackerValve.getScheme();
- assertEquals("Scheme should be marked to https.","https",scheme);
+ Assert.assertEquals("Scheme should be marked to https.","https",scheme);
}
@@ -442,41 +435,41 @@ public class TestRemoteIpValve {
// VERIFY
// client ip
String actualXForwardedFor = remoteAddrAndHostTrackerValve.getForwardedFor();
- assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
+ Assert.assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
String actualXForwardedBy = request.getHeader("x-forwarded-by");
- assertNull("no intermediate trusted proxy", actualXForwardedBy);
+ Assert.assertNull("no intermediate trusted proxy", actualXForwardedBy);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
String actualPostInvokeRemoteAddr = request.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
// protocol
String actualScheme = remoteAddrAndHostTrackerValve.getScheme();
- assertEquals("x-forwarded-proto says https", "https", actualScheme);
+ Assert.assertEquals("x-forwarded-proto says https", "https", actualScheme);
int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort();
- assertEquals("x-forwarded-proto says https", 443, actualServerPort);
+ Assert.assertEquals("x-forwarded-proto says https", 443, actualServerPort);
boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure();
- assertTrue("x-forwarded-proto says https", actualSecure);
+ Assert.assertTrue("x-forwarded-proto says https", actualSecure);
boolean actualPostInvokeSecure = request.isSecure();
- assertFalse("postInvoke secure", actualPostInvokeSecure);
+ Assert.assertFalse("postInvoke secure", actualPostInvokeSecure);
int actualPostInvokeServerPort = request.getServerPort();
- assertEquals("postInvoke serverPort", 8080, actualPostInvokeServerPort);
+ Assert.assertEquals("postInvoke serverPort", 8080, actualPostInvokeServerPort);
String actualPostInvokeScheme = request.getScheme();
- assertEquals("postInvoke scheme", "http", actualPostInvokeScheme);
+ Assert.assertEquals("postInvoke scheme", "http", actualPostInvokeScheme);
}
@Test
@@ -507,41 +500,41 @@ public class TestRemoteIpValve {
// VERIFY
// client ip
String actualXForwardedFor = remoteAddrAndHostTrackerValve.getForwardedFor();
- assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
+ Assert.assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
String actualXForwardedBy = request.getHeader("x-forwarded-by");
- assertNull("no intermediate trusted proxy", actualXForwardedBy);
+ Assert.assertNull("no intermediate trusted proxy", actualXForwardedBy);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
String actualPostInvokeRemoteAddr = request.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
// protocol
String actualScheme = remoteAddrAndHostTrackerValve.getScheme();
- assertEquals("x-forwarded-proto is null", "http", actualScheme);
+ Assert.assertEquals("x-forwarded-proto is null", "http", actualScheme);
int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort();
- assertEquals("x-forwarded-proto is null", 8080, actualServerPort);
+ Assert.assertEquals("x-forwarded-proto is null", 8080, actualServerPort);
boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure();
- assertFalse("x-forwarded-proto is null", actualSecure);
+ Assert.assertFalse("x-forwarded-proto is null", actualSecure);
boolean actualPostInvokeSecure = request.isSecure();
- assertFalse("postInvoke secure", actualPostInvokeSecure);
+ Assert.assertFalse("postInvoke secure", actualPostInvokeSecure);
int actualPostInvokeServerPort = request.getServerPort();
- assertEquals("postInvoke serverPort", 8080, actualPostInvokeServerPort);
+ Assert.assertEquals("postInvoke serverPort", 8080, actualPostInvokeServerPort);
String actualPostInvokeScheme = request.getScheme();
- assertEquals("postInvoke scheme", "http", actualPostInvokeScheme);
+ Assert.assertEquals("postInvoke scheme", "http", actualPostInvokeScheme);
}
@Test
@@ -572,41 +565,41 @@ public class TestRemoteIpValve {
// VERIFY
// client ip
String actualXForwardedFor = remoteAddrAndHostTrackerValve.getForwardedFor();
- assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
+ Assert.assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
String actualXForwardedBy = remoteAddrAndHostTrackerValve.getForwardedBy();
- assertNull("no intermediate trusted proxy", actualXForwardedBy);
+ Assert.assertNull("no intermediate trusted proxy", actualXForwardedBy);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
String actualPostInvokeRemoteAddr = request.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
// protocol
String actualScheme = remoteAddrAndHostTrackerValve.getScheme();
- assertEquals("x-forwarded-proto says http", "http", actualScheme);
+ Assert.assertEquals("x-forwarded-proto says http", "http", actualScheme);
int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort();
- assertEquals("x-forwarded-proto says http", 80, actualServerPort);
+ Assert.assertEquals("x-forwarded-proto says http", 80, actualServerPort);
boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure();
- assertFalse("x-forwarded-proto says http", actualSecure);
+ Assert.assertFalse("x-forwarded-proto says http", actualSecure);
boolean actualPostInvokeSecure = request.isSecure();
- assertTrue("postInvoke secure", actualPostInvokeSecure);
+ Assert.assertTrue("postInvoke secure", actualPostInvokeSecure);
int actualPostInvokeServerPort = request.getServerPort();
- assertEquals("postInvoke serverPort", 8443, actualPostInvokeServerPort);
+ Assert.assertEquals("postInvoke serverPort", 8443, actualPostInvokeServerPort);
String actualPostInvokeScheme = request.getScheme();
- assertEquals("postInvoke scheme", "https", actualPostInvokeScheme);
+ Assert.assertEquals("postInvoke scheme", "https", actualPostInvokeScheme);
}
@Test
@@ -637,41 +630,41 @@ public class TestRemoteIpValve {
// VERIFY
// client ip
String actualXForwardedFor = remoteAddrAndHostTrackerValve.getForwardedFor();
- assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
+ Assert.assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor);
String actualXForwardedBy = request.getHeader("x-forwarded-by");
- assertNull("no intermediate trusted proxy", actualXForwardedBy);
+ Assert.assertNull("no intermediate trusted proxy", actualXForwardedBy);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost);
String actualPostInvokeRemoteAddr = request.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost);
// protocol
String actualScheme = remoteAddrAndHostTrackerValve.getScheme();
- assertEquals("x-forwarded-proto is null", "https", actualScheme);
+ Assert.assertEquals("x-forwarded-proto is null", "https", actualScheme);
int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort();
- assertEquals("x-forwarded-proto is null", 8443, actualServerPort);
+ Assert.assertEquals("x-forwarded-proto is null", 8443, actualServerPort);
boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure();
- assertTrue("x-forwarded-proto is null", actualSecure);
+ Assert.assertTrue("x-forwarded-proto is null", actualSecure);
boolean actualPostInvokeSecure = request.isSecure();
- assertTrue("postInvoke secure", actualPostInvokeSecure);
+ Assert.assertTrue("postInvoke secure", actualPostInvokeSecure);
int actualPostInvokeServerPort = request.getServerPort();
- assertEquals("postInvoke serverPort", 8443, actualPostInvokeServerPort);
+ Assert.assertEquals("postInvoke serverPort", 8443, actualPostInvokeServerPort);
String actualPostInvokeScheme = request.getScheme();
- assertEquals("postInvoke scheme", "https", actualPostInvokeScheme);
+ Assert.assertEquals("postInvoke scheme", "https", actualPostInvokeScheme);
}
@Test
@@ -696,22 +689,22 @@ public class TestRemoteIpValve {
// VERIFY
String actualXForwardedFor = request.getHeader("x-forwarded-for");
- assertEquals("x-forwarded-for must be unchanged", "140.211.11.130, proxy1, proxy2", actualXForwardedFor);
+ Assert.assertEquals("x-forwarded-for must be unchanged", "140.211.11.130, proxy1, proxy2", actualXForwardedFor);
String actualXForwardedBy = request.getHeader("x-forwarded-by");
- assertNull("x-forwarded-by must be null", actualXForwardedBy);
+ Assert.assertNull("x-forwarded-by must be null", actualXForwardedBy);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "not-allowed-internal-proxy", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "not-allowed-internal-proxy", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "not-allowed-internal-proxy-host", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "not-allowed-internal-proxy-host", actualRemoteHost);
String actualPostInvokeRemoteAddr = request.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "not-allowed-internal-proxy", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "not-allowed-internal-proxy", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "not-allowed-internal-proxy-host", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "not-allowed-internal-proxy-host", actualPostInvokeRemoteHost);
}
@Test
@@ -737,22 +730,22 @@ public class TestRemoteIpValve {
// VERIFY
String actualXForwardedFor = remoteAddrAndHostTrackerValve.getForwardedFor();
- assertEquals("ip/host before untrusted-proxy must appear in x-forwarded-for", "140.211.11.130, proxy1", actualXForwardedFor);
+ Assert.assertEquals("ip/host before untrusted-proxy must appear in x-forwarded-for", "140.211.11.130, proxy1", actualXForwardedFor);
String actualXForwardedBy = remoteAddrAndHostTrackerValve.getForwardedBy();
- assertEquals("ip/host after untrusted-proxy must appear in x-forwarded-by", "proxy2", actualXForwardedBy);
+ Assert.assertEquals("ip/host after untrusted-proxy must appear in x-forwarded-by", "proxy2", actualXForwardedBy);
String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr();
- assertEquals("remoteAddr", "untrusted-proxy", actualRemoteAddr);
+ Assert.assertEquals("remoteAddr", "untrusted-proxy", actualRemoteAddr);
String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost();
- assertEquals("remoteHost", "untrusted-proxy", actualRemoteHost);
+ Assert.assertEquals("remoteHost", "untrusted-proxy", actualRemoteHost);
String actualPostInvokeRemoteAddr = request.getRemoteAddr();
- assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
+ Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr);
String actualPostInvokeRemoteHost = request.getRemoteHost();
- assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
+ Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost);
}
@Test
@@ -812,19 +805,19 @@ public class TestRemoteIpValve {
private void assertArrayEquals(String[] expected, String[] actual) {
if (expected == null) {
- assertNull(actual);
+ Assert.assertNull(actual);
return;
}
- assertNotNull(actual);
- assertEquals(expected.length, actual.length);
+ Assert.assertNotNull(actual);
+ Assert.assertEquals(expected.length, actual.length);
List<String> e = new ArrayList<>();
e.addAll(Arrays.asList(expected));
List<String> a = new ArrayList<>();
a.addAll(Arrays.asList(actual));
for (String entry : e) {
- assertTrue(a.remove(entry));
+ Assert.assertTrue(a.remove(entry));
}
- assertTrue(a.isEmpty());
+ Assert.assertTrue(a.isEmpty());
}
}
Modified: tomcat/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java (original)
+++ tomcat/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java Mon Nov 13 10:49:13 2017
@@ -14,16 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.catalina.valves;
import java.io.IOException;
import javax.servlet.ServletException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
import org.junit.Assert;
import org.junit.Test;
@@ -133,7 +129,7 @@ public class TestRequestFilterValve {
} else if (valve instanceof RemoteHostValve) {
((RemoteHostValve)valve).setAddConnectorPort(true);
} else {
- fail("Can only set 'addConnectorPort' for RemoteAddrValve and RemoteHostValve");
+ Assert.fail("Can only set 'addConnectorPort' for RemoteAddrValve and RemoteHostValve");
}
msg.append(" addConnectorPort='true'");
}
@@ -154,10 +150,10 @@ public class TestRequestFilterValve {
// VERIFY
if (!allowed && auth) {
- assertEquals(msg.toString(), OK, response.getStatus());
- assertEquals(msg.toString(), "invalid", request.getHeader("authorization"));
+ Assert.assertEquals(msg.toString(), OK, response.getStatus());
+ Assert.assertEquals(msg.toString(), "invalid", request.getHeader("authorization"));
} else {
- assertEquals(msg.toString(), expected, response.getStatus());
+ Assert.assertEquals(msg.toString(), expected, response.getStatus());
}
}
Modified: tomcat/trunk/test/org/apache/catalina/valves/TesterAccessLogValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/valves/TesterAccessLogValve.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/valves/TesterAccessLogValve.java (original)
+++ tomcat/trunk/test/org/apache/catalina/valves/TesterAccessLogValve.java Mon Nov 13 10:49:13 2017
@@ -22,8 +22,7 @@ import java.util.concurrent.ConcurrentLi
import javax.servlet.ServletException;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import org.junit.Assert;
import org.apache.catalina.AccessLog;
import org.apache.catalina.connector.Request;
@@ -85,12 +84,12 @@ public class TesterAccessLogValve extend
entriesLog.append(entry.toString());
entriesLog.append(System.lineSeparator());
}
- assertEquals(entriesLog.toString(), count, entries.size());
+ Assert.assertEquals(entriesLog.toString(), count, entries.size());
for (Entry entry : entries) {
- assertEquals(status, entry.getStatus());
- assertTrue(entry.toString() + " duration is not >= " + (minTime - ERROR_MARGIN),
+ Assert.assertEquals(status, entry.getStatus());
+ Assert.assertTrue(entry.toString() + " duration is not >= " + (minTime - ERROR_MARGIN),
entry.getTime() >= minTime - ERROR_MARGIN);
- assertTrue(entry.toString() + " duration is not < " + (maxTime + ERROR_MARGIN),
+ Assert.assertTrue(entry.toString() + " duration is not < " + (maxTime + ERROR_MARGIN),
entry.getTime() < maxTime + ERROR_MARGIN);
}
}
Modified: tomcat/trunk/test/org/apache/coyote/http11/TestHttp11InputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/coyote/http11/TestHttp11InputBuffer.java?rev=1815079&r1=1815078&r2=1815079&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/coyote/http11/TestHttp11InputBuffer.java (original)
+++ tomcat/trunk/test/org/apache/coyote/http11/TestHttp11InputBuffer.java Mon Nov 13 10:49:13 2017
@@ -26,10 +26,7 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
+import org.junit.Assert;
import org.junit.Test;
import org.apache.catalina.Context;
@@ -50,8 +47,8 @@ public class TestHttp11InputBuffer exten
Bug48839Client client = new Bug48839Client();
client.doRequest();
- assertTrue(client.isResponse200());
- assertTrue(client.isResponseBodyOK());
+ Assert.assertTrue(client.isResponse200());
+ Assert.assertTrue(client.isResponseBodyOK());
}
@@ -137,9 +134,9 @@ public class TestHttp11InputBuffer exten
Bug51557Client client = new Bug51557Client("X-Bug51557Valid", "1234");
client.doRequest();
- assertTrue(client.isResponse200());
- assertEquals("1234abcd", client.getResponseBody());
- assertTrue(client.isResponseBodyOK());
+ Assert.assertTrue(client.isResponse200());
+ Assert.assertEquals("1234abcd", client.getResponseBody());
+ Assert.assertTrue(client.isResponseBodyOK());
}
@@ -149,7 +146,7 @@ public class TestHttp11InputBuffer exten
Bug51557Client client = new Bug51557Client("X-Bug51557=Invalid", "1234", true);
client.doRequest();
- assertTrue(client.isResponse400());
+ Assert.assertTrue(client.isResponse400());
}
@@ -159,9 +156,9 @@ public class TestHttp11InputBuffer exten
Bug51557Client client = new Bug51557Client("X-Bug51557NoColon");
client.doRequest();
- assertTrue(client.isResponse200());
- assertEquals("abcd", client.getResponseBody());
- assertTrue(client.isResponseBodyOK());
+ Assert.assertTrue(client.isResponse200());
+ Assert.assertEquals("abcd", client.getResponseBody());
+ Assert.assertTrue(client.isResponseBodyOK());
}
@@ -197,9 +194,9 @@ public class TestHttp11InputBuffer exten
"foo" + SimpleHttpClient.CRLF + " bar");
client.doRequest();
- assertTrue(client.isResponse200());
- assertEquals("abcd", client.getResponseBody());
- assertTrue(client.isResponseBodyOK());
+ Assert.assertTrue(client.isResponse200());
+ Assert.assertEquals("abcd", client.getResponseBody());
+ Assert.assertTrue(client.isResponseBodyOK());
}
@@ -210,9 +207,9 @@ public class TestHttp11InputBuffer exten
"invalid");
client.doRequest();
- assertTrue(client.isResponse200());
- assertEquals("abcd", client.getResponseBody());
- assertTrue(client.isResponseBodyOK());
+ Assert.assertTrue(client.isResponse200());
+ Assert.assertEquals("abcd", client.getResponseBody());
+ Assert.assertTrue(client.isResponseBodyOK());
}
@@ -223,9 +220,9 @@ public class TestHttp11InputBuffer exten
"invalid");
client.doRequest();
- assertTrue(client.isResponse200());
- assertEquals("abcd", client.getResponseBody());
- assertTrue(client.isResponseBodyOK());
+ Assert.assertTrue(client.isResponse200());
+ Assert.assertEquals("abcd", client.getResponseBody());
+ Assert.assertTrue(client.isResponseBodyOK());
}
@@ -234,9 +231,9 @@ public class TestHttp11InputBuffer exten
new Bug51557Client("X-Bug" + s + "51557", "invalid");
client.doRequest();
- assertTrue(client.isResponse200());
- assertEquals("abcd", client.getResponseBody());
- assertTrue(client.isResponseBodyOK());
+ Assert.assertTrue(client.isResponse200());
+ Assert.assertEquals("abcd", client.getResponseBody());
+ Assert.assertTrue(client.isResponseBodyOK());
}
/**
@@ -367,8 +364,8 @@ public class TestHttp11InputBuffer exten
NewLinesClient client = new NewLinesClient(10);
client.doRequest();
- assertTrue(client.isResponse200());
- assertTrue(client.isResponseBodyOK());
+ Assert.assertTrue(client.isResponse200());
+ Assert.assertTrue(client.isResponseBodyOK());
}
@@ -385,9 +382,9 @@ public class TestHttp11InputBuffer exten
// fail and the response won't be read.
Exception e = client.doRequest();
if (e == null) {
- assertTrue(client.getResponseLine(), client.isResponse400());
+ Assert.assertTrue(client.getResponseLine(), client.isResponse400());
}
- assertFalse(client.isResponseBodyOK());
+ Assert.assertFalse(client.isResponseBodyOK());
}
@@ -462,8 +459,8 @@ public class TestHttp11InputBuffer exten
Bug54947Client client = new Bug54947Client();
client.doRequest();
- assertTrue(client.isResponse200());
- assertTrue(client.isResponseBodyOK());
+ Assert.assertTrue(client.isResponse200());
+ Assert.assertTrue(client.isResponseBodyOK());
}
@@ -528,8 +525,8 @@ public class TestHttp11InputBuffer exten
Bug59089Client client = new Bug59089Client();
client.doRequest();
- assertTrue(client.isResponse200());
- assertTrue(client.isResponseBodyOK());
+ Assert.assertTrue(client.isResponse200());
+ Assert.assertTrue(client.isResponseBodyOK());
}
@@ -594,8 +591,8 @@ public class TestHttp11InputBuffer exten
InvalidMethodClient client = new InvalidMethodClient();
client.doRequest();
- assertTrue(client.getResponseLine(), client.isResponse400());
- assertTrue(client.isResponseBodyOK());
+ Assert.assertTrue(client.getResponseLine(), client.isResponse400());
+ Assert.assertTrue(client.isResponseBodyOK());
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org