7
7
import java .io .File ;
8
8
import java .nio .file .Path ;
9
9
import java .nio .file .Paths ;
10
- import java .util .HashMap ;
11
- import java .util .Map ;
12
- import java .util .Map .Entry ;
10
+ import java .util .LinkedList ;
11
+ import java .util .List ;
13
12
14
13
import junit .framework .Assert ;
15
14
@@ -33,7 +32,7 @@ public class ModuleTesterTest {
33
32
private static final String SIMPLE_MODULE_NAME = "ASimpleModule_for_unit_testing" ;
34
33
private static final boolean DELETE_TEST_MODULES = true ;
35
34
36
- private static final Map <Path , Boolean > CREATED_MODULES = new HashMap <>();
35
+ private static final List <Path > CREATED_MODULES = new LinkedList <>();
37
36
private static AuthToken token ;
38
37
39
38
@ BeforeClass
@@ -43,9 +42,8 @@ public static void beforeClass() throws Exception {
43
42
44
43
@ AfterClass
45
44
public static void tearDownModule () throws Exception {
46
- for (final Entry <Path , Boolean > dirAndCov : CREATED_MODULES .entrySet ()) {
47
- TestUtils .deleteTestModule (
48
- dirAndCov .getKey (), dirAndCov .getValue (), DELETE_TEST_MODULES );
45
+ for (final Path mod : CREATED_MODULES ) {
46
+ TestUtils .deleteTestModule (mod , true , DELETE_TEST_MODULES );
49
47
}
50
48
}
51
49
@@ -55,14 +53,9 @@ public void afterTest() {
55
53
}
56
54
57
55
private Path init (final String lang , final String moduleName ) throws Exception {
58
- return init (lang , moduleName , false );
59
- }
60
-
61
- private Path init (final String lang , final String moduleName , final boolean hasPyCov )
62
- throws Exception {
63
56
final Path workDir = Paths .get (TestConfigHelper .getTempTestDir (), moduleName );
64
- TestUtils .deleteTestModule (workDir , hasPyCov , true );
65
- CREATED_MODULES .put (workDir , hasPyCov );
57
+ TestUtils .deleteTestModule (workDir , true , true );
58
+ CREATED_MODULES .add (workDir );
66
59
new ModuleInitializer (
67
60
moduleName ,
68
61
token .getUserName (),
@@ -105,7 +98,7 @@ public void testPythonModuleExample() throws Exception {
105
98
System .out .println ("Test [testPythonModuleExample]" );
106
99
String lang = "python" ;
107
100
String moduleName = SIMPLE_MODULE_NAME + "Python" ;
108
- final Path moduleDir = init (lang , moduleName , true );
101
+ final Path moduleDir = init (lang , moduleName );
109
102
// TODO TESTHACK remove this when there's a base image that deploys the authclient correctly
110
103
FileUtils .copyFile (
111
104
new File ("./src/java/us/kbase/templates/authclient.py" ),
@@ -133,7 +126,7 @@ public void testPythonModuleError() throws Exception {
133
126
System .out .println ("Test [testPythonModuleError]" );
134
127
String lang = "python" ;
135
128
String moduleName = SIMPLE_MODULE_NAME + "PythonError" ;
136
- final Path moduleDir = init (lang , moduleName , true );
129
+ final Path moduleDir = init (lang , moduleName );
137
130
final Path implFile = moduleDir .resolve (
138
131
Paths .get ("lib" , moduleName , moduleName + "Impl.py" )
139
132
);
@@ -188,7 +181,7 @@ public void testSelfCalls() throws Exception {
188
181
String moduleName = SIMPLE_MODULE_NAME + "Self" ;
189
182
final Path workDir = Paths .get (TestConfigHelper .getTempTestDir (), moduleName );
190
183
TestUtils .deleteTestModule (workDir , true , true );
191
- CREATED_MODULES .put (workDir , true );
184
+ CREATED_MODULES .add (workDir );
192
185
String implInit = "" +
193
186
"#BEGIN_HEADER\n " +
194
187
"import os\n " +
0 commit comments