Skip to content

Commit 4ef008e

Browse files
HongJiangEricleomaatEric
authored andcommitted
update util with regular expression
1 parent c7509a8 commit 4ef008e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/e2e-test/java/com/cisco/trex/stateless/TRexClientUtilTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
public class TRexClientUtilTest {
88
@Test
9-
public void getModeTest() throws Exception {
9+
public void getModeTest() {
1010
TRexServerMode mode = TRexClientUtil.getMode("trex-host", "4501");
1111
System.out.println(mode);
1212
}

src/main/java/com/cisco/trex/util/TRexClientUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.HashMap;
55
import java.util.Map;
66
import java.util.Random;
7+
import java.util.regex.Pattern;
78

89
import com.cisco.trex.stateless.TRexCommand;
910
import com.cisco.trex.stateless.TRexTransport;
@@ -42,7 +43,7 @@ public static TRexServerMode getMode(String host, String port) {
4243
if (!response.isFailed()) {
4344
return TRexServerMode.ASTF;
4445
}
45-
if ("RPC configuration mismatch - server RPC configuration: 'STL', client RPC configuration: 'ASTF'".equalsIgnoreCase(response.getError().getSpecificErr())) {
46+
if (Pattern.compile(".*mismatch.*server RPC.*STL.").matcher(response.getError().getSpecificErr()).find()) {
4647
return TRexServerMode.STL;
4748
}
4849
return TRexServerMode.UNKNOWN;

0 commit comments

Comments
 (0)