44
44
45
45
class CertUtilsTest {
46
46
47
- private static final String FABRIC8_STORE_PATH = Utils .filePath (CertUtilsTest .class .getResource ("/ssl/fabric8-store" ));
47
+ private static final String FABRIC8_STORE_PATH = Utils .filePath (CertUtilsTest .class .getResource ("/ssl-test /fabric8-store" ));
48
48
private static final String FABRIC8_STORE_PASSPHRASE = "fabric8" ;
49
49
private Properties systemProperties ;
50
50
@@ -76,7 +76,7 @@ void handleReadOnlyJavaTrustStore() throws Exception {
76
76
KeyStore trustStore = Mockito .spy (system );
77
77
Mockito .doThrow (KeyStoreException .class ).when (trustStore ).setCertificateEntry (Mockito .anyString (), Mockito .any ());
78
78
KeyStore result = CertUtils .mergePemCertsIntoTrustStore (
79
- CertUtils .getInputStreamFromDataOrFile (null , "src/test/resources/ssl/multiple-certs.pem" ), trustStore , true );
79
+ CertUtils .getInputStreamFromDataOrFile (null , "src/test/resources/ssl-test /multiple-certs.pem" ), trustStore , true );
80
80
81
81
assertNotSame (trustStore , result );
82
82
assertThat (Collections .list (result .aliases ()))
@@ -88,7 +88,7 @@ void handleReadOnlyJavaTrustStore() throws Exception {
88
88
@ Test
89
89
void loadingMultipleCertsFromSameFile () throws Exception {
90
90
KeyStore ts = CertUtils .createTrustStore (
91
- null , "src/test/resources/ssl/multiple-certs.pem" , null , "changeit" );
91
+ null , "src/test/resources/ssl-test /multiple-certs.pem" , null , "changeit" );
92
92
93
93
assertThat (Collections .list (ts .aliases ()))
94
94
.hasSizeGreaterThanOrEqualTo (2 )
@@ -99,15 +99,15 @@ void loadingMultipleCertsFromSameFile() throws Exception {
99
99
@ Test
100
100
void loadingMultipleCertsWithSameSubjectFromSameFile () throws Exception {
101
101
KeyStore ts = CertUtils .createTrustStore (
102
- null , "src/test/resources/ssl/nonunique-subject.pem" , null , "changeit" );
102
+ null , "src/test/resources/ssl-test /nonunique-subject.pem" , null , "changeit" );
103
103
104
104
assertTrue (ts .size () >= 2 );
105
105
}
106
106
107
107
@ Test
108
108
void loadTrustStoreFromFileUsingConfigProperties () throws Exception {
109
109
KeyStore trustStore = CertUtils .createTrustStore (
110
- null , "src/test/resources/ssl/multiple-certs.pem" , FABRIC8_STORE_PATH , FABRIC8_STORE_PASSPHRASE );
110
+ null , "src/test/resources/ssl-test /multiple-certs.pem" , FABRIC8_STORE_PATH , FABRIC8_STORE_PASSPHRASE );
111
111
112
112
assertThat (Collections .list (trustStore .aliases ()))
113
113
.hasSizeGreaterThanOrEqualTo (3 )
@@ -123,7 +123,7 @@ void loadTrustStoreFromFileUsingSystemProperties() throws Exception {
123
123
System .setProperty ("javax.net.ssl.trustStorePassword" , FABRIC8_STORE_PASSPHRASE );
124
124
125
125
KeyStore trustStore = CertUtils .createTrustStore (
126
- null , "src/test/resources/ssl/multiple-certs.pem" , null , null );
126
+ null , "src/test/resources/ssl-test /multiple-certs.pem" , null , null );
127
127
128
128
assertEquals (3 , trustStore .size ());
129
129
verifyFabric8InStore (trustStore );
@@ -132,8 +132,8 @@ void loadTrustStoreFromFileUsingSystemProperties() throws Exception {
132
132
@ Test
133
133
void loadKeyStoreFromFileUsingConfigProperties () throws Exception {
134
134
KeyStore trustStore = CertUtils .createKeyStore (
135
- null , "src/test/resources/ssl/multiple-certs.pem" ,
136
- null , "src/test/resources/ssl/fabric8" , "RSA" , "changeit" ,
135
+ null , "src/test/resources/ssl-test /multiple-certs.pem" ,
136
+ null , "src/test/resources/ssl-test /fabric8" , "RSA" , "changeit" ,
137
137
FABRIC8_STORE_PATH , FABRIC8_STORE_PASSPHRASE );
138
138
139
139
assertEquals (2 , trustStore .size ());
@@ -145,8 +145,8 @@ void loadKeyStoreFromFileUsingSystemProperties() throws Exception {
145
145
System .setProperty ("javax.net.ssl.keyStore" , FABRIC8_STORE_PATH );
146
146
System .setProperty ("javax.net.ssl.keyStorePassword" , String .valueOf (FABRIC8_STORE_PASSPHRASE ));
147
147
148
- String privateKeyPath = Utils .filePath (getClass ().getResource ("/ssl/fabric8" ));
149
- String multipleCertsPath = Utils .filePath (getClass ().getResource ("/ssl/multiple-certs.pem" ));
148
+ String privateKeyPath = Utils .filePath (getClass ().getResource ("/ssl-test /fabric8" ));
149
+ String multipleCertsPath = Utils .filePath (getClass ().getResource ("/ssl-test /multiple-certs.pem" ));
150
150
151
151
KeyStore trustStore = CertUtils .createKeyStore (null , multipleCertsPath , null , privateKeyPath , "RSA" , "changeit" , null ,
152
152
null );
@@ -159,7 +159,7 @@ void loadKeyStoreFromFileUsingSystemProperties() throws Exception {
159
159
void getInputStreamFromDataOrFileShouldNotDecodedPEMAgain () throws IOException {
160
160
// Given
161
161
File certFile = new File (
162
- Objects .requireNonNull (getClass ().getResource ("/ssl/valid-non-base64-encoded-cert.pem" )).getFile ());
162
+ Objects .requireNonNull (getClass ().getResource ("/ssl-test /valid-non-base64-encoded-cert.pem" )).getFile ());
163
163
String certData = new String (Files .readAllBytes (certFile .toPath ()));
164
164
165
165
// When
@@ -188,7 +188,7 @@ void getInputStreamFromDataOrFileShouldDecodeBase64EncodedString() throws IOExce
188
188
void storeKeyFallbacksToDefault () throws Exception {
189
189
// When
190
190
final KeyStore result = CertUtils .createTrustStore (
191
- null , "src/test/resources/ssl/multiple-certs.pem" , null , "" );
191
+ null , "src/test/resources/ssl-test /multiple-certs.pem" , null , "" );
192
192
// Then
193
193
assertThat (Collections .list (result .aliases ()))
194
194
.hasSizeGreaterThanOrEqualTo (2 )
@@ -203,7 +203,7 @@ private void verifyFabric8InStore(KeyStore trustStore)
203
203
assertNotNull (certificate );
204
204
205
205
KeyStore storeWithCert = CertUtils .createTrustStore (
206
- null , "src/test/resources/ssl/fabric8.crt" , null , "" );
206
+ null , "src/test/resources/ssl-test /fabric8.crt" , null , "" );
207
207
String certificateAlias = storeWithCert .getCertificateAlias (certificate );
208
208
assertNotNull (certificateAlias );
209
209
}
0 commit comments