Revision 12328

View differences:

branches/v10/extensions/extWFS2/src-test/com/iver/cit/gvsig/wfs/filters/FilterEncodingTest.java
49 49
 *
50 50
 * $Id$
51 51
 * $Log$
52
 * Revision 1.1.2.2  2006-11-17 11:28:45  ppiqueras
52
 * Revision 1.1.2.3  2007-06-26 07:50:20  jorpiell
53
 * Test updated
54
 *
55
 * Revision 1.1.2.2  2006/11/17 11:28:45  ppiqueras
53 56
 * Corregidos bugs y aƱadida nueva funcionalidad.
54 57
 *
55 58
 * Revision 1.1  2006/10/05 10:26:26  jorpiell
......
62 65
 */
63 66
public class FilterEncodingTest extends TestCase {
64 67
	String query1 = "nombre='pepe' and apellidos='sanchez' or edad < 3"; 
65
	public void test1(){
66
		System.out.println(parseQuery(query1));
68
	String filter1 = "<Filter><Or><And><PropertyIsEqualTo><PropertyName>nombre</PropertyName><Literal>pepe</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>apellidos</PropertyName><Literal>sanchez</Literal></PropertyIsEqualTo></And><PropertyIsLessThan><PropertyName>edad</PropertyName><Literal>3</Literal></PropertyIsLessThan></Or></Filter>";
69
	String query2 = "nombre='pepe' or apellidos='sanchez' and edad < 3"; 
70
	String filter2 = "<Filter><Or><PropertyIsEqualTo><PropertyName>nombre</PropertyName><Literal>pepe</Literal></PropertyIsEqualTo><And><PropertyIsEqualTo><PropertyName>apellidos</PropertyName><Literal>sanchez</Literal></PropertyIsEqualTo><PropertyIsLessThan><PropertyName>edad</PropertyName><Literal>3</Literal></PropertyIsLessThan></And></Or></Filter>";
71
	String query3 = "nombre='pepe' or apellidos='sanchez' or edad < 3"; 
72
	String filter3 = "<Filter><Or><PropertyIsEqualTo><PropertyName>nombre</PropertyName><Literal>pepe</Literal></PropertyIsEqualTo><Or><PropertyIsEqualTo><PropertyName>apellidos</PropertyName><Literal>sanchez</Literal></PropertyIsEqualTo><PropertyIsLessThan><PropertyName>edad</PropertyName><Literal>3</Literal></PropertyIsLessThan></Or></Or></Filter>";
73
	
74
//	public void test1(){
75
//		parseQuery(query1,filter1);
76
//	}
77
//	
78
//	public void test2(){
79
//		parseQuery(query2,filter2);
80
//	}
81
	
82
	public void test3(){
83
		parseQuery(query3,filter3);
67 84
	}
68 85
	
69
	private String parseQuery(String query){
86
	private void parseQuery(String query, String filter){
70 87
		FilterEncoding fe = new FilterEncoding(new SQLExpressionFormat());
71 88
		fe.setQuery(query);
72
		return fe.toString();
89
		System.out.println(fe.toString());
90
		assertEquals(fe.toString(), filter);
73 91
	}
74 92
}

Also available in: Unified diff