01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, 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: package org.geotools.filter.v1_0;
17:
18: import org.w3c.dom.Document;
19: import org.opengis.filter.And;
20: import org.opengis.filter.BinaryLogicOperator;
21: import org.opengis.filter.Or;
22: import org.geotools.xml.Binding;
23:
24: public class BinaryLogicOpTypeBindingTest extends FilterTestSupport {
25: public void testBinaryLogicOpType() {
26: assertEquals(BinaryLogicOperator.class, binding(
27: OGC.BinaryLogicOpType).getType());
28: }
29:
30: public void testAndType() {
31: assertEquals(And.class, binding(OGC.And).getType());
32: }
33:
34: public void testAndExecutionMode() {
35: assertEquals(Binding.AFTER, binding(OGC.And).getExecutionMode());
36: }
37:
38: public void testAndParse() throws Exception {
39: FilterMockData.and(document, document);
40:
41: And and = (And) parse();
42:
43: assertEquals(2, and.getChildren().size());
44: }
45:
46: public void testAndEncode() throws Exception {
47: Document dom = encode(FilterMockData.and(), OGC.And);
48: assertEquals(1, dom.getElementsByTagNameNS(OGC.NAMESPACE,
49: OGC.PropertyIsEqualTo.getLocalPart()).getLength());
50: assertEquals(1, dom.getElementsByTagNameNS(OGC.NAMESPACE,
51: OGC.PropertyIsNotEqualTo.getLocalPart()).getLength());
52: }
53:
54: public void testOrType() {
55: assertEquals(Or.class, binding(OGC.Or).getType());
56: }
57:
58: public void testOrExecutionMode() {
59: assertEquals(Binding.AFTER, binding(OGC.Or).getExecutionMode());
60: }
61:
62: public void testOrParse() throws Exception {
63: FilterMockData.or(document, document);
64:
65: Or or = (Or) parse();
66:
67: assertEquals(2, or.getChildren().size());
68: }
69:
70: public void testOrEncode() throws Exception {
71: Document dom = encode(FilterMockData.or(), OGC.Or);
72: assertEquals(1, dom.getElementsByTagNameNS(OGC.NAMESPACE,
73: OGC.PropertyIsEqualTo.getLocalPart()).getLength());
74: assertEquals(1, dom.getElementsByTagNameNS(OGC.NAMESPACE,
75: OGC.PropertyIsNotEqualTo.getLocalPart()).getLength());
76: }
77: }
|