~ubuntu-branches/debian/stretch/libcommons-compress-java/stretch

« back to all changes in this revision

Viewing changes to src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZOutputFileTest.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2015-08-31 23:22:38 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20150831232238-gz3ynyvs68tok1a3
Tags: 1.10-1
* New upstream release
* Updated the OSGi metadata

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 */
18
18
package org.apache.commons.compress.archivers.sevenz;
19
19
 
 
20
import static org.junit.Assert.*;
 
21
import org.junit.Test;
 
22
 
20
23
import java.io.File;
21
24
import java.io.IOException;
22
25
import java.util.Arrays;
49
52
        super.tearDown();
50
53
    }
51
54
 
 
55
    @Test
52
56
    public void testDirectoriesAndEmptyFiles() throws Exception {
53
57
        output = new File(dir, "empties.7z");
54
58
 
145
149
 
146
150
    }
147
151
 
 
152
    @Test
148
153
    public void testDirectoriesOnly() throws Exception {
149
154
        output = new File(dir, "dirs.7z");
150
155
        SevenZOutputFile outArchive = new SevenZOutputFile(output);
173
178
 
174
179
    }
175
180
 
 
181
    @Test
176
182
    public void testCantFinishTwice() throws Exception {
177
183
        output = new File(dir, "finish.7z");
178
184
        SevenZOutputFile outArchive = new SevenZOutputFile(output);
187
193
        }
188
194
    }
189
195
 
 
196
    @Test
190
197
    public void testSixEmptyFiles() throws Exception {
191
198
        testCompress252(6, 0);
192
199
    }
193
200
 
 
201
    @Test
194
202
    public void testSixFilesSomeNotEmpty() throws Exception {
195
203
        testCompress252(6, 2);
196
204
    }
197
205
 
 
206
    @Test
198
207
    public void testSevenEmptyFiles() throws Exception {
199
208
        testCompress252(7, 0);
200
209
    }
201
210
 
 
211
    @Test
202
212
    public void testSevenFilesSomeNotEmpty() throws Exception {
203
213
        testCompress252(7, 2);
204
214
    }
205
215
 
 
216
    @Test
206
217
    public void testEightEmptyFiles() throws Exception {
207
218
        testCompress252(8, 0);
208
219
    }
209
220
 
 
221
    @Test
210
222
    public void testEightFilesSomeNotEmpty() throws Exception {
211
223
        testCompress252(8, 2);
212
224
    }
213
225
 
 
226
    @Test
214
227
    public void testNineEmptyFiles() throws Exception {
215
228
        testCompress252(9, 0);
216
229
    }
217
230
 
 
231
    @Test
218
232
    public void testNineFilesSomeNotEmpty() throws Exception {
219
233
        testCompress252(9, 2);
220
234
    }
221
235
 
 
236
    @Test
222
237
    public void testTwentyNineEmptyFiles() throws Exception {
223
238
        testCompress252(29, 0);
224
239
    }
225
240
 
 
241
    @Test
226
242
    public void testTwentyNineFilesSomeNotEmpty() throws Exception {
227
243
        testCompress252(29, 7);
228
244
    }
229
245
 
 
246
    @Test
230
247
    public void testCopyRoundtrip() throws Exception {
231
248
        testRoundTrip(SevenZMethod.COPY);
232
249
    }
233
250
 
 
251
    @Test
234
252
    public void testBzip2Roundtrip() throws Exception {
235
253
        testRoundTrip(SevenZMethod.BZIP2);
236
254
    }
237
255
 
 
256
    @Test
238
257
    public void testLzma2Roundtrip() throws Exception {
239
258
        testRoundTrip(SevenZMethod.LZMA2);
240
259
    }
241
260
 
 
261
    @Test
242
262
    public void testDeflateRoundtrip() throws Exception {
243
263
        testRoundTrip(SevenZMethod.DEFLATE);
244
264
    }
245
265
 
 
266
    @Test
246
267
    public void testBCJX86Roundtrip() throws Exception {
247
268
        if (XZ_BCJ_IS_BUGGY) { return; }
248
269
        testFilterRoundTrip(new SevenZMethodConfiguration(SevenZMethod.BCJ_X86_FILTER));
249
270
    }
250
271
 
 
272
    @Test
251
273
    public void testBCJARMRoundtrip() throws Exception {
252
274
        if (XZ_BCJ_IS_BUGGY) { return; }
253
275
        testFilterRoundTrip(new SevenZMethodConfiguration(SevenZMethod.BCJ_ARM_FILTER));
254
276
    }
255
277
 
 
278
    @Test
256
279
    public void testBCJARMThumbRoundtrip() throws Exception {
257
280
        if (XZ_BCJ_IS_BUGGY) { return; }
258
281
        testFilterRoundTrip(new SevenZMethodConfiguration(SevenZMethod.BCJ_ARM_THUMB_FILTER));
259
282
    }
260
283
 
 
284
    @Test
261
285
    public void testBCJIA64Roundtrip() throws Exception {
262
286
        if (XZ_BCJ_IS_BUGGY) { return; }
263
287
        testFilterRoundTrip(new SevenZMethodConfiguration(SevenZMethod.BCJ_IA64_FILTER));
264
288
    }
265
289
 
 
290
    @Test
266
291
    public void testBCJPPCRoundtrip() throws Exception {
267
292
        if (XZ_BCJ_IS_BUGGY) { return; }
268
293
        testFilterRoundTrip(new SevenZMethodConfiguration(SevenZMethod.BCJ_PPC_FILTER));
269
294
    }
270
295
 
 
296
    @Test
271
297
    public void testBCJSparcRoundtrip() throws Exception {
272
298
        if (XZ_BCJ_IS_BUGGY) { return; }
273
299
        testFilterRoundTrip(new SevenZMethodConfiguration(SevenZMethod.BCJ_SPARC_FILTER));
274
300
    }
275
301
 
 
302
    @Test
276
303
    public void testDeltaRoundtrip() throws Exception {
277
304
        testFilterRoundTrip(new SevenZMethodConfiguration(SevenZMethod.DELTA_FILTER));
278
305
    }
279
306
 
 
307
    @Test
280
308
    public void testStackOfContentCompressions() throws Exception {
281
309
        output = new File(dir, "multiple-methods.7z");
282
310
        ArrayList<SevenZMethodConfiguration> methods = new ArrayList<SevenZMethodConfiguration>();
287
315
        createAndReadBack(output, methods);
288
316
    }
289
317
 
 
318
    @Test
290
319
    public void testDeflateWithConfiguration() throws Exception {
291
320
        output = new File(dir, "deflate-options.7z");
292
321
        // Deflater.BEST_SPEED
294
323
                          .singletonList(new SevenZMethodConfiguration(SevenZMethod.DEFLATE, 1)));
295
324
    }
296
325
 
 
326
    @Test
297
327
    public void testBzip2WithConfiguration() throws Exception {
298
328
        output = new File(dir, "bzip2-options.7z");
299
329
        // 400k block size
301
331
                          .singletonList(new SevenZMethodConfiguration(SevenZMethod.BZIP2, 4)));
302
332
    }
303
333
 
 
334
    @Test
304
335
    public void testLzma2WithIntConfiguration() throws Exception {
305
336
        output = new File(dir, "lzma2-options.7z");
306
337
        // 1 MB dictionary
308
339
                          .singletonList(new SevenZMethodConfiguration(SevenZMethod.LZMA2, 1 << 20)));
309
340
    }
310
341
 
 
342
    @Test
311
343
    public void testLzma2WithOptionsConfiguration() throws Exception {
312
344
        output = new File(dir, "lzma2-options2.7z");
313
345
        LZMA2Options opts = new LZMA2Options(1);
315
347
                          .singletonList(new SevenZMethodConfiguration(SevenZMethod.LZMA2, opts)));
316
348
    }
317
349
 
 
350
    @Test
318
351
    public void testArchiveWithMixedMethods() throws Exception {
319
352
        output = new File(dir, "mixed-methods.7z");
320
353
        SevenZOutputFile outArchive = new SevenZOutputFile(output);