/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2007-2008, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * */ package org.geotools.coverageio.jp2k; import java.util.Iterator; import org.geotools.coverage.grid.io.GridFormatFactorySpi; import org.geotools.coverage.grid.io.GridFormatFinder; import org.geotools.coverageio.jp2k.JP2KFormatFactory; import org.junit.Test; import org.opengis.referencing.FactoryException; import org.opengis.referencing.NoSuchAuthorityCodeException; /** * Class for testing availability of JP2K format factory * * @author Daniele Romagnoli, GeoSolutions * @author Simone Giannecchini (simboss), GeoSolutions * * * * @source $URL: http://svn.osgeo.org/geotools/trunk/modules/plugin/jp2k/src/test/java/org/geotools/coverageio/jp2k/ServiceTest.java $ */ public class ServiceTest extends BaseJP2K { public ServiceTest() { } @Test public void testIsAvailable() throws NoSuchAuthorityCodeException, FactoryException { if (!testingEnabled()) { return; } GridFormatFinder.scanForPlugins(); final Iterator<GridFormatFactorySpi> list = GridFormatFinder.getAvailableFormats().iterator(); boolean found = false; GridFormatFactorySpi fac = null; while (list.hasNext()) { fac = (GridFormatFactorySpi) list.next(); if (fac instanceof JP2KFormatFactory) { found = true; break; } } assertTrue("JP2KFormatFactory not registered", found); assertTrue("JP2KFormatFactory not available", fac.isAvailable()); assertNotNull(new JP2KFormatFactory().createFormat()); } }