1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.utility;
17
18 import static org.junit.Assert.fail;
19
20 import java.io.File;
21
22 import org.junit.After;
23 import org.junit.Before;
24 import org.junit.Test;
25
26
27
28
29
30
31
32 public class CompressUtils_UT {
33
34 private CompressUtils fileUtil = new CompressUtils();
35
36 @Before
37 public void setUp() throws Exception {
38 }
39
40 @After
41 public void tearDown() throws Exception {
42 }
43
44
45
46
47
48
49 @Test
50 public void testCreateZippedBagFile() throws Exception {
51 try {
52 File dir = new File(getClass().getResource("license").toURI());
53 File bagFile = fileUtil.createZippedBagFile(dir);
54 System.out.println("Bag File: " + bagFile);
55 } catch (Exception e) {
56 e.printStackTrace();
57 fail("Fialed in creating bag: ");
58 throw e;
59 }
60 }
61
62
63
64
65
66
67 @Test
68 public void testExtractZippedBagFile() throws Exception {
69
70 try {
71 File dir = new File(getClass().getResource("license").toURI());
72 File bagFile = fileUtil.createZippedBagFile(dir);
73 System.out.println("Extracted to location : " + fileUtil.extractZippedBagFile(bagFile.getAbsolutePath(), null).getAbsolutePath());
74 } catch (Exception e) {
75 e.printStackTrace();
76 fail("Fialed in extracting bag: ");
77 throw e;
78 }
79 }
80
81 }