diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /qadevOOo/tests/java/ifc/sdb | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'qadevOOo/tests/java/ifc/sdb')
19 files changed, 2140 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/ifc/sdb/_DataAccessDescriptor.java b/qadevOOo/tests/java/ifc/sdb/_DataAccessDescriptor.java new file mode 100644 index 000000000..fda6ad192 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_DataAccessDescriptor.java @@ -0,0 +1,116 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import com.sun.star.sdbc.XConnection; +import com.sun.star.sdbc.XResultSet; +import com.sun.star.uno.UnoRuntime; +import lib.MultiPropertyTest; + +public class _DataAccessDescriptor extends MultiPropertyTest { + + /** + * Tested with custom property tester. + */ + public void _ResultSet() { + String propName = "ResultSet"; + try{ + + log.println("try to get value from property..."); + UnoRuntime.queryInterface(XResultSet.class,oObj.getPropertyValue(propName)); + + log.println("try to get value from object relation..."); + XResultSet newValue = UnoRuntime.queryInterface(XResultSet.class,tEnv.getObjRelation("DataAccessDescriptor.XResultSet")); + + log.println("set property to a new value..."); + oObj.setPropertyValue(propName, newValue); + + log.println("get the new value..."); + XResultSet getValue = UnoRuntime.queryInterface(XResultSet.class,oObj.getPropertyValue(propName)); + + tRes.tested(propName, this.compare(newValue, getValue)); + } catch (com.sun.star.beans.PropertyVetoException e){ + log.println("could not set property '"+ propName +"' to a new value!"); + tRes.tested(propName, false); + } catch (com.sun.star.lang.IllegalArgumentException e){ + log.println("could not set property '"+ propName +"' to a new value!"); + tRes.tested(propName, false); + } catch (com.sun.star.beans.UnknownPropertyException e){ + if (this.isOptional(propName)){ + // skipping optional property test + log.println("Property '" + propName + + "' is optional and not supported"); + tRes.tested(propName,true); + + } else { + log.println("could not get property '"+ propName +"' from XPropertySet!"); + tRes.tested(propName, false); + } + } catch (com.sun.star.lang.WrappedTargetException e){ + log.println("could not get property '"+ propName +"' from XPropertySet!"); + tRes.tested(propName, false); + } + } + + /** + * Tested with custom property tester. + */ + public void _ActiveConnection() { + String propName = "ActiveConnection"; + try{ + + log.println("try to get value from property..."); + UnoRuntime.queryInterface(XConnection.class,oObj.getPropertyValue(propName)); + + log.println("try to get value from object relation..."); + XConnection newValue = UnoRuntime.queryInterface(XConnection.class,tEnv.getObjRelation("DataAccessDescriptor.XConnection")); + + log.println("set property to a new value..."); + oObj.setPropertyValue(propName, newValue); + + log.println("get the new value..."); + XConnection getValue = UnoRuntime.queryInterface(XConnection.class,oObj.getPropertyValue(propName)); + + tRes.tested(propName, this.compare(newValue, getValue)); + } catch (com.sun.star.beans.PropertyVetoException e){ + log.println("could not set property '"+ propName +"' to a new value! " + e.toString()); + tRes.tested(propName, false); + } catch (com.sun.star.lang.IllegalArgumentException e){ + log.println("could not set property '"+ propName +"' to a new value! " + e.toString()); + tRes.tested(propName, false); + } catch (com.sun.star.beans.UnknownPropertyException e){ + if (this.isOptional(propName)){ + // skipping optional property test + log.println("Property '" + propName + + "' is optional and not supported"); + tRes.tested(propName,true); + + } else { + log.println("could not get property '"+ propName +"' from XPropertySet!"); + tRes.tested(propName, false); + } + } catch (com.sun.star.lang.WrappedTargetException e){ + log.println("could not get property '"+ propName +"' from XPropertySet!"); + tRes.tested(propName, false); + } + } + +} + + diff --git a/qadevOOo/tests/java/ifc/sdb/_DataSource.java b/qadevOOo/tests/java/ifc/sdb/_DataSource.java new file mode 100644 index 000000000..e693d781a --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_DataSource.java @@ -0,0 +1,165 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiPropertyTest; + +import com.sun.star.beans.PropertyValue; + +/** + * Testing <code>com.sun.star.sdb.DataSource</code> + * service properties : + * <ul> + * <li><code> Name</code></li> + * <li><code> URL</code></li> + * <li><code> Info</code></li> + * <li><code> User</code></li> + * <li><code> Password</code></li> + * <li><code> IsPasswordRequired</code></li> + * <li><code> SuppressVersionColumns</code></li> + * <li><code> IsReadOnly</code></li> + * <li><code> NumberFormatsSupplier</code></li> + * <li><code> TableFilter</code></li> + * <li><code> TableTypeFilter</code></li> + * </ul> <p> + * Properties testing is automated by <code>lib.MultiPropertyTest</code> <p>. +* After this interface test <b>it's better to recreate</b> object tested. +* @see com.sun.star.beans.XPropertySet +* @see com.sun.star.beans.XPropertySetInfo +* @see com.sun.star.beans.Property +* @see com.sun.star.lang.XServiceInfo +*/ +public class _DataSource extends MultiPropertyTest { + + /** + * This property is an array of additional parameters for database + * connecting. Parameter is <code>PropertyValue</code> structure. + * The test just changes existing array onto array with a single + * element <code>("user", "API_QA_Tester")</code> <p> + * + * After testing old value is set for this property. <p> + * + * Result is OK: if property successfully changed with no exceptions. + * @see com.sun.star.beans.PropertyValue + */ + public void _Info() { + try { + Object oldInfo = oObj.getPropertyValue("Info") ; + + testProperty("Info", new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + + PropertyValue propUsr = new PropertyValue(), + propPass = new PropertyValue() ; + + propUsr.Name = "user" ; + propUsr.Value = "API_QA_Tester" ; + propPass.Name = "password" ; + propPass.Value = "guest" ; + + return new PropertyValue[] { propUsr, propPass } ; + } + }) ; + + oObj.setPropertyValue("Info", oldInfo) ; + } catch(com.sun.star.beans.UnknownPropertyException e) {} + catch(com.sun.star.beans.PropertyVetoException e) {} + catch(com.sun.star.lang.IllegalArgumentException e) {} + catch(com.sun.star.lang.WrappedTargetException e) {} + } + + /** + * Property is tested by the common method, but after testing + * old value is set for this property. + */ + public void _URL() { + try { + Object oldURL = oObj.getPropertyValue("URL") ; + + testProperty("URL") ; + + oObj.setPropertyValue("URL", oldURL) ; + } catch(com.sun.star.beans.UnknownPropertyException e) {} + catch(com.sun.star.beans.PropertyVetoException e) {} + catch(com.sun.star.lang.IllegalArgumentException e) {} + catch(com.sun.star.lang.WrappedTargetException e) {} + } + + /** + * Property is tested by the common method, but after testing + * old value is set for this property. + */ + public void _User() { + try { + Object oldUser = oObj.getPropertyValue("User") ; + + testProperty("User") ; + + oObj.setPropertyValue("User", oldUser) ; + } catch(com.sun.star.beans.UnknownPropertyException e) {} + catch(com.sun.star.beans.PropertyVetoException e) {} + catch(com.sun.star.lang.IllegalArgumentException e) {} + catch(com.sun.star.lang.WrappedTargetException e) {} + } + + /** + * Property is tested by the common method, but after testing + * old value is set for this property. + */ + public void _Password() { + try { + Object oldPass = oObj.getPropertyValue("Password") ; + + testProperty("Password") ; + + oObj.setPropertyValue("Password", oldPass) ; + } catch(com.sun.star.beans.UnknownPropertyException e) {} + catch(com.sun.star.beans.PropertyVetoException e) {} + catch(com.sun.star.lang.IllegalArgumentException e) {} + catch(com.sun.star.lang.WrappedTargetException e) {} + } + + /** + * New value for the test is always <code>null</code>. + */ + public void _NumberFormatsSupplier() { + testProperty("NumberFormatsSupplier", new PropertyTester() { + @Override + protected Object getNewValue(String propName, Object oldValue) { + return null ; + } + }) ; + } + + /** + * If object test allows to recreate environment it is better to do it. + */ + @Override + public void after() { + try { + oObj.setPropertyValue("IsPasswordRequired",Boolean.FALSE); + } catch (Exception e) { + log.println("Couldn't set 'IsPasswordRequired' to false"); + } + } + +} // finish class _DataSource + + diff --git a/qadevOOo/tests/java/ifc/sdb/_DatasourceAdministrationDialog.java b/qadevOOo/tests/java/ifc/sdb/_DatasourceAdministrationDialog.java new file mode 100644 index 000000000..747ffe5d0 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_DatasourceAdministrationDialog.java @@ -0,0 +1,36 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiPropertyTest; + +/** + * Testing <code>com.sun.star.sdb.DatasourceAdministrationDialog</code> + * service properties : + * <ul> + * <li><code> Title</code></li> + * <li><code> ParentWindow</code></li> + * </ul> <p> + * Properties testing is automated by <code>lib.MultiPropertyTest</code>. + * @see com.sun.star.sdb.DatasourceAdministrationDialog + */ +public class _DatasourceAdministrationDialog extends MultiPropertyTest { + +} // EOF DatasourceAdministrationDialog + diff --git a/qadevOOo/tests/java/ifc/sdb/_ErrorMessageDialog.java b/qadevOOo/tests/java/ifc/sdb/_ErrorMessageDialog.java new file mode 100644 index 000000000..fcdc4f3f9 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_ErrorMessageDialog.java @@ -0,0 +1,60 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiPropertyTest; + +/** + * Testing <code>com.sun.star.sdb.ErrorMessageDialog</code> + * service properties : + * <ul> + * <li><code> Title</code></li> + * <li><code> ParentWindow</code></li> + * <li><code> SQLException</code></li> + * </ul> <p> + * This test needs the following object relations : + * <ul> + * <li> <code>'ERR1', 'ERR2'</code> + * (of type <code>com.sun.star.sdbc.SQLException</code>): + * two objects which are used for changing 'SQLException' + * property. </li> + * <ul> <p> + * Properties testing is automated by <code>lib.MultiPropertyTest</code>. + * @see com.sun.star.sdb.ErrorMessageDialog + */ +public class _ErrorMessageDialog extends MultiPropertyTest { + + /** + * <code>SQLException</code> instances must be used as property + * value. + */ + public void _SQLException() { + log.println("Testing with custom Property tester") ; + testProperty("SQLException", tEnv.getObjRelation("ERR1"), + tEnv.getObjRelation("ERR2")) ; + } + + public void _ParentWindow(){ + log.println("Testing with custom Property tester"); + testProperty("ParentWindow", tEnv.getObjRelation("ERR_XWindow"), null); + } + +} // finish class _ErrorMessageDialog + + diff --git a/qadevOOo/tests/java/ifc/sdb/_QueryDefinition.java b/qadevOOo/tests/java/ifc/sdb/_QueryDefinition.java new file mode 100644 index 000000000..efd49829b --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_QueryDefinition.java @@ -0,0 +1,46 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiPropertyTest; + +/** + * Testing <code>com.sun.star.sdb.QueryDefinition</code> + * service properties : + * <ul> + * <li><code> Name</code></li> + * <li><code> Command</code></li> + * <li><code> EscapeProcessing</code></li> + * <li><code> UpdateTableName</code></li> + * <li><code> UpdateCatalogName</code></li> + * <li><code> UpdateSchemaName</code></li> + * </ul> <p> + * Properties testing is automated by <code>lib.MultiPropertyTest</code>. + * @see com.sun.star.sdb.QueryDefinition + * @see com.sun.star.beans.XPropertySet + * @see com.sun.star.beans.XPropertySetInfo + * @see com.sun.star.beans.Property + * @see com.sun.star.lang.XServiceInfo + */ +public class _QueryDefinition extends MultiPropertyTest { + + +} // finish class _QueryDefinition + + diff --git a/qadevOOo/tests/java/ifc/sdb/_RowSet.java b/qadevOOo/tests/java/ifc/sdb/_RowSet.java new file mode 100644 index 000000000..9064a1411 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_RowSet.java @@ -0,0 +1,144 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiPropertyTest; +import lib.StatusException; + +import com.sun.star.sdbc.XConnection; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.Type; + +/** + * Testing <code>com.sun.star.sdb.RowSet</code> + * service properties : + * <ul> + * <li><code> ActiveConnection</code></li> + * <li><code> DataSourceName</code></li> + * <li><code> Command</code></li> + * <li><code> CommandType</code></li> + * <li><code> ActiveCommand</code></li> + * <li><code> IgnoreResult</code></li> + * <li><code> Filter</code></li> + * <li><code> ApplyFilter</code></li> + * <li><code> Order</code></li> + * <li><code> Privileges</code></li> + * <li><code> IsModified</code></li> + * <li><code> IsNew</code></li> + * <li><code> RowCount</code></li> + * <li><code> IsRowCountFinal</code></li> + * <li><code> UpdateTableName</code></li> + * <li><code> UpdateCatalogName</code></li> + * <li><code> UpdateSchemaName</code></li> + * </ul> <p> + * + * Properties are tested in a safe way, this means that old + * properties' values are restored to their previous values + * after testing. These values are meaningful for further + * testing. <p> + * + * Properties testing is automated by <code>lib.MultiPropertyTest</code>. + * @see com.sun.star.sdb.RowSet + */ +public class _RowSet extends MultiPropertyTest { + + /** + * The tester implementation which restores properties + * values after testing. + */ + protected class SafeTester extends PropertyTester { + Object oldValue = null ; + + @Override + protected Object getNewValue(String prop, Object old) { + log.println("Testing with SafeTester ...") ; + oldValue = old ; + return super.getNewValue(prop, old) ; + } + + @Override + protected void checkResult(String propName, Object oldValue, + Object newValue, Object resValue, Exception exception) + throws Exception { + + super.checkResult(propName, oldValue, newValue, resValue, exception); + + try { + oObj.setPropertyValue(propName, this.oldValue); + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println("Exception while setting property to its old value '" + + this.oldValue + "' (ignoring) : " + e ); + } catch (com.sun.star.lang.IllegalArgumentException e) { + log.println("Exception while setting property to its old value '" + + this.oldValue + "' (ignoring) : " + e ); + } catch (com.sun.star.beans.PropertyVetoException e) { + log.println("Exception while setting property to its old value '" + + this.oldValue + "' (ignoring) : " + e ); + } catch (com.sun.star.beans.UnknownPropertyException e) { + log.println("Exception while setting property to its old value '" + + this.oldValue + "' (ignoring) : " + e ); + } + + } + } + + /** + * Overridden method which tests all the properties + * with <code>SafeTester</code>. + * + * @see SafeTester + */ + @Override + protected void testProperty(String propName) { + testProperty(propName, new SafeTester()) ; + } + + public void _ActiveConnection() { + boolean result = false; + try { + XConnection the_connection = null; + + try { + the_connection = (XConnection) AnyConverter.toObject( + new Type(XConnection.class), + oObj.getPropertyValue("ActiveConnection")); + } catch (com.sun.star.lang.IllegalArgumentException iae) { + throw new StatusException("couldn't convert Any",iae); + } + + result = (the_connection != null); + } catch (com.sun.star.beans.UnknownPropertyException e) { + log.println("the property is unknown"); + } catch (com.sun.star.lang.WrappedTargetException e) { + log.println(e.getMessage()); + } + + tRes.tested("ActiveConnection", result) ; + } + + /** + * Forces environment recreation. + */ + @Override + protected void after() { + disposeEnvironment(); + } + +} // EOF DatasourceAdministrationDialog + diff --git a/qadevOOo/tests/java/ifc/sdb/_SingleSelectQueryComposer.java b/qadevOOo/tests/java/ifc/sdb/_SingleSelectQueryComposer.java new file mode 100644 index 000000000..082bb7415 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_SingleSelectQueryComposer.java @@ -0,0 +1,41 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiPropertyTest; + +/** + * Testing <code>com.sun.star.sdb.SingleSelectQueryComposer</code> + * service properties : + * <ul> + * <li><code> Original</code></li> + * </ul> <p> + * Properties testing is automated by <code>lib.MultiPropertyTest</code>. + * @see com.sun.star.sdb.SingleSelectQueryComposer + * @see com.sun.star.beans.XPropertySet + * @see com.sun.star.beans.XPropertySetInfo + * @see com.sun.star.beans.Property + * @see com.sun.star.lang.XServiceInfo + */ +public class _SingleSelectQueryComposer extends MultiPropertyTest { + + +} // finish class _SingleSelectQueryComposer + + diff --git a/qadevOOo/tests/java/ifc/sdb/_XBookmarksSupplier.java b/qadevOOo/tests/java/ifc/sdb/_XBookmarksSupplier.java new file mode 100644 index 000000000..a0ddfdd57 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XBookmarksSupplier.java @@ -0,0 +1,51 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiMethodTest; + +import com.sun.star.container.XNameAccess; +import com.sun.star.sdb.XBookmarksSupplier; + + +/** + * Testing <code>com.sun.star.sdb.XBookmarksSupplier</code> + * interface methods : + * <ul> + * <li><code> getBookmarks()</code></li> + * </ul> <p> + * Test is <b> NOT </b> multithread compliant. <p> + * @see com.sun.star.sdb.XBookmarksSupplier + */ +public class _XBookmarksSupplier extends MultiMethodTest { + + public XBookmarksSupplier oObj = null ; + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method returns not + * <code>null</code> value. + */ + public void _getBookmarks() { + XNameAccess bookmarks = oObj.getBookmarks(); + tRes.tested("getBookmarks()",bookmarks != null); + } + +} // finish class _XBookmarksSupplier + diff --git a/qadevOOo/tests/java/ifc/sdb/_XCompletedConnection.java b/qadevOOo/tests/java/ifc/sdb/_XCompletedConnection.java new file mode 100644 index 000000000..12542edaa --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XCompletedConnection.java @@ -0,0 +1,75 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiMethodTest; +import lib.StatusException; + +import com.sun.star.sdb.XCompletedConnection; +import com.sun.star.sdbc.XConnection; +import com.sun.star.task.XInteractionHandler; + +/** + * Testing <code>com.sun.star.sdb.XCompletedConnection</code> + * interface methods : + * <ul> + * <li><code> connectWithCompletion()</code></li> + * </ul> <p> +* The following object relations required : +* <ul> +* <li> <code>'XCompletedConnection.Handler'</code> : passed as parameter +* to <code>connectWithCompletion</code> method. </li> +* </ul> +* @see com.sun.star.sdb.XCompletedConnection +* @see com.sun.star.task.XInteractionHandler +* @see com.sun.star.sdbc.XConnection +*/ +public class _XCompletedConnection extends MultiMethodTest { + + // oObj filled by MultiMethodTest + public XCompletedConnection oObj = null ; + + /** + * Test call the method with handler passed as object relation. + * Then value returned is checked.<p> + * Has OK status if not null value returned. < > + * FAILED if exception occurred, null value returned or object + * relation was not found. + */ + public void _connectWithCompletion() throws StatusException { + XInteractionHandler handler = (XInteractionHandler) + tEnv.getObjRelation("XCompletedConnection.Handler") ; + + if (handler == null) { + log.println("Required object relation not found !") ; + tRes.tested("connectWithCompletion()", false) ; + return ; + } + + XConnection con = null ; + try { + con = oObj.connectWithCompletion(handler) ; + } catch (com.sun.star.sdbc.SQLException e) { + throw new StatusException("Exception while method calling", e) ; + } + + tRes.tested("connectWithCompletion()", con != null) ; + } +} // finish class _XCompletedConnection + diff --git a/qadevOOo/tests/java/ifc/sdb/_XCompletedExecution.java b/qadevOOo/tests/java/ifc/sdb/_XCompletedExecution.java new file mode 100644 index 000000000..548b86c96 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XCompletedExecution.java @@ -0,0 +1,77 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package ifc.sdb; + +import com.sun.star.sdb.XCompletedExecution; +import com.sun.star.task.XInteractionHandler; +import java.io.PrintWriter; +import lib.MultiMethodTest; +import lib.StatusException; + +/** + * + */ +public class _XCompletedExecution extends MultiMethodTest { + + // oObj filled by MultiMethodTest + public XCompletedExecution oObj = null ; + + private CheckInteractionHandler checkHandler = null; + /** + * Interface to implement so the call of the listener can be checked. + */ + public interface CheckInteractionHandler extends XInteractionHandler { + /** + * Set a log of the listener, so messages of the listener get printed + * into the file of the interface + */ + void setLog(PrintWriter log); + /** + * Return True, when the listener was called correctly. + */ + boolean checkInteractionHandler(); + } + + @Override + protected void before() { + checkHandler = (CheckInteractionHandler) + tEnv.getObjRelation("InteractionHandlerChecker"); + if (checkHandler == null) + throw new StatusException("Missing object relation 'InteractionHandlerChecker'", new Exception()); + checkHandler.setLog(log); + } + + + public void _executeWithCompletion() { + try { + oObj.executeWithCompletion(checkHandler); + } + catch(com.sun.star.sdbc.SQLException e) { + e.printStackTrace(log); + tRes.tested("executeWithCompletion()", false); + return; + } + + tRes.tested("executeWithCompletion()", checkHandler.checkInteractionHandler()); + } + + @Override + protected void after() { + disposeEnvironment(); + } +} diff --git a/qadevOOo/tests/java/ifc/sdb/_XFormDocumentsSupplier.java b/qadevOOo/tests/java/ifc/sdb/_XFormDocumentsSupplier.java new file mode 100644 index 000000000..3ca625281 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XFormDocumentsSupplier.java @@ -0,0 +1,55 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiMethodTest; + +import com.sun.star.container.XNameAccess; +import com.sun.star.sdb.XFormDocumentsSupplier; + +/** +* <code>com.sun.star.sdb.XFormDocumentsSupplier</code> interface +* testing. +* @see com.sun.star.sdb.XFormDocumentsSupplier +*/ +public class _XFormDocumentsSupplier extends MultiMethodTest { + + // oObj filled by MultiMethodTest + public XFormDocumentsSupplier oObj = null ; + + /** + * Has OK status if not null returned. <p> + */ + public void _getFormDocuments() { + + XNameAccess docs = oObj.getFormDocuments() ; + + String[] docNames = docs.getElementNames() ; + if (docNames != null) { + log.println("Totally " + docNames.length + " documents :") ; + for (int i = 0; i < docNames.length; i++) + log.println(" " + docNames[i]) ; + } + + tRes.tested("getFormDocuments()", docNames != null) ; + } + +} // finish class _XFormDocumentsSupplier + + diff --git a/qadevOOo/tests/java/ifc/sdb/_XParametersSupplier.java b/qadevOOo/tests/java/ifc/sdb/_XParametersSupplier.java new file mode 100644 index 000000000..0c40f8547 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XParametersSupplier.java @@ -0,0 +1,52 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import com.sun.star.container.XIndexAccess; +import com.sun.star.sdb.XParametersSupplier; +import lib.MultiMethodTest; + +/** +* Testing <code>com.sun.star.sdb.XParametersSupplier</code> +* interface methods : +* <ul> +* <li><code> getParameters()</code></li> +* </ul> <p> +* Test is multithread compliant. <p> +* @see com.sun.star.sdb.XParametersSupplier +*/ +public class _XParametersSupplier extends MultiMethodTest { + + // oObj filled by MultiMethodTest + public XParametersSupplier oObj = null ; + + /** + * checks of the return of <code>getParameters()</code> + * is not null + */ + public void _getParameters() { + + XIndexAccess the_Set = oObj.getParameters(); + if (the_Set == null) log.println("'getParameters()' returns NULL"); + tRes.tested("getParameters()",the_Set != null); + + } +} // finish class _XParametersSupplier + + diff --git a/qadevOOo/tests/java/ifc/sdb/_XQueryDefinitionsSupplier.java b/qadevOOo/tests/java/ifc/sdb/_XQueryDefinitionsSupplier.java new file mode 100644 index 000000000..a8d88983a --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XQueryDefinitionsSupplier.java @@ -0,0 +1,60 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiMethodTest; + +import com.sun.star.container.XNameAccess; +import com.sun.star.sdb.XQueryDefinitionsSupplier; + +/** + * Testing <code>com.sun.star.sdb.XQueryDefinitionsSupplier</code> + * interface methods : + * <ul> + * <li><code> getQueryDefinitions()</code></li> + * </ul> <p> + * Test is <b> NOT </b> multithread compliant. <p> + * @see com.sun.star.sdb.XQueryDefinitionsSupplier + */ +public class _XQueryDefinitionsSupplier extends MultiMethodTest { + + // oObj filled by MultiMethodTest + public XQueryDefinitionsSupplier oObj = null ; + + /** + * Test calls the method. <p> + * Has <b> OK </b> status if the method returns not + * <code>null</code> value. + */ + public void _getQueryDefinitions() { + + XNameAccess docs = oObj.getQueryDefinitions() ; + + String[] docNames = docs.getElementNames() ; + if (docNames != null) { + log.println("Totally " + docNames.length + " queries :") ; + for (int i = 0; i < docNames.length; i++) + log.println(" " + docNames[i]) ; + } + + tRes.tested("getQueryDefinitions()", docNames != null) ; + } + +} // finish class _XQueryDefinitionsSupplier + diff --git a/qadevOOo/tests/java/ifc/sdb/_XReportDocumentsSupplier.java b/qadevOOo/tests/java/ifc/sdb/_XReportDocumentsSupplier.java new file mode 100644 index 000000000..fe1b5f0b1 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XReportDocumentsSupplier.java @@ -0,0 +1,55 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiMethodTest; + +import com.sun.star.container.XNameAccess; +import com.sun.star.sdb.XReportDocumentsSupplier; + +/** +* <code>com.sun.star.sdb.XReportDocumentsSupplier</code> interface +* testing. +* @see com.sun.star.sdb.XReportDocumentsSupplier +*/ +public class _XReportDocumentsSupplier extends MultiMethodTest { + + // oObj filled by MultiMethodTest + public XReportDocumentsSupplier oObj = null ; + + /** + * Has OK status if not null returned. <p> + */ + public void _getReportDocuments() { + + XNameAccess docs = oObj.getReportDocuments() ; + + String[] docNames = docs.getElementNames() ; + if (docNames != null) { + log.println("Totally " + docNames.length + " documents :") ; + for (int i = 0; i < docNames.length; i++) + log.println(" " + docNames[i]) ; + } + + tRes.tested("getReportDocuments()", docNames != null) ; + } + +} // finish class _XReportDocumentsSupplier + + diff --git a/qadevOOo/tests/java/ifc/sdb/_XResultSetAccess.java b/qadevOOo/tests/java/ifc/sdb/_XResultSetAccess.java new file mode 100644 index 000000000..f689c6cbf --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XResultSetAccess.java @@ -0,0 +1,60 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiMethodTest; + +import com.sun.star.sdb.XResultSetAccess; +import com.sun.star.sdbc.XResultSet; + +/** +* Testing <code>com.sun.star.sdb.XResultSetAccess</code> +* interface methods : +* <ul> +* <li><code> createResultSet()</code></li> +* </ul> <p> +* Test is multithread compliant. <p> +* @see com.sun.star.sdb.XResultSetAccess +*/ +public class _XResultSetAccess extends MultiMethodTest { + + // oObj filled by MultiMethodTest + public XResultSetAccess oObj = null ; + + /** + * tries to create a ResultSet for the Object</br> + * an XResultSet is returned.</br> + * The test is OK if a not null ResultSet is returned + */ + public void _createResultSet() { + + try { + XResultSet the_Set = oObj.createResultSet(); + if (the_Set == null) log.println("'createResulSet()' returns NULL"); + tRes.tested("createResultSet()",the_Set != null); + } catch (com.sun.star.sdbc.SQLException e) { + log.println("Exception while checking 'createResultSet()'"); + e.printStackTrace(log); + tRes.tested("createResultSet()",false); + } + + } +} // finish class _XResultSetAccess + + diff --git a/qadevOOo/tests/java/ifc/sdb/_XRowSetApproveBroadcaster.java b/qadevOOo/tests/java/ifc/sdb/_XRowSetApproveBroadcaster.java new file mode 100644 index 000000000..62911c851 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XRowSetApproveBroadcaster.java @@ -0,0 +1,207 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import lib.MultiMethodTest; +import lib.Status; +import lib.StatusException; + +import com.sun.star.lang.EventObject; +import com.sun.star.sdb.RowChangeEvent; +import com.sun.star.sdb.XRowSetApproveBroadcaster; +import com.sun.star.sdb.XRowSetApproveListener; + +/** +* <code>com.sun.star.sdb.XRowSetApproveBroadcaster</code> interface test. <p> +* Required object relations : +* <ul> +* <li> <code>'XRowSetApproveBroadcaster.ApproveChecker'</code>: +* implementation of inner interface <code>RowSetApproveChecker</code> +* which can move cursor within a rowset, change row, and change the +* whole rowset. </li> +* </ul> <p> +* It is better to recreate the object after test, because of unknown +* actions made by <code>RowSetApproveChecker</code> interface implementation. +* +* @see com.sun.star.sdb.XRowSetApproveBroadcaster +* @see _XRowSetApproveBroadcaster.RowSetApproveChecker +*/ +public class _XRowSetApproveBroadcaster extends MultiMethodTest { + + // oObj filled by MultiMethodTest + public XRowSetApproveBroadcaster oObj = null ; + + /** + * The purpose of this interface is to pass to this test + * relation which can make some operations with row set + * on which <code>XRowSetApproveListener</code>s can react. + * @see com.sun.star.sdb.XRowSetApproveListener + */ + public interface RowSetApproveChecker { + /** + * Moves cursor within row set. Method <code>approveCursorMove</code> + * of <code>XRowSetApproveListener</code> must be called. + */ + void moveCursor() ; + /** + * Change rows in row set. Method <code>approveRowChange</code> + * of <code>XRowSetApproveListener</code> must be called. + * @return <code>RowChangeEvent</code> structure which contains + * what type of change was made and how many rows it affected. + * @see com.sun.star.sdb.RowChangeEvent + */ + RowChangeEvent changeRow() ; + /** + * Change the whole row set. Method <code>approveRowSetChange</code> + * of <code>XRowSetApproveListener</code> must be called. + */ + void changeRowSet() ; + } + + /** + * Implementation of <code>XRowSetApproveListener</code> interface + * which just detects and stores approve requirements. They are checked + * later. + */ + private static class TestListener implements XRowSetApproveListener { + public boolean approveRequests = true ; + public boolean approveCursorMoveCalled = false ; + public boolean approveRowChangeCalled = false ; + public RowChangeEvent approveRowChangeEvent = null ; + public boolean approveRowSetChangeCalled = false ; + + public TestListener(boolean approve) { + approveRequests = approve ; + } + + public void reset() { + approveCursorMoveCalled = false ; + approveRowChangeCalled = false ; + approveRowSetChangeCalled = false ; + } + public boolean approveCursorMove(EventObject ev) { + approveCursorMoveCalled = true ; + return approveRequests ; + } + public boolean approveRowChange(RowChangeEvent ev) { + approveRowChangeCalled = true ; + approveRowChangeEvent = ev ; + return approveRequests ; + } + public boolean approveRowSetChange(EventObject ev) { + approveRowSetChangeCalled = true ; + return approveRequests ; + } + public void disposing(EventObject ev) {} + } + private TestListener listener1 = null ; + + private RowSetApproveChecker checker = null ; + + /** + * Tries to retrieve object relation. + */ + @Override + public void before() { + checker = (RowSetApproveChecker) tEnv.getObjRelation + ("XRowSetApproveBroadcaster.ApproveChecker") ; + + if (checker == null) { + log.println("!!! Relation for test not found !!!") ; + throw new StatusException(Status.failed + ("!!! Relation for test not found !!!")) ; + } + } + + /** + * Creates and adds listener, then call <code>RowSetApproveChecker</code> + * methods for listener methods to be called. Then checks if + * listener methods were called on appropriate actions. <p> + * Has OK status : If and only if appropriate listener methods called, + * and listener <code>approveRowChange</code> method has write parameter, + * i.e. type and rows number expected. + */ + public void _addRowSetApproveListener() { + listener1 = new TestListener(true) ; + oObj.addRowSetApproveListener(listener1) ; + log.println("Listener added.") ; + + boolean result = true ; + + checker.moveCursor() ; + log.println("Cursor moved.") ; + result &= listener1.approveCursorMoveCalled ; + + listener1.reset() ; + RowChangeEvent actualEvent = checker.changeRow() ; + log.println("Row changed.") ; + + RowChangeEvent event = listener1.approveRowChangeEvent ; + result &= listener1.approveRowChangeCalled ; + + boolean eventOK = event.Action == actualEvent.Action && + event.Rows == actualEvent.Rows ; + + result &= eventOK ; + + listener1.reset() ; + checker.changeRowSet(); + log.println("Row set changed.") ; + result &= listener1.approveRowSetChangeCalled ; + + tRes.tested("addRowSetApproveListener()", result) ; + } + + /** + * Removes listener inserted before, then perform all actions + * on which listener must react. <p> + * Has OK status if no listener methods were called. <p> + * Methods required to pass before : + * <ul> + * <li> <code>_addRowSetApproveListener</code> </li> + * </ul> + */ + public void _removeRowSetApproveListener() { + requiredMethod("addRowSetApproveListener()") ; + + listener1.reset() ; + + oObj.removeRowSetApproveListener(listener1) ; + + checker.moveCursor() ; + checker.changeRow() ; + checker.changeRowSet() ; + + tRes.tested("removeRowSetApproveListener()", + !listener1.approveCursorMoveCalled && + !listener1.approveRowChangeCalled && + !listener1.approveRowSetChangeCalled) ; + } + + /** + * Disposes object environment. + */ + @Override + public void after() { + disposeEnvironment() ; + } + +} // finish class _XRowSetApproveBroadcaster + + diff --git a/qadevOOo/tests/java/ifc/sdb/_XSQLErrorBroadcaster.java b/qadevOOo/tests/java/ifc/sdb/_XSQLErrorBroadcaster.java new file mode 100644 index 000000000..ca2efa664 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XSQLErrorBroadcaster.java @@ -0,0 +1,29 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package ifc.sdb; + +import com.sun.star.sdb.XSQLErrorBroadcaster; +import lib.MultiMethodTest; + +/** + * + */ +public class _XSQLErrorBroadcaster extends MultiMethodTest { + + public XSQLErrorBroadcaster oObj = null; +} diff --git a/qadevOOo/tests/java/ifc/sdb/_XSingleSelectQueryAnalyzer.java b/qadevOOo/tests/java/ifc/sdb/_XSingleSelectQueryAnalyzer.java new file mode 100644 index 000000000..39aabf688 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XSingleSelectQueryAnalyzer.java @@ -0,0 +1,290 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import com.sun.star.sdb.XSingleSelectQueryAnalyzer; +import lib.MultiMethodTest; +import com.sun.star.sdb.XSingleSelectQueryComposer; +import com.sun.star.uno.UnoRuntime; +import lib.StatusException; +import lib.Status; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XIndexAccess; + +/** +* Testing <code>com.sun.star.sdb.XSingleSelectQueryAnalyzer</code> +* interface methods : +* <ul> +* <li><code>getQuery()</code></li> +* <li><code>setQuery()</code></li> +* <li><code>getFilter()</code></li> +* <li><code>getStructuredFilter()</code></li> +* <li><code>getGroup()</code></li> +* <li><code>getGroupColumns()</code></li> +* <li><code>getHavingClause()</code></li> +* <li><code>getStructuredHavingClause()</code></li> +* <li><code>getOrder()</code></li> +* <li><code>getOrderColumns()</code></li> + +* </ul> <p> +* @see com.sun.star.sdb.XSingleSelectQueryAnalyzer +*/ +public class _XSingleSelectQueryAnalyzer extends MultiMethodTest { + + // oObj filled by MultiMethodTest + public XSingleSelectQueryAnalyzer oObj = null ; + + private static final String queryString = "SELECT * FROM \"biblio\""; + + private XSingleSelectQueryComposer xComposer = null; + + /** + * Receives the object relations: + * <ul> + * <li><code>XSingleSelectQueryComposer xCompoer</code></li> + * </ul> <p> + * @see com.sun.star.sdb.XSingleSelectQueryComposer + */ + @Override + protected void before() { + + xComposer = UnoRuntime.queryInterface(XSingleSelectQueryComposer.class, + tEnv.getObjRelation("xComposer")); + + if (xComposer == null) { + throw new StatusException(Status.failed( + "Couldn't get object relation 'xComposer'. Test must be modified")); + + } + + } + /** + * call <code>setQuery()</code> once with valid query, once with invalid + * query. Has ok if only on second call <code>SQLException</code> was thrown + */ + public void _setQuery() { + + try{ + oObj.setQuery("This is an invalid SQL query"); + } catch (com.sun.star.sdbc.SQLException e){ + log.println("expected Exception. "); + } + + try{ + oObj.setQuery(queryString); + } catch (com.sun.star.sdbc.SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("setQuery()", false); + } + tRes.tested("setQuery()", true); + } + + /** + * checks of the returned value of <code>getQuery()</code> + * equals the string which was set by <code>setQuery()</code> + * <p> + * required methods: + *<ul> + * <li><code>setQuery</code></li> + *</ul> + */ + public void _getQuery() { + this.requiredMethod("setQuery()"); + + boolean res = false; + + res = oObj.getQuery().equals(queryString); + + tRes.tested("getQuery()", res); + } + + + /** + * Object relation <code>xComposer</code> set a filter. This filter + * must returned while calling <code>getFilter</code> + */ + public void _getFilter() { + try{ + String filter = "\"Identifier\" = 'BOR02b'"; + xComposer.setFilter(filter); + tRes.tested("getFilter()", oObj.getFilter().equals(filter)); + + } catch (com.sun.star.sdbc.SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("getFilter()", false); + } + } + + /** + * Object relation <code>xComposer</code> set a complex filter with method + . <code>setFilter</code>. Then <code>getStructuredFilter</code> returns a + * sequence of <code>PropertyValue</code> which was set with method + * <code>setStructuredFilter</code> from <xComposer>. + * Then test has ok status if <getFilter> returns the complex filter. + * <p> + * required methods: + *<ul> + * <li><code>setQuery</code></li> + * <li><code>getFilter</code></li> + *</ul> + */ + public void _getStructuredFilter() { + requiredMethod("setQuery()"); + requiredMethod("getFilter()"); + try{ + oObj.setQuery("SELECT \"Identifier\", \"Type\", \"Address\" FROM \"biblio\" \"biblio\""); + 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' )"; + xComposer.setFilter(complexFilter); + PropertyValue[][] aStructuredFilter = oObj.getStructuredFilter(); + + xComposer.setFilter(""); + xComposer.setStructuredFilter(aStructuredFilter); + tRes.tested("getStructuredFilter()", oObj.getFilter().equals(complexFilter)); + + } catch (com.sun.star.sdbc.SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("getStructuredFilter()", false); + } catch (com.sun.star.lang.IllegalArgumentException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("getStructuredFilter()", false); + } + } + + /** + * Object relation <code>xComposer</code> set a goup. This group + * must returned while calling <code>getGroup</code> + */ + public void _getGroup() { + try{ + String group = "\"Identifier\""; + xComposer.setGroup(group); + tRes.tested("getGroup()", oObj.getGroup().equals(group)); + + } catch (com.sun.star.sdbc.SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("getGroup()", false); + } + } + + /** + * Method <code>getGroupColumns</code> returns a <code>XIndexAccess</code> + * Test has ok status if returned value is a usable <code>XIndexAccess</code> + */ + public void _getGroupColumns() { + try{ + XIndexAccess xGroupColumns = oObj.getGroupColumns(); + + tRes.tested("getGroupColumns()", (xGroupColumns != null && + xGroupColumns.getCount() == 1 && + xGroupColumns.getByIndex(0) != null)); + + } catch (com.sun.star.lang.IndexOutOfBoundsException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("getGroupColumns()", false); + } catch (com.sun.star.lang.WrappedTargetException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("getGroupColumns()", false); + } + } + + /** + * Object relation <code>xComposer</code> set a clause. This clause + * must returned while calling <code>getHavingClause</code> + */ + public void _getHavingClause() { + try{ + String clause = "\"Identifier\" = 'BOR02b'"; + xComposer.setHavingClause(clause); + tRes.tested("getHavingClause()", oObj.getHavingClause().equals(clause)); + + } catch (com.sun.star.sdbc.SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("getHavingClause()", false); + } + } + + /** + * Object relation <code>xComposer</code> set a clause. This clause + * must returned while calling <code>getHavingClause</code> + * <p> + * required methods: + *<ul> + * <li><code>setQuery</code></li> + * <li><code>getFilter</code></li> + * <li><code>getStructuredFilter</code></li> + *</ul> + */ + public void _getStructuredHavingClause() { + requiredMethod("setQuery()"); + requiredMethod("getFilter()"); + executeMethod("getStructuredFilter()"); + + 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' )"; + try{ + xComposer.setHavingClause(complexFilter); + PropertyValue[][] aStructuredHaving = oObj.getStructuredHavingClause(); + xComposer.setHavingClause(""); + xComposer.setStructuredHavingClause(aStructuredHaving); + tRes.tested("getStructuredHavingClause()", + oObj.getHavingClause().equals(complexFilter)); + + } catch (com.sun.star.sdbc.SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("getStructuredHavingClause()", false); + } + } + + /** + * Object relation <code>xComposer</code> set an order. This order + * must returned while calling <code>getOrder</code> + */ + public void _getOrder() { + try{ + String order = "\"Identifier\""; + xComposer.setOrder(order); + tRes.tested("getOrder()", oObj.getOrder().equals(order)); + + } catch (com.sun.star.sdbc.SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("getOrder()", false); + } + } + + /** + * Method <code>getGroupColumns</code> returns a <code>XIndexAccess</code> + * Test has ok status if returned value is a usable <code>XIndexAccess</code> + */ + public void _getOrderColumns() { + try{ + XIndexAccess xOrderColumns = oObj.getOrderColumns(); + tRes.tested("getOrderColumns()", (xOrderColumns != null && + xOrderColumns.getCount() == 1 && + xOrderColumns.getByIndex(0) != null)); + + } catch (com.sun.star.lang.IndexOutOfBoundsException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("getOrderColumns()", false); + } catch (com.sun.star.lang.WrappedTargetException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("getOrderColumns()", false); + } + } + + +} // finish class _XSingleSelectQueryAnalyzer diff --git a/qadevOOo/tests/java/ifc/sdb/_XSingleSelectQueryComposer.java b/qadevOOo/tests/java/ifc/sdb/_XSingleSelectQueryComposer.java new file mode 100644 index 000000000..53b31f693 --- /dev/null +++ b/qadevOOo/tests/java/ifc/sdb/_XSingleSelectQueryComposer.java @@ -0,0 +1,521 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +package ifc.sdb; + +import com.sun.star.sdb.XSingleSelectQueryComposer; +import lib.MultiMethodTest; +import com.sun.star.sdb.XSingleSelectQueryAnalyzer; +import com.sun.star.sdbc.XResultSet; +import com.sun.star.uno.AnyConverter; +import com.sun.star.uno.UnoRuntime; +import lib.StatusException; +import lib.Status; +import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.XPropertySet; +import com.sun.star.sdb.SQLFilterOperator; +import com.sun.star.sdbc.SQLException; + +/** +* Testing <code>com.sun.star.sdb.XSingleSelectQueryComposer</code> +* interface methods : +* <ul> +* <li><code>setFilter()</code></li> +* <li><code>setStructuredFilter()</code></li> +* <li><code>appendFilterByColumn()</code></li> +* <li><code>appendGroupByColumn()</code></li> +* <li><code>setGroup()</code></li> +* <li><code>setHavingClause()</code></li> +* <li><code>setStructuredHavingClause()</code></li> +* <li><code>appendHavingClauseByColumn()</code></li> +* <li><code>appendOrderByColumn()</code></li> +* <li><code>setOrder()</code></li> + +* </ul> <p> +* @see com.sun.star.sdb.XSingleSelectQueryComposer +*/ +public class _XSingleSelectQueryComposer extends MultiMethodTest { + + // oObj filled by MultiMethodTest + public XSingleSelectQueryComposer oObj = null ; + + private XSingleSelectQueryAnalyzer xQueryAna = null; + + private XPropertySet xProp = null; + + private String colName = null; + + private XResultSet xReSet = null; + + /** + * Retrieves the object relations: + * <ul> + * <li><code>XSingleSelectQueryAnalyzer xQueryAna</code></li> + * <li><code>XPropertySet xProp</code></li> + * <li><code>String colName</code></li> + * </ul> <p> + * @see com.sun.star.sdb.XSingleSelectQueryAnalyzer + * @see com.sun.star.beans.XPropertySet + */ + @Override + protected void before() /* throws Exception*/ { + + xQueryAna = UnoRuntime.queryInterface(XSingleSelectQueryAnalyzer.class, + tEnv.getObjRelation("xQueryAna")); + + if (xQueryAna == null) { + throw new StatusException(Status.failed( + "Couldn't get object relation 'xQueryAna'. Test must be modified")); + + } + + xProp = UnoRuntime.queryInterface(XPropertySet.class, + tEnv.getObjRelation("xProp")); + + if (xProp == null) { + throw new StatusException(Status.failed( + "Couldn't get object relation 'xProp'. Test must be modified")); + + } + + xReSet = UnoRuntime.queryInterface(XResultSet.class, + tEnv.getObjRelation("xResultSet")); + + if (xReSet == null) { + throw new StatusException(Status.failed( + "Couldn't get object relation 'xResultSet'. Test must be modified")); + + } + + try + { + colName = AnyConverter.toString(tEnv.getObjRelation("colName")); + } + catch (com.sun.star.lang.IllegalArgumentException e) + { + colName = null; + } + + if (colName == null) { + throw new StatusException(Status.failed( + "Couldn't get object relation 'colName'. Test must be modified")); + + } + + } + + + /** + * Object relation <code>xQueryAna</code> set a filter. This filter + * must returned while calling <code>getFilter</code> + */ + public void _setFilter() { + try{ + String filter = "\"Identifier\" = 'BOR02b'"; + oObj.setFilter(filter); + tRes.tested("setFilter()", xQueryAna.getFilter().equals(filter)); + + } catch (SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("setFilter()", false); + } + } + + /** + * Object relation <code>xQueryAna</code> set a complex filter with method + . <code>setFilter</code>. Then <code>getStructuredFilter</code> returns a + * sequence of <code>PropertyValue</code> which was set with method + * <code>setStructuredFilter</code> from <code>xQueryAna</code>. + * Then test has ok status if <code>getFilter</code> returns the complex filter. + */ + public void _setStructuredFilter() { + requiredMethod("setFilter()"); + try{ + xQueryAna.setQuery("SELECT \"Identifier\", \"Type\", \"Address\" FROM \"biblio\" \"biblio\""); + 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' )"; + oObj.setFilter(complexFilter); + PropertyValue[][] aStructuredFilter = xQueryAna.getStructuredFilter(); + oObj.setFilter(""); + oObj.setStructuredFilter(aStructuredFilter); + tRes.tested("setStructuredFilter()", xQueryAna.getFilter().equals(complexFilter)); + + } catch (SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("setStructuredFilter()", false); + } catch (com.sun.star.lang.IllegalArgumentException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("setStructuredFilter()", false); + } + } + + /** + * At first the object relation <code>xProp</code> was set as parameter. + * Relation <code>xQueryAna</code> was used to check if relation + * <code>colName</code> was found. + * Second an empty <code>XPropertySet</code> was used as parameter. A + * <code>SQLException</code> must be thrown. + */ + public void _appendFilterByColumn() { + boolean ok = true; + try + { + xReSet.beforeFirst(); + } + catch (SQLException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendFilterByColumn()", false); + } + try + { + oObj.appendFilterByColumn(xProp, true,SQLFilterOperator.EQUAL); + log.println("expected Exception was not thrown"); + tRes.tested("appendFilterByColumn()", false); + ok = false; + } + catch (com.sun.star.uno.RuntimeException e) + { + log.println("expected Exception: " + e.toString()); + ok = ok && true; + } + catch (SQLException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendFilterByColumn()", false); + } + catch (com.sun.star.lang.WrappedTargetException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendFilterByColumn()", false); + } + + try + { + xReSet.first(); + } + catch (SQLException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendFilterByColumn()", false); + } + try{ + + oObj.appendFilterByColumn(xProp, true,SQLFilterOperator.EQUAL); + log.println("appendFilterByColumn: " + xQueryAna.getFilter()); + ok = ok && (xQueryAna.getFilter().indexOf(colName) > 0); + + } catch (SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendFilterByColumn()", false); + } + catch (com.sun.star.lang.WrappedTargetException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendFilterByColumn()", false); + } + + try{ + + oObj.appendFilterByColumn(xProp, false,SQLFilterOperator.EQUAL); + log.println("appendFilterByColumn: " + xQueryAna.getFilter()); + ok = ok && (xQueryAna.getFilter().indexOf(colName) > 0); + + } catch (SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendFilterByColumn()", false); + } catch (com.sun.star.lang.WrappedTargetException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendFilterByColumn()", false); + } + + try{ + XPropertySet dummy = null; + oObj.appendFilterByColumn(dummy, true,SQLFilterOperator.EQUAL); + log.println("expected Exception was not thrown"); + tRes.tested("appendFilterByColumn()", false); + + } catch (SQLException e){ + log.println("expected Exception"); + ok = ok && true; + } catch (com.sun.star.lang.WrappedTargetException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendFilterByColumn()", false); + } + + try + { + xReSet.beforeFirst(); + } + catch (SQLException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendFilterByColumn()", false); + } + tRes.tested("appendFilterByColumn()", ok); + } + + /** + * At first the object relation <code>xProp</code> was used as parameter. + * Relation <code>xQueryAna</code> was used to check if relation + * <code>colName</code> was found. + * Second an empty <code>XPropertySet</code> was used as parameter. An + * <code>SQLException</code> must be thrown. + */ + public void _appendGroupByColumn() { + boolean ok = true; + try{ + + oObj.appendGroupByColumn(xProp); + log.println("appendGroupByColumn: " + xQueryAna.getFilter()); + ok = ok && (xQueryAna.getFilter().indexOf(colName) > 0); + + } catch (SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendGroupByColumn()", false); + } + try{ + XPropertySet dummy = null; + oObj.appendGroupByColumn(dummy); + log.println("expected Exception was not thrown"); + tRes.tested("appendGroupByColumn()", false); + + } catch (SQLException e){ + log.println("expected Exception"); + ok = ok && true; + } + tRes.tested("appendGroupByColumn()", ok); + } + + /** + * The group which was set by <code>setGroup</code> must be returned + * while calling from object relation <code>XQueryAna</code> + * method <code>getGroup</code> + */ + public void _setGroup() { + try{ + String group = "\"Identifier\""; + oObj.setGroup(group); + tRes.tested("setGroup()", xQueryAna.getGroup().equals(group)); + + } catch (SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("setGroup()", false); + } + } + + + /** + * The clause which was set by <code>setHavingClause</code> must be returned + * while calling from object relation <code>XQueryAna</code> + * method <code>getHavingClause</code> + */ + public void _setHavingClause() { + try{ + String clause = "\"Identifier\" = 'BOR02b'"; + oObj.setHavingClause(clause); + tRes.tested("setHavingClause()", + xQueryAna.getHavingClause().equals(clause)); + + } catch (SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("setHavingClause()", false); + } + } + + /** + * At first <code>setHavingClause</code> sets a complex clause. + * Then method <code>getStructuredHavingClause</code> from object relation + * <code>xQueryAna</code> returns a valid <code>PropertyValue[][]</code> + * Method <code>setHavingClause</code> was called with an empty string to + * reset filter. Now <code>setStructuredHavingClause</code> with the valid + * <code>PropertyValue[][]</code> as parameter was called. + * Test is ok if <code>getHavingClause</code> from <code>xQueryAna</code> + * returns the complex clause from beginning. + * <p> + * required methods: + *<ul> + * <li><code>setHavingClause</code></li> + * <li><code>setStructuredFilter</code></li> + *</ul> + */ + public void _setStructuredHavingClause() { + requiredMethod("setHavingClause()"); + executeMethod("setStructuredFilter()"); + 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' )"; + try{ + oObj.setHavingClause(complexFilter); + PropertyValue[][] aStructuredHaving = + xQueryAna.getStructuredHavingClause(); + oObj.setHavingClause(""); + oObj.setStructuredHavingClause(aStructuredHaving); + tRes.tested("setStructuredHavingClause()", + xQueryAna.getHavingClause().equals(complexFilter)); + + } catch (SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("setStructuredHavingClause()", false); + } + } + + /** + * First object relation <code>xProp</code> was used as parameter. Relation + * <code>xQueryAna</code> was used to check if relation <code>colName</code> + * was found. + * Second an empty <code>XPropertySet</code> was given as parameter. An + * <code>SQLException</code> must be thrown. + */ + public void _appendHavingClauseByColumn() { + boolean ok = true; + try + { + xReSet.beforeFirst(); + } + catch (SQLException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendHavingClauseByColumn()", false); + } + try{ + + oObj.appendHavingClauseByColumn(xProp, true,SQLFilterOperator.EQUAL); + log.println("expected Exception was not thrown"); + tRes.tested("appendHavingClauseByColumn()", false); + ok = false; + + } + catch (com.sun.star.uno.RuntimeException e) + { + log.println("expected Exception: " + e.toString()); + ok = ok && true; + } + catch (SQLException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendHavingClauseByColumn()", false); + } catch (com.sun.star.lang.WrappedTargetException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendHavingClauseByColumn()", false); + } + + try + { + xReSet.first(); + } + catch (SQLException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendHavingClauseByColumn()", false); + } + try{ + + oObj.appendHavingClauseByColumn(xProp, true,SQLFilterOperator.EQUAL); + log.println("appendHavingClauseByColumn: " + xQueryAna.getFilter()); + ok = ok && (xQueryAna.getFilter().indexOf(colName) > 0); + + } catch (SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendHavingClauseByColumn()", false); + } catch (com.sun.star.lang.WrappedTargetException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendHavingClauseByColumn()", false); + } + + try{ + XPropertySet dummy = null; + oObj.appendHavingClauseByColumn(dummy, true,SQLFilterOperator.EQUAL); + log.println("expected Exception was not thrown"); + tRes.tested("appendHavingClauseByColumn()", false); + + } catch (SQLException e){ + log.println("expected Exception"); + ok = ok && true; + } catch (com.sun.star.lang.WrappedTargetException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendHavingClauseByColumn()", false); + } + + // cleanup + try + { + xReSet.beforeFirst(); + } + catch (SQLException e) + { + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendHavingClauseByColumn()", false); + } + tRes.tested("appendHavingClauseByColumn()", ok); + } + + /** + * First object relation <code>xProp</code> was set as parameter. Relation + * <code>xQueryAna</code> was used to check if relation <code>colName</code> + * was found. + * Second an empty <code>XPropertySet</code> was given as parameter. An + * <code>SQLException</code> must be thrown. + */ + public void _appendOrderByColumn() { + boolean ok = true; + try{ + + oObj.appendOrderByColumn(xProp, true); + log.println("appendOrderByColumn: " + xQueryAna.getFilter()); + ok = ok && (xQueryAna.getFilter().indexOf(colName) > 0); + + } catch (SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("appendOrderByColumn()", false); + } + try{ + XPropertySet dummy = null; + oObj.appendOrderByColumn(dummy, true); + log.println("expected Exception was not thrown"); + tRes.tested("appendOrderByColumn()", false); + + } catch (SQLException e){ + log.println("expected Exception"); + ok = ok && true; + } + tRes.tested("appendOrderByColumn()", ok); + } + + + /** + * Method <code>getOrder</code> from object relation <code>xQueryAna</code> + * checks the order which was set while calling <code>setOrder</code> + */ + public void _setOrder() { + try{ + String order = "\"Identifier\""; + oObj.setOrder(order); + tRes.tested("setOrder()", xQueryAna.getOrder().equals(order)); + + } catch (SQLException e){ + log.println("unexpected Exception: " + e.toString()); + tRes.tested("setOrder()", false); + } + } + + + +} // finish class _XSingleSelectQueryComposer |