KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > schlichtherle > util > zip > RandomDataRaesZipTest


1 /*
2  * RandomDataRaesZipTest.java
3  *
4  * Created on 14. Oktober 2005, 16:49
5  */

6 /*
7  * Copyright 2005 Schlichtherle IT Services
8  *
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  */

21
22 package de.schlichtherle.util.zip;
23
24 import java.security.SecureRandom JavaDoc;
25 import java.util.Random JavaDoc;
26 import java.util.logging.Logger JavaDoc;
27
28 import junit.framework.*;
29
30 /**
31  * Tests compression of a data with 1MB of random data.
32  *
33  * @author Christian Schlichtherle
34  */

35 public class RandomDataRaesZipTest extends RaesZipTestBase {
36
37     private static final Logger JavaDoc logger
38             = Logger.getLogger(RandomDataRaesZipTest.class.getName());
39
40     private static final byte[] data = new byte[1024 * 1024];
41     static {
42         boolean ea = false;
43         assert ea = true; // NOT ea == true !
44
logger.config("Java assertions enabled: " + ea);
45
46         rnd.nextBytes(data);
47         logger.config("Created " + data.length + " bytes of random data.");
48     }
49
50     public static Test suite() throws Exception JavaDoc {
51         TestSuite suite = new TestSuite(RandomDataRaesZipTest.class);
52         
53         return suite;
54     }
55     
56     /**
57      * Creates a new instance of RandomDataZipTest
58      */

59     public RandomDataRaesZipTest(String JavaDoc testName) {
60         super(testName);
61     }
62
63     protected void setUp() throws Exception JavaDoc {
64         super.data = RandomDataRaesZipTest.data;
65         
66         super.setUp();
67     }
68 }
69
Popular Tags