3333public class DependencyResolverTest {
3434 private static DependencyResolver resolver ;
3535 private static String testPath ;
36- private static String testCopyPath ;
37- private static String home ;
38-
36+ private static File testCopyPath ;
37+ private static File tmpDir ;
38+
3939 @ BeforeClass
4040 public static void setUp () throws Exception {
41- testPath = "test-repo" ;
42- testCopyPath = "test-copy-repo" ;
41+ tmpDir = new File (System .getProperty ("java.io.tmpdir" )+"/ZeppelinLTest_" +System .currentTimeMillis ());
42+ testPath = tmpDir .getAbsolutePath () + "/test-repo" ;
43+ testCopyPath = new File (tmpDir , "test-copy-repo" );
4344 resolver = new DependencyResolver (testPath );
44- home = System .getenv ("ZEPPELIN_HOME" );
45- if (home == null ) {
46- home = System .getProperty ("zeppelin.home" );
47- }
48- if (home == null ) {
49- home = ".." ;
50- }
5145 }
5246
5347 @ AfterClass
5448 public static void tearDown () throws Exception {
55- FileUtils .deleteDirectory (new File (home + "/" + testPath ));
56- FileUtils .deleteDirectory (new File (home + "/" + testCopyPath ));
49+ FileUtils .deleteDirectory (tmpDir );
5750 }
5851
5952 @ Rule
@@ -78,19 +71,19 @@ public void testDelRepo() {
7871 public void testLoad () throws Exception {
7972 // basic load
8073 resolver .load ("com.databricks:spark-csv_2.10:1.3.0" , testCopyPath );
81- assertEquals (new File ( home + "/" + testCopyPath ) .list ().length , 4 );
82- FileUtils .cleanDirectory (new File ( home + "/" + testCopyPath ) );
74+ assertEquals (testCopyPath .list ().length , 4 );
75+ FileUtils .cleanDirectory (testCopyPath );
8376
8477 // load with exclusions parameter
8578 resolver .load ("com.databricks:spark-csv_2.10:1.3.0" ,
8679 Collections .singletonList ("org.scala-lang:scala-library" ), testCopyPath );
87- assertEquals (new File ( home + "/" + testCopyPath ) .list ().length , 3 );
88- FileUtils .cleanDirectory (new File ( home + "/" + testCopyPath ) );
80+ assertEquals (testCopyPath .list ().length , 3 );
81+ FileUtils .cleanDirectory (testCopyPath );
8982
9083 // load from added repository
9184 resolver .addRepo ("sonatype" , "https://oss.sonatype.org/content/repositories/agimatec-releases/" , false );
9285 resolver .load ("com.agimatec:agimatec-validation:0.9.3" , testCopyPath );
93- assertEquals (new File ( home + "/" + testCopyPath ) .list ().length , 8 );
86+ assertEquals (testCopyPath .list ().length , 8 );
9487
9588 // load invalid artifact
9689 resolver .delRepo ("sonatype" );
0 commit comments