update unit test for Windows environment, closes #647
parent
2ae06b2611
commit
78f3e68e8b
|
@ -161,28 +161,37 @@ public class TestJWKSetKeyStore {
|
|||
File file = new File(ks_file);
|
||||
|
||||
/* First, test with file without "read" permission */
|
||||
|
||||
boolean set = false;
|
||||
|
||||
if (file.exists()) {
|
||||
set = file.setReadable(false);
|
||||
}
|
||||
|
||||
// skip this part of the test on systems that don't allow the settable function, like Windows
|
||||
if (set) {
|
||||
|
||||
Resource loc_noread = new FileSystemResource(file);
|
||||
assertTrue(loc_noread.exists());
|
||||
// assertTrue(!loc_noread.isReadable());
|
||||
|
||||
boolean thrown = false;
|
||||
try {
|
||||
ks.setLocation(loc_noread);
|
||||
} catch (IllegalArgumentException e) {
|
||||
thrown = true;
|
||||
}
|
||||
assertTrue(thrown);
|
||||
|
||||
/* Now, make cache file readable */
|
||||
|
||||
if (file.exists()) {
|
||||
file.setReadable(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (file.exists()) {
|
||||
file.setReadable(false);
|
||||
}
|
||||
Resource loc_noread = new FileSystemResource(file);
|
||||
assertTrue(loc_noread.exists());
|
||||
assertTrue(!loc_noread.isReadable());
|
||||
|
||||
boolean thrown = false;
|
||||
try {
|
||||
ks.setLocation(loc_noread);
|
||||
} catch (IllegalArgumentException e) {
|
||||
thrown = true;
|
||||
}
|
||||
assertTrue(thrown);
|
||||
|
||||
/* Now, make cache file readable */
|
||||
|
||||
if (file.exists()) {
|
||||
file.setReadable(true);
|
||||
}
|
||||
Resource loc = new FileSystemResource(file);
|
||||
Resource loc = new FileSystemResource(file);
|
||||
assertTrue(loc.exists());
|
||||
assertTrue(loc.isReadable());
|
||||
|
||||
|
|
Loading…
Reference in New Issue