2003-01-27 17:20:08 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 16:09:42 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2003-01-27 17:20:08 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2003-01-27 17:20:08 +00:00
|
|
|
*
|
2008-04-10 16:09:42 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2003-01-27 17:20:08 +00:00
|
|
|
*
|
2008-04-10 16:09:42 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2003-01-27 17:20:08 +00:00
|
|
|
*
|
2008-04-10 16:09:42 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2003-01-27 17:20:08 +00:00
|
|
|
*
|
2008-04-10 16:09:42 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2003-01-27 17:20:08 +00:00
|
|
|
*
|
2008-04-10 16:09:42 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2003-01-27 17:20:08 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
package mod._forms;
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
import java.io.PrintWriter;
|
|
|
|
import java.util.Vector;
|
|
|
|
|
|
|
|
import lib.Status;
|
|
|
|
import lib.StatusException;
|
|
|
|
import lib.TestCase;
|
|
|
|
import lib.TestEnvironment;
|
|
|
|
import lib.TestParameters;
|
|
|
|
import util.DBTools;
|
|
|
|
import util.DrawTools;
|
|
|
|
import util.FormTools;
|
|
|
|
import util.WriterTools;
|
|
|
|
import util.utils;
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
import com.sun.star.awt.XControl;
|
|
|
|
import com.sun.star.awt.XControlModel;
|
|
|
|
import com.sun.star.beans.PropertyValue;
|
|
|
|
import com.sun.star.beans.XPropertySet;
|
|
|
|
import com.sun.star.container.XIndexAccess;
|
|
|
|
import com.sun.star.container.XNameContainer;
|
|
|
|
import com.sun.star.container.XNamed;
|
|
|
|
import com.sun.star.drawing.XControlShape;
|
|
|
|
import com.sun.star.drawing.XShape;
|
|
|
|
import com.sun.star.drawing.XShapes;
|
2003-11-18 15:27:32 +00:00
|
|
|
import com.sun.star.form.DatabaseParameterEvent;
|
2003-01-27 17:20:08 +00:00
|
|
|
import com.sun.star.form.XForm;
|
|
|
|
import com.sun.star.form.XLoadable;
|
2003-11-18 15:27:32 +00:00
|
|
|
import com.sun.star.lang.EventObject;
|
2003-01-27 17:20:08 +00:00
|
|
|
import com.sun.star.lang.XMultiServiceFactory;
|
2003-11-18 15:27:32 +00:00
|
|
|
import com.sun.star.sdb.CommandType;
|
|
|
|
import com.sun.star.sdb.ParametersRequest;
|
2003-01-27 17:20:08 +00:00
|
|
|
import com.sun.star.sdb.RowChangeEvent;
|
|
|
|
import com.sun.star.sdbc.SQLException;
|
|
|
|
import com.sun.star.sdbc.XConnection;
|
|
|
|
import com.sun.star.sdbc.XResultSet;
|
|
|
|
import com.sun.star.sdbc.XResultSetUpdate;
|
|
|
|
import com.sun.star.sdbc.XRow;
|
|
|
|
import com.sun.star.sdbc.XRowSet;
|
|
|
|
import com.sun.star.sdbc.XRowUpdate;
|
2003-11-18 15:27:32 +00:00
|
|
|
import com.sun.star.task.XInteractionRequest;
|
2003-01-27 17:20:08 +00:00
|
|
|
import com.sun.star.text.XTextDocument;
|
2003-11-18 15:27:32 +00:00
|
|
|
import com.sun.star.uno.Any;
|
2003-09-08 10:47:02 +00:00
|
|
|
import com.sun.star.uno.AnyConverter;
|
|
|
|
import com.sun.star.uno.Type;
|
2003-01-27 17:20:08 +00:00
|
|
|
import com.sun.star.uno.UnoRuntime;
|
|
|
|
import com.sun.star.uno.XInterface;
|
2003-11-18 15:27:32 +00:00
|
|
|
import com.sun.star.util.Date;
|
|
|
|
import com.sun.star.util.DateTime;
|
|
|
|
import com.sun.star.util.Time;
|
2003-09-08 10:47:02 +00:00
|
|
|
import com.sun.star.util.XCloseable;
|
2003-01-27 17:20:08 +00:00
|
|
|
import com.sun.star.view.XControlAccess;
|
2003-11-18 15:27:32 +00:00
|
|
|
import ifc.form._XDatabaseParameterBroadcaster;
|
|
|
|
import ifc.sdb._XCompletedExecution;
|
2003-01-27 17:20:08 +00:00
|
|
|
|
2003-02-04 07:51:36 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
/**
|
|
|
|
* Test for object which is represented by service
|
|
|
|
* <code>com.sun.star.form.component.DatabaseForm</code>. <p>
|
|
|
|
*
|
|
|
|
* Object implements the following interfaces :
|
|
|
|
* <ul>
|
|
|
|
* <li> <code>com::sun::star::script::XEventAttacherManager</code></li>
|
|
|
|
* <li> <code>com::sun::star::container::XElementAccess</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbcx::ResultSet</code></li>
|
|
|
|
* <li> <code>com::sun::star::container::XChild</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::XResultSetUpdate</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdb::XResultSetAccess</code></li>
|
|
|
|
* <li> <code>com::sun::star::form::FormComponent</code></li>
|
|
|
|
* <li> <code>com::sun::star::form::component::DataForm</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::XResultSetMetaDataSupplier</code></li>
|
|
|
|
* <li> <code>com::sun::star::container::XEnumerationAccess</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbcx::XDeleteRows</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdb::RowSet</code></li>
|
|
|
|
* <li> <code>com::sun::star::lang::XComponent</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::XRowSet</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::XRowUpdate</code></li>
|
|
|
|
* <li> <code>com::sun::star::form::XLoadable</code></li>
|
|
|
|
* <li> <code>com::sun::star::container::XNamed</code></li>
|
|
|
|
* <li> <code>com::sun::star::container::XIndexReplace</code></li>
|
|
|
|
* <li> <code>com::sun::star::io::XPersistObject</code></li>
|
|
|
|
* <li> <code>com::sun::star::container::XNameReplace</code></li>
|
|
|
|
* <li> <code>com::sun::star::container::XIndexContainer</code></li>
|
|
|
|
* <li> <code>com::sun::star::container::XNameAccess</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::XParameters</code></li>
|
|
|
|
* <li> <code>com::sun::star::util::XCancellable</code></li>
|
|
|
|
* <li> <code>com::sun::star::form::XReset</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::XCloseable</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbcx::XColumnsSupplier</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdb::XRowSetApproveBroadcaster</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::ResultSet</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::XResultSet</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::XRow</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::XColumnLocate</code></li>
|
|
|
|
* <li> <code>com::sun::star::awt::XTabControllerModel</code></li>
|
|
|
|
* <li> <code>com::sun::star::container::XIndexAccess</code></li>
|
|
|
|
* <li> <code>com::sun::star::form::XSubmit</code></li>
|
|
|
|
* <li> <code>com::sun::star::form::component::HTMLForm</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbcx::XRowLocate</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::XWarningsSupplier</code></li>
|
|
|
|
* <li> <code>com::sun::star::container::XNameContainer</code></li>
|
2007-06-04 12:34:15 +00:00
|
|
|
* <li> <code>com::sun::star::beans::XPropertyAccess</code></li>
|
|
|
|
* <li> <code>com::sun::star::beans::XPropertyContainer</code></li>
|
2003-01-27 17:20:08 +00:00
|
|
|
* <li> <code>com::sun::star::beans::XPropertySet</code></li>
|
|
|
|
* <li> <code>com::sun::star::sdbc::RowSet</code></li>
|
|
|
|
* </ul> <p>
|
|
|
|
*
|
|
|
|
* This object test <b> is NOT </b> designed to be run in several
|
|
|
|
* threads concurently.
|
|
|
|
* The following parameters in ini-file used by this test:
|
|
|
|
* <ul>
|
|
|
|
* <li><code>test.db.url</code> - URL to MySQL database.
|
|
|
|
* For example: <code>mysql://mercury:3306/api_current</code></li>
|
|
|
|
* <li><code>test.db.user</code> - user for MySQL database</li>
|
|
|
|
* <li><code>test.db.password</code> - password for MySQL database</li>
|
|
|
|
* </ul><p>
|
|
|
|
*
|
|
|
|
* @see com.sun.star.script.XEventAttacherManager
|
|
|
|
* @see com.sun.star.container.XElementAccess
|
|
|
|
* @see com.sun.star.sdbcx.ResultSet
|
|
|
|
* @see com.sun.star.container.XChild
|
|
|
|
* @see com.sun.star.sdbc.XResultSetUpdate
|
|
|
|
* @see com.sun.star.sdb.XResultSetAccess
|
|
|
|
* @see com.sun.star.form.FormComponent
|
|
|
|
* @see com.sun.star.form.component.DataForm
|
|
|
|
* @see com.sun.star.sdbc.XResultSetMetaDataSupplier
|
|
|
|
* @see com.sun.star.container.XEnumerationAccess
|
|
|
|
* @see com.sun.star.sdbcx.XDeleteRows
|
|
|
|
* @see com.sun.star.sdb.RowSet
|
|
|
|
* @see com.sun.star.lang.XComponent
|
|
|
|
* @see com.sun.star.sdbc.XRowSet
|
|
|
|
* @see com.sun.star.sdbc.XRowUpdate
|
|
|
|
* @see com.sun.star.form.XLoadable
|
|
|
|
* @see com.sun.star.container.XNamed
|
|
|
|
* @see com.sun.star.container.XIndexReplace
|
|
|
|
* @see com.sun.star.io.XPersistObject
|
|
|
|
* @see com.sun.star.container.XNameReplace
|
|
|
|
* @see com.sun.star.container.XIndexContainer
|
|
|
|
* @see com.sun.star.container.XNameAccess
|
|
|
|
* @see com.sun.star.sdbc.XParameters
|
|
|
|
* @see com.sun.star.util.XCancellable
|
|
|
|
* @see com.sun.star.form.XReset
|
|
|
|
* @see com.sun.star.sdbc.XCloseable
|
|
|
|
* @see com.sun.star.sdbcx.XColumnsSupplier
|
|
|
|
* @see com.sun.star.sdb.XRowSetApproveBroadcaster
|
|
|
|
* @see com.sun.star.sdbc.ResultSet
|
|
|
|
* @see com.sun.star.sdbc.XResultSet
|
|
|
|
* @see com.sun.star.sdbc.XRow
|
|
|
|
* @see com.sun.star.sdbc.XColumnLocate
|
|
|
|
* @see com.sun.star.awt.XTabControllerModel
|
|
|
|
* @see com.sun.star.container.XIndexAccess
|
|
|
|
* @see com.sun.star.form.XSubmit
|
|
|
|
* @see com.sun.star.form.component.HTMLForm
|
|
|
|
* @see com.sun.star.sdbcx.XRowLocate
|
|
|
|
* @see com.sun.star.sdbc.XWarningsSupplier
|
|
|
|
* @see com.sun.star.container.XNameContainer
|
|
|
|
* @see com.sun.star.beans.XPropertySet
|
|
|
|
* @see com.sun.star.sdbc.RowSet
|
|
|
|
* @see ifc.script._XEventAttacherManager
|
|
|
|
* @see ifc.container._XElementAccess
|
|
|
|
* @see ifc.sdbcx._ResultSet
|
|
|
|
* @see ifc.container._XChild
|
|
|
|
* @see ifc.sdbc._XResultSetUpdate
|
|
|
|
* @see ifc.sdb._XResultSetAccess
|
|
|
|
* @see ifc.form._FormComponent
|
|
|
|
* @see ifc.form.component._DataForm
|
|
|
|
* @see ifc.sdbc._XResultSetMetaDataSupplier
|
|
|
|
* @see ifc.container._XEnumerationAccess
|
|
|
|
* @see ifc.sdbcx._XDeleteRows
|
|
|
|
* @see ifc.sdb._RowSet
|
|
|
|
* @see ifc.lang._XComponent
|
|
|
|
* @see ifc.sdbc._XRowSet
|
|
|
|
* @see ifc.sdbc._XRowUpdate
|
|
|
|
* @see ifc.form._XLoadable
|
|
|
|
* @see ifc.container._XNamed
|
|
|
|
* @see ifc.container._XIndexReplace
|
|
|
|
* @see ifc.io._XPersistObject
|
|
|
|
* @see ifc.container._XNameReplace
|
|
|
|
* @see ifc.container._XIndexContainer
|
|
|
|
* @see ifc.container._XNameAccess
|
|
|
|
* @see ifc.sdbc._XParameters
|
|
|
|
* @see ifc.util._XCancellable
|
|
|
|
* @see ifc.form._XReset
|
|
|
|
* @see ifc.sdbc._XCloseable
|
|
|
|
* @see ifc.sdbcx._XColumnsSupplier
|
|
|
|
* @see ifc.sdb._XRowSetApproveBroadcaster
|
|
|
|
* @see ifc.sdbc._ResultSet
|
|
|
|
* @see ifc.sdbc._XResultSet
|
|
|
|
* @see ifc.sdbc._XRow
|
|
|
|
* @see ifc.sdbc._XColumnLocate
|
|
|
|
* @see ifc.awt._XTabControllerModel
|
|
|
|
* @see ifc.container._XIndexAccess
|
|
|
|
* @see ifc.form._XSubmit
|
|
|
|
* @see ifc.form.component._HTMLForm
|
|
|
|
* @see ifc.sdbcx._XRowLocate
|
|
|
|
* @see ifc.sdbc._XWarningsSupplier
|
|
|
|
* @see ifc.container._XNameContainer
|
2007-06-04 12:34:15 +00:00
|
|
|
* @see ifc.beans._XPropertyAccess
|
|
|
|
* @see ifc.beans._XPropertyContainer
|
2003-01-27 17:20:08 +00:00
|
|
|
* @see ifc.beans._XPropertySet
|
|
|
|
* @see ifc.sdbc._RowSet
|
|
|
|
*/
|
|
|
|
public class ODatabaseForm extends TestCase {
|
2003-09-08 10:47:02 +00:00
|
|
|
protected final static String dbSourceName = "ODatabaseFormDataSource";
|
|
|
|
private static int uniqueSuffix = 0;
|
|
|
|
private static String origDB = null;
|
|
|
|
private static String tmpDir = null;
|
2003-02-04 07:51:36 +00:00
|
|
|
protected XTextDocument xTextDoc = null;
|
2003-09-08 10:47:02 +00:00
|
|
|
private DBTools dbTools = null;
|
2003-01-27 17:20:08 +00:00
|
|
|
String tableName = null;
|
|
|
|
DBTools.DataSourceInfo srcInf = null;
|
|
|
|
boolean isMySQLDB = false;
|
|
|
|
protected XConnection conn = null;
|
2005-02-24 16:42:37 +00:00
|
|
|
private Object dbSrc = null;
|
2003-01-27 17:20:08 +00:00
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
protected void initialize(TestParameters tParam, PrintWriter log) {
|
2003-02-04 07:51:36 +00:00
|
|
|
//log.println( "creating a draw document" );
|
2003-09-08 10:47:02 +00:00
|
|
|
//xTextDoc = WriterTools.createTextDoc(t((XMultiServiceFactory) Param.getMSF));
|
|
|
|
tmpDir = utils.getOfficeTemp(((XMultiServiceFactory) tParam.getMSF()));
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
origDB = util.utils.getFullTestDocName("TestDB/testDB.dbf");
|
|
|
|
|
dba33a: summary migration from SVN
2009-11-06 13:10:39 +0000 msc r277387 : minor fix for automatic test
2009-11-06 13:09:33 +0000 msc r277385 : minor fix for automatic test
2009-11-06 12:30:57 +0000 fs r277383 : argh. On some virtual machines, waiting 5 seconds for the event to arrive is not enough. Increasing the timeout ...
2009-11-06 12:13:34 +0000 fs r277382 : this diagnostic code should not have slipped in
2009-11-05 13:21:06 +0000 fs r277369 : SHL2NOCHECK=TRUE (requested by hjs)
2009-11-04 14:09:46 +0000 msc r277355 : minor fix for automatic testing
2009-11-04 13:23:02 +0000 msc r277352 : minor fix for automatic testing
2009-11-04 10:53:28 +0000 msc r277341 : minor fix for automated testscript
2009-11-04 08:30:58 +0000 msc r277333 : minor fix for automatic test
2009-11-04 08:15:43 +0000 msc r277332 : minor fix for automatic test
2009-11-03 14:25:44 +0000 fs r277324 : #i10000#
2009-11-03 09:47:47 +0000 fs r277315 : found yet another help ID zombie ... moved formhelpid.hrc content to propctrlr.hrc, where it belongs
2009-11-03 08:50:24 +0000 fs r277312 : use createTempFileURL, which cares for some more specialities ...
2009-11-03 08:44:55 +0000 fs r277311 : when creating a temp file for purpose of getting a temp file URL, the delete the file immediately. On some machines/JVMs, the file exists, with write access denied, which isn't Good (TM)
2009-10-22 13:06:17 +0000 fs r277126 : removed wrong assertion
2009-10-21 08:10:35 +0000 fs r277077 : reverted the previous change, which was nonsense
2009-10-21 07:19:43 +0000 fs r277076 : export the component_foo functions, now that some of the objects are built with VISIBILITY_HIDDEN=TRUE
2009-10-21 07:08:35 +0000 fs r277075 : spare useless call
2009-10-20 21:26:31 +0000 fs r277072 : #i10000#
2009-10-20 08:06:04 +0000 fs r277039 : CWS-TOOLING: rebase CWS dba33a to trunk@277035 (milestone: DEV300:m62)
2009-10-16 09:55:25 +0000 fs r276960 : remove one of the superfluous implts_doLayout calls introduced with the previous patch
2009-10-15 13:18:52 +0000 fs r276941 : removed the basic tests. According to cn, they're not used anymore (for a long time), and according to 'du -h', they take up 6.0M on my hard disc. For too much for useless code, /me thinks.
2009-10-15 13:06:51 +0000 fs r276940 : #i10000# remove useless include (otherwise the compiler warning it provokes would need to be fixed by declaring VISIBILITY_HIDDEN=TRUE in the makefile.mk)
2009-10-15 12:52:39 +0000 fs r276939 : #i10000#
2009-10-15 12:44:26 +0000 fs r276938 : #i10000#
2009-10-15 12:00:33 +0000 fs r276936 : #i10000#
2009-10-15 10:31:37 +0000 fs r276934 : #i105259# prepare for the Hidden arg
2009-10-15 10:31:05 +0000 fs r276933 : IsMaximized -> const
2009-10-15 09:50:15 +0000 fs r276932 : during #i105259#:
introduce an option to the layout manager to preserve, if possible, the size of the content window
when layouting. Enable this option for embedded (SFX-based) documents opened for outplace editing.
(the option is incompatible with in-place editing, anyway)
This is because such embedded objects couple the (content) window size to the VisAreaSize, in that
both are used interchangeably. When an embedded object is closed, it remembers the VisAreaSize,
and restores it upon next open. This, however, leads to different content window sizes when the
window is closed with another toolbar set than used during opening.
This patch here prevents those different content window sizes. Also, now the content window size
doesn't change when, explicitly or implicitly, a toolbar is shown or hidden. Instead, the content
window size stays the same, and the container window size is adjusted.
2009-10-15 09:32:41 +0000 fs r276931 : during #i105259#: UNO access to more attributes of top windows
2009-10-15 09:30:28 +0000 fs r276930 : indention corrected (better readable)
2009-10-15 09:26:46 +0000 fs r276929 : during #i105259#: access to more attributes of top windows
2009-10-14 10:04:39 +0000 fs r276889 : connecting via services manager, not naming service
2009-10-12 11:31:08 +0000 fs r276831 : during #i105806# FillPropertySet: do not attempt to set *AutoStyleName if it doesn't exist
2009-10-12 11:24:44 +0000 fs r276830 : #i105806# getPropertyValue: throw an UnknownPropertyException for, well, unknown properties
2009-10-08 08:20:58 +0000 fs r276774 : implSubmit: re-throw WrappedTargetExceptions unmodified
2009-10-07 19:19:42 +0000 fs r276770 : #i105198# do not pass an CommandType if we do not have a command
2009-10-07 17:39:36 +0000 fs r276768 : export the OWeakObject::disposeWeakConnectionPoint symbol
2009-10-07 12:59:17 +0000 fs r276754 : #i87693#
2009-10-07 11:19:22 +0000 fs r276752 : #i10000#
2009-10-07 10:21:08 +0000 fs r276748 : #105482# do not require a controller, at least not in *all* circumstances (executed reports have a model, the ReportDefinition, but no Controller)
2009-10-07 10:04:08 +0000 fs r276747 : copying the changes from CWS fwk121 herein, in particular the fix for
issue #i105371#
2009-10-07 09:58:30 +0000 fs r276746 : copying the changes from CWS fwk121 herein, in particular the fix for
issue #i105371#
2009-10-07 09:48:14 +0000 fs r276744 : removed (now) pointless assertion
2009-10-07 06:59:19 +0000 fs r276740 : export the OWeakObject::disposeWeakConnectionPoint symbol
2009-10-07 06:44:43 +0000 fs r276739 : OComponentHelper::release & WeakAggComponentImplHelperBase::release:
when our ref count drops to 0, call OWeakObject's disposeWeakConnectionPoint before (temporarily) incrementing
the ref count, again. This ensures that our adapter cannot create references to the dying object anymore.
(A complex test case in dbaccess (#i105505#) triggered such a situation, but in another class using an analogous
release/dispose/destroy pattern, namely WeakComponentImplHelperBase)
2009-10-07 06:37:20 +0000 fs r276738 : found during some new complex test cases: call disposeWeakConnectionPoint before actually starting to destroy the object, this ensures no other threads will resurrect it while it is dying
2009-10-06 21:58:24 +0000 fs r276734 : oops, two small corrections to the previous fix (hey, complex test cases are cool)
2009-10-06 21:51:16 +0000 fs r276733 : log the name of the data source which cannot be revoked
2009-10-06 21:50:41 +0000 fs r276732 : more detailed error message when cleanup fails
2009-10-06 21:50:01 +0000 fs r276731 : reworked the ModelImpl caching. The new and improved UNO API test for css.sdb.RowSet
revealed some inconsistencies, in whether the objects are cached by their URL, or by their
registration name. This has been changed to caching by registration name.
2009-10-06 13:50:34 +0000 fs r276714 : print diagnostics when we cannot clean up the test case
2009-10-06 13:45:02 +0000 fs r276713 : this test failed all the time, since the core (rightfully) threw an exception. Disabled it for the moment, until issue 84253 is fixed
2009-10-06 12:52:46 +0000 fs r276711 : rewrote this test. Now we do not re-use the same .odb across different test cases, as this leads to unreliable
(timing-dependent) results/failures. Instead, every test sets up a new odb file.
Also, did some re-factoring, improved the cleanup code, and caught a few more errors.
2009-10-06 12:51:07 +0000 fs r276710 : DBTools taking a logger now
2009-10-06 12:50:42 +0000 fs r276709 : taking a PrintWriter for logging purpose
2009-10-06 12:50:03 +0000 fs r276708 : DBTools taking a logger now
2009-10-06 12:49:22 +0000 fs r276707 : typo
2009-10-06 12:49:03 +0000 fs r276706 : typo
2009-10-06 12:48:52 +0000 fs r276705 : wrappers around some database-related services - initial versions only, to evolve over time, and intended to finally replace the DBTools class
2009-10-06 12:48:02 +0000 fs r276704 : typo
2009-10-06 12:38:42 +0000 fs r276702 : some better diagnostics, done during getting the API tests to work more reliably
2009-10-06 10:35:51 +0000 fs r276698 : when living in, e.g., the DataSourceBrowser, we can't expect to find an XModifiable2, so don't assert its existence
2009-10-05 12:47:52 +0000 oj r276677 : #i105607# check for read moved into if scope
2009-10-05 11:37:06 +0000 fs r276676 : when saving a file fails, retrieve the error message from the InteractionRequestStringResolver - this is better than any generic message we can create
2009-10-05 10:04:23 +0000 oj r276673 : #i105607# check for read moved into if scope
2009-10-05 09:46:17 +0000 fs r276671 : #i10000#
2009-10-05 08:43:58 +0000 fs r276664 : #i105505#
release: dispose the (base classes) weak connection point before disposing ourself,
and in particular before temporarily incrementing our ref count, again.
This way, we prevent that a separate thread re-surrects us (using the weak connection
point's queryAdapted) while we're in the process of destruction
2009-10-05 08:41:49 +0000 fs r276663 : #i105505# +disposeWeakConnectionPoint (outsourced into dedicated method from ::release)
2009-10-05 08:40:26 +0000 fs r276662 : no need to derived from OSubComponent, its features are not used, directly derive from WeakComponentImplFoo instead
2009-10-05 08:39:38 +0000 fs r276661 : #i105505# diagnostics
2009-10-05 08:39:16 +0000 fs r276660 : #i105505# +testDocumentRevenants
2009-10-05 08:36:01 +0000 fs r276659 : #i105560# reverted the removal of GenericController::openHelpAgent - this is needed in module reportdesign
2009-10-04 19:53:30 +0000 fs r276657 : #105560#
remove unused code
thanks to cmc@openoffice.org for submitting the patch
2009-10-04 19:50:28 +0000 fs r276656 : #i105550# remove unused 'fire' method (thanks to cmc)
2009-10-03 16:13:15 +0000 fs r276655 : CWS-TOOLING: rebase CWS dba33a to trunk@276429 (milestone: DEV300:m60)
2009-10-02 19:20:48 +0000 fs r276651 : #i104117# lotta changed IDs ...
2009-10-02 10:52:24 +0000 fs r276634 : #i105505#
If a model is created, and is a revenant of a previous incarnation, then ensure it is properly initialized.
In particular, in its ctor, set the state to "Initializing", not "Initialized", and then let the ModelImpl
call attachResource. This ensures that the model is initialized completely, including firing the necessary
events.
2009-10-02 10:51:08 +0000 fs r276633 : #i105505# always do an attachResource at the newly loaded model, even if it (internally) was not really loaded, but only a revenant of a previous incarnation of this document
2009-10-01 11:10:13 +0000 fs r276597 : do not rely on the name 'Standard' for the one and only form in a document
2009-10-01 10:36:29 +0000 fs r276590 : #i105509# don't rely on default form component names, use indexes
2009-10-01 09:12:20 +0000 fs r276582 : #i105505#
2009-09-30 07:55:21 +0000 fs r276542 : removed some unsed methods / spared some unnecessary pixel<->logic conversion
2009-09-30 07:53:22 +0000 fs r276541 : removed unneeded methods
2009-09-30 06:35:59 +0000 fs r276538 : #i10000#
2009-09-29 13:45:02 +0000 fs r276531 : refactored the Roadmap* classes, to be able to fix above-mentioned #i105113#
2009-09-29 10:27:10 +0000 fs r276520 : #i105367#
2009-09-29 08:46:45 +0000 fs r276510 : #i104956# cleaned up the makefiles
2009-09-28 21:00:07 +0000 fs r276505 : #i104117# sourced those IDs out from extension.hrc
2009-09-28 20:59:05 +0000 fs r276504 : no need to let one FREE...
2009-09-28 20:53:36 +0000 fs r276503 : #i104117#
cleaned up the mess with help IDs in module extensions.
Formerly, extensions used to use help IDs which were declared in module svx, and vice versa.
Also, help ID ranges were not respected.
2009-09-28 11:25:36 +0000 fs r276489 : typo
2009-09-28 11:25:10 +0000 fs r276488 : #i105235#
2009-09-24 11:53:16 +0000 fs r276423 : #i105234# do not zoom the control when they view information is still uninitialized (happens at least in Writer when opening a form document)
2009-09-24 09:42:28 +0000 fs r276415 : #i105234# proper zoom handling for the nav bar
2009-09-24 09:42:19 +0000 fs r276414 : #i105234# setZoom: care for precision errors caused by implicit conversion float->double
2009-09-16 11:11:43 +0000 fs r276195 : #i105082#
consolidated the sub storage handling, by delegating more functionality into
the DocumentStorageAccess class. As a result, there won't be that many unnecessary
commits anymore. Also, the two different storage caches (in ModelImpl::m_aStorages
and DocumentStorageAccess::m_aExposedStorages) have been consolidated.
This is not really part of the fix of issue 105082, but it helped reducing the
calls to the storage/package implementation.
2009-09-15 21:42:27 +0000 fs r276190 : don't calculate space for BOLD if the text is not really bold (speeds up rendering for large tree structures)
2009-09-15 20:20:23 +0000 fs r276188 : getTypeInfo: fill m_aTypeInfoRows only if really all type infos could be retrieved
2009-09-15 20:19:29 +0000 fs r276187 : do not continue loading when the controller initialization throws an error
2009-09-14 12:25:57 +0000 fs r276119 : oops, this patch was not intended for this CWS
2009-09-14 12:13:57 +0000 fs r276114 : #cr6875455# introduce a ReferenceDevice property for various control models
2009-09-14 10:33:02 +0000 fs r276106 : removed dead file
2009-09-09 08:37:31 +0000 fs r275972 : remove OSL_TRACE in VCLXButton dtor
2009-09-08 11:19:17 +0000 oj r275926 : i76534# remove mnemonic from fixed text
2009-09-07 08:39:37 +0000 fs r275874 : create CWS dba33a from cws/dba32g@275857 (CWS: dba32g)
2009-11-27 12:39:32 +00:00
|
|
|
dbTools = new DBTools( (XMultiServiceFactory)tParam.getMSF(), log );
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
// creating DataSource and registering it in DatabaseContext
|
|
|
|
String dbURL = (String) tParam.get("test.db.url");
|
|
|
|
String dbUser = (String) tParam.get("test.db.user");
|
|
|
|
String dbPassword = (String) tParam.get("test.db.password");
|
|
|
|
|
|
|
|
log.println("Creating and registering DataSource ...");
|
|
|
|
srcInf = dbTools.newDataSourceInfo();
|
2003-09-08 10:47:02 +00:00
|
|
|
|
|
|
|
if ((dbURL != null) && (dbUser != null) && (dbPassword != null)) {
|
2003-01-27 17:20:08 +00:00
|
|
|
isMySQLDB = true;
|
|
|
|
log.println("dbURL = " + dbURL);
|
|
|
|
log.println("dbUSER = " + dbUser);
|
|
|
|
log.println("dbPASSWORD = " + dbPassword);
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
//DataSource for mysql db
|
|
|
|
try {
|
|
|
|
tableName = "soffice_test_table";
|
|
|
|
srcInf.URL = "jdbc:" + dbURL;
|
|
|
|
srcInf.IsPasswordRequired = new Boolean(true);
|
|
|
|
srcInf.Password = dbPassword;
|
|
|
|
srcInf.User = dbUser;
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
PropertyValue[] propInfo = new PropertyValue[1];
|
|
|
|
propInfo[0] = new PropertyValue();
|
|
|
|
propInfo[0].Name = "JavaDriverClass";
|
2003-11-18 15:27:32 +00:00
|
|
|
// propInfo[0].Value = "org.gjt.mm.mysql.Driver";
|
|
|
|
propInfo[0].Value = "util.dddriver.Driver";
|
2003-01-27 17:20:08 +00:00
|
|
|
srcInf.Info = propInfo;
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2005-02-24 16:42:37 +00:00
|
|
|
dbSrc = srcInf.getDataSourceService();
|
2003-01-27 17:20:08 +00:00
|
|
|
dbTools.reRegisterDB(dbSourceName, dbSrc);
|
|
|
|
} catch (com.sun.star.uno.Exception e) {
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("Error while object test initialization :");
|
|
|
|
e.printStackTrace(log);
|
2003-01-27 17:20:08 +00:00
|
|
|
throw new StatusException("Error while object test" +
|
2003-09-08 10:47:02 +00:00
|
|
|
" initialization", e);
|
2003-01-27 17:20:08 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//DataSource for sdbc db
|
|
|
|
try {
|
2005-11-02 16:50:10 +00:00
|
|
|
String myDbUrl = "sdbc:dbase:" + DBTools.dirToUrl(tmpDir);
|
|
|
|
srcInf.URL = myDbUrl;
|
|
|
|
|
|
|
|
log.println("try to register '"+myDbUrl+"' as '"+dbSourceName+"'");
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2005-02-24 16:42:37 +00:00
|
|
|
dbSrc = srcInf.getDataSourceService();
|
2003-09-08 10:47:02 +00:00
|
|
|
dbTools.reRegisterDB(dbSourceName, dbSrc);
|
2003-01-27 17:20:08 +00:00
|
|
|
} catch (com.sun.star.uno.Exception e) {
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("Error while object test initialization :");
|
|
|
|
e.printStackTrace(log);
|
|
|
|
throw new StatusException(
|
|
|
|
"Error while object test initialization", e);
|
2003-01-27 17:20:08 +00:00
|
|
|
}
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
String oldF = null;
|
|
|
|
String newF = null;
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
do {
|
2003-09-08 10:47:02 +00:00
|
|
|
tableName = "ODatabaseForm_tmp" + uniqueSuffix;
|
2003-01-27 17:20:08 +00:00
|
|
|
oldF = utils.getFullURL(origDB);
|
2003-09-08 10:47:02 +00:00
|
|
|
newF = utils.getOfficeTemp((XMultiServiceFactory) tParam.getMSF()) + tableName +
|
|
|
|
".dbf";
|
2010-04-28 11:08:02 +02:00
|
|
|
} while (!utils.tryOverwriteFile(((XMultiServiceFactory) tParam.getMSF()), oldF, newF) &&
|
2003-09-08 10:47:02 +00:00
|
|
|
(uniqueSuffix++ < 50));
|
|
|
|
}
|
2003-01-27 17:20:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* * creating a Testenvironment for the interfaces to be tested
|
|
|
|
*/
|
2003-09-08 10:47:02 +00:00
|
|
|
protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
|
|
|
|
PrintWriter log) {
|
2003-02-04 07:51:36 +00:00
|
|
|
if (xTextDoc != null) {
|
2003-09-08 10:47:02 +00:00
|
|
|
try {
|
|
|
|
XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
|
|
|
|
XCloseable.class, xTextDoc);
|
|
|
|
closer.close(true);
|
|
|
|
} catch (com.sun.star.util.CloseVetoException e) {
|
|
|
|
log.println("couldn't close document");
|
|
|
|
} catch (com.sun.star.lang.DisposedException e) {
|
|
|
|
log.println("couldn't close document");
|
|
|
|
}
|
|
|
|
|
|
|
|
log.println("Existing document disposed");
|
2003-02-04 07:51:36 +00:00
|
|
|
}
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("creating a text document");
|
|
|
|
xTextDoc = WriterTools.createTextDoc(((XMultiServiceFactory) Param.getMSF()));
|
2003-02-04 07:51:36 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
//initialize test table
|
|
|
|
if (isMySQLDB) {
|
|
|
|
try {
|
|
|
|
dbTools.initTestTableUsingJDBC(tableName, srcInf);
|
2003-09-08 10:47:02 +00:00
|
|
|
} catch (java.sql.SQLException e) {
|
2003-01-27 17:20:08 +00:00
|
|
|
e.printStackTrace(log);
|
2003-09-08 10:47:02 +00:00
|
|
|
throw new StatusException(Status.failed("Couldn't " + " init test table. SQLException..."));
|
|
|
|
} catch (java.lang.ClassNotFoundException e) {
|
|
|
|
throw new StatusException(Status.failed("Couldn't " + "register mysql driver"));
|
2003-01-27 17:20:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
XInterface oObj = null;
|
|
|
|
XShapes oShapes = null;
|
|
|
|
XInterface oInstance = null;
|
2003-09-08 10:47:02 +00:00
|
|
|
XConnection connection = null;
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
// creation of testobject here
|
|
|
|
// first we write what we are intend to do to log file
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("creating a test environment");
|
|
|
|
|
|
|
|
XNameContainer forms = FormTools.getForms(WriterTools.getDrawPage(
|
|
|
|
xTextDoc));
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
String[] formNames = forms.getElementNames();
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
for (int i = 0; i < formNames.length; i++) {
|
|
|
|
log.println("Removing form '" + formNames[i] + "' ...");
|
2003-09-08 10:47:02 +00:00
|
|
|
forms.removeByName(formNames[i]);
|
2003-01-27 17:20:08 +00:00
|
|
|
}
|
|
|
|
} catch (com.sun.star.lang.WrappedTargetException e) {
|
|
|
|
e.printStackTrace(log);
|
|
|
|
} catch (com.sun.star.container.NoSuchElementException e) {
|
|
|
|
e.printStackTrace(log);
|
|
|
|
}
|
|
|
|
|
|
|
|
String[] formNames = forms.getElementNames();
|
|
|
|
FormTools.insertForm(xTextDoc, forms, "MyForm");
|
|
|
|
formNames = forms.getElementNames();
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
XLoadable formLoader = null;
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
try {
|
2003-09-08 10:47:02 +00:00
|
|
|
formLoader = FormTools.bindForm(xTextDoc, "MyForm", dbSourceName,
|
|
|
|
tableName);
|
2003-01-27 17:20:08 +00:00
|
|
|
} catch (com.sun.star.uno.Exception e) {
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("Cann't bind the form to source '" + dbSourceName +
|
|
|
|
"', table '" + tableName + "' :");
|
2003-01-27 17:20:08 +00:00
|
|
|
e.printStackTrace(log);
|
|
|
|
throw new StatusException("Cann't bind a form", e);
|
|
|
|
}
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
// DEBUG
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("Forms before adding controls : ");
|
|
|
|
formNames = forms.getElementNames();
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
for (int i = 0; i < formNames.length; i++) {
|
|
|
|
log.println(" '" + formNames[i] + "'");
|
|
|
|
}
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
XControlShape shape1 = null;
|
|
|
|
XControlShape shape2 = null;
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
try {
|
2003-09-08 10:47:02 +00:00
|
|
|
|
|
|
|
log.println("Elements in the 'MyForm' :");
|
|
|
|
|
|
|
|
XIndexAccess formElements1 = (XIndexAccess) UnoRuntime.queryInterface(
|
|
|
|
XIndexAccess.class,
|
|
|
|
forms.getByName("MyForm"));
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
for (int i = 0; i < formElements1.getCount(); i++) {
|
2003-09-08 10:47:02 +00:00
|
|
|
XNamed elemName = (XNamed) UnoRuntime.queryInterface(
|
|
|
|
XNamed.class,
|
|
|
|
formElements1.getByIndex(i));
|
2003-01-27 17:20:08 +00:00
|
|
|
log.println(" '" + elemName.getName() + "'");
|
|
|
|
}
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
|
|
|
|
// END DEBUG
|
2003-01-27 17:20:08 +00:00
|
|
|
//put something on the drawpage
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("inserting some ControlShapes");
|
2003-01-27 17:20:08 +00:00
|
|
|
oShapes = DrawTools.getShapes(WriterTools.getDrawPage(xTextDoc));
|
2003-09-08 10:47:02 +00:00
|
|
|
shape1 = FormTools.createControlShape(xTextDoc, 3000, 4500, 15000,
|
|
|
|
1000, "CommandButton");
|
|
|
|
shape2 = FormTools.createControlShape(xTextDoc, 5000, 3500, 7500,
|
|
|
|
5000, "TextField");
|
|
|
|
|
|
|
|
XControlShape shape3 = FormTools.createControlShape(xTextDoc, 2000,
|
|
|
|
1500, 1000,
|
|
|
|
1000,
|
|
|
|
"CheckBox");
|
2003-01-27 17:20:08 +00:00
|
|
|
oShapes.add((XShape) shape1);
|
|
|
|
oShapes.add((XShape) shape2);
|
2003-09-08 10:47:02 +00:00
|
|
|
oShapes.add(shape3);
|
2003-01-27 17:20:08 +00:00
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace(log);
|
|
|
|
}
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("Forms after adding controls : ");
|
|
|
|
formNames = forms.getElementNames();
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
for (int i = 0; i < formNames.length; i++) {
|
|
|
|
log.println(" '" + formNames[i] + "'");
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("Elements in the 'MyForm' :");
|
|
|
|
|
|
|
|
XIndexAccess formElements1 = (XIndexAccess) UnoRuntime.queryInterface(
|
|
|
|
XIndexAccess.class,
|
|
|
|
forms.getByName("MyForm"));
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
for (int i = 0; i < formElements1.getCount(); i++) {
|
2003-09-08 10:47:02 +00:00
|
|
|
XNamed elemName = (XNamed) UnoRuntime.queryInterface(
|
|
|
|
XNamed.class,
|
|
|
|
formElements1.getByIndex(i));
|
2003-01-27 17:20:08 +00:00
|
|
|
log.println(" '" + elemName.getName() + "'");
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace(log);
|
|
|
|
}
|
|
|
|
|
|
|
|
formLoader.load();
|
|
|
|
|
|
|
|
try {
|
2003-02-04 07:51:36 +00:00
|
|
|
oObj = (XForm) AnyConverter.toObject(new Type(XForm.class),
|
2003-09-08 10:47:02 +00:00
|
|
|
(FormTools.getForms(
|
|
|
|
WriterTools.getDrawPage(
|
|
|
|
xTextDoc)))
|
|
|
|
.getByName("MyForm"));
|
|
|
|
|
|
|
|
XPropertySet xSetProp = (XPropertySet) UnoRuntime.queryInterface(
|
|
|
|
XPropertySet.class, oObj);
|
|
|
|
connection = (XConnection) AnyConverter.toObject(
|
|
|
|
new Type(XConnection.class),
|
|
|
|
xSetProp.getPropertyValue("ActiveConnection"));
|
|
|
|
} catch (com.sun.star.uno.Exception e) {
|
2003-01-27 17:20:08 +00:00
|
|
|
log.println("Couldn't get Form");
|
|
|
|
e.printStackTrace(log);
|
|
|
|
}
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
// get a control
|
|
|
|
oInstance = FormTools.createControl(xTextDoc, "TextField");
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("creating a new environment for drawpage object");
|
|
|
|
|
|
|
|
TestEnvironment tEnv = new TestEnvironment(oObj);
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
// adding relation for closing connection while environment disposing.
|
|
|
|
this.conn = connection;
|
|
|
|
|
|
|
|
// adding relation for XSubmit
|
2003-09-08 10:47:02 +00:00
|
|
|
XControlModel the_Model = shape2.getControl();
|
2003-01-27 17:20:08 +00:00
|
|
|
XControlAccess the_access = (XControlAccess) UnoRuntime.queryInterface(
|
2003-09-08 10:47:02 +00:00
|
|
|
XControlAccess.class,
|
|
|
|
xTextDoc.getCurrentController());
|
|
|
|
XControl cntrl = null;
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
//now get the OEditControl
|
|
|
|
try {
|
|
|
|
cntrl = the_access.getControl(the_Model);
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println(cntrl.getClass().getName());
|
2003-01-27 17:20:08 +00:00
|
|
|
} catch (com.sun.star.container.NoSuchElementException e) {
|
|
|
|
log.println("Couldn't get OEditControl");
|
|
|
|
e.printStackTrace(log);
|
2003-09-08 10:47:02 +00:00
|
|
|
throw new StatusException("Couldn't get OEditControl", e);
|
2003-01-27 17:20:08 +00:00
|
|
|
}
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
XResultSet the_set = (XResultSet) UnoRuntime.queryInterface(
|
|
|
|
XResultSet.class, oObj);
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
the_set.first();
|
|
|
|
} catch (SQLException e) {
|
|
|
|
log.println("Cann't move cursor to the first row.");
|
2003-11-18 15:27:32 +00:00
|
|
|
e.printStackTrace();
|
|
|
|
throw new StatusException("Can't move cursor to the first row.", e);
|
2003-01-27 17:20:08 +00:00
|
|
|
}
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
tEnv.addObjRelation("Model1", shape1.getControl());
|
|
|
|
tEnv.addObjRelation("Model2", shape2.getControl());
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
// adding an object for XNameReplace testing
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("adding oInstace as obj relation to environment");
|
2003-01-27 17:20:08 +00:00
|
|
|
tEnv.addObjRelation("INSTANCE", oInstance);
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
// INDEX : _XNameContainer
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("adding INDEX as obj relation to environment");
|
2003-01-27 17:20:08 +00:00
|
|
|
tEnv.addObjRelation("INDEX", "0");
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
// INDEX : _XNameReplace
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("adding NameReplaceIndex as obj relation to environment");
|
2003-01-27 17:20:08 +00:00
|
|
|
tEnv.addObjRelation("XNameReplaceINDEX", "2");
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
// INSTANCEn : _XNameContainer; _XNameReplace
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("adding INSTANCEn as obj relation to environment");
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
//XComponent xComp = (XComponent)
|
|
|
|
// UnoRuntime.queryInterface(XComponent.class, xDrawDoc);
|
2003-09-08 10:47:02 +00:00
|
|
|
String tc = (String) Param.get("THRCNT");
|
2003-01-27 17:20:08 +00:00
|
|
|
int THRCNT = 1;
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
if (tc != null) {
|
|
|
|
THRCNT = Integer.parseInt(tc);
|
|
|
|
}
|
2003-09-08 10:47:02 +00:00
|
|
|
|
|
|
|
for (int n = 1; n < (2 * (THRCNT + 1)); n++) {
|
|
|
|
log.println("adding INSTANCE" + n +
|
|
|
|
" as obj relation to environment");
|
2003-01-27 17:20:08 +00:00
|
|
|
tEnv.addObjRelation("INSTANCE" + n,
|
2003-09-08 10:47:02 +00:00
|
|
|
FormTools.createControl(xTextDoc, "CheckBox"));
|
2003-01-27 17:20:08 +00:00
|
|
|
}
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
// adding relation for XNameContainer
|
|
|
|
tEnv.addObjRelation("XNameContainer.AllowDuplicateNames", new Object());
|
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
// adding relation for XPersistObject
|
2003-09-08 10:47:02 +00:00
|
|
|
tEnv.addObjRelation("OBJNAME", "stardiv.one.form.component.Form");
|
|
|
|
|
|
|
|
if (the_set != null) {
|
|
|
|
log.println("The Form has a not empty ResultSet");
|
|
|
|
}
|
|
|
|
|
|
|
|
// Adding obj relation for XRowSetApproveBroadcaster test
|
|
|
|
final XResultSet xResSet = (XResultSet) UnoRuntime.queryInterface(
|
|
|
|
XResultSet.class, oObj);
|
|
|
|
final XResultSetUpdate xResSetUpdate = (XResultSetUpdate) UnoRuntime.queryInterface(
|
|
|
|
XResultSetUpdate.class,
|
|
|
|
oObj);
|
|
|
|
final XRowSet xRowSet = (XRowSet) UnoRuntime.queryInterface(
|
|
|
|
XRowSet.class, oObj);
|
|
|
|
final PrintWriter logF = log;
|
|
|
|
tEnv.addObjRelation("XRowSetApproveBroadcaster.ApproveChecker",
|
|
|
|
new ifc.sdb._XRowSetApproveBroadcaster.RowSetApproveChecker() {
|
|
|
|
public void moveCursor() {
|
|
|
|
try {
|
|
|
|
xResSet.beforeFirst();
|
|
|
|
xResSet.afterLast();
|
|
|
|
} catch (com.sun.star.sdbc.SQLException e) {
|
|
|
|
logF.println("### _XRowSetApproveBroadcaster." + "RowSetApproveChecker.moveCursor() :");
|
|
|
|
e.printStackTrace(logF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public RowChangeEvent changeRow() {
|
|
|
|
try {
|
|
|
|
xResSet.first();
|
|
|
|
|
|
|
|
XRowUpdate row = (XRowUpdate) UnoRuntime.queryInterface(
|
|
|
|
XRowUpdate.class, xResSet);
|
|
|
|
row.updateString(1, "1");
|
|
|
|
xResSetUpdate.updateRow();
|
|
|
|
} catch (com.sun.star.sdbc.SQLException e) {
|
|
|
|
logF.println("### _XRowSetApproveBroadcaster." + "RowSetApproveChecker.changeRow() :");
|
|
|
|
e.printStackTrace(logF);
|
|
|
|
}
|
|
|
|
|
|
|
|
RowChangeEvent ev = new RowChangeEvent();
|
|
|
|
ev.Action = com.sun.star.sdb.RowChangeAction.UPDATE;
|
|
|
|
ev.Rows = 1;
|
|
|
|
|
|
|
|
return ev;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void changeRowSet() {
|
|
|
|
try {
|
|
|
|
xRowSet.execute();
|
|
|
|
} catch (com.sun.star.sdbc.SQLException e) {
|
|
|
|
logF.println("### _XRowSetApproveBroadcaster." + "RowSetApproveChecker.changeRowSet() :");
|
|
|
|
e.printStackTrace(logF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
// Adding relation for XColumnLocate test
|
2003-09-08 10:47:02 +00:00
|
|
|
tEnv.addObjRelation("XColumnLocate.ColumnName", DBTools.TST_STRING_F);
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
// Adding relation for XParameters ifc test
|
2003-09-08 10:47:02 +00:00
|
|
|
Vector params = new Vector();
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
/***** statement parameter types and their initial
|
2003-11-18 15:27:32 +00:00
|
|
|
values must be added here as relation. */
|
2003-01-27 17:20:08 +00:00
|
|
|
params.add(new String("SAU99")) ;
|
|
|
|
params.add(new Boolean(false)) ;
|
|
|
|
params.add(new Byte((byte) 123)) ;
|
|
|
|
params.add(new Short((short) 234)) ;
|
|
|
|
params.add(new Integer(12345)) ;
|
|
|
|
params.add(new Long(23456)) ;
|
|
|
|
params.add(new Float(1.234)) ;
|
|
|
|
params.add(new Double(2.345)) ;
|
|
|
|
params.add(new byte[] {1, 2, 3}) ;
|
2003-11-18 15:27:32 +00:00
|
|
|
Date d = new Date();
|
|
|
|
d.Day = 26; d.Month = 1; d.Year = 2001;
|
|
|
|
params.add(d) ;
|
|
|
|
Time t = new Time();
|
|
|
|
t.Hours = 1; t.HundredthSeconds = 12; t.Minutes = 25; t.Seconds = 14;
|
|
|
|
params.add(t) ;
|
|
|
|
DateTime dt = new DateTime();
|
|
|
|
dt.Day = 26; dt.Month = 1; dt.Year = 2001; dt.Hours = 1;
|
|
|
|
dt.HundredthSeconds = 12; dt.Minutes = 25; dt.Seconds = 14;
|
|
|
|
params.add(dt) ;
|
2003-09-08 10:47:02 +00:00
|
|
|
tEnv.addObjRelation("XParameters.ParamValues", params);
|
2003-01-27 17:20:08 +00:00
|
|
|
|
2003-11-18 15:27:32 +00:00
|
|
|
// Adding relation for XCompletedExecution
|
|
|
|
tEnv.addObjRelation("InteractionHandlerChecker", new InteractionHandlerImpl());
|
|
|
|
|
|
|
|
// Adding for XWarningSupplier
|
|
|
|
tEnv.addObjRelation("CheckWarningsSupplier", new Boolean(isMySQLDB));
|
|
|
|
|
|
|
|
// Adding relation for XDatabaseParameterBroadcaster
|
|
|
|
tEnv.addObjRelation("ParameterListenerChecker", new ODatabaseForm.ParameterListenerImpl());
|
|
|
|
XPropertySet xSetProp = (XPropertySet) UnoRuntime.queryInterface
|
|
|
|
(XPropertySet.class, oObj) ;
|
|
|
|
try {
|
|
|
|
xSetProp.setPropertyValue("DataSourceName", dbSourceName) ;
|
|
|
|
if(isMySQLDB) {
|
|
|
|
xSetProp.setPropertyValue("Command", "SELECT Column0 FROM soffice_test_table WHERE ( ( Column0 = :param1 ) )");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
xSetProp.setPropertyValue("Command", "SELECT \"_TEXT\" FROM \"ODatabaseForm_tmp0\" WHERE ( ( \"_TEXT\" = :param1 ) )");
|
|
|
|
}
|
|
|
|
|
|
|
|
xSetProp.setPropertyValue("CommandType",
|
|
|
|
new Integer(CommandType.COMMAND)) ;
|
|
|
|
}
|
|
|
|
catch(Exception e) {
|
|
|
|
}
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
// Adding relation for XResultSetUpdate
|
2003-09-08 10:47:02 +00:00
|
|
|
final XRowUpdate xRowUpdate = (XRowUpdate) UnoRuntime.queryInterface(
|
|
|
|
XRowUpdate.class, oObj);
|
|
|
|
final XRow xRow = (XRow) UnoRuntime.queryInterface(XRow.class, oObj);
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
tEnv.addObjRelation("XResultSetUpdate.UpdateTester",
|
2003-09-08 10:47:02 +00:00
|
|
|
new ifc.sdbc._XResultSetUpdate.UpdateTester() {
|
|
|
|
String lastUpdate = null;
|
2003-01-27 17:20:08 +00:00
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
public int rowCount() throws SQLException {
|
|
|
|
int prevPos = xResSet.getRow();
|
|
|
|
xResSet.last();
|
2003-01-27 17:20:08 +00:00
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
int count = xResSet.getRow();
|
|
|
|
xResSet.absolute(prevPos);
|
2003-01-27 17:20:08 +00:00
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
return count;
|
|
|
|
}
|
2003-01-27 17:20:08 +00:00
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
public void update() throws SQLException {
|
|
|
|
lastUpdate = xRow.getString(1);
|
|
|
|
lastUpdate += "_";
|
|
|
|
xRowUpdate.updateString(1, lastUpdate);
|
|
|
|
}
|
2003-01-27 17:20:08 +00:00
|
|
|
|
2003-09-08 10:47:02 +00:00
|
|
|
public boolean wasUpdated() throws SQLException {
|
|
|
|
String getStr = xRow.getString(1);
|
|
|
|
|
|
|
|
return lastUpdate.equals(getStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
public int currentRow() throws SQLException {
|
|
|
|
return xResSet.getRow();
|
|
|
|
}
|
|
|
|
});
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
// Adding relations for XRow as a Vector with all data
|
|
|
|
// of current row of RowSet.
|
|
|
|
|
|
|
|
Vector rowData = new Vector();
|
|
|
|
|
|
|
|
for (int i = 0; i < DBTools.TST_TABLE_VALUES[0].length; i++) {
|
|
|
|
rowData.add(DBTools.TST_TABLE_VALUES[0][i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
tEnv.addObjRelation("CurrentRowData", rowData);
|
|
|
|
|
|
|
|
// Adding relation for XRowUpdate
|
|
|
|
XRow row = (XRow) UnoRuntime.queryInterface(XRow.class, oObj);
|
|
|
|
tEnv.addObjRelation("XRowUpdate.XRow", row);
|
|
|
|
|
2007-06-04 12:34:15 +00:00
|
|
|
|
|
|
|
tEnv.addObjRelation("XPropertyContainer.propertyNotRemovable", "Cycle");
|
|
|
|
|
|
|
|
PropertyValue propVal = new PropertyValue();
|
|
|
|
propVal.Name = "Name";
|
|
|
|
propVal.Value = "Text since XPropertyAccess";
|
|
|
|
|
|
|
|
tEnv.addObjRelation("XPropertyAccess.propertyToChange", propVal);
|
|
|
|
|
2003-01-27 17:20:08 +00:00
|
|
|
return tEnv;
|
|
|
|
} // finish method getTestEnvironment
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Closes connection of <code>RowSet</code> instance created.
|
|
|
|
*/
|
2003-09-08 10:47:02 +00:00
|
|
|
protected void cleanup(TestParameters Param, PrintWriter log) {
|
2005-02-24 16:42:37 +00:00
|
|
|
log.println("closing connection...");
|
2003-01-27 17:20:08 +00:00
|
|
|
try {
|
|
|
|
conn.close();
|
|
|
|
} catch (com.sun.star.uno.Exception e) {
|
|
|
|
log.println("Can't close the connection");
|
|
|
|
e.printStackTrace(log);
|
|
|
|
} catch (com.sun.star.lang.DisposedException e) {
|
|
|
|
log.println("Connection was already closed. It's OK.");
|
|
|
|
}
|
2003-09-08 10:47:02 +00:00
|
|
|
|
2005-02-24 16:42:37 +00:00
|
|
|
|
|
|
|
log.println("closing data source...");
|
|
|
|
try {
|
|
|
|
XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
|
|
|
|
XCloseable.class, dbSrc);
|
|
|
|
closer.close(true);
|
|
|
|
} catch (com.sun.star.util.CloseVetoException e) {
|
|
|
|
log.println("couldn't close data source");
|
|
|
|
} catch (com.sun.star.lang.DisposedException e) {
|
|
|
|
log.println("couldn't close data source");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
log.println("closing document...");
|
2003-01-27 17:20:08 +00:00
|
|
|
|
|
|
|
try {
|
2003-09-08 10:47:02 +00:00
|
|
|
XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
|
|
|
|
XCloseable.class, xTextDoc);
|
|
|
|
closer.close(true);
|
|
|
|
} catch (com.sun.star.util.CloseVetoException e) {
|
|
|
|
log.println("couldn't close document");
|
|
|
|
} catch (com.sun.star.lang.DisposedException e) {
|
|
|
|
log.println("couldn't close document");
|
|
|
|
}
|
|
|
|
|
2005-02-24 16:42:37 +00:00
|
|
|
log.println("revoking data source...");
|
2003-09-08 10:47:02 +00:00
|
|
|
try {
|
|
|
|
dbTools.revokeDB(dbSourceName);
|
2005-02-24 16:42:37 +00:00
|
|
|
} catch (com.sun.star.container.NoSuchElementException e){
|
2003-01-27 17:20:08 +00:00
|
|
|
} catch (com.sun.star.uno.Exception e) {
|
2003-09-08 10:47:02 +00:00
|
|
|
log.println("Error while object test cleaning up :");
|
|
|
|
e.printStackTrace(log);
|
|
|
|
throw new StatusException("Error while object test cleaning up", e);
|
2003-01-27 17:20:08 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-18 15:27:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of interface _XDatabaseParameterBroadcaster.CheckParameterListener
|
|
|
|
* for the XDatabaseParameterBroadcaster test
|
|
|
|
* @see ifc.form._XDatabaseParameterBroadcaster
|
|
|
|
*/
|
|
|
|
public class ParameterListenerImpl implements _XDatabaseParameterBroadcaster.CheckParameterListener {
|
|
|
|
boolean listenerWasCalled = false;
|
|
|
|
PrintWriter log = new PrintWriter(System.out);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true, if the listener was called, false otherwise.
|
|
|
|
* @return True, if any other method of the listener was called.
|
|
|
|
*/
|
|
|
|
public boolean checkListener() {
|
|
|
|
return listenerWasCalled;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Take the DataBaseParameterEvent and fill it with a meaningful value.
|
|
|
|
* @param e The database parameter that will be filled with a value.
|
|
|
|
* @return True, if the value could be filled.
|
|
|
|
*/
|
|
|
|
public boolean approveParameter(DatabaseParameterEvent e) {
|
|
|
|
log.println("### ParameterListenerImpl: approve called.");
|
|
|
|
XIndexAccess params = e.Parameters;
|
|
|
|
int count = params.getCount();
|
|
|
|
try {
|
|
|
|
for(int i=0; i<count; i++) {
|
|
|
|
log.println("### _XDatabaseParameterBroadcaster.ParameterListenerImpl: Parameter "+i+": "+params.getByIndex(i));
|
|
|
|
XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(i));
|
|
|
|
log.println("### _XDatabaseParameterBroadcaster.ParameterListenerImpl: Parameter Name: '"+xProp.getPropertyValue("Name") + "' is set to Value '1'");
|
|
|
|
xProp.setPropertyValue("Value", new Integer(1));
|
|
|
|
listenerWasCalled = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception eI) {
|
|
|
|
log.println("### _XDatabaseParameterBroadcaster.ParameterListenerImpl: Exception!");
|
|
|
|
eI.printStackTrace(log);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Dummy implemetnation. Do nothing, just log
|
|
|
|
* @param o Ignore.
|
|
|
|
*/
|
|
|
|
public void disposing(EventObject o) {
|
|
|
|
log.println("### _XDatabaseParameterBroadcaster.ParameterListenerImpl: disposing");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a log writer, so messages go to log instead of Standard.out
|
|
|
|
* @param log The log messages get printed to.
|
|
|
|
*/
|
|
|
|
public void setLog(PrintWriter log) {
|
|
|
|
this.log = log;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implementation of interface _XCompletedExecution.CheckInteractionHandler
|
|
|
|
* for the XCompletedExecution test
|
|
|
|
* @see ifc.sdb._XCompletedExecution
|
|
|
|
*/
|
|
|
|
public class InteractionHandlerImpl implements _XCompletedExecution.CheckInteractionHandler {
|
|
|
|
private boolean handlerWasUsed = false;
|
|
|
|
private PrintWriter log = new PrintWriter(System.out);
|
|
|
|
|
|
|
|
public boolean checkInteractionHandler() {
|
|
|
|
return handlerWasUsed;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void handle(XInteractionRequest xInteractionRequest) {
|
|
|
|
log.println("### _XCompletedExecution.InteractionHandlerImpl: handle called.");
|
|
|
|
handlerWasUsed = true;
|
|
|
|
|
|
|
|
Object o = xInteractionRequest.getRequest();
|
|
|
|
ParametersRequest req = (ParametersRequest)o;
|
|
|
|
XIndexAccess params = req.Parameters;
|
|
|
|
int count = params.getCount();
|
|
|
|
try {
|
|
|
|
for(int i=0; i<count; i++) {
|
|
|
|
Object aObject = params.getByIndex(i);
|
|
|
|
Any any = (Any)aObject;
|
|
|
|
log.println("### _XCompletedExecution.InteractionHandlerImpl: Parameter "+i+": "+params.getByIndex(i));
|
|
|
|
XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, params.getByIndex(i));
|
|
|
|
log.println("### _XCompletedExecution.InteractionHandlerImpl: Parameter Name: '"+xProp.getPropertyValue("Name") + "' is set to Value '1'");
|
|
|
|
xProp.setPropertyValue("Value", new Integer(1));
|
|
|
|
handlerWasUsed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch(Exception eI) {
|
|
|
|
log.println("### _XCompletedExecution.InteractionHandlerImpl: Exception!");
|
|
|
|
eI.printStackTrace(log);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setLog(PrintWriter log) {
|
|
|
|
this.log = log;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2003-09-08 10:47:02 +00:00
|
|
|
} // finish class ODatabaseForm
|