1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.owasp.dependencycheck.maven;
19
20 import java.io.IOException;
21 import java.io.InputStream;
22 import java.util.logging.Level;
23 import java.util.logging.Logger;
24 import org.junit.AfterClass;
25 import org.junit.BeforeClass;
26 import org.owasp.dependencycheck.utils.Settings;
27
28
29
30
31
32 public class BaseTest {
33
34
35
36
37 public static final String PROPERTIES_FILE = "mojo.properties";
38
39 @BeforeClass
40 public static void setUpClass() throws Exception {
41 Settings.initialize();
42 InputStream mojoProperties = null;
43 try {
44 mojoProperties = BaseTest.class.getClassLoader().getResourceAsStream(BaseTest.PROPERTIES_FILE);
45 Settings.mergeProperties(mojoProperties);
46 } finally {
47 if (mojoProperties != null) {
48 try {
49 mojoProperties.close();
50 } catch (IOException ex) {
51 Logger.getLogger(BaseTest.class.getName()).log(Level.SEVERE, null, ex);
52 }
53 }
54 }
55
56 }
57
58 @AfterClass
59 public static void tearDownClass() throws Exception {
60 Settings.cleanup(true);
61 }
62 }