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.arcgrid;
18:
19: import java.util.Iterator;
20:
21: import junit.framework.TestCase;
22:
23: import org.geotools.coverage.grid.io.GridFormatFactorySpi;
24: import org.geotools.coverage.grid.io.GridFormatFinder;
25: import org.opengis.referencing.FactoryException;
26: import org.opengis.referencing.NoSuchAuthorityCodeException;
27:
28: /**
29: * Class for testing availaibility of arcgrid format factory
30: *
31: * @author Simone Giannecchini
32: * @author ian
33: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/arcgrid/src/test/java/org/geotools/gce/arcgrid/ServiceTest.java $
34: */
35: public class ServiceTest extends TestCase {
36:
37: public ServiceTest(java.lang.String testName) {
38: super (testName);
39: }
40:
41: public static void main(java.lang.String[] args) {
42: junit.textui.TestRunner.run(ServiceTest.class);
43: }
44:
45: public void testIsAvailable() throws NoSuchAuthorityCodeException,
46: FactoryException {
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 ArcGridFormatFactory) {
56: found = true;
57:
58: break;
59: }
60: }
61:
62: assertTrue("ArcGridFormatFactory not registered", found);
63: assertTrue("ArcGridFormatFactory not available", fac
64: .isAvailable());
65: assertNotNull(new ArcGridFormatFactory().createFormat());
66: }
67: }
|