From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- .../tests/java/ifc/sdb/_DataAccessDescriptor.java | 116 +++++ qadevOOo/tests/java/ifc/sdb/_DataSource.java | 165 +++++++ .../ifc/sdb/_DatasourceAdministrationDialog.java | 36 ++ .../tests/java/ifc/sdb/_ErrorMessageDialog.java | 60 +++ qadevOOo/tests/java/ifc/sdb/_QueryDefinition.java | 46 ++ qadevOOo/tests/java/ifc/sdb/_RowSet.java | 144 ++++++ .../java/ifc/sdb/_SingleSelectQueryComposer.java | 41 ++ .../tests/java/ifc/sdb/_XBookmarksSupplier.java | 51 ++ .../tests/java/ifc/sdb/_XCompletedConnection.java | 75 +++ .../tests/java/ifc/sdb/_XCompletedExecution.java | 77 +++ .../java/ifc/sdb/_XFormDocumentsSupplier.java | 55 +++ .../tests/java/ifc/sdb/_XParametersSupplier.java | 52 ++ .../java/ifc/sdb/_XQueryDefinitionsSupplier.java | 60 +++ .../java/ifc/sdb/_XReportDocumentsSupplier.java | 55 +++ qadevOOo/tests/java/ifc/sdb/_XResultSetAccess.java | 60 +++ .../java/ifc/sdb/_XRowSetApproveBroadcaster.java | 207 ++++++++ .../tests/java/ifc/sdb/_XSQLErrorBroadcaster.java | 29 ++ .../java/ifc/sdb/_XSingleSelectQueryAnalyzer.java | 290 ++++++++++++ .../java/ifc/sdb/_XSingleSelectQueryComposer.java | 521 +++++++++++++++++++++ 19 files changed, 2140 insertions(+) create mode 100644 qadevOOo/tests/java/ifc/sdb/_DataAccessDescriptor.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_DataSource.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_DatasourceAdministrationDialog.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_ErrorMessageDialog.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_QueryDefinition.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_RowSet.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_SingleSelectQueryComposer.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XBookmarksSupplier.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XCompletedConnection.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XCompletedExecution.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XFormDocumentsSupplier.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XParametersSupplier.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XQueryDefinitionsSupplier.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XReportDocumentsSupplier.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XResultSetAccess.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XRowSetApproveBroadcaster.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XSQLErrorBroadcaster.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XSingleSelectQueryAnalyzer.java create mode 100644 qadevOOo/tests/java/ifc/sdb/_XSingleSelectQueryComposer.java (limited to 'qadevOOo/tests/java/ifc/sdb') 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 com.sun.star.sdb.DataSource + * service properties : + *

+ * Properties testing is automated by lib.MultiPropertyTest

. +* After this interface test it's better to recreate 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 PropertyValue structure. + * The test just changes existing array onto array with a single + * element ("user", "API_QA_Tester")

+ * + * After testing old value is set for this property.

+ * + * 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 null. + */ + 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 com.sun.star.sdb.DatasourceAdministrationDialog + * service properties : + *

+ * Properties testing is automated by lib.MultiPropertyTest. + * @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 com.sun.star.sdb.ErrorMessageDialog + * service properties : + *

+ * This test needs the following object relations : + *