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