summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/ifc/sdbcx
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/ifc/sdbcx')
-rw-r--r--qadevOOo/tests/java/ifc/sdbcx/_ResultSet.java48
-rw-r--r--qadevOOo/tests/java/ifc/sdbcx/_XColumnsSupplier.java82
-rw-r--r--qadevOOo/tests/java/ifc/sdbcx/_XCreateCatalog.java53
-rw-r--r--qadevOOo/tests/java/ifc/sdbcx/_XDataDefinitionSupplier.java182
-rw-r--r--qadevOOo/tests/java/ifc/sdbcx/_XDeleteRows.java97
-rw-r--r--qadevOOo/tests/java/ifc/sdbcx/_XDropCatalog.java53
-rw-r--r--qadevOOo/tests/java/ifc/sdbcx/_XRowLocate.java237
-rw-r--r--qadevOOo/tests/java/ifc/sdbcx/_XTablesSupplier.java84
8 files changed, 836 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/ifc/sdbcx/_ResultSet.java b/qadevOOo/tests/java/ifc/sdbcx/_ResultSet.java
new file mode 100644
index 000000000000..4eb571e2e72b
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/sdbcx/_ResultSet.java
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * 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: _ResultSet.java,v $
+ * $Revision: 1.4 $
+ *
+ * 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 ifc.sdbcx;
+
+import lib.MultiPropertyTest;
+
+/**
+* Testing <code>com.sun.star.sdbcx.ResultSet</code>
+* service properties :
+* <ul>
+* <li><code> IsBookmarkable</code></li>
+* <li><code> CanUpdateInsertedRows</code></li>
+* </ul> <p>
+* Properties testing is automated by <code>lib.MultiPropertyTest</code>.
+* @see com.sun.star.sdbcx.ResultSet
+*/
+public class _ResultSet extends MultiPropertyTest {
+
+}
+
diff --git a/qadevOOo/tests/java/ifc/sdbcx/_XColumnsSupplier.java b/qadevOOo/tests/java/ifc/sdbcx/_XColumnsSupplier.java
new file mode 100644
index 000000000000..4d1bc5131040
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/sdbcx/_XColumnsSupplier.java
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * 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: _XColumnsSupplier.java,v $
+ * $Revision: 1.4 $
+ *
+ * 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 ifc.sdbcx;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.sdbcx.XColumnsSupplier;
+
+/**
+* Testing <code>com.sun.star.sdbcx.XColumnsSupplier</code>
+* interface methods :
+* <ul>
+* <li><code> getColumns()</code></li>
+* </ul> <p>
+* @see com.sun.star.sdbcx.XColumnsSupplier
+*/
+public class _XColumnsSupplier extends MultiMethodTest {
+
+ // oObj filled by MultiMethodTest
+ public XColumnsSupplier oObj = null ;
+
+ /**
+ * Has OK status if method returns not null
+ * <code>XNameAccess</code> object, FAILED otherwise.
+ */
+ public void _getColumns() {
+
+ XNameAccess cols = oObj.getColumns() ;
+
+ /*
+ String[] colNames = cols.getElementNames() ;
+
+ log.println("Column names:") ;
+ for (int i =0 ; i < colNames.length; i++) {
+ log.println(" " + colNames[i]) ;
+ }
+
+ XServiceInfo info = null ;
+ try {
+ info = (XServiceInfo) UnoRuntime.queryInterface
+ (XServiceInfo.class, cols.getByName("colNames[0]")) ;
+ } catch (com.sun.star.uno.Exception e) {}
+
+ log.println("Support : " +
+ info.supportsService("com.sun.star.sdbcx.Column")) ;
+ */
+
+ tRes.tested("getColumns()", cols != null) ;
+ }
+
+} // finish class _XColumnsSupplier
+
+
diff --git a/qadevOOo/tests/java/ifc/sdbcx/_XCreateCatalog.java b/qadevOOo/tests/java/ifc/sdbcx/_XCreateCatalog.java
new file mode 100644
index 000000000000..4212e4beb1ac
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/sdbcx/_XCreateCatalog.java
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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: _XCreateCatalog.java,v $
+ * $Revision: 1.4 $
+ *
+ * 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 ifc.sdbcx;
+
+import lib.MultiMethodTest;
+import lib.Status;
+
+import com.sun.star.sdbcx.XCreateCatalog;
+
+/**
+* Testing <code>com.sun.star.sdbcx.XCreateCatalog</code>
+* interface methods :
+* <ul>
+* <li><code>createCatalog()</code></li>
+* </ul> <p>
+* @see com.sun.star.sdbcx.XCreateCatalog
+*/
+public class _XCreateCatalog extends MultiMethodTest {
+ // oObj filled by MultiMethodTest
+ public XCreateCatalog oObj = null;
+
+ public void _createCatalog() {
+ tRes.tested("createCatalog()", Status.skipped(false));
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/sdbcx/_XDataDefinitionSupplier.java b/qadevOOo/tests/java/ifc/sdbcx/_XDataDefinitionSupplier.java
new file mode 100644
index 000000000000..8c4080b5b383
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/sdbcx/_XDataDefinitionSupplier.java
@@ -0,0 +1,182 @@
+/*************************************************************************
+ *
+ * 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: _XDataDefinitionSupplier.java,v $
+ * $Revision: 1.4 $
+ *
+ * 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 ifc.sdbcx;
+
+import lib.MultiMethodTest;
+import lib.Status;
+import lib.StatusException;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.sdbc.XConnection;
+import com.sun.star.sdbc.XDriver;
+import com.sun.star.sdbcx.XDataDefinitionSupplier;
+import com.sun.star.sdbcx.XTablesSupplier;
+import com.sun.star.uno.UnoRuntime;
+
+/**
+* Testing <code>com.sun.star.sdbcx.XDataDefinitionSupplier</code>
+* interface methods :
+* <ul>
+* <li><code> getDataDefinitionByConnection()</code></li>
+* <li><code> getDataDefinitionByURL()</code></li>
+* </ul> <p>
+* Required object relations :
+* <ul>
+* <li> <code>'XDriver.URL'</code>:
+* is the URL of the database to which to connect</code></li>
+* <li><code>'XDriver.UNSUITABLE_URL'</code>:
+* the wrong kind of URL to connect using given driver</li>
+* <li><code>'XDriver.INFO'</code>:
+* a list of arbitrary string tag/value pairs as connection arguments</li>
+* </ul> <p>
+* @see com.sun.star.sdbcx.XDataDefinitionSupplier
+*/
+public class _XDataDefinitionSupplier extends MultiMethodTest {
+
+ // oObj filled by MultiMethodTest
+ public XDataDefinitionSupplier oObj = null ;
+
+ String url = null;
+ String wrongUrl = null;
+ PropertyValue[] info = null;
+
+ /**
+ * Retrieves relations.
+ * @throw StatusException If any relation not found.
+ */
+ protected void before() {
+ url = (String)tEnv.getObjRelation("XDriver.URL");
+ if (url == null) {
+ throw new StatusException(Status.failed(
+ "Couldn't get relation 'XDriver.URL'"));
+ }
+ wrongUrl = (String)tEnv.getObjRelation("XDriver.UNSUITABLE_URL");
+ if (wrongUrl == null) {
+ throw new StatusException(Status.failed(
+ "Couldn't get relation 'XDriver.WRONG_URL'"));
+ }
+ info = (PropertyValue[])tEnv.getObjRelation("XDriver.INFO");
+ if (info == null) {
+ throw new StatusException(Status.failed(
+ "Couldn't get relation 'XDriver.INFO'"));
+ }
+ }
+
+ XConnection connection = null;
+
+ /**
+ * Obtains the connection to url(relation <code>'XDriver.URL'</code>)
+ * with info(relation <code>'XDriver.INFO'</code>).
+ * Calls the method with obtained connection and checks that returned value
+ * isn't null.
+ */
+ public void _getDataDefinitionByConnection() {
+ boolean bRes = true;
+ XDriver xDriver = (XDriver)
+ UnoRuntime.queryInterface(XDriver.class, oObj);
+ if (xDriver == null) {
+ log.println("The XDriver interface isn't supported");
+ tRes.tested("getDataDefinitionByConnection()",
+ Status.skipped(false));
+ return;
+ }
+ try {
+ connection = xDriver.connect(url, info);
+ } catch(com.sun.star.sdbc.SQLException e) {
+ e.printStackTrace(log);
+ bRes = false;
+ }
+ if (connection == null) {
+ log.println("Couldn't get connection to specified url using " +
+ "specified info");
+ tRes.tested("getDataDefinitionByConnection()",
+ Status.skipped(false));
+ return;
+ }
+ XTablesSupplier xTS = null;
+ try {
+ log.println("getDataDefinitionByConnection(connection)");
+ xTS = oObj.getDataDefinitionByConnection(connection);
+ bRes = xTS != null;
+ } catch(com.sun.star.sdbc.SQLException e) {
+ log.println("Unexpected exception: " + e);
+ bRes = false;
+ }
+
+ try {
+ log.println("getDataDefinitionByConnection(null)");
+ xTS = oObj.getDataDefinitionByConnection(null);
+ bRes = xTS == null;
+ } catch(com.sun.star.sdbc.SQLException e) {
+ log.println("Exception: " + e);
+ bRes = true;
+ }
+
+ tRes.tested("getDataDefinitionByConnection()", bRes);
+ }
+
+ /**
+ * Calls the method with url and info obtained from the relations
+ * <code>XDriver.URL</code> and <code>XDriver.INFO</code>.
+ * Checks that retuned value isn't null.
+ * Then calls the method with the unsuitable url obtained from the relation
+ * <code>XDriver.UNSUITABLE_URL</code> and checks that SQLException
+ * exception was thrown.
+ */
+ public void _getDataDefinitionByURL() {
+ boolean bRes = false;
+ XTablesSupplier xTS = null;
+
+ try {
+ log.println("getDataDefinitionByURL('" + url + "')");
+ xTS = oObj.getDataDefinitionByURL(url, info);
+ bRes = xTS != null;
+ } catch (com.sun.star.sdbc.SQLException e) {
+ log.println("Unexpected exception: " + e);
+ bRes = false;
+ }
+
+ try {
+ log.println("getDataDefinitionByURL('" + wrongUrl + "')");
+ xTS = oObj.getDataDefinitionByURL(wrongUrl, info);
+ log.println("Exception was expected");
+ bRes = false;
+ } catch (com.sun.star.sdbc.SQLException e) {
+ log.println("Expected exception");
+ bRes &= true;
+ }
+
+ tRes.tested("getDataDefinitionByURL()", true);
+
+ }
+} // finish class _XDataDefinitionSupplier
+
+
diff --git a/qadevOOo/tests/java/ifc/sdbcx/_XDeleteRows.java b/qadevOOo/tests/java/ifc/sdbcx/_XDeleteRows.java
new file mode 100644
index 000000000000..af9218b8387e
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/sdbcx/_XDeleteRows.java
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * 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: _XDeleteRows.java,v $
+ * $Revision: 1.4 $
+ *
+ * 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 ifc.sdbcx;
+
+import lib.MultiMethodTest;
+import lib.Status;
+import lib.StatusException;
+
+import com.sun.star.sdbc.XResultSet;
+import com.sun.star.sdbcx.XDeleteRows;
+import com.sun.star.sdbcx.XRowLocate;
+import com.sun.star.uno.UnoRuntime;
+
+/**
+* Testing <code>com.sun.star.sdbcx.XDeleteRows</code>
+* interface methods :
+* <ul>
+* <li><code> deleteRows()</code></li>
+* </ul> <p>
+* @see com.sun.star.sdbcx.XDeleteRows
+*/
+public class _XDeleteRows extends MultiMethodTest {
+ // oObj filled by MultiMethodTest
+ public XDeleteRows oObj = null ;
+
+ /**
+ * Retrieves bookmark using XRowLocate and deletes
+ * row pointed by this bookmark. <p>
+ * Has OK status if number of rows after deleting is less than before
+ * and no exception rizes while method call, FAILED otherwise. <p>
+ */
+ public void _deleteRows() {
+ XRowLocate xRowLocate = (XRowLocate)
+ UnoRuntime.queryInterface(XRowLocate.class, oObj);
+ XResultSet xResultSet = (XResultSet)
+ UnoRuntime.queryInterface(XResultSet.class, oObj);
+ if (xRowLocate == null || xResultSet == null) {
+ log.println("The test must be modified according to "+
+ "component testcase");
+ throw new StatusException(Status.failed(
+ "The component doesn't support one of the "+
+ "required interfaces"));
+ }
+
+ int rowsBefore = 0, rowsAfter = 0;
+ Object bkmrk = null;
+ try {
+ xResultSet.last();
+ rowsBefore = xResultSet.getRow();
+ xResultSet.first();
+ bkmrk = xRowLocate.getBookmark();
+ oObj.deleteRows(new Object[] {bkmrk});
+ xResultSet.last();
+ rowsAfter = xResultSet.getRow();
+ } catch(com.sun.star.sdbc.SQLException e) {
+ log.println("SQLException:" + e);
+ tRes.tested("deleteRows()", false);
+ return;
+ }
+
+ log.println("Rows before: " + rowsBefore + ", after: " + rowsAfter);
+ tRes.tested("deleteRows()", rowsBefore - 1 == rowsAfter);
+ }
+
+ protected void after() {
+ disposeEnvironment();
+ }
+} // finish class _XDeleteRows
+
diff --git a/qadevOOo/tests/java/ifc/sdbcx/_XDropCatalog.java b/qadevOOo/tests/java/ifc/sdbcx/_XDropCatalog.java
new file mode 100644
index 000000000000..2f151e7dd738
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/sdbcx/_XDropCatalog.java
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * 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: _XDropCatalog.java,v $
+ * $Revision: 1.4 $
+ *
+ * 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 ifc.sdbcx;
+
+import lib.MultiMethodTest;
+import lib.Status;
+
+import com.sun.star.sdbcx.XDropCatalog;
+
+/**
+* Testing <code>com.sun.star.sdbcx.XDropCatalog</code>
+* interface methods :
+* <ul>
+* <li><code>dropCatalog()</code></li>
+* </ul> <p>
+* @see com.sun.star.sdbcx.XDropCatalog
+*/
+public class _XDropCatalog extends MultiMethodTest {
+ // oObj filled by MultiMethodTest
+ public XDropCatalog oObj = null;
+
+ public void _dropCatalog() {
+ tRes.tested("dropCatalog()", Status.skipped(false));
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/sdbcx/_XRowLocate.java b/qadevOOo/tests/java/ifc/sdbcx/_XRowLocate.java
new file mode 100644
index 000000000000..d9e688830a37
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/sdbcx/_XRowLocate.java
@@ -0,0 +1,237 @@
+/*************************************************************************
+ *
+ * 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: _XRowLocate.java,v $
+ * $Revision: 1.4 $
+ *
+ * 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 ifc.sdbcx;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.sdbc.SQLException;
+import com.sun.star.sdbcx.XRowLocate;
+
+/**
+* Testing <code>com.sun.star.sdbcx.XRowLocate</code>
+* interface methods :
+* <ul>
+* <li><code> getBookmark()</code></li>
+* <li><code> moveToBookmark()</code></li>
+* <li><code> moveRelativeToBookmark()</code></li>
+* <li><code> compareBookmarks()</code></li>
+* <li><code> hasOrderedBookmarks()</code></li>
+* <li><code> hashBookmark()</code></li>
+* </ul> <p>
+* Object relations needed :
+* <ul>
+* <li> <code>XRowLocate.HasOrderedBookmarks</code> <b>(optional)</b>:
+* <code>Boolean</code> type. If information about bookmark ordering
+* of object tested exists it placed in this relation.</li>
+* </ul> <p>
+* @see com.sun.star.sdbcx.XRowLocate
+*/
+public class _XRowLocate extends MultiMethodTest {
+
+ // oObj filled by MultiMethodTest
+ public XRowLocate oObj = null ;
+
+ private Object bookmark1 = null, bookmark2 = null ;
+
+ /**
+ * Gets the bookmark of the current cursor position and
+ * stores it for other methods use.
+ * Has OK status if method returns not null
+ * <code>XNameAccess</code> object, FAILED otherwise.
+ */
+ public void _getBookmark() {
+
+ try {
+ bookmark1 = oObj.getBookmark() ;
+ } catch (SQLException e) {
+ log.println("Exception occured :" + e) ;
+ }
+
+ tRes.tested("getBookmark()", bookmark1 != null) ;
+ }
+
+ /**
+ * Moves to bookmark previously created by method <code>_getBookmark</code>
+ * then creates new bookmark and compare it to the first one. The
+ * row difference must be equal to 0. <p>
+ * Method tests to be completed successfully before :
+ * <ul>
+ * <li> <code>getBookmark()</code> : to have a bookmark to move to.</li>
+ * </ul>
+ * Method tests to be executed before :
+ * <ul>
+ * <li> <code>moveRelativeToBookmark()</code> : to move the cursor from
+ * the initial position, to check if it returns back.</li>
+ * </ul> <p>
+ * Has OK status difference between positions of bookmarks (where
+ * cursor was moved to and created new one) equals to 0 and no
+ * exceptions occured, FAILED otherwise.
+ */
+ public void _moveToBookmark() {
+ requiredMethod("getBookmark()") ;
+ executeMethod("moveRelativeToBookmark()") ;
+
+ int comparison = -1 ;
+ Object tmpBookmark = null ;
+ try {
+ synchronized(oObj) {
+ oObj.moveToBookmark(bookmark1) ;
+ tmpBookmark = oObj.getBookmark() ;
+ }
+ comparison = oObj.compareBookmarks(bookmark1, tmpBookmark) ;
+ } catch (SQLException e) {
+ log.println("Exception occured :" + e) ;
+ }
+
+ tRes.tested("moveToBookmark()", comparison == 0) ;
+ }
+
+ /**
+ * Moves the cursor to the position with offset 2 from the
+ * bookmark created by <code>_getBookmark()</code> method and
+ * then creates a bookmark of new position. <p>
+ * Method tests to be completed successfully before :
+ * <ul>
+ * <li> <code>getBookmark()</code> : to have a bookmark to move to.</li>
+ * </ul> <p>
+ * Has OK status if no exceptions occured while method call.
+ */
+ public void _moveRelativeToBookmark() {
+ requiredMethod("getBookmark()") ;
+
+ boolean result = true ;
+ try {
+ synchronized (oObj) {
+ oObj.moveRelativeToBookmark(bookmark1, 1) ;
+ bookmark2 = oObj.getBookmark() ;
+ }
+ } catch (SQLException e) {
+ log.println("Exception occured :" + e) ;
+ result = false ;
+ }
+
+ tRes.tested("moveRelativeToBookmark()", result) ;
+ }
+
+ /**
+ * Compares bookmarks created in <code>getBookmark()</code> and
+ * <code>moveRelativeToBokkmark()</code> methods.
+ * Method tests to be completed successfully before :
+ * <ul>
+ * <li> <code>getBookmark()</code> : to have first bookmark to compare.</li>
+ * <li> <code>moveRelativeToBookmark()</code> : to have second
+ * bookmark to compare.</li>
+ * </ul> <p>
+ * Has OK status if difference in bookmark positions equals to 2.
+ */
+ public void _compareBookmarks() {
+ requiredMethod("getBookmark()") ;
+ requiredMethod("moveRelativeToBookmark()") ;
+
+ int comparison = 0 ;
+ int comparison1 = 0 ;
+ try {
+ comparison = oObj.compareBookmarks(bookmark1, bookmark2) ;
+ comparison1 = oObj.compareBookmarks(bookmark1, bookmark1) ;
+ } catch (SQLException e) {
+ log.println("Exception occured :" + e) ;
+ }
+
+ if (comparison != -1) {
+ log.println("! Wrong compare number :" + comparison) ;
+ }
+
+ tRes.tested("compareBookmarks()", comparison == -1 && comparison1 == 0) ;
+ }
+
+ /**
+ * Calls method. If relation is not found, returned result is not
+ * checked. <p>
+ * Has OK status if method returned right value (in case if relation
+ * and value to compare to exist), or just successfully returned
+ * (in case of no relation).
+ */
+ public void _hasOrderedBookmarks() {
+ boolean result = true ;
+ boolean res = true ;
+
+ // Optional relation
+ Boolean has = (Boolean) tEnv.getObjRelation
+ ("XRowLocate.HasOrderedBookmarks") ;
+
+ try {
+ res = oObj.hasOrderedBookmarks() ;
+ } catch (SQLException e) {
+ log.println("Exception occured :" + e) ;
+ result = false ;
+ }
+
+ if (has == null) {
+ log.println("Optional relation not found - result not checked") ;
+ } else {
+ result &= res == has.booleanValue() ;
+ }
+
+ tRes.tested("hasOrderedBookmarks()", result) ;
+ }
+
+ /**
+ * Gets hash values of two previously created bookmarks of different
+ * cursor positions and compares them. <p>
+ * Method tests to be completed successfully before :
+ * <ul>
+ * <li> <code>getBookmark()</code> : to have first bookmark.</li>
+ * <li> <code>moveRelativeToBookmark()</code> : to have second
+ * bookmark.</li>
+ * </ul> <p>
+ * Has OK status if hash values of two bookmarks are different.
+ */
+ public void _hashBookmark() {
+ requiredMethod("getBookmark()") ;
+ requiredMethod("moveRelativeToBookmark()") ;
+
+ boolean result = true ;
+ try {
+ int hash1 = oObj.hashBookmark(bookmark1) ;
+ int hash2 = oObj.hashBookmark(bookmark2) ;
+ log.println("1st hash = " + hash1 + ", 2nd = " + hash2) ;
+
+ result = hash1 != hash2 ;
+ } catch (SQLException e) {
+ log.println("Exception occured :" + e) ;
+ result = false ;
+ }
+
+ tRes.tested("hashBookmark()", result) ;
+ }
+
+} // finish class _XRowLocate
+
diff --git a/qadevOOo/tests/java/ifc/sdbcx/_XTablesSupplier.java b/qadevOOo/tests/java/ifc/sdbcx/_XTablesSupplier.java
new file mode 100644
index 000000000000..9986facec414
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/sdbcx/_XTablesSupplier.java
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * 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: _XTablesSupplier.java,v $
+ * $Revision: 1.4 $
+ *
+ * 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 ifc.sdbcx;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.sdbcx.XTablesSupplier;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.uno.UnoRuntime;
+import lib.MultiMethodTest;
+
+/**
+* Testing <code>com.sun.star.sdbcx.XTablesSupplier</code>
+* interface methods :
+* <ul>
+* <li><code> getTables()</code></li>
+* </ul> <p>
+* @see com.sun.star.sdbcx.XTablesSupplier
+*/
+public class _XTablesSupplier extends MultiMethodTest {
+
+ // oObj filled by MultiMethodTest
+ public XTablesSupplier oObj = null ;
+
+ /**
+ * Has OK status if method returns not null
+ * <code>XNameAccess</code> object, FAILED otherwise.
+ */
+ public void _getTables() {
+ boolean result = true ;
+
+ XNameAccess tabs = oObj.getTables() ;
+
+
+ String[] tabNames = tabs.getElementNames() ;
+
+ log.println("Table names:") ;
+ for (int i =0 ; i < tabNames.length; i++) {
+ log.println(" " + tabNames[i]) ;
+ }
+
+ XServiceInfo info = null ;
+ try {
+ info = (XServiceInfo) UnoRuntime.queryInterface
+ (XServiceInfo.class, tabs.getByName(tabNames[0])) ;
+ } catch (com.sun.star.uno.Exception e) {}
+
+ log.println("Support : " +
+ info.supportsService("com.sun.star.sdbcx.Table")) ;
+
+
+ tRes.tested("getTables()", tabs != null) ;
+ }
+
+} // finish class _XTablesSupplier
+
+