1
package jenkins.security;
4
import org.junit.rules.ExternalResource;
7
import java.io.IOException;
10
* Test rule that injects a temporary {@link DefaultConfidentialStore}
11
* @author Kohsuke Kawaguchi
13
public class ConfidentialStoreRule extends ExternalResource {
14
public ConfidentialStore store;
18
protected void before() throws Throwable {
19
tmp = Util.createTempDir();
20
store = new DefaultConfidentialStore(tmp);
21
ConfidentialStore.TEST.set(store);
25
protected void after() {
26
ConfidentialStore.TEST.set(null);
28
Util.deleteRecursive(tmp);
29
} catch (IOException e) {
35
ConfidentialStore.TEST = new ThreadLocal<ConfidentialStore>();