8069038: javax/net/ssl/TLS/TLSClientPropertyTest.java needs to be updated for JDK-8061210
Reviewed-by: xuelei, mullan
This commit is contained in:
parent
1059b1665d
commit
2a29bb3be6
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -29,8 +29,10 @@ import javax.net.ssl.SSLContext;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 8049432
|
* @bug 8049432 8069038
|
||||||
* @summary New tests for TLS property jdk.tls.client.protocols
|
* @summary New tests for TLS property jdk.tls.client.protocols
|
||||||
|
* @summary javax/net/ssl/TLS/TLSClientPropertyTest.java needs to be
|
||||||
|
* updated for JDK-8061210
|
||||||
* @run main/othervm TLSClientPropertyTest NoProperty
|
* @run main/othervm TLSClientPropertyTest NoProperty
|
||||||
* @run main/othervm TLSClientPropertyTest SSLv3
|
* @run main/othervm TLSClientPropertyTest SSLv3
|
||||||
* @run main/othervm TLSClientPropertyTest TLSv1
|
* @run main/othervm TLSClientPropertyTest TLSv1
|
||||||
@ -46,7 +48,7 @@ import javax.net.ssl.SSLContext;
|
|||||||
* protocols in the SSLContext.
|
* protocols in the SSLContext.
|
||||||
*/
|
*/
|
||||||
public class TLSClientPropertyTest {
|
public class TLSClientPropertyTest {
|
||||||
private final String[] expecteSupportedProtos = new String[] {
|
private final String[] expectedSupportedProtos = new String[] {
|
||||||
"SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"
|
"SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -67,31 +69,30 @@ public class TLSClientPropertyTest {
|
|||||||
}
|
}
|
||||||
contextProtocol = null;
|
contextProtocol = null;
|
||||||
expectedDefaultProtos = new String[] {
|
expectedDefaultProtos = new String[] {
|
||||||
"SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"
|
"TLSv1", "TLSv1.1", "TLSv1.2"
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case "SSLv3":
|
case "SSLv3":
|
||||||
contextProtocol = "SSLv3";
|
contextProtocol = "SSLv3";
|
||||||
expectedDefaultProtos = new String[] {
|
expectedDefaultProtos = new String[] {
|
||||||
"SSLv3"
|
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case "TLSv1":
|
case "TLSv1":
|
||||||
contextProtocol = "TLSv1";
|
contextProtocol = "TLSv1";
|
||||||
expectedDefaultProtos = new String[] {
|
expectedDefaultProtos = new String[] {
|
||||||
"SSLv3", "TLSv1"
|
"TLSv1"
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case "TLSv11":
|
case "TLSv11":
|
||||||
contextProtocol = "TLSv1.1";
|
contextProtocol = "TLSv1.1";
|
||||||
expectedDefaultProtos = new String[] {
|
expectedDefaultProtos = new String[] {
|
||||||
"SSLv3", "TLSv1", "TLSv1.1"
|
"TLSv1", "TLSv1.1"
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case "TLSv12":
|
case "TLSv12":
|
||||||
contextProtocol = "TLSv1.2";
|
contextProtocol = "TLSv1.2";
|
||||||
expectedDefaultProtos = new String[] {
|
expectedDefaultProtos = new String[] {
|
||||||
"SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"
|
"TLSv1", "TLSv1.1", "TLSv1.2"
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case "WrongProperty":
|
case "WrongProperty":
|
||||||
@ -182,12 +183,12 @@ public class TLSClientPropertyTest {
|
|||||||
expectedProto = "Default";
|
expectedProto = "Default";
|
||||||
}
|
}
|
||||||
if (!context.getProtocol().equals(expectedProto)) {
|
if (!context.getProtocol().equals(expectedProto)) {
|
||||||
error("Invalid current protocol:" + context.getProtocol()
|
error("Invalid current protocol: " + context.getProtocol()
|
||||||
+ ", Expected:" + expectedProto, null);
|
+ ", Expected:" + expectedProto, null);
|
||||||
}
|
}
|
||||||
List<String> actualDefaultProtos = Arrays.asList(context
|
List<String> actualDefaultProtos = Arrays.asList(context
|
||||||
.getDefaultSSLParameters().getProtocols());
|
.getDefaultSSLParameters().getProtocols());
|
||||||
for (String p: expectedDefaultProtos) {
|
for (String p : expectedDefaultProtos) {
|
||||||
if (!actualDefaultProtos.contains(p)) {
|
if (!actualDefaultProtos.contains(p)) {
|
||||||
error("Default protocol " + p + "missing", null);
|
error("Default protocol " + p + "missing", null);
|
||||||
}
|
}
|
||||||
@ -195,7 +196,7 @@ public class TLSClientPropertyTest {
|
|||||||
List<String> actualSupportedProtos = Arrays.asList(context
|
List<String> actualSupportedProtos = Arrays.asList(context
|
||||||
.getSupportedSSLParameters().getProtocols());
|
.getSupportedSSLParameters().getProtocols());
|
||||||
|
|
||||||
for (String p: expecteSupportedProtos) {
|
for (String p : expectedSupportedProtos) {
|
||||||
if (!actualSupportedProtos.contains(p)) {
|
if (!actualSupportedProtos.contains(p)) {
|
||||||
error("Expected to support protocol:" + p, null);
|
error("Expected to support protocol:" + p, null);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user