~ubuntu-branches/ubuntu/saucy/jenkins/saucy

« back to all changes in this revision

Viewing changes to core/src/test/java/jenkins/security/ConfidentialStoreRule.java

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-01-10 09:50:50 UTC
  • mfrom: (5.1.10 experimental)
  • Revision ID: package-import@ubuntu.com-20130110095050-kj8xuw20gcfh62k3
Tags: 1.480.2+dfsg-1~exp1
* New upstream release (Closes: #696816, #697617):
  - d/control: Added new BD on libjbcrypt-java.
  - d/control: Versioned BD jenkins-winstone >= 0.9.10-jenkins-40.
  - d/control: Versioned BD jenkins-trilead-ssh2 >= 214-jenkins-1.
  - Fixes the following security vulnerabilities:
    CVE-2012-6072, CVE-2012-6073, CVE-2012-6072, CVE-2013-0158.
* Tidied lintian warnings.
* Bumped Standards-Version: 3.9.4, no changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package jenkins.security;
 
2
 
 
3
import hudson.Util;
 
4
import org.junit.rules.ExternalResource;
 
5
 
 
6
import java.io.File;
 
7
import java.io.IOException;
 
8
 
 
9
/**
 
10
 * Test rule that injects a temporary {@link DefaultConfidentialStore}
 
11
 * @author Kohsuke Kawaguchi
 
12
 */
 
13
public class ConfidentialStoreRule extends ExternalResource {
 
14
    public ConfidentialStore store;
 
15
    public File tmp;
 
16
 
 
17
    @Override
 
18
    protected void before() throws Throwable {
 
19
        tmp = Util.createTempDir();
 
20
        store = new DefaultConfidentialStore(tmp);
 
21
        ConfidentialStore.TEST.set(store);
 
22
    }
 
23
 
 
24
    @Override
 
25
    protected void after() {
 
26
        ConfidentialStore.TEST.set(null);
 
27
        try {
 
28
            Util.deleteRecursive(tmp);
 
29
        } catch (IOException e) {
 
30
            throw new Error(e);
 
31
        }
 
32
    }
 
33
 
 
34
    static {
 
35
        ConfidentialStore.TEST = new ThreadLocal<ConfidentialStore>();
 
36
    }
 
37
}