diff options
Diffstat (limited to 'dbaccess/qa')
-rw-r--r-- | dbaccess/qa/complex/dbaccess/DatabaseDocument.java | 2 | ||||
-rwxr-xr-x | dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java | 33 |
2 files changed, 33 insertions, 2 deletions
diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java index d9b84153ff16..02fb820f3fd4 100644 --- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java +++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java @@ -839,8 +839,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. final String otherURL = copyToTempFile(databaseDoc.getURL()); final XModel otherDoc = (XModel) UnoRuntime.queryInterface(XModel.class, loader.loadComponentFromURL(otherURL, _BLANK, 0, impl_getDefaultLoadArgs())); - impl_waitForEvent(m_globalEvents, "OnLoad", 5000, previousOnLoadEventPos + 1); impl_raise(otherDoc); + impl_waitForEvent(m_globalEvents, "OnLoad", 5000, previousOnLoadEventPos + 1); // ... and switch between the two impl_startObservingEvents(context); diff --git a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java index f795b0a3cc17..bb3636100849 100755 --- a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java +++ b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java @@ -52,6 +52,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase { return new String[] { + "testSetCommand", "testAttributes", "testSubQueries", "testParameters", @@ -128,6 +129,31 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase log.println(" (results in " + (String) m_composer.getQuery() + ")"); } + /** tests setCommand of the composer + */ + public void testSetCommand() + { + log.println("testing SingleSelectQueryComposer's setCommand"); + + try + { + final String table = "SELECT * FROM \"customers\""; + m_composer.setCommand("customers",CommandType.TABLE); + assure("setCommand/getQuery TABLE inconsistent", m_composer.getQuery().equals(table)); + + m_database.getDatabase().getDataSource().createQuery("set command test", "SELECT * FROM \"orders for customer\" \"a\", \"customers\" \"b\" WHERE \"a\".\"Product Name\" = \"b\".\"Name\""); + m_composer.setCommand("set command test",CommandType.QUERY); + assure("setCommand/getQuery QUERY inconsistent", m_composer.getQuery().equals(m_database.getDatabase().getDataSource().getQueryDefinition("set command test").getCommand())); + + final String sql = "SELECT * FROM \"orders for customer\" WHERE \"Product Name\" = 'test'"; + m_composer.setCommand(sql,CommandType.COMMAND); + assure("setCommand/getQuery COMMAND inconsistent", m_composer.getQuery().equals(sql)); + } + catch (Exception e) + { + assure("Exception caught: " + e, false); + } + } /** tests accessing attributes of the composer (order, filter, group by, having) */ public void testAttributes() @@ -136,6 +162,11 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase try { + log.println("check setElementaryQuery"); + final String simpleQuery2 = "SELECT * FROM \"customers\" WHERE \"Name\" = 'oranges'"; + m_composer.setElementaryQuery(simpleQuery2); + assure("setElementaryQuery/getQuery inconsistent", m_composer.getQuery().equals(simpleQuery2)); + log.println("check setQuery"); final String simpleQuery = "SELECT * FROM \"customers\""; m_composer.setQuery(simpleQuery); @@ -260,7 +291,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase filter.addProperty("Type", PropertyAttribute.MAYBEVOID, Integer.valueOf(DataType.LONGVARCHAR)); final XPropertySet column = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class,filter); - m_composer.appendFilterByColumn(column, true); + m_composer.appendFilterByColumn(column, true,SQLFilterOperator.LIKE); assure("At least one row should exist",m_database.getConnection().createStatement().executeQuery(m_composer.getQuery()).next()); } |