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)
569 lines
24 KiB
Java
569 lines
24 KiB
Java
/*************************************************************************
|
|
*
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
*
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
|
*
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
|
*
|
|
* $RCSfile: GenericModelTest.java,v $
|
|
* $Revision: 1.6 $
|
|
*
|
|
* This file is part of OpenOffice.org.
|
|
*
|
|
* 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.
|
|
*
|
|
* 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).
|
|
*
|
|
* 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.
|
|
*
|
|
************************************************************************/
|
|
package mod._forms;
|
|
import com.sun.star.beans.NamedValue;
|
|
import com.sun.star.beans.PropertyValue;
|
|
import java.io.PrintWriter;
|
|
|
|
import lib.StatusException;
|
|
import lib.TestCase;
|
|
import lib.TestEnvironment;
|
|
import lib.TestParameters;
|
|
import util.DBTools;
|
|
import util.FormTools;
|
|
import util.WriterTools;
|
|
|
|
import com.sun.star.beans.XPropertySet;
|
|
import com.sun.star.drawing.XControlShape;
|
|
import com.sun.star.drawing.XShape;
|
|
import com.sun.star.form.XBoundComponent;
|
|
import com.sun.star.form.XForm;
|
|
import com.sun.star.form.XLoadable;
|
|
import com.sun.star.lang.XMultiServiceFactory;
|
|
import com.sun.star.lang.XComponent;
|
|
import com.sun.star.sdbc.XConnection;
|
|
import com.sun.star.sdbc.XResultSetUpdate;
|
|
import com.sun.star.sdb.XDocumentDataSource;
|
|
import com.sun.star.text.XTextDocument;
|
|
import com.sun.star.uno.AnyConverter;
|
|
import com.sun.star.uno.Type;
|
|
import com.sun.star.uno.UnoRuntime;
|
|
import com.sun.star.uno.XInterface;
|
|
import com.sun.star.util.XCloseable;
|
|
import java.util.ArrayList;
|
|
import lib.Status;
|
|
import util.utils;
|
|
|
|
|
|
/**
|
|
* Test for object which is represented by service
|
|
* <code>com.sun.star.form.component.DateField</code>. <p>
|
|
* Object implements the following interfaces :
|
|
* <ul>
|
|
* <li> <code>com::sun::star::io::XPersistObject</code></li>
|
|
* <li> <code>com::sun::star::awt::UnoControlDateFieldModel</code></li>
|
|
* <li> <code>com::sun::star::form::XReset</code></li>
|
|
* <li> <code>com::sun::star::form::XBoundComponent</code></li>
|
|
* <li> <code>com::sun::star::form::FormComponent</code></li>
|
|
* <li> <code>com::sun::star::form::component::DateField</code></li>
|
|
* <li> <code>com::sun::star::beans::XFastPropertySet</code></li>
|
|
* <li> <code>com::sun::star::beans::XMultiPropertySet</code></li>
|
|
* <li> <code>com::sun::star::form::XUpdateBroadcaster</code></li>
|
|
* <li> <code>com::sun::star::form::DataAwareControlModel</code></li>
|
|
* <li> <code>com::sun::star::beans::XPropertyState</code></li>
|
|
* <li> <code>com::sun::star::form::FormControlModel</code></li>
|
|
* <li> <code>com::sun::star::container::XNamed</code></li>
|
|
* <li> <code>com::sun::star::lang::XComponent</code></li>
|
|
* <li> <code>com::sun::star::lang::XEventListener</code></li>
|
|
* <li> <code>com::sun::star::beans::XPropertyAccess</code></li>
|
|
* <li> <code>com::sun::star::beans::XPropertyContainer</code></li>
|
|
* <li> <code>com::sun::star::beans::XPropertySet</code></li>
|
|
* <li> <code>com::sun::star::form::XLoadListener</code></li>
|
|
* <li> <code>com::sun::star::container::XChild</code></li>
|
|
* </ul>
|
|
* The following files used by this test :
|
|
* <ul>
|
|
* <li><b> TestDB </b> (directory) : directory with test database </li>
|
|
* <li><b> TestDB/TestDB.dbf </b> : table file. See
|
|
* {@link util.DBTools DBTools} class for more information.</li>
|
|
* </ul> <p>
|
|
* This object test <b> is NOT </b> designed to be run in several
|
|
* threads concurently.
|
|
* @see com.sun.star.io.XPersistObject
|
|
* @see com.sun.star.awt.UnoControlDateFieldModel
|
|
* @see com.sun.star.form.XReset
|
|
* @see com.sun.star.form.XBoundComponent
|
|
* @see com.sun.star.form.FormComponent
|
|
* @see com.sun.star.form.component.DateField
|
|
* @see com.sun.star.beans.XFastPropertySet
|
|
* @see com.sun.star.beans.XMultiPropertySet
|
|
* @see com.sun.star.form.XUpdateBroadcaster
|
|
* @see com.sun.star.form.DataAwareControlModel
|
|
* @see com.sun.star.beans.XPropertyState
|
|
* @see com.sun.star.form.FormControlModel
|
|
* @see com.sun.star.container.XNamed
|
|
* @see com.sun.star.lang.XComponent
|
|
* @see com.sun.star.lang.XEventListener
|
|
* @see com.sun.star.beans.XPropertyAccess
|
|
* @see com.sun.star.beans.XPropertyContainer
|
|
* @see com.sun.star.beans.XPropertySet
|
|
* @see com.sun.star.form.XLoadListener
|
|
* @see com.sun.star.container.XChild
|
|
* @see ifc.io._XPersistObject
|
|
* @see ifc.awt._UnoControlDateFieldModel
|
|
* @see ifc.form._XReset
|
|
* @see ifc.form._XBoundComponent
|
|
* @see ifc.form._FormComponent
|
|
* @see ifc.form.component._DateField
|
|
* @see ifc.beans._XFastPropertySet
|
|
* @see ifc.beans._XMultiPropertySet
|
|
* @see ifc.form._XUpdateBroadcaster
|
|
* @see ifc.form._DataAwareControlModel
|
|
* @see ifc.beans._XPropertyState
|
|
* @see ifc.form._FormControlModel
|
|
* @see ifc.container._XNamed
|
|
* @see ifc.lang._XComponent
|
|
* @see ifc.lang._XEventListener
|
|
* @see ifc.beans._XPropertySet
|
|
* @see ifc.form._XLoadListener
|
|
* @see ifc.container._XChild
|
|
*/
|
|
public class GenericModelTest extends TestCase {
|
|
private static XTextDocument m_xTextDoc;
|
|
private static Object m_dbSrc = null;
|
|
private static DBTools.DataSourceInfo m_srcInf = null;
|
|
/**
|
|
* This is the name of the Data Base which the test uses: "APITestDatabase"
|
|
*/
|
|
protected final static String m_dbSourceName = "APITestDatabase";
|
|
protected final static String m_TestDB = "TestDB";
|
|
private DBTools m_dbTools = null;
|
|
|
|
private static boolean m_ConnectionColsed = false;
|
|
|
|
/**
|
|
* descibes the kind of the shape which should be created.
|
|
* Example: m_kindOfshape=DateFiled
|
|
*/
|
|
public static String m_kindOfControl = null;
|
|
|
|
/**
|
|
* If your object needs some special propery values you can specify them with this
|
|
* <CODE>ArrayList</CODE>. You have to add a <CODE>NamedValue</CODE> to this list.
|
|
* Example:
|
|
* NamedValue myProp = new NamedValue();
|
|
* myProp.Name = "Test";
|
|
* myProp.Value = "My special Value";
|
|
* m_propertiesToSet.add(myProp);
|
|
*/
|
|
public static ArrayList m_propertiesToSet = new ArrayList();
|
|
|
|
/**
|
|
* This variable contains the name of the property which should be changed while
|
|
* interface <CODE>com::sun::star::form::XUpdateBroadcaster</CODE> is tested. The
|
|
* interface test needs the <CODE>ObjectRelation</CODE>
|
|
* "XUpdateBroadcaster.Checker" which is a <CODE>ifc.form._XUpdateBroadcaster.UpdateChecker</CODE>.
|
|
* @see ifc.form._XUpdateBroadcaster.UpdateChecker
|
|
* @see ifc.form._XUpdateBroadcaster
|
|
*/
|
|
public static String m_ChangePropertyName = null;
|
|
/**
|
|
* This variable contains the value the property should be set while
|
|
* interface <CODE>com::sun::star::form::XUpdateBroadcaster</CODE> is tested.
|
|
* The interface test needs the <CODE>ObjectRelation</CODE>
|
|
* "XUpdateBroadcaster.Checker" which is a <CODE>ifc.form._XUpdateBroadcaster.UpdateChecker</CODE>.
|
|
* Normaly the <CODE>Checker</CODE> uses <CODE>util.ValueChanger</CODE> to change
|
|
* the value of the property. If the current of this property is NULL the
|
|
* <CODE>ValueChanger</CODE> is unable to change the value. In this case the value
|
|
* of this variable was used.
|
|
*/
|
|
public static Object m_ChangePropertyValue = null;
|
|
|
|
/**
|
|
* This variable contains the implelemtation name of the object.
|
|
*/
|
|
public static String m_ObjectName = null;
|
|
|
|
/**
|
|
* For local implementaions of <CODE>Checker</CODE> this variable contains the
|
|
* <CODE>FormLoader</CODE>
|
|
*/
|
|
protected static XLoadable m_XFormLoader = null;
|
|
/**
|
|
* For local implementaions of <CODE>Checker</CODE> this variable contains the
|
|
* <CODE>XPropertySet</CODE>
|
|
*/
|
|
protected static XPropertySet m_XPS = null;
|
|
/**
|
|
* For local implementaions of <CODE>Checker</CODE> this variable contains the
|
|
* <CODE>Control</CODE>
|
|
*/
|
|
protected static XInterface m_XCtrl = null;
|
|
/**
|
|
* The insterface test of <CODE>ifc.form._DataWareControlModel</CODE> expects an
|
|
* object relation <CODE>'LC'</CODE>. This is a <CODE>XControlModel</CODE> of a shape.
|
|
* This variable contains the kind of shape to create for the interface test,
|
|
* f.e. "FixedText"
|
|
* @see ifc.form._DataAwareControlModel
|
|
*/
|
|
protected static String m_LCShape_Type = null;
|
|
|
|
protected static String m_XPropertyAccess_propertyToChange = "HelpText";
|
|
|
|
protected static String m_XPropertyContainer_propertyNotRemovable = "HelpText";
|
|
/**
|
|
* If this variable is true some more debug info was logged. It was setted by the parameter variable
|
|
* <code>debug_is_active</code>
|
|
*/
|
|
protected static boolean debug = false;
|
|
|
|
/**
|
|
* Creates Writer document where controls are placed.
|
|
* @param tParam the test paremter
|
|
* @param log the log writer
|
|
*/
|
|
protected void initialize(TestParameters tParam, PrintWriter log) {
|
|
log.println("creating a textdocument");
|
|
m_xTextDoc = WriterTools.createTextDoc(((XMultiServiceFactory) tParam.getMSF()));
|
|
m_ConnectionColsed = false;
|
|
debug = tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE);
|
|
m_propertiesToSet.clear();
|
|
}
|
|
|
|
/**
|
|
* close the connection
|
|
* close the data source
|
|
* close the document
|
|
* revoke the data source
|
|
* @param tParam the test parameter
|
|
* @param log the log writer
|
|
*/
|
|
protected void cleanup(TestParameters tParam, PrintWriter log) {
|
|
log.println("closing connection...");
|
|
|
|
// some interface tests call cleanup to reset the environment. If such
|
|
// a test is the last one cleanup was called twice. The second call
|
|
// causes then nasty exceptions...
|
|
if (m_ConnectionColsed) return;
|
|
|
|
try {
|
|
XForm myForm = (XForm) AnyConverter.toObject(new Type(XForm.class),
|
|
(FormTools.getForms(
|
|
WriterTools.getDrawPage(
|
|
m_xTextDoc)))
|
|
.getByName("Standard"));
|
|
|
|
if (debug){
|
|
if (myForm == null){
|
|
log.println("ERROR: could not get 'Standard' from drawpage!");
|
|
}
|
|
log.println("the draw page contains folowing elemtens:");
|
|
String[] elements = FormTools.getForms(WriterTools.getDrawPage(m_xTextDoc)).getElementNames();
|
|
for (int i = 0; i< elements.length; i++){
|
|
log.println("Element[" + i + "] :" + elements[i]);
|
|
}
|
|
|
|
}
|
|
|
|
XPropertySet xSetProp = (XPropertySet) UnoRuntime.queryInterface(
|
|
XPropertySet.class, myForm);
|
|
XConnection connection = (XConnection) AnyConverter.toObject(
|
|
new Type(XConnection.class),
|
|
xSetProp.getPropertyValue("ActiveConnection"));
|
|
if (debug && connection == null){
|
|
log.println("ERROR: could not get property 'ActiveConnection' from the XForm");
|
|
}
|
|
|
|
connection.close();
|
|
} catch (Exception e) {
|
|
log.println("ERROR: Can't close the connection: " + e.toString());
|
|
}
|
|
|
|
log.println("closing data source...");
|
|
try {
|
|
XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
|
|
XCloseable.class, m_dbSrc);
|
|
if ( closer == null )
|
|
{
|
|
XDocumentDataSource dataSource = (XDocumentDataSource)UnoRuntime.queryInterface(
|
|
XDocumentDataSource.class, m_dbSrc);
|
|
if ( dataSource != null )
|
|
closer = (XCloseable) UnoRuntime.queryInterface(
|
|
XCloseable.class, dataSource.getDatabaseDocument() );
|
|
}
|
|
if (debug && closer==null){
|
|
log.println("ERROR: couldn't get 'XCloseable' from DataSource");
|
|
}
|
|
closer.close(true);
|
|
} catch (com.sun.star.util.CloseVetoException e) {
|
|
log.println("ERROR: couldn't close data source: " + e.toString());
|
|
} catch (com.sun.star.lang.DisposedException e) {
|
|
log.println("ERROR: couldn't close data source: " + e.toString());
|
|
} catch (Exception e) {
|
|
log.println("ERROR: couldn't close data source: " + e.toString());
|
|
}
|
|
|
|
log.println("disposing data source...");
|
|
try {
|
|
XComponent dataSourceComp = (XComponent)UnoRuntime.queryInterface(
|
|
XComponent.class, m_dbSrc);
|
|
dataSourceComp.dispose();
|
|
}
|
|
catch (Exception e) {
|
|
log.println("couldn't dispose the data source");
|
|
}
|
|
|
|
log.println("closing document...");
|
|
|
|
try {
|
|
XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
|
|
XCloseable.class, m_xTextDoc);
|
|
closer.close(true);
|
|
} catch (com.sun.star.util.CloseVetoException e) {
|
|
log.println("ERROR: couldn't close document: " + e.toString());
|
|
} catch (com.sun.star.lang.DisposedException e) {
|
|
log.println("ERROR: couldn't close document: " + e.toString());
|
|
} catch (Exception e) {
|
|
log.println("ERROR: couldn't close document: " + e.toString());
|
|
}
|
|
|
|
log.println("revoking data source...");
|
|
try {
|
|
m_dbTools.revokeDB(m_dbSourceName);
|
|
} catch (com.sun.star.container.NoSuchElementException e){
|
|
} catch (com.sun.star.uno.Exception e) {
|
|
log.println("ERROR: Error while object test cleaning up: " + e.toString());
|
|
}
|
|
|
|
m_ConnectionColsed = true;
|
|
}
|
|
|
|
/**
|
|
* Creating a Testenvironment for the interfaces to be tested.
|
|
* First <code>TestDB</code> database is registered.
|
|
* Creates DateField in the Form, then binds it to TestDB
|
|
* database and returns Field's control. <p>
|
|
* Object relations created :
|
|
* <ul>
|
|
* <li> <code>'OBJNAME'</code> for
|
|
* {@link ifc.io._XPersistObject} : name of service which is
|
|
* represented by this object. </li>
|
|
* <li> <code>'LC'</code> for {@link ifc.form._DataAwareControlModel}.
|
|
* Specifies the value for LabelControl property. It is
|
|
* <code>FixedText</code> component added to the document.</li>
|
|
* <li> <code>'FL'</code> for
|
|
* {@link ifc.form._DataAwareControlModel} interface.
|
|
* Specifies XLoadable implementation which connects form to
|
|
* the data source.</li>
|
|
* <li> <code>'XUpdateBroadcaster.Checker'</code> : <code>
|
|
* _XUpdateBroadcaster.UpdateChecker</code> interface implementation
|
|
* which can update, commit data and check if the data was successfully
|
|
* commited.</li>
|
|
* <li> <code>'DataAwareControlModel.NewFieldName'</code> : for
|
|
* <code>com.sun.star.form.DataAwareControlModel</code> service
|
|
* which contains new name of the field ('_DATE') to bind control to.
|
|
* </li>
|
|
* <li> <code>'XFastPropertySet.ExcludeProps'</code> : for
|
|
* <code>com.sun.star.beans.XFastPropertySet</code> interface
|
|
* the property FormatKey can have only restricted set of values.
|
|
* </li>
|
|
* </ul>
|
|
* @see ifc.form._XUpdateBroadcaster
|
|
* @param Param the test parameter
|
|
* @param log the log writer
|
|
* @return a test environment
|
|
*/
|
|
protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
|
|
PrintWriter log) {
|
|
XInterface oObj = null;
|
|
XControlShape aShape = null;
|
|
XMultiServiceFactory xMSF = (XMultiServiceFactory) Param.getMSF();
|
|
|
|
try{
|
|
log.println("adding contol shape '" + m_kindOfControl + "'");
|
|
aShape = FormTools.createControlShape(m_xTextDoc, 3000,
|
|
4500, 15000, 10000,
|
|
m_kindOfControl);
|
|
} catch (Exception e){
|
|
e.printStackTrace(log);
|
|
throw new StatusException("Couldn't create following control shape (m_kindOfControl): '" +
|
|
m_kindOfControl + "': ", e);
|
|
|
|
}
|
|
|
|
WriterTools.getDrawPage(m_xTextDoc).add((XShape) aShape);
|
|
oObj = aShape.getControl();
|
|
|
|
log.println("Implementation name: " + util.utils.getImplName(oObj));
|
|
|
|
try {
|
|
String sourceTestDB = utils.getFullURL(utils.getFullTestDocName("TestDB/testDB.dbf"));
|
|
String destTestDB = utils.getOfficeTemp(xMSF);
|
|
destTestDB = utils.getFullURL(destTestDB + "testDB.dbf");
|
|
|
|
log.println("copy '"+sourceTestDB + "' -> '" + destTestDB + "'");
|
|
utils.copyFile(xMSF, sourceTestDB, destTestDB);
|
|
|
|
m_dbTools = new DBTools( xMSF, log );
|
|
String tmpDir = utils.getOfficeTemp((xMSF));
|
|
|
|
m_srcInf = m_dbTools.newDataSourceInfo();
|
|
m_srcInf.URL = "sdbc:dbase:" + DBTools.dirToUrl(tmpDir);
|
|
log.println("data source: " + m_srcInf.URL);
|
|
|
|
m_dbSrc = m_srcInf.getDataSourceService();
|
|
m_dbTools.reRegisterDB(m_dbSourceName, m_dbSrc);
|
|
|
|
m_XFormLoader = FormTools.bindForm(m_xTextDoc, m_dbSourceName,
|
|
m_TestDB);
|
|
} catch (com.sun.star.uno.Exception e) {
|
|
log.println("!!! Can't access TestDB !!!");
|
|
e.printStackTrace(log);
|
|
throw new StatusException("Can't access TestDB", e);
|
|
}
|
|
|
|
log.println("creating a new environment for object");
|
|
|
|
TestEnvironment tEnv = new TestEnvironment(oObj);
|
|
|
|
tEnv.addObjRelation("OBJNAME", m_ObjectName);
|
|
|
|
log.println("adding shape '" + m_LCShape_Type +"' for DataAwareControlModel test");
|
|
aShape = FormTools.createControlShape(m_xTextDoc, 6000, 4500, 15000,
|
|
10000, m_LCShape_Type);
|
|
WriterTools.getDrawPage(m_xTextDoc).add((XShape) aShape);
|
|
|
|
m_XPS = (XPropertySet) UnoRuntime.queryInterface(
|
|
XPropertySet.class, oObj);
|
|
|
|
int i = 0;
|
|
NamedValue prop = null;
|
|
try {
|
|
for (i = 0; i < m_propertiesToSet.size(); i++){
|
|
prop = (NamedValue) m_propertiesToSet.get(i);
|
|
|
|
log.println("setting property: '"+prop.Name+"' to value '"+prop.Value.toString()+"'");
|
|
|
|
m_XPS.setPropertyValue(prop.Name, prop.Value);
|
|
}
|
|
} catch (com.sun.star.lang.WrappedTargetException e) {
|
|
e.printStackTrace(log);
|
|
throw new StatusException("Couldn't set property '" + prop.Name + "': ", e);
|
|
} catch (com.sun.star.lang.IllegalArgumentException e) {
|
|
e.printStackTrace(log);
|
|
throw new StatusException("Couldn't set property '" + prop.Name + "': ", e);
|
|
} catch (com.sun.star.beans.PropertyVetoException e) {
|
|
e.printStackTrace(log);
|
|
throw new StatusException("Couldn't set property '" + prop.Name + "': ", e);
|
|
} catch (com.sun.star.beans.UnknownPropertyException e) {
|
|
e.printStackTrace(log);
|
|
throw new StatusException("Couldn't set property '" + prop.Name + "': ", e);
|
|
} catch (java.lang.ClassCastException e) {
|
|
e.printStackTrace(log);
|
|
throw new StatusException("Couldn't get property on index '" + i + "': ", e);
|
|
}
|
|
|
|
// added LabelControl for 'DataAwareControlModel'
|
|
tEnv.addObjRelation("LC", aShape.getControl());
|
|
|
|
// added FormLoader for 'DataAwareControlModel'
|
|
tEnv.addObjRelation("FL", m_XFormLoader);
|
|
|
|
// adding relation for XUpdateBroadcaster
|
|
m_XCtrl = oObj;
|
|
|
|
tEnv.addObjRelation("XUpdateBroadcaster.Checker",
|
|
new Checker(m_XFormLoader, m_XPS, m_XCtrl, m_ChangePropertyName, m_ChangePropertyValue));
|
|
|
|
// adding relation for DataAwareControlModel service
|
|
tEnv.addObjRelation("DataAwareControlModel.NewFieldName",
|
|
DBTools.TST_DATE_F);
|
|
|
|
//adding ObjRelation for XPersistObject
|
|
tEnv.addObjRelation("PSEUDOPERSISTENT", new Boolean(true));
|
|
|
|
// adding relation for XFastPropertySet
|
|
java.util.HashSet exclude = new java.util.HashSet();
|
|
exclude.add("FormatKey");
|
|
tEnv.addObjRelation("XFastPropertySet.ExcludeProps", exclude);
|
|
|
|
PropertyValue propVal = new PropertyValue();
|
|
propVal.Name = m_XPropertyAccess_propertyToChange;
|
|
propVal.Value = "Text since XPropertyAccess";
|
|
tEnv.addObjRelation("XPropertyAccess.propertyToChange", propVal);
|
|
tEnv.addObjRelation("XPropertyContainer.propertyNotRemovable", m_XPropertyContainer_propertyNotRemovable);
|
|
|
|
|
|
return tEnv;
|
|
} // finish method getTestEnvironment
|
|
|
|
|
|
static class Checker implements ifc.form._XUpdateBroadcaster.UpdateChecker {
|
|
private Object lastValue = null;
|
|
XLoadable formLoaderF = null;
|
|
XPropertySet ps = null;
|
|
XInterface ctrl = null;
|
|
String ChangePropertyName = null;
|
|
Object ChangePropertyValue = null;
|
|
|
|
public Checker(XLoadable xl, XPropertySet ps, XInterface ctrl, String ChangePropertyName, Object ChangePropertyValue) {
|
|
formLoaderF = xl;
|
|
this.ps = ps;
|
|
this.ctrl = ctrl;
|
|
this.ChangePropertyName=ChangePropertyName;
|
|
this.ChangePropertyValue=ChangePropertyValue;
|
|
}
|
|
|
|
public void update() throws com.sun.star.uno.Exception {
|
|
if (!formLoaderF.isLoaded()) {
|
|
formLoaderF.load();
|
|
}
|
|
|
|
lastValue = util.ValueChanger.changePValue(ps.getPropertyValue(ChangePropertyName));
|
|
|
|
if (lastValue == null){
|
|
|
|
if (ChangePropertyValue != null){
|
|
|
|
lastValue = ChangePropertyValue;
|
|
|
|
} else {
|
|
|
|
String msg = "The initial value of the property '" + ChangePropertyName + "' is NULL\n";
|
|
msg += "The member variable 'm_ChangePropertyValue' is NULL\n";
|
|
msg += "Could not change Property.";
|
|
|
|
throw new StatusException(Status.failed(msg));
|
|
}
|
|
}
|
|
ps.setPropertyValue(ChangePropertyName, lastValue);
|
|
}
|
|
|
|
public void commit() throws com.sun.star.sdbc.SQLException {
|
|
XBoundComponent bound = (XBoundComponent) UnoRuntime.queryInterface(
|
|
XBoundComponent.class, ctrl);
|
|
XResultSetUpdate update = (XResultSetUpdate) UnoRuntime.queryInterface(
|
|
XResultSetUpdate.class,
|
|
formLoaderF);
|
|
|
|
bound.commit();
|
|
update.updateRow();
|
|
}
|
|
|
|
public boolean wasCommited() throws com.sun.star.uno.Exception {
|
|
formLoaderF.reload();
|
|
|
|
Object newValue = ps.getPropertyValue(ChangePropertyName);
|
|
|
|
return (newValue != null) && (util.ValueComparer.equalValue(lastValue, newValue));
|
|
}
|
|
}
|
|
} // finish class GenericModelTest
|