01: /*
02: * Geotools2 - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package org.geotools.gce.mrsid;
18:
19: import java.util.logging.Logger;
20:
21: import javax.imageio.ImageIO;
22: import javax.media.jai.JAI;
23:
24: import junit.framework.TestCase;
25:
26: /**
27: * @author Daniele Romagnoli, GeoSolutions
28: * @author Simone Giannecchini (simboss), GeoSolutions
29: *
30: * Base testing class initializing JAI properties to be used during tests.
31: */
32: public abstract class AbstractMrSIDTestCase extends TestCase {
33:
34: protected final static Logger LOGGER = org.geotools.util.logging.Logging
35: .getLogger("org.geotools.gce.mrsid");
36:
37: public AbstractMrSIDTestCase(String name) {
38: super (name);
39: }
40:
41: protected void setUp() throws Exception {
42: super .setUp();
43:
44: ImageIO.setUseCache(false);
45: JAI.getDefaultInstance().getTileCache().setMemoryCapacity(
46: 10 * 1024 * 1024);
47: JAI.getDefaultInstance().getTileCache()
48: .setMemoryThreshold(1.0f);
49:
50: JAI.getDefaultInstance().getTileScheduler().setParallelism(50);
51: JAI.getDefaultInstance().getTileScheduler()
52: .setPrefetchParallelism(50);
53: JAI.getDefaultInstance().getTileScheduler()
54: .setPrefetchPriority(5);
55: JAI.getDefaultInstance().getTileScheduler().setPriority(5);
56: }
57:
58: protected boolean testingEnabled() {
59: boolean available = new MrSIDFormatFactory().isAvailable();
60: if (!available)
61: LOGGER
62: .warning("MrSid libraries are not available, skipping tests!");
63: return available;
64: }
65:
66: }
|