From: <jde...@sv...> - 2007-01-21 06:33:30
|
Author: jdeolive Date: 2007-01-20 23:32:52 -0800 (Sat, 20 Jan 2007) New Revision: 23992 Added: geotools/trunk/gt/modules/unsupported/xml-filter/src/test/java/org/geo= tools/filter/v1_1/FilterTypeBindingTest.java Log: added Added: geotools/trunk/gt/modules/unsupported/xml-filter/src/test/java/org= /geotools/filter/v1_1/FilterTypeBindingTest.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- geotools/trunk/gt/modules/unsupported/xml-filter/src/test/java/org/ge= otools/filter/v1_1/FilterTypeBindingTest.java 2007-01-21 07:29:51 UTC (re= v 23991) +++ geotools/trunk/gt/modules/unsupported/xml-filter/src/test/java/org/ge= otools/filter/v1_1/FilterTypeBindingTest.java 2007-01-21 07:32:52 UTC (re= v 23992) @@ -0,0 +1,80 @@ +/* + * GeoTools - OpenSource mapping toolkit + * http://geotools.org + * (C) 2002-2006, GeoTools Project Managment Committee (PMC) + * + * 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.filter.v1_1; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.opengis.filter.And; +import org.opengis.filter.Filter; +import org.opengis.filter.PropertyIsEqualTo; +import org.opengis.filter.spatial.Intersects; +import org.geotools.xml.Binding; + + +public class FilterTypeBindingTest extends FilterTestSupport { + public void testType() { + assertEquals(Filter.class, binding(OGC.FilterType).getType()); + } + + public void testExecutionMode() { + assertEquals(Binding.OVERRIDE, binding(OGC.FilterType).getExecut= ionMode()); + } + + public void testParseSpatial() throws Exception { + Element filterElement =3D FilterMockData.element(document, docum= ent, OGC.Filter); + FilterMockData.intersects(document, filterElement); + + Filter filter =3D (Filter) parse(); + assertTrue(filter instanceof Intersects); + } + + public void testEncodeSpatial() throws Exception { + Document doc =3D encode(FilterMockData.intersects(), OGC.Filter)= ; + assertEquals("ogc:Filter", doc.getDocumentElement().getNodeName(= )); + + assertEquals(1, doc.getElementsByTagNameNS(OGC.NAMESPACE, "Inter= sects").getLength()); + } + + public void testParseComparison() throws Exception { + Element filterElement =3D FilterMockData.element(document, docum= ent, OGC.Filter); + FilterMockData.propertyIsEqualTo(document, filterElement); + + Filter filter =3D (Filter) parse(); + assertTrue(filter instanceof PropertyIsEqualTo); + } + + public void testEncodeComparison() throws Exception { + Document doc =3D encode(FilterMockData.propertyIsEqualTo(), OGC.= Filter); + + assertEquals("ogc:Filter", doc.getDocumentElement().getNodeName(= )); + assertEquals(1, doc.getElementsByTagNameNS(OGC.NAMESPACE, "Prope= rtyIsEqualTo").getLength()); + } + + public void testParseLogical() throws Exception { + Element filterElement =3D FilterMockData.element(document, docum= ent, OGC.Filter); + FilterMockData.and(document, filterElement); + + Filter filter =3D (Filter) parse(); + assertTrue(filter instanceof And); + } + + public void testEncodeLogical() throws Exception { + Document doc =3D encode(FilterMockData.and(), OGC.Filter); + + assertEquals("ogc:Filter", doc.getDocumentElement().getNodeName(= )); + assertEquals(1, doc.getElementsByTagNameNS(OGC.NAMESPACE, "And")= .getLength()); + } +} Property changes on: geotools/trunk/gt/modules/unsupported/xml-filter/src= /test/java/org/geotools/filter/v1_1/FilterTypeBindingTest.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:keywords + Id Name: svn:eol-style + native |