1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir package ifc.sdb; 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir import com.sun.star.sdb.XSingleSelectQueryComposer; 31*cdf0e10cSrcweir import lib.MultiMethodTest; 32*cdf0e10cSrcweir import com.sun.star.sdb.XSingleSelectQueryAnalyzer; 33*cdf0e10cSrcweir import com.sun.star.uno.AnyConverter; 34*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 35*cdf0e10cSrcweir import lib.StatusException; 36*cdf0e10cSrcweir import lib.Status; 37*cdf0e10cSrcweir import com.sun.star.beans.PropertyValue; 38*cdf0e10cSrcweir import com.sun.star.beans.XPropertySet; 39*cdf0e10cSrcweir import com.sun.star.sdb.SQLFilterOperator; 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir /** 42*cdf0e10cSrcweir * Testing <code>com.sun.star.sdb.XSingleSelectQueryComposer</code> 43*cdf0e10cSrcweir * interface methods : 44*cdf0e10cSrcweir * <ul> 45*cdf0e10cSrcweir * <li><code>setFilter()</code></li> 46*cdf0e10cSrcweir * <li><code>setStructuredFilter()</code></li> 47*cdf0e10cSrcweir * <li><code>appendFilterByColumn()</code></li> 48*cdf0e10cSrcweir * <li><code>appendGroupByColumn()</code></li> 49*cdf0e10cSrcweir * <li><code>setGroup()</code></li> 50*cdf0e10cSrcweir * <li><code>setHavingClause()</code></li> 51*cdf0e10cSrcweir * <li><code>setStructuredHavingClause()</code></li> 52*cdf0e10cSrcweir * <li><code>appendHavingClauseByColumn()</code></li> 53*cdf0e10cSrcweir * <li><code>appendOrderByColumn()</code></li> 54*cdf0e10cSrcweir * <li><code>setOrder()</code></li> 55*cdf0e10cSrcweir 56*cdf0e10cSrcweir * </ul> <p> 57*cdf0e10cSrcweir * @see com.sun.star.sdb.XSingleSelectQueryComposer 58*cdf0e10cSrcweir */ 59*cdf0e10cSrcweir public class _XSingleSelectQueryComposer extends MultiMethodTest { 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir // oObj filled by MultiMethodTest 62*cdf0e10cSrcweir public XSingleSelectQueryComposer oObj = null ; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir private String queryString = "SELECT * FROM \"biblio\""; 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir private XSingleSelectQueryAnalyzer xQueryAna = null; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir private XPropertySet xProp = null; 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir private String colName = null; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir /** 73*cdf0e10cSrcweir * Retcieves the object relations: 74*cdf0e10cSrcweir * <ul> 75*cdf0e10cSrcweir * <li><code>XSingleSelectQueryAnalyzer xQueryAna</code></li> 76*cdf0e10cSrcweir * <li><code>XPropertySet xProp</code></li> 77*cdf0e10cSrcweir * <li><code>String colName</code></li> 78*cdf0e10cSrcweir * </ul> <p> 79*cdf0e10cSrcweir * @see om.sun.star.sdb.XSingleSelectQueryAnalyzer 80*cdf0e10cSrcweir * @see com.sun.star.beans.XPropertySet 81*cdf0e10cSrcweir */ 82*cdf0e10cSrcweir protected void before() /* throws Exception*/ { 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir xQueryAna = (XSingleSelectQueryAnalyzer) 85*cdf0e10cSrcweir UnoRuntime.queryInterface(XSingleSelectQueryAnalyzer.class, 86*cdf0e10cSrcweir tEnv.getObjRelation("xQueryAna")); 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir if (xQueryAna == null) { 89*cdf0e10cSrcweir throw new StatusException(Status.failed( 90*cdf0e10cSrcweir "Couldn't get object relation 'xQueryAna'. Test must be modified")); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir } 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir xProp = (XPropertySet) 95*cdf0e10cSrcweir UnoRuntime.queryInterface(XPropertySet.class, 96*cdf0e10cSrcweir tEnv.getObjRelation("xProp")); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir if (xProp == null) { 99*cdf0e10cSrcweir throw new StatusException(Status.failed( 100*cdf0e10cSrcweir "Couldn't get object relation 'xProp'. Test must be modified")); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir try 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir colName = AnyConverter.toString(tEnv.getObjRelation("colName")); 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir catch (com.sun.star.lang.IllegalArgumentException e) 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir colName = null; 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir if (colName == null) { 114*cdf0e10cSrcweir throw new StatusException(Status.failed( 115*cdf0e10cSrcweir "Couldn't get object relation 'colName'. Test must be modified")); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir } 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir } 120*cdf0e10cSrcweir 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir /** 123*cdf0e10cSrcweir * Object relation <code>xQueryAna</code> set a filter. This filter 124*cdf0e10cSrcweir * must returned while calling <code>getFilter</code> 125*cdf0e10cSrcweir */ 126*cdf0e10cSrcweir public void _setFilter() { 127*cdf0e10cSrcweir try{ 128*cdf0e10cSrcweir String filter = "\"Identifier\" = 'BOR02b'"; 129*cdf0e10cSrcweir oObj.setFilter(filter); 130*cdf0e10cSrcweir tRes.tested("setFilter()", (xQueryAna.getFilter().equals(filter))); 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 133*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 134*cdf0e10cSrcweir tRes.tested("setFilter()", false); 135*cdf0e10cSrcweir } 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir /** 139*cdf0e10cSrcweir * Object relation <code>xQueryAna</code> set a complex filter with method 140*cdf0e10cSrcweir . <code>setFilter</code>. Then <code>getStructuredFilter</code> returns a 141*cdf0e10cSrcweir * sequenze of <code>PropertyValue</code> which was set with method 142*cdf0e10cSrcweir * <code>setStructuredFilter</code> from <code>xQueryAna</code>. 143*cdf0e10cSrcweir * Then test has ok status if <code>getFilter</code> returns the complex filter. 144*cdf0e10cSrcweir */ 145*cdf0e10cSrcweir public void _setStructuredFilter() { 146*cdf0e10cSrcweir requiredMethod("setFilter()"); 147*cdf0e10cSrcweir try{ 148*cdf0e10cSrcweir xQueryAna.setQuery("SELECT \"Identifier\", \"Type\", \"Address\" FROM \"biblio\" \"biblio\""); 149*cdf0e10cSrcweir String complexFilter = "( \"Identifier\" = '1' AND \"Type\" = '4' ) OR ( \"Identifier\" = '2' AND \"Type\" = '5' ) OR ( \"Identifier\" = '3' AND \"Type\" = '6' AND \"Address\" = '7' ) OR ( \"Address\" = '8' ) OR ( \"Type\" = '9' )"; 150*cdf0e10cSrcweir oObj.setFilter(complexFilter); 151*cdf0e10cSrcweir PropertyValue[][] aStructuredFilter = xQueryAna.getStructuredFilter(); 152*cdf0e10cSrcweir oObj.setFilter(""); 153*cdf0e10cSrcweir oObj.setStructuredFilter(aStructuredFilter); 154*cdf0e10cSrcweir tRes.tested("setStructuredFilter()", (xQueryAna.getFilter().equals(complexFilter))); 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 157*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 158*cdf0e10cSrcweir tRes.tested("setStructuredFilter()", false); 159*cdf0e10cSrcweir } catch (com.sun.star.lang.IllegalArgumentException e){ 160*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 161*cdf0e10cSrcweir tRes.tested("setStructuredFilter()", false); 162*cdf0e10cSrcweir } 163*cdf0e10cSrcweir } 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir /** 166*cdf0e10cSrcweir * At first the object relation <code>xProp</code> was set as parameter. 167*cdf0e10cSrcweir * Relation <code>xQueryAna</code> was used to chek if realtion 168*cdf0e10cSrcweir * <code>colName</code> was found. 169*cdf0e10cSrcweir * Second an empty <code>XPropertySet</code> was used as parameter. A 170*cdf0e10cSrcweir * <code>com.sun.star.sdbc.SQLException</code> must be thrown. 171*cdf0e10cSrcweir */ 172*cdf0e10cSrcweir public void _appendFilterByColumn() { 173*cdf0e10cSrcweir boolean ok = true; 174*cdf0e10cSrcweir try{ 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir oObj.appendFilterByColumn(xProp, true,SQLFilterOperator.EQUAL); 177*cdf0e10cSrcweir log.println("appendFilterByColumn: " + xQueryAna.getFilter()); 178*cdf0e10cSrcweir ok = ok && (xQueryAna.getFilter().indexOf(colName) > 0); 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 181*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 182*cdf0e10cSrcweir tRes.tested("appendFilterByColumn()", false); 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir try{ 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir oObj.appendFilterByColumn(xProp, false,SQLFilterOperator.EQUAL); 188*cdf0e10cSrcweir log.println("appendFilterByColumn: " + xQueryAna.getFilter()); 189*cdf0e10cSrcweir ok = ok && (xQueryAna.getFilter().indexOf(colName) > 0); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 192*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 193*cdf0e10cSrcweir tRes.tested("appendFilterByColumn()", false); 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir try{ 197*cdf0e10cSrcweir XPropertySet dummy = null; 198*cdf0e10cSrcweir oObj.appendFilterByColumn(dummy, true,SQLFilterOperator.EQUAL); 199*cdf0e10cSrcweir log.println("expected Exception was not thrown"); 200*cdf0e10cSrcweir tRes.tested("appendFilterByColumn()", false); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 203*cdf0e10cSrcweir log.println("expected Exception"); 204*cdf0e10cSrcweir ok = ok && true; 205*cdf0e10cSrcweir } 206*cdf0e10cSrcweir tRes.tested("appendFilterByColumn()", ok); 207*cdf0e10cSrcweir } 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir /** 210*cdf0e10cSrcweir * At first the object relation <code>xProp</code> was used as parameter. 211*cdf0e10cSrcweir * Relation <code>xQueryAna</code> was used to chek if realtion 212*cdf0e10cSrcweir * <code>colName</code> was found. 213*cdf0e10cSrcweir * Second an empty <code>XPropertySet</code> was used as parameter. An 214*cdf0e10cSrcweir * <code>com.sun.star.sdbc.SQLException</code> must be thrown. 215*cdf0e10cSrcweir */ 216*cdf0e10cSrcweir public void _appendGroupByColumn() { 217*cdf0e10cSrcweir boolean ok = true; 218*cdf0e10cSrcweir try{ 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir oObj.appendGroupByColumn(xProp); 221*cdf0e10cSrcweir log.println("appendGroupByColumn: " + xQueryAna.getFilter()); 222*cdf0e10cSrcweir ok = ok && (xQueryAna.getFilter().indexOf(colName) > 0); 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 225*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 226*cdf0e10cSrcweir tRes.tested("appendGroupByColumn()", false); 227*cdf0e10cSrcweir } 228*cdf0e10cSrcweir try{ 229*cdf0e10cSrcweir XPropertySet dummy = null; 230*cdf0e10cSrcweir oObj.appendGroupByColumn(dummy); 231*cdf0e10cSrcweir log.println("expected Exception was not thrown"); 232*cdf0e10cSrcweir tRes.tested("appendGroupByColumn()", false); 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 235*cdf0e10cSrcweir log.println("expected Exception"); 236*cdf0e10cSrcweir ok = ok && true; 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir tRes.tested("appendGroupByColumn()", ok); 239*cdf0e10cSrcweir } 240*cdf0e10cSrcweir 241*cdf0e10cSrcweir /** 242*cdf0e10cSrcweir * The group which was setted by <code>setGroup</code> must be returned 243*cdf0e10cSrcweir * while calling from object relation <code>XQueryAna</code> 244*cdf0e10cSrcweir * method <code>getGroup</code> 245*cdf0e10cSrcweir */ 246*cdf0e10cSrcweir public void _setGroup() { 247*cdf0e10cSrcweir try{ 248*cdf0e10cSrcweir String group = "\"Identifier\""; 249*cdf0e10cSrcweir oObj.setGroup(group); 250*cdf0e10cSrcweir tRes.tested("setGroup()", (xQueryAna.getGroup().equals(group))); 251*cdf0e10cSrcweir 252*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 253*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 254*cdf0e10cSrcweir tRes.tested("setGroup()", false); 255*cdf0e10cSrcweir } 256*cdf0e10cSrcweir } 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir /** 260*cdf0e10cSrcweir * The cluase which was setted by <code>setHavingClause</code> must be returned 261*cdf0e10cSrcweir * while calling from object relation <code>XQueryAna</code> 262*cdf0e10cSrcweir * method <code>getHavingClause</code> 263*cdf0e10cSrcweir */ 264*cdf0e10cSrcweir public void _setHavingClause() { 265*cdf0e10cSrcweir try{ 266*cdf0e10cSrcweir String clause = "\"Identifier\" = 'BOR02b'"; 267*cdf0e10cSrcweir oObj.setHavingClause(clause); 268*cdf0e10cSrcweir tRes.tested("setHavingClause()", ( 269*cdf0e10cSrcweir xQueryAna.getHavingClause().equals(clause))); 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 272*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 273*cdf0e10cSrcweir tRes.tested("setHavingClause()", false); 274*cdf0e10cSrcweir } 275*cdf0e10cSrcweir } 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir /** 278*cdf0e10cSrcweir * At first <code>setHavingClause</code> sets a complex clause. 279*cdf0e10cSrcweir * Then method <code>getStructuredHavingClause</code> from object relation 280*cdf0e10cSrcweir * <code>xQueryAna</code> returns a valid <code>PropertyValue[][]</code> 281*cdf0e10cSrcweir * Method <code>setHavingClause</code> was called with an empty sting to 282*cdf0e10cSrcweir * reset filter. Now <code>setStructuredHavingClause</code> with the valid 283*cdf0e10cSrcweir * <code>PropertyValue[][]</code> as parameter was called. 284*cdf0e10cSrcweir * Test is ok if <code>getHavingClause</code> from <code>xQueryAna</code> 285*cdf0e10cSrcweir * returns the complex clause from beginning. 286*cdf0e10cSrcweir * <p> 287*cdf0e10cSrcweir * required methods: 288*cdf0e10cSrcweir *<ul> 289*cdf0e10cSrcweir * <li><code>setHavingClause</code></li> 290*cdf0e10cSrcweir * <li><code>setStructuredFilter</code></li> 291*cdf0e10cSrcweir *</ul> 292*cdf0e10cSrcweir */ 293*cdf0e10cSrcweir public void _setStructuredHavingClause() { 294*cdf0e10cSrcweir requiredMethod("setHavingClause()"); 295*cdf0e10cSrcweir executeMethod("setStructuredFilter()"); 296*cdf0e10cSrcweir String complexFilter = "( \"Identifier\" = '1' AND \"Type\" = '4' ) OR ( \"Identifier\" = '2' AND \"Type\" = '5' ) OR ( \"Identifier\" = '3' AND \"Type\" = '6' AND \"Address\" = '7' ) OR ( \"Address\" = '8' ) OR ( \"Type\" = '9' )"; 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir try{ 299*cdf0e10cSrcweir oObj.setHavingClause(complexFilter); 300*cdf0e10cSrcweir PropertyValue[][] aStructuredHaving = 301*cdf0e10cSrcweir xQueryAna.getStructuredHavingClause(); 302*cdf0e10cSrcweir oObj.setHavingClause(""); 303*cdf0e10cSrcweir oObj.setStructuredHavingClause(aStructuredHaving); 304*cdf0e10cSrcweir tRes.tested("setStructuredHavingClause()", 305*cdf0e10cSrcweir (xQueryAna.getHavingClause().equals(complexFilter))); 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 308*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 309*cdf0e10cSrcweir tRes.tested("setStructuredHavingClause()", false); 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir } 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir /** 314*cdf0e10cSrcweir * First object relation <code>xProp</code> was used as parameter. Relation 315*cdf0e10cSrcweir * <code>xQueryAna</code> was used to chek if realtion <code>colName</code> 316*cdf0e10cSrcweir * was found. 317*cdf0e10cSrcweir * Second an empty <code>XPropertySet</code> was given as parameter. An 318*cdf0e10cSrcweir * <code>com.sun.star.sdbc.SQLException</code> must be thrown. 319*cdf0e10cSrcweir */ 320*cdf0e10cSrcweir public void _appendHavingClauseByColumn() { 321*cdf0e10cSrcweir boolean ok = true; 322*cdf0e10cSrcweir try{ 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir oObj.appendHavingClauseByColumn(xProp, true,SQLFilterOperator.EQUAL); 325*cdf0e10cSrcweir log.println("appendHavingClauseByColumn: " + xQueryAna.getFilter()); 326*cdf0e10cSrcweir ok = ok && (xQueryAna.getFilter().indexOf(colName) > 0); 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 329*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 330*cdf0e10cSrcweir tRes.tested("appendHavingClauseByColumn()", false); 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir try{ 333*cdf0e10cSrcweir XPropertySet dummy = null; 334*cdf0e10cSrcweir oObj.appendHavingClauseByColumn(dummy, true,SQLFilterOperator.EQUAL); 335*cdf0e10cSrcweir log.println("expected Exception was not thrown"); 336*cdf0e10cSrcweir tRes.tested("appendHavingClauseByColumn()", false); 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 339*cdf0e10cSrcweir log.println("expected Exception"); 340*cdf0e10cSrcweir ok = ok && true; 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir tRes.tested("appendHavingClauseByColumn()", ok); 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir /** 346*cdf0e10cSrcweir * First object relation <code>xProp</code> was set as parameter. Relation 347*cdf0e10cSrcweir * <code>xQueryAna</code> was used to chek if realtion <code>colName</code> 348*cdf0e10cSrcweir * was found. 349*cdf0e10cSrcweir * Second an empty <code>XPropertySet</code> was given as parameter. An 350*cdf0e10cSrcweir * <code>com.sun.star.sdbc.SQLException</code> must be thrown. 351*cdf0e10cSrcweir */ 352*cdf0e10cSrcweir public void _appendOrderByColumn() { 353*cdf0e10cSrcweir boolean ok = true; 354*cdf0e10cSrcweir try{ 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir oObj.appendOrderByColumn(xProp, true); 357*cdf0e10cSrcweir log.println("appendOrderByColumn: " + xQueryAna.getFilter()); 358*cdf0e10cSrcweir ok = ok && (xQueryAna.getFilter().indexOf(colName) > 0); 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 361*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 362*cdf0e10cSrcweir tRes.tested("appendOrderByColumn()", false); 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir try{ 365*cdf0e10cSrcweir XPropertySet dummy = null; 366*cdf0e10cSrcweir oObj.appendOrderByColumn(dummy, true); 367*cdf0e10cSrcweir log.println("expected Exception was not thrown"); 368*cdf0e10cSrcweir tRes.tested("appendOrderByColumn()", false); 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 371*cdf0e10cSrcweir log.println("expected Exception"); 372*cdf0e10cSrcweir ok = ok && true; 373*cdf0e10cSrcweir } 374*cdf0e10cSrcweir tRes.tested("appendOrderByColumn()", ok); 375*cdf0e10cSrcweir } 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir /** 379*cdf0e10cSrcweir * Method <code>getOrder</code> from object relation <code>xQueryAna</code> 380*cdf0e10cSrcweir * checks the order which was setted while calling <code>setOrder</code> 381*cdf0e10cSrcweir */ 382*cdf0e10cSrcweir public void _setOrder() { 383*cdf0e10cSrcweir try{ 384*cdf0e10cSrcweir String order = "\"Identifier\""; 385*cdf0e10cSrcweir oObj.setOrder(order); 386*cdf0e10cSrcweir tRes.tested("setOrder()", (xQueryAna.getOrder().equals(order))); 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir } catch (com.sun.star.sdbc.SQLException e){ 389*cdf0e10cSrcweir log.println("unexpected Exception: " + e.toString()); 390*cdf0e10cSrcweir tRes.tested("setOrder()", false); 391*cdf0e10cSrcweir } 392*cdf0e10cSrcweir } 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir } // finish class _XSingleSelectQueryComposer 397