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.ecw;
18:
19: import java.util.Iterator;
20:
21: import org.geotools.coverage.grid.io.GridFormatFactorySpi;
22: import org.geotools.coverage.grid.io.GridFormatFinder;
23: import org.opengis.referencing.FactoryException;
24: import org.opengis.referencing.NoSuchAuthorityCodeException;
25:
26: /**
27: * Class for testing availaibility of ECW format factory
28: *
29: * @author Daniele Romagnoli, GeoSolutions
30: * @author Simone Giannecchini (simboss), GeoSolutions
31: */
32: public class ServiceTest extends AbstractECWTestCase {
33:
34: public ServiceTest(java.lang.String testName) {
35: super (testName);
36: }
37:
38: public static void main(java.lang.String[] args) {
39: junit.textui.TestRunner.run(ServiceTest.class);
40: }
41:
42: public void testIsAvailable() throws NoSuchAuthorityCodeException,
43: FactoryException {
44: if (!testingEnabled())
45: return;
46:
47: GridFormatFinder.scanForPlugins();
48: Iterator list = GridFormatFinder.getAvailableFormats()
49: .iterator();
50: boolean found = false;
51: GridFormatFactorySpi fac = null;
52: while (list.hasNext()) {
53: fac = (GridFormatFactorySpi) list.next();
54:
55: if (fac instanceof ECWFormatFactory) {
56: found = true;
57: break;
58: }
59: }
60: assertTrue("ECWFormatFactory not registered", found);
61: assertTrue("ECWFormatFactory not available", fac.isAvailable());
62: assertNotNull(new ECWFormatFactory().createFormat());
63: }
64: }
|