27
27
import javax .net .ssl .SSLSocketFactory ;
28
28
import org .junit .jupiter .api .Test ;
29
29
30
- public class SslConfigurationTest {
30
+ class SslConfigurationTest {
31
31
32
- private static final String TLS_TEST_HOST = "login.yahoo.com " ;
32
+ private static final String TLS_TEST_HOST = "apache.org " ;
33
33
private static final int TLS_TEST_PORT = 443 ;
34
34
35
- @ SuppressWarnings ("deprecation" )
36
- public static SslConfiguration createTestSslConfigurationResourcesDeprecated () throws StoreConfigurationException {
37
- final KeyStoreConfiguration ksc = new KeyStoreConfiguration (
38
- TestConstants .KEYSTORE_FILE_RESOURCE , TestConstants .KEYSTORE_PWD (), TestConstants .KEYSTORE_TYPE , null );
39
- final TrustStoreConfiguration tsc = new TrustStoreConfiguration (
40
- TestConstants .TRUSTSTORE_FILE_RESOURCE , TestConstants .TRUSTSTORE_PWD (), null , null );
41
- return SslConfiguration .createSSLConfiguration (null , ksc , tsc );
42
- }
43
-
44
- public static SslConfiguration createTestSslConfigurationResources () throws StoreConfigurationException {
35
+ private static SslConfiguration createTestSslConfigurationResources () throws StoreConfigurationException {
45
36
final KeyStoreConfiguration ksc = new KeyStoreConfiguration (
46
37
TestConstants .KEYSTORE_FILE_RESOURCE ,
47
38
new MemoryPasswordProvider (TestConstants .KEYSTORE_PWD ()),
@@ -55,16 +46,7 @@ public static SslConfiguration createTestSslConfigurationResources() throws Stor
55
46
return SslConfiguration .createSSLConfiguration (null , ksc , tsc );
56
47
}
57
48
58
- @ SuppressWarnings ("deprecation" )
59
- public static SslConfiguration createTestSslConfigurationFilesDeprecated () throws StoreConfigurationException {
60
- final KeyStoreConfiguration ksc = new KeyStoreConfiguration (
61
- TestConstants .KEYSTORE_FILE , TestConstants .KEYSTORE_PWD (), TestConstants .KEYSTORE_TYPE , null );
62
- final TrustStoreConfiguration tsc =
63
- new TrustStoreConfiguration (TestConstants .TRUSTSTORE_FILE , TestConstants .TRUSTSTORE_PWD (), null , null );
64
- return SslConfiguration .createSSLConfiguration (null , ksc , tsc );
65
- }
66
-
67
- public static SslConfiguration createTestSslConfigurationFiles () throws StoreConfigurationException {
49
+ private static SslConfiguration createTestSslConfigurationFiles () throws StoreConfigurationException {
68
50
final KeyStoreConfiguration ksc = new KeyStoreConfiguration (
69
51
TestConstants .KEYSTORE_FILE ,
70
52
new MemoryPasswordProvider (TestConstants .KEYSTORE_PWD ()),
@@ -76,7 +58,7 @@ public static SslConfiguration createTestSslConfigurationFiles() throws StoreCon
76
58
}
77
59
78
60
@ Test
79
- public void testGettersFromScratchFiles () throws StoreConfigurationException {
61
+ void testGettersFromScratchFiles () throws StoreConfigurationException {
80
62
assertNotNull (createTestSslConfigurationFiles ().getProtocol ());
81
63
assertNotNull (createTestSslConfigurationFiles ().getKeyStoreConfig ());
82
64
assertNotNull (createTestSslConfigurationFiles ().getSslContext ());
@@ -85,7 +67,7 @@ public void testGettersFromScratchFiles() throws StoreConfigurationException {
85
67
}
86
68
87
69
@ Test
88
- public void testGettersFromScratchResources () throws StoreConfigurationException {
70
+ void testGettersFromScratchResources () throws StoreConfigurationException {
89
71
assertNotNull (createTestSslConfigurationResources ().getProtocol ());
90
72
assertNotNull (createTestSslConfigurationResources ().getKeyStoreConfig ());
91
73
assertNotNull (createTestSslConfigurationResources ().getSslContext ());
@@ -94,21 +76,21 @@ public void testGettersFromScratchResources() throws StoreConfigurationException
94
76
}
95
77
96
78
@ Test
97
- public void equals () {
79
+ void testEquals () {
98
80
assertEquals (
99
81
SslConfiguration .createSSLConfiguration (null , null , null ),
100
82
SslConfiguration .createSSLConfiguration (null , null , null ));
101
83
}
102
84
103
85
@ Test
104
- public void emptyConfigurationDoesntCauseNullSSLSocketFactory () {
86
+ void emptyConfigurationDoesNotCauseNullSSLSocketFactory () {
105
87
final SslConfiguration sc = SslConfiguration .createSSLConfiguration (null , null , null );
106
88
final SSLSocketFactory factory = sc .getSslSocketFactory ();
107
89
assertNotNull (factory );
108
90
}
109
91
110
92
@ Test
111
- public void emptyConfigurationHasDefaultTrustStore () throws IOException {
93
+ void emptyConfigurationHasDefaultTrustStore () throws IOException {
112
94
final SslConfiguration sc = SslConfiguration .createSSLConfiguration (null , null , null );
113
95
final SSLSocketFactory factory = sc .getSslSocketFactory ();
114
96
try {
@@ -121,7 +103,7 @@ public void emptyConfigurationHasDefaultTrustStore() throws IOException {
121
103
}
122
104
123
105
@ Test
124
- public void connectionFailsWithoutValidServerCertificate () throws IOException , StoreConfigurationException {
106
+ void connectionFailsWithoutValidServerCertificate () throws IOException , StoreConfigurationException {
125
107
final TrustStoreConfiguration tsc = new TrustStoreConfiguration (
126
108
TestConstants .TRUSTSTORE_FILE , new MemoryPasswordProvider (TestConstants .NULL_PWD ), null , null );
127
109
final SslConfiguration sc = SslConfiguration .createSSLConfiguration (null , null , tsc );
@@ -138,7 +120,7 @@ public void connectionFailsWithoutValidServerCertificate() throws IOException, S
138
120
}
139
121
140
122
@ Test
141
- public void loadKeyStoreWithoutPassword () throws StoreConfigurationException {
123
+ void loadKeyStoreWithoutPassword () throws StoreConfigurationException {
142
124
final KeyStoreConfiguration ksc = new KeyStoreConfiguration (
143
125
TestConstants .KEYSTORE_FILE , new MemoryPasswordProvider (TestConstants .NULL_PWD ), null , null );
144
126
final SslConfiguration sslConf = SslConfiguration .createSSLConfiguration (null , ksc , null );
0 commit comments