From 9cd619e2924acf79a484f5f6fe97cc9c9080b0d4 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 23 Nov 2010 21:51:40 +0100 Subject: dba34b: massaged the dbaccess complex test cases a bit, made them running, again, re-implemented functionality which got list in the recent refactoring (assureException) --- .../qa/complex/dbaccess/ApplicationController.java | 29 ++--- dbaccess/qa/complex/dbaccess/Beamer.java | 57 ++------- dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java | 12 +- .../dbaccess/CopyTableInterActionHandler.java | 8 +- dbaccess/qa/complex/dbaccess/CopyTableWizard.java | 55 +++------ dbaccess/qa/complex/dbaccess/DataSource.java | 37 +----- dbaccess/qa/complex/dbaccess/DatabaseDocument.java | 63 ++++------ dbaccess/qa/complex/dbaccess/Parser.java | 32 ++--- dbaccess/qa/complex/dbaccess/PropertyBag.java | 35 +++--- dbaccess/qa/complex/dbaccess/Query.java | 22 +--- dbaccess/qa/complex/dbaccess/QueryInQuery.java | 38 ++---- dbaccess/qa/complex/dbaccess/RowSet.java | 54 ++------- .../qa/complex/dbaccess/RowSetEventListener.java | 2 +- .../dbaccess/SingleSelectQueryComposer.java | 62 +++++----- dbaccess/qa/complex/dbaccess/TestCase.java | 131 +++++++++++++++++---- dbaccess/qa/complex/dbaccess/UISettings.java | 28 +---- dbaccess/qa/complex/dbaccess/dbaccess.sce | 12 -- dbaccess/qa/complex/dbaccess/makefile.mk | 99 ++++++---------- 18 files changed, 302 insertions(+), 474 deletions(-) mode change 100644 => 100755 dbaccess/qa/complex/dbaccess/CopyTableWizard.java delete mode 100644 dbaccess/qa/complex/dbaccess/dbaccess.sce (limited to 'dbaccess/qa') diff --git a/dbaccess/qa/complex/dbaccess/ApplicationController.java b/dbaccess/qa/complex/dbaccess/ApplicationController.java index bffc1ce97c4c..f8a57b8f6efb 100644 --- a/dbaccess/qa/complex/dbaccess/ApplicationController.java +++ b/dbaccess/qa/complex/dbaccess/ApplicationController.java @@ -27,35 +27,27 @@ package complex.dbaccess; import com.sun.star.beans.PropertyValue; -import com.sun.star.beans.XPropertySet; import com.sun.star.container.XNameAccess; import com.sun.star.frame.FrameSearchFlag; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XModel; import com.sun.star.frame.XStorable; import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdb.XOfficeDatabaseDocument; import com.sun.star.sdb.application.XDatabaseDocumentUI; import com.sun.star.sdbcx.XTablesSupplier; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; -import com.sun.star.uno.XComponentContext; import connectivity.tools.HsqlColumnDescriptor; import connectivity.tools.HsqlDatabase; import connectivity.tools.HsqlTableDescriptor; -import helper.URLHelper; -import java.io.File; import java.io.IOException; // ---------- junit imports ----------------- import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ @@ -74,16 +66,6 @@ public class ApplicationController extends TestCase } // -------------------------------------------------------------------------------------------------------- - -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "checkSaveAs" -// }; -// } - - // -------------------------------------------------------------------------------------------------------- public String getTestObjectName() { return getClass().getName(); @@ -129,21 +111,26 @@ public class ApplicationController extends TestCase } // -------------------------------------------------------------------------------------------------------- - @Before public void before() throws java.lang.Exception + @Before + @Override + public void before() throws java.lang.Exception { super.before(); impl_switchToDocument(null); } // -------------------------------------------------------------------------------------------------------- - @After public void after() throws java.lang.Exception + @After + @Override + public void after() throws java.lang.Exception { impl_closeDocument(); super.after(); } // -------------------------------------------------------------------------------------------------------- - @Test public void checkSaveAs() throws Exception, IOException, java.lang.Exception + @Test + public void checkSaveAs() throws Exception, IOException, java.lang.Exception { // issue 93737 describes the problem that when you save-as a database document, and do changes to it, // then those changes are saved in the old document, actually diff --git a/dbaccess/qa/complex/dbaccess/Beamer.java b/dbaccess/qa/complex/dbaccess/Beamer.java index 2b77e21b9d60..6052c308dbdf 100644 --- a/dbaccess/qa/complex/dbaccess/Beamer.java +++ b/dbaccess/qa/complex/dbaccess/Beamer.java @@ -70,51 +70,10 @@ public class Beamer extends TestCase super(); } -// // -------------------------------------------------------------------------------------------------------- -// protected final XComponentContext getComponentContext() -// { -// XComponentContext context = null; -// try -// { -// final XPropertySet orbProps = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, getORB()); -// context = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, -// orbProps.getPropertyValue("DefaultContext")); -// } -// catch (Exception ex) -// { -// failed("could not retrieve the ComponentContext"); -// } -// return context; -// } // -------------------------------------------------------------------------------------------------------- - -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "testBeamer" -// }; -// } - -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return getClass().getName(); -// } - - // -------------------------------------------------------------------------------------------------------- -// protected final XMultiServiceFactory getORB() -// { -// return (XMultiServiceFactory) param.getMSF(); -// } - - // -------------------------------------------------------------------------------------------------------- - private void impl_closeDocument() - { - } - - // -------------------------------------------------------------------------------------------------------- - @Before public void before() throws Exception, java.lang.Exception + @Before + @Override + public void before() throws Exception, java.lang.Exception { // load it into a frame final Object object = getMSF().createInstance("com.sun.star.frame.Desktop"); @@ -125,18 +84,20 @@ public class Beamer extends TestCase } // -------------------------------------------------------------------------------------------------------- - @After public void after() + @After + @Override + public void after() { } - // -------------------------------------------------------------------------------------------------------- - @Test public void testBeamer() throws Exception, IOException, java.lang.Exception + // -------------------------------------------------------------------------------------------------------- + @Test + public void testBeamer() throws Exception, IOException, java.lang.Exception { final XController controller = docModel.getCurrentController(); final XFrame frame = controller.getFrame(); final XDispatchProvider dispatchP = UnoRuntime.queryInterface(XDispatchProvider.class, frame); URL command = new URL(); - // command.Complete = ".component:DB/DataSourceBrowser"; command.Complete = ".uno:ViewDataSourceBrowser"; Object instance = getMSF().createInstance("com.sun.star.util.URLTransformer"); diff --git a/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java b/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java index ff89c755a90f..aa74ea87a3f6 100644 --- a/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java +++ b/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java @@ -33,11 +33,7 @@ import java.util.logging.Logger; // ---------- junit imports ----------------- import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ @@ -60,13 +56,17 @@ public abstract class CRMBasedTestCase extends TestCase } // -------------------------------------------------------------------------------------------------------- - @Before public void before() + @Before + @Override + public void before() { createTestCase(); } // -------------------------------------------------------------------------------------------------------- - @After public void after() + @After + @Override + public void after() { try { diff --git a/dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler.java b/dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler.java index 53527e356f78..7f88028f72c9 100755 --- a/dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler.java +++ b/dbaccess/qa/complex/dbaccess/CopyTableInterActionHandler.java @@ -30,6 +30,8 @@ import com.sun.star.lib.uno.helper.WeakBase; import com.sun.star.task.XInteractionHandler; import com.sun.star.task.XInteractionRequest; +import static org.junit.Assert.*; + /** * * @author oj93728 @@ -37,14 +39,12 @@ import com.sun.star.task.XInteractionRequest; class CopyTableInterActionHandler extends WeakBase implements XInteractionHandler { - private final CopyTableWizard test; - public CopyTableInterActionHandler(CopyTableWizard testCase) + CopyTableInterActionHandler() { - test = testCase; } public void handle(XInteractionRequest xRequest) { - test.assure(xRequest.toString()); + fail( "interaction handler is not expected to be called" ); } } diff --git a/dbaccess/qa/complex/dbaccess/CopyTableWizard.java b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java old mode 100644 new mode 100755 index 89fc56253ed0..1facca3d8497 --- a/dbaccess/qa/complex/dbaccess/CopyTableWizard.java +++ b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java @@ -48,11 +48,8 @@ import util.UITools; // ---------- junit imports ----------------- import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ @@ -70,30 +67,18 @@ public class CopyTableWizard extends CRMBasedTestCase } // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "copyTable", "copyTableDbase" -// }; -// } - // -------------------------------------------------------------------------------------------------------- -// @Override -// public String getTestObjectName() -// { -// return getClass().getName(); -// } -// -------------------------------------------------------------------------------------------------------- - // -------------------------------------------------------------------------------------------------------- - - @After public void after() + @After + @Override + public void after() { dest.store(); super.after(); } - @Before public void before() + @Before + @Override + public void before() { try { @@ -106,16 +91,14 @@ public class CopyTableWizard extends CRMBasedTestCase fail(""); } } - // -------------------------------------------------------------------------------------------------------- - - + // -------------------------------------------------------------------------------------------------------- class CopyThread implements Runnable { final XCopyTableWizard copyWizard; - public CopyThread(final XCopyTableWizard copyWizard) + CopyThread(final XCopyTableWizard copyWizard) { this.copyWizard = copyWizard; } @@ -138,17 +121,19 @@ public class CopyTableWizard extends CRMBasedTestCase return null; } - XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(XExtendedToolkit.class, toolKit); + XExtendedToolkit tk = UnoRuntime.queryInterface( XExtendedToolkit.class, toolKit ); Object atw = tk.getActiveTopWindow(); - return (XWindow) UnoRuntime.queryInterface(XWindow.class, atw); + return UnoRuntime.queryInterface( XWindow.class, atw ); } - @Test public void copyTable() throws Exception, IOException, java.lang.Exception + @Test + public void copyTable() throws Exception, IOException, java.lang.Exception { copyTable(source,source); } - @Test public void copyTableDbase() throws Exception, IOException, java.lang.Exception + @Test + public void copyTableDbase() throws Exception, IOException, java.lang.Exception { copyTable(source,dest); } @@ -167,15 +152,10 @@ public class CopyTableWizard extends CRMBasedTestCase } } - public void assure(final String message) - { - fail(message); - } - private void copyTable(final String tableName, final XConnection sourceConnection, final XConnection destConnection) throws Exception, IOException, java.lang.Exception { - final XInteractionHandler interAction = new CopyTableInterActionHandler(this); + final XInteractionHandler interAction = new CopyTableInterActionHandler(); final XComponentContext context = getComponentContext(); final XPropertySet sourceDescriptor = DataAccessDescriptorFactory.get(context).createDataAccessDescriptor(); sourceDescriptor.setPropertyValue("CommandType", CommandType.TABLE); @@ -185,7 +165,8 @@ public class CopyTableWizard extends CRMBasedTestCase final XPropertySet destDescriptor = DataAccessDescriptorFactory.get(context).createDataAccessDescriptor(); destDescriptor.setPropertyValue("ActiveConnection", destConnection); - final XCopyTableWizard copyWizard = com.sun.star.sdb.application.CopyTableWizard.createWithInteractionHandler(context, sourceDescriptor, destDescriptor, interAction); + final XCopyTableWizard copyWizard = com.sun.star.sdb.application.CopyTableWizard.createWithInteractionHandler( + context, sourceDescriptor, destDescriptor, interAction); copyWizard.setOperation((short) 0); // com.sun.star.sdb.application.CopyDefinitionAndData Optional auto = new Optional(); @@ -219,7 +200,7 @@ public class CopyTableWizard extends CRMBasedTestCase } catch (java.lang.Exception exception) { - exception.printStackTrace(); + exception.printStackTrace( System.err ); } } catch (com.sun.star.lang.IndexOutOfBoundsException indexOutOfBoundsException) diff --git a/dbaccess/qa/complex/dbaccess/DataSource.java b/dbaccess/qa/complex/dbaccess/DataSource.java index e8f8f7a41d77..ae5d131c1e20 100644 --- a/dbaccess/qa/complex/dbaccess/DataSource.java +++ b/dbaccess/qa/complex/dbaccess/DataSource.java @@ -27,23 +27,14 @@ package complex.dbaccess; import com.sun.star.container.XNameAccess; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XNamingService; -// import complexlib.ComplexTestCase; import connectivity.tools.CRMDatabase; import connectivity.tools.HsqlDatabase; -//import java.util.logging.Level; -//import java.util.logging.Logger; // ---------- junit imports ----------------- -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ @@ -54,21 +45,6 @@ public class DataSource extends TestCase HsqlDatabase m_database; connectivity.tools.DataSource m_dataSource; - // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "testRegistrationName" -// }; -// } -// -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "DataSource"; -// } - // -------------------------------------------------------------------------------------------------------- private void createTestCase() { @@ -92,13 +68,8 @@ public class DataSource extends TestCase } // -------------------------------------------------------------------------------------------------------- -// private XMultiServiceFactory getFactory() -// { -// return (XMultiServiceFactory) param.getMSF(); -// } - - // -------------------------------------------------------------------------------------------------------- - @Test public void testRegistrationName() + @Test + public void testRegistrationName() { try { @@ -109,8 +80,8 @@ public class DataSource extends TestCase assertEquals("pre-registered database has a wrong name!", dataSourceName, bibliography.getName()); // 2. register a newly created data source, and verify it has the proper name dataSourceName = "someDataSource"; - final XNamingService dataSourceRegistrations = (XNamingService) UnoRuntime.queryInterface( - XNamingService.class, getMSF().createInstance("com.sun.star.sdb.DatabaseContext")); + final XNamingService dataSourceRegistrations = UnoRuntime.queryInterface( + XNamingService.class, getMSF().createInstance( "com.sun.star.sdb.DatabaseContext" ) ); final XNameAccess existenceCheck = UnoRuntime.queryInterface( XNameAccess.class, dataSourceRegistrations ); if ( existenceCheck.hasByName( "someDataSource" ) ) dataSourceRegistrations.revokeObject( "someDataSource" ); diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java index 757ae2de22d5..d0c60eb9c4fb 100644 --- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java +++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java @@ -26,6 +26,8 @@ ************************************************************************/ package complex.dbaccess; +import com.sun.star.lang.NotInitializedException; +import com.sun.star.frame.DoubleInitializationException; import com.sun.star.awt.XTopWindow; import com.sun.star.beans.PropertyState; import com.sun.star.document.DocumentEvent; @@ -83,11 +85,8 @@ import java.util.logging.Logger; // ---------- junit imports ----------------- import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ @@ -253,25 +252,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. // ======================================================================================================== // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "testLoadable", -// "testDocumentRevenants", -// "testDocumentEvents", -// "testGlobalEvents" -// }; -// } -// -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "DatabaseDocument"; -// } - - // -------------------------------------------------------------------------------------------------------- - @Before public void before() throws java.lang.Exception + @Before + public void before() throws java.lang.Exception { super.before(); @@ -297,7 +279,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } // -------------------------------------------------------------------------------------------------------- - @After public void after() throws java.lang.Exception + @After + public void after() throws java.lang.Exception { try { @@ -326,7 +309,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. public Class unoInterfaceClass = null; public String methodName = null; - public UnoMethodDescriptor(Class _class, String _method) + UnoMethodDescriptor(Class _class, String _method) { unoInterfaceClass = _class; methodName = _method; @@ -351,8 +334,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. for (int i = 0; i < unsupportedMethods.length; ++i) { -// assureException( _document, unsupportedMethods[i].unoInterfaceClass, -// unsupportedMethods[i].methodName, new Object[]{}, _isInitialized ? null : NotInitializedException.class ); + assureException( _document, unsupportedMethods[i].unoInterfaceClass, + unsupportedMethods[i].methodName, new Object[]{}, _isInitialized ? null : NotInitializedException.class ); } } @@ -410,7 +393,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } // -------------------------------------------------------------------------------------------------------- - @Test public void testLoadable() throws Exception, IOException + @Test + public void testLoadable() throws Exception, IOException { XModel databaseDoc = impl_createEmptyEmbeddedHSQLDocument(); String documentURL = databaseDoc.getURL(); @@ -438,10 +422,10 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. impl_checkDocumentInitState(databaseDoc, true); // and while we are here ... initilizing the same document again should not be possible -// assureException( databaseDoc, XLoadable.class, "initNew", new Object[0], -// DoubleInitializationException.class ); -// assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, -// DoubleInitializationException.class ); + assureException( databaseDoc, XLoadable.class, "initNew", new Object[0], + DoubleInitializationException.class ); + assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, + DoubleInitializationException.class ); // .................................................................... // 3. XLoadable::initNew @@ -453,10 +437,10 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. impl_checkDocumentInitState(databaseDoc, true); // same as above - initializing the document a second time must fail -// assureException( databaseDoc, XLoadable.class, "initNew", new Object[0], -// DoubleInitializationException.class ); -// assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, -// DoubleInitializationException.class ); + assureException( databaseDoc, XLoadable.class, "initNew", new Object[0], + DoubleInitializationException.class ); + assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, + DoubleInitializationException.class ); } // -------------------------------------------------------------------------------------------------------- @@ -571,7 +555,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. * This method here tests some of those aspects of a document which should survive the death of one * instance and re-creation as a revenant. */ - @Test public void testDocumentRevenants() throws Exception, IOException + @Test + public void testDocumentRevenants() throws Exception, IOException { // create an empty document XModel databaseDoc = impl_createDocWithMacro( "Lib", "Module", @@ -623,7 +608,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } // -------------------------------------------------------------------------------------------------------- - @Test public void testDocumentEvents() throws Exception, IOException + @Test + public void testDocumentEvents() throws Exception, IOException { // create an empty document final String libName = "EventHandlers"; @@ -691,7 +677,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } // -------------------------------------------------------------------------------------------------------- - @Test public void testGlobalEvents() throws Exception, IOException + @Test + public void testGlobalEvents() throws Exception, IOException { XModel databaseDoc = impl_createEmptyEmbeddedHSQLDocument(); final XStorable storeDoc = UnoRuntime.queryInterface(XStorable.class, databaseDoc); diff --git a/dbaccess/qa/complex/dbaccess/Parser.java b/dbaccess/qa/complex/dbaccess/Parser.java index 3b6b0b92e3ed..588755a8c29c 100644 --- a/dbaccess/qa/complex/dbaccess/Parser.java +++ b/dbaccess/qa/complex/dbaccess/Parser.java @@ -37,34 +37,14 @@ import com.sun.star.uno.UnoRuntime; // ---------- junit imports ----------------- -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ public class Parser extends CRMBasedTestCase { // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] { -// "checkJoinSyntax", -// "checkParameterTypes", -// "checkWhere", -// }; -// } - - // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "Parser"; -// } - - // -------------------------------------------------------------------------------------------------------- + @Override protected void createTestCase() { try @@ -79,7 +59,9 @@ public class Parser extends CRMBasedTestCase } } - @Test public void checkWhere() throws Exception + // -------------------------------------------------------------------------------------------------------- + @Test + public void checkWhere() throws Exception { final XSingleSelectQueryComposer composer = createQueryComposer(); final String SELECT = "SELECT \"products\".\"Name\" FROM \"products\" WHERE "; @@ -118,7 +100,8 @@ public class Parser extends CRMBasedTestCase // -------------------------------------------------------------------------------------------------------- /** verifies that aliases for inner queries work as expected */ - @Test public void checkJoinSyntax() throws Exception + @Test + public void checkJoinSyntax() throws Exception { final XSingleSelectQueryComposer composer = createQueryComposer(); @@ -186,7 +169,8 @@ public class Parser extends CRMBasedTestCase // -------------------------------------------------------------------------------------------------------- /** verifies that the parser properly recognizes the types of parameters */ - @Test public void checkParameterTypes() throws Exception + @Test + public void checkParameterTypes() throws Exception { impl_checkParameters( "SELECT * FROM \"all orders\" " + diff --git a/dbaccess/qa/complex/dbaccess/PropertyBag.java b/dbaccess/qa/complex/dbaccess/PropertyBag.java index 4920f8fa0006..9f77559eab0b 100644 --- a/dbaccess/qa/complex/dbaccess/PropertyBag.java +++ b/dbaccess/qa/complex/dbaccess/PropertyBag.java @@ -29,18 +29,20 @@ package complex.dbaccess; // import complexlib.ComplexTestCase; +import com.sun.star.beans.NamedValue; +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.PropertyAttribute; +import com.sun.star.beans.XPropertyAccess; +import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertyContainer; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XInterface; import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.beans.*; // ---------- junit imports ----------------- -import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ @@ -52,27 +54,20 @@ public class PropertyBag extends TestCase private XPropertyAccess m_access; private XMultiServiceFactory m_orb = null; -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "checkBasics", -// "checkSequenceAccess", -// "checkDynamicSet" -// }; -// } - public String getTestObjectName() { return "PropertyBag"; } - @Before public void before() + @Before + @Override + public void before() { m_orb = getMSF(); } - @Test public void checkBasics() + @Test + public void checkBasics() { createEmptyBag(); System.out.println("testing the basics"); @@ -161,7 +156,8 @@ public class PropertyBag extends TestCase } } - @Test public void checkSequenceAccess() throws com.sun.star.uno.Exception + @Test + public void checkSequenceAccess() throws com.sun.star.uno.Exception { System.out.println( "checking PropertySetAccess via sequences" ); createStandardBag( false ); @@ -218,7 +214,8 @@ public class PropertyBag extends TestCase } } - @Test public void checkDynamicSet() throws com.sun.star.uno.Exception + @Test + public void checkDynamicSet() throws com.sun.star.uno.Exception { System.out.println( "checking proper dynamic of the set" ); createStandardBag( false ); diff --git a/dbaccess/qa/complex/dbaccess/Query.java b/dbaccess/qa/complex/dbaccess/Query.java index 222a6668f705..e78f6859fb88 100644 --- a/dbaccess/qa/complex/dbaccess/Query.java +++ b/dbaccess/qa/complex/dbaccess/Query.java @@ -30,19 +30,13 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexAccess; import com.sun.star.container.XNameAccess; import com.sun.star.container.XNamed; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdb.XQueriesSupplier; import com.sun.star.sdbcx.XColumnsSupplier; import com.sun.star.uno.UnoRuntime; import connectivity.tools.CRMDatabase; // ---------- junit imports ----------------- -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ @@ -50,19 +44,6 @@ public class Query extends TestCase { connectivity.tools.HsqlDatabase m_database; - // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() { -// return new String[] -// { -// "testQueryColumns" -// }; -// } - - // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() { -// return "Query"; -// } - // -------------------------------------------------------------------------------------------------------- private void createTestCase() { @@ -89,7 +70,8 @@ public class Query extends TestCase { // } // -------------------------------------------------------------------------------------------------------- - @Test public void testQueryColumns() + @Test + public void testQueryColumns() { createTestCase(); diff --git a/dbaccess/qa/complex/dbaccess/QueryInQuery.java b/dbaccess/qa/complex/dbaccess/QueryInQuery.java index 0cb0789b782c..ad78eb37718b 100644 --- a/dbaccess/qa/complex/dbaccess/QueryInQuery.java +++ b/dbaccess/qa/complex/dbaccess/QueryInQuery.java @@ -38,37 +38,16 @@ import com.sun.star.sdbc.XStatement; import com.sun.star.sdbc.XResultSet; // ---------- junit imports ----------------- -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ public class QueryInQuery extends CRMBasedTestCase { private static final String QUERY_PRODUCTS = "query products"; -// // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] { -// "executeSimpleSelect", -// "executeAliasedSelect", -// "checkNameCollisions", -// "checkCyclicReferences", -// "checkStatementQiQSupport" -// }; -// } -// -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "QueryInQuery"; -// } // -------------------------------------------------------------------------------------------------------- + @Override protected void createTestCase() { try @@ -113,7 +92,8 @@ public class QueryInQuery extends CRMBasedTestCase // -------------------------------------------------------------------------------------------------------- /** executes a SQL statement simply selecting all columns from a query */ - @Test public void executeSimpleSelect() throws SQLException + @Test + public void executeSimpleSelect() throws SQLException { verifyEqualRowSetContent( CommandType.COMMAND, "SELECT * FROM \"query products\"", @@ -123,7 +103,8 @@ public class QueryInQuery extends CRMBasedTestCase // -------------------------------------------------------------------------------------------------------- /** verifies that aliases for inner queries work as expected */ - @Test public void executeAliasedSelect() throws SQLException + @Test + public void executeAliasedSelect() throws SQLException { verifyEqualRowSetContent( CommandType.COMMAND, "SELECT \"PROD\".\"ID\" FROM \"query products\" AS \"PROD\"", @@ -136,7 +117,8 @@ public class QueryInQuery extends CRMBasedTestCase // -------------------------------------------------------------------------------------------------------- /** verifies that aliases for inner queries work as expected */ - @Test public void checkNameCollisions() + @Test + public void checkNameCollisions() { // create a query with a name which is used by a table boolean caughtExpected = false; @@ -168,7 +150,8 @@ public class QueryInQuery extends CRMBasedTestCase } // -------------------------------------------------------------------------------------------------------- - @Test public void checkCyclicReferences() throws ElementExistException, WrappedTargetException, IllegalArgumentException + @Test + public void checkCyclicReferences() throws ElementExistException, WrappedTargetException, IllegalArgumentException { // some queries which create a cycle in the sub query tree m_database.getDatabase().getDataSource().createQuery( "orders level 1", "SELECT * FROM \"orders level 0\"" ); @@ -186,7 +169,8 @@ public class QueryInQuery extends CRMBasedTestCase } // -------------------------------------------------------------------------------------------------------- - @Test public void checkStatementQiQSupport() + @Test + public void checkStatementQiQSupport() { try { diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java index 7a11a96d9b00..7716f7f30512 100644 --- a/dbaccess/qa/complex/dbaccess/RowSet.java +++ b/dbaccess/qa/complex/dbaccess/RowSet.java @@ -32,7 +32,6 @@ import com.sun.star.beans.XPropertySet; import com.sun.star.container.XIndexAccess; import com.sun.star.lang.WrappedTargetException; import com.sun.star.lang.XComponent; -import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.sdb.CommandType; import com.sun.star.sdb.XParametersSupplier; import com.sun.star.sdb.XResultSetAccess; @@ -58,12 +57,7 @@ import java.lang.reflect.Method; import java.util.Random; // ---------- junit imports ----------------- -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ @@ -92,7 +86,7 @@ public class RowSet extends TestCase XRow m_row; int m_id; - public ResultSetMovementStress(XResultSet _resultSet, int _id) throws java.lang.Exception + ResultSetMovementStress(XResultSet _resultSet, int _id) throws java.lang.Exception { m_resultSet = _resultSet; m_row = UnoRuntime.queryInterface( XRow.class, m_resultSet ); @@ -123,27 +117,6 @@ public class RowSet extends TestCase } } // -------------------------------------------------------------------------------------------------------- - -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "testRowSet", -// "testRowSetEvents", -// "testDeleteBehavior", -// "testCloneMovesPlusDeletions", -// "testCloneMovesPlusInsertions", -// "testParameters" -// }; -// } -// -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "RowSet"; -// } -// - // -------------------------------------------------------------------------------------------------------- private void createTestCase(boolean _defaultRowSet) { if (m_database == null) @@ -175,12 +148,6 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- -// private XMultiServiceFactory getFactory() -// { -// return (XMultiServiceFactory) param.getMSF(); -// } - // -------------------------------------------------------------------------------------------------------- /** creates a com.sun.star.sdb.RowSet to use during the test * @param command @@ -239,7 +206,8 @@ public class RowSet extends TestCase } // -------------------------------------------------------------------------------------------------------- - @Test public void testRowSet() throws java.lang.Exception + @Test + public void testRowSet() throws java.lang.Exception { System.out.println("testing testRowSet"); @@ -415,7 +383,8 @@ public class RowSet extends TestCase } // -------------------------------------------------------------------------------------------------------- - @Test public void testRowSetEvents() throws java.lang.Exception + @Test + public void testRowSetEvents() throws java.lang.Exception { System.out.println("testing RowSet Events"); createTestCase(true); @@ -632,7 +601,8 @@ public class RowSet extends TestCase } // -------------------------------------------------------------------------------------------------------- - @Test public void testDeleteBehavior() throws Exception + @Test + public void testDeleteBehavior() throws Exception { createTestCase(true); @@ -765,8 +735,8 @@ public class RowSet extends TestCase /** checks whether deletions on the main RowSet properly interfere (or don't interfere) with the movement * on a clone of the RowSet */ - @SuppressWarnings("empty-statement") - @Test public void testCloneMovesPlusDeletions() throws SQLException, UnknownPropertyException, WrappedTargetException + @Test + public void testCloneMovesPlusDeletions() throws SQLException, UnknownPropertyException, WrappedTargetException { createTestCase(true); // ensure that all records are known @@ -834,7 +804,8 @@ public class RowSet extends TestCase /** checks whether insertions on the main RowSet properly interfere (or don't interfere) with the movement * on a clone of the RowSet */ - @Test public void testCloneMovesPlusInsertions() throws SQLException, UnknownPropertyException, WrappedTargetException, PropertyVetoException, com.sun.star.lang.IllegalArgumentException + @Test + public void testCloneMovesPlusInsertions() throws SQLException, UnknownPropertyException, WrappedTargetException, PropertyVetoException, com.sun.star.lang.IllegalArgumentException { createTestCase(true); // ensure that all records are known @@ -1019,7 +990,8 @@ public class RowSet extends TestCase // -------------------------------------------------------------------------------------------------------- /** checks the XParametersSupplier functionality of a RowSet */ - @Test public void testParameters() + @Test + public void testParameters() { createTestCase(false); // use an own RowSet instance, not the one which is also used for the other cases diff --git a/dbaccess/qa/complex/dbaccess/RowSetEventListener.java b/dbaccess/qa/complex/dbaccess/RowSetEventListener.java index c4569986a5d7..2f1d642c19b3 100644 --- a/dbaccess/qa/complex/dbaccess/RowSetEventListener.java +++ b/dbaccess/qa/complex/dbaccess/RowSetEventListener.java @@ -33,7 +33,7 @@ import com.sun.star.sdb.RowChangeEvent; import com.sun.star.lang.EventObject; import com.sun.star.beans.XPropertyChangeListener; -public class RowSetEventListener implements XRowSetApproveListener,XRowSetListener,XPropertyChangeListener +public final class RowSetEventListener implements XRowSetApproveListener,XRowSetListener,XPropertyChangeListener { public static final int APPROVE_CURSOR_MOVE = 0; public static final int APPROVE_ROW_CHANGE = 1; diff --git a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java index ec77f084063e..89d107ed5bb1 100755 --- a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java +++ b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java @@ -26,23 +26,28 @@ ************************************************************************/ package complex.dbaccess; +import com.sun.star.beans.PropertyState; +import com.sun.star.sdb.SQLFilterOperator; +import com.sun.star.beans.PropertyAttribute; +import com.sun.star.beans.XPropertySet; +import com.sun.star.beans.XPropertyContainer; +import com.sun.star.beans.NamedValue; +import com.sun.star.container.XNameAccess; +import com.sun.star.sdbcx.XTablesSupplier; +import com.sun.star.sdb.XParametersSupplier; +import com.sun.star.beans.PropertyValue; +import com.sun.star.sdbcx.XColumnsSupplier; +import com.sun.star.container.XIndexAccess; +import com.sun.star.sdb.CommandType; +import com.sun.star.sdb.XSingleSelectQueryComposer; import com.sun.star.uno.UnoRuntime; -import com.sun.star.beans.*; -import com.sun.star.sdbcx.*; -import com.sun.star.sdb.*; -import com.sun.star.container.*; import com.sun.star.sdbc.DataType; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; // ---------- junit imports ----------------- -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ @@ -57,26 +62,6 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase " OR ( \"Postal\" = '9' )"; private final static String INNERPRODUCTSQUERY = "products (inner)"; - // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] -// { -// "testSetCommand", -// "testAttributes", -// "testSubQueries", -// "testParameters", -// "testDisjunctiveNormalForm", -// "testConditionByColumn" -// }; -// } - -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "SingleSelectQueryComposer"; -// } - // -------------------------------------------------------------------------------------------------------- private void createQueries() throws Exception { @@ -84,6 +69,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase } // -------------------------------------------------------------------------------------------------------- + @Override protected void createTestCase() { try @@ -141,7 +127,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase /** tests setCommand of the composer */ - @Test public void testSetCommand() + @Test + public void testSetCommand() { System.out.println("testing SingleSelectQueryComposer's setCommand"); @@ -166,7 +153,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase } /** tests accessing attributes of the composer (order, filter, group by, having) */ - @Test public void testAttributes() + @Test + public void testAttributes() { System.out.println("testing SingleSelectQueryComposer's attributes (order, filter, group by, having)"); @@ -223,7 +211,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase /** test various sub query related features ("queries in queries") */ - @Test public void testSubQueries() throws Exception + @Test + public void testSubQueries() throws Exception { m_composer.setQuery("SELECT * from \"" + INNERPRODUCTSQUERY + "\""); final XTablesSupplier suppTables = UnoRuntime.queryInterface(XTablesSupplier.class, m_composer); @@ -239,7 +228,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase /** tests the XParametersSupplier functionality */ - @Test public void testParameters() + @Test + public void testParameters() { try { @@ -278,7 +268,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase } } - @Test public void testConditionByColumn() + @Test + public void testConditionByColumn() { try { @@ -337,7 +328,8 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase /** tests the disjunctive normal form functionality, aka the structured filter, * of the composer */ - @Test public void testDisjunctiveNormalForm() + @Test + public void testDisjunctiveNormalForm() { // a simple case: WHERE clause simply is a combination of predicates knitted with AND String query = diff --git a/dbaccess/qa/complex/dbaccess/TestCase.java b/dbaccess/qa/complex/dbaccess/TestCase.java index ba899a114205..f2cbdf988b38 100644 --- a/dbaccess/qa/complex/dbaccess/TestCase.java +++ b/dbaccess/qa/complex/dbaccess/TestCase.java @@ -26,6 +26,8 @@ ************************************************************************/ package complex.dbaccess; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; import com.sun.star.frame.XComponentLoader; @@ -41,11 +43,8 @@ import java.net.URI; import java.net.URISyntaxException; // ---------- junit imports ----------------- -import org.junit.After; import org.junit.AfterClass; -import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Test; import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ @@ -54,12 +53,6 @@ import static org.junit.Assert.*; public abstract class TestCase { // -------------------------------------------------------------------------------------------------------- -// protected final XMultiServiceFactory getORB() -// { -// return (XMultiServiceFactory)param.getMSF(); -// } - - // -------------------------------------------------------------------------------------------------------- protected final XComponentContext getComponentContext() { XComponentContext context = null; @@ -130,31 +123,129 @@ public abstract class TestCase } // -------------------------------------------------------------------------------------------------------- -// protected void assureException( Object _object, Class _unoInterfaceClass, String _methodName, Object[] _methodArgs, -// Class _expectedExceptionClass ) -// { -// assureException( UnoRuntime.queryInterface( _unoInterfaceClass, _object ), _methodName, -// _methodArgs, _expectedExceptionClass ); -// } + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _message + * is the message to print when the check fails + * @param _object + * is the object to invoke the method on + * @param _methodName + * is the name of the method to invoke + * @param _methodArgs + * are the arguments to pass to the method. + * @param _argClasses + * are the classes to assume for the arguments of the methods + * @param _expectedExceptionClass + * is the class of the exception to be caught. If this is null, + * it means that no exception must be throw by invoking the method. + */ + protected void assureException( final String _message, final Object _object, final String _methodName, + final Class[] _argClasses, final Object[] _methodArgs, final Class _expectedExceptionClass ) + { + Class objectClass = _object.getClass(); + boolean noExceptionAllowed = ( _expectedExceptionClass == null ); + boolean caughtExpected = noExceptionAllowed ? true : false; + try + { + Method method = objectClass.getMethod( _methodName, _argClasses ); + method.invoke(_object, _methodArgs ); + } + catch ( InvocationTargetException e ) + { + caughtExpected = noExceptionAllowed + ? false + : ( e.getTargetException().getClass().equals( _expectedExceptionClass ) ); + } + catch( Exception e ) + { + caughtExpected = false; + } + + assertTrue( _message, caughtExpected ); + } + + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _message is the message to print when the check fails + * @param _object is the object to invoke the method on + * @param _methodName is the name of the method to invoke + * @param _methodArgs are the arguments to pass to the method. Those implicitly define + * the classes of the arguments of the method which is called. + * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that no exception must be throw by invoking the method. + */ + protected void assureException( final String _message, final Object _object, final String _methodName, + final Object[] _methodArgs, final Class _expectedExceptionClass ) + { + Class[] argClasses = new Class[ _methodArgs.length ]; + for ( int i=0; i<_methodArgs.length; ++i ) + argClasses[i] = _methodArgs[i].getClass(); + assureException( _message, _object, _methodName, argClasses, _methodArgs, _expectedExceptionClass ); + } + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _object is the object to invoke the method on + * @param _methodName is the name of the method to invoke + * @param _methodArgs are the arguments to pass to the method. Those implicitly define + * the classes of the arguments of the method which is called. + * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that no exception must be throw by invoking the method. + */ + protected void assureException( final Object _object, final String _methodName, final Object[] _methodArgs, + final Class _expectedExceptionClass ) + { + assureException( + "did not catch the expected exception (" + + ( ( _expectedExceptionClass == null ) ? "none" : _expectedExceptionClass.getName() ) + + ") while calling " + _object.getClass().getName() + "." + _methodName, + _object, _methodName, _methodArgs, _expectedExceptionClass ); + } + + /** invokes a given method on a given object, and assures a certain exception is caught + * @param _object is the object to invoke the method on + * @param _methodName is the name of the method to invoke + * @param _methodArgs are the arguments to pass to the method + * @param _argClasses are the classes to assume for the arguments of the methods + * @param _expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that no exception must be throw by invoking the method. + */ + protected void assureException( final Object _object, final String _methodName, final Class[] _argClasses, + final Object[] _methodArgs, final Class _expectedExceptionClass ) + { + assureException( + "did not catch the expected exception (" + + ( ( _expectedExceptionClass == null ) ? "none" : _expectedExceptionClass.getName() ) + + ") while calling " + _object.getClass().getName() + "." + _methodName, + _object, _methodName, _argClasses, _methodArgs, _expectedExceptionClass ); + } + + // -------------------------------------------------------------------------------------------------------- + protected void assureException( Object _object, Class _unoInterfaceClass, String _methodName, Object[] _methodArgs, + Class _expectedExceptionClass ) + { + assureException( UnoRuntime.queryInterface( _unoInterfaceClass, _object ), _methodName, + _methodArgs, _expectedExceptionClass ); + } + + // -------------------------------------------------------------------------------------------------------- protected XMultiServiceFactory getMSF() { final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); return xMSF1; } + // -------------------------------------------------------------------------------------------------------- // setup and close connections - @BeforeClass public static void setUpConnection() throws Exception { - System.out.println("setUpConnection()"); + @BeforeClass + public static void setUpConnection() throws Exception + { connection.setUp(); } - @AfterClass public static void tearDownConnection() - throws InterruptedException, com.sun.star.uno.Exception + // -------------------------------------------------------------------------------------------------------- + @AfterClass + public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception { - System.out.println("tearDownConnection()"); connection.tearDown(); } diff --git a/dbaccess/qa/complex/dbaccess/UISettings.java b/dbaccess/qa/complex/dbaccess/UISettings.java index 8733f000f644..536d66025deb 100644 --- a/dbaccess/qa/complex/dbaccess/UISettings.java +++ b/dbaccess/qa/complex/dbaccess/UISettings.java @@ -38,36 +38,17 @@ import com.sun.star.util.XCloseable; import connectivity.tools.CRMDatabase; // ---------- junit imports ----------------- -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; -import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; // ------------------------------------------ public class UISettings extends TestCase { // -------------------------------------------------------------------------------------------------------- -// public String[] getTestMethodNames() -// { -// return new String[] { -// "checkTableFormattingPersistence", -// "checkTransparentQueryColumnSettings" -// }; -// } -// -// // -------------------------------------------------------------------------------------------------------- -// public String getTestObjectName() -// { -// return "UISettings"; -// } - - // -------------------------------------------------------------------------------------------------------- /** verifies that aliases for inner queries work as expected */ - @Test public void checkTableFormattingPersistence() throws java.lang.Exception + @Test + public void checkTableFormattingPersistence() throws java.lang.Exception { // create, load, and connect a DB doc CRMDatabase database = new CRMDatabase( getMSF(), true ); @@ -107,7 +88,7 @@ public class UISettings extends TestCase // verify the properties assertEquals( "wrong font name", "Andale Sans UI", (String)tableControlModel.getPropertyValue( "FontName" ) ); - assertEquals( "wrong font height", (float)20, ((Float)tableControlModel.getPropertyValue( "FontHeight" )).floatValue() ); + assertEquals( "wrong font height", (float)20, ((Float)tableControlModel.getPropertyValue( "FontHeight" )).floatValue(), 0 ); assertEquals( "wrong font slant", FontSlant.ITALIC, (FontSlant)tableControlModel.getPropertyValue( "FontSlant" ) ); // close the doc @@ -119,7 +100,8 @@ public class UISettings extends TestCase * settings * @throws java.lang.Exception */ - @Test public void checkTransparentQueryColumnSettings() throws java.lang.Exception + @Test + public void checkTransparentQueryColumnSettings() throws java.lang.Exception { // create, load, and connect a DB doc CRMDatabase database = new CRMDatabase( getMSF(), true ); diff --git a/dbaccess/qa/complex/dbaccess/dbaccess.sce b/dbaccess/qa/complex/dbaccess/dbaccess.sce deleted file mode 100644 index c5fa408ff273..000000000000 --- a/dbaccess/qa/complex/dbaccess/dbaccess.sce +++ /dev/null @@ -1,12 +0,0 @@ --o complex.dbaccess.SingleSelectQueryComposer --o complex.dbaccess.RowSet --o complex.dbaccess.PropertyBag --o complex.dbaccess.Query --o complex.dbaccess.QueryInQuery --o complex.dbaccess.DatabaseDocument --o complex.dbaccess.DataSource --o complex.dbaccess.Parser --o complex.dbaccess.ApplicationController --o complex.dbaccess.CopyTableWizard --o complex.dbaccess.UISettings --o complex.dbaccess.Beamer diff --git a/dbaccess/qa/complex/dbaccess/makefile.mk b/dbaccess/qa/complex/dbaccess/makefile.mk index 4a3e0426fe1d..b0f0911174da 100755 --- a/dbaccess/qa/complex/dbaccess/makefile.mk +++ b/dbaccess/qa/complex/dbaccess/makefile.mk @@ -25,22 +25,36 @@ # #************************************************************************* -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +.IF "$(OOO_JUNIT_JAR)" == "" nothing .PHONY: + @echo ----------------------------------------------------- + @echo - JUnit not available, not building anything + @echo ----------------------------------------------------- .ELSE PRJ = ../../.. PRJNAME = dbaccess TARGET = qa_complex_dbaccess - -.IF "$(OOO_JUNIT_JAR)" != "" PACKAGE = complex/dbaccess +# --- Settings ----------------------------------------------------- +.INCLUDE: settings.mk + +#----- compile .java files ----------------------------------------- + +JARFILES = OOoRunner.jar ridl.jar test.jar juh.jar unoil.jar ConnectivityTools.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) + +#----- create a jar from compiled files ---------------------------- + +JARTARGET = $(TARGET).jar + +#----- Java files -------------------------------------------------- + # here store only Files which contain a @Test JAVATESTFILES = \ ApplicationController.java \ Beamer.java \ - CRMBasedTestCase.java \ CopyTableWizard.java \ DataSource.java \ DatabaseDocument.java \ @@ -51,83 +65,38 @@ JAVATESTFILES = \ RowSet.java \ SingleSelectQueryComposer.java \ UISettings.java \ - TestCase.java # put here all other files JAVAFILES = $(JAVATESTFILES) \ + CRMBasedTestCase.java \ CopyTableInterActionHandler.java \ DatabaseApplication.java \ FileHelper.java \ - RowSetEventListener.java - + RowSetEventListener.java \ + TestCase.java -JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar ConnectivityTools.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) # Sample how to debug # JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y -.END +# --- Targets ------------------------------------------------------ -.INCLUDE: settings.mk .INCLUDE: target.mk + +ALL : ALLTAR + +# --- subsequent tests --------------------------------------------- + +.IF "$(OOO_SUBSEQUENT_TESTS)" != "" + .INCLUDE: installationtest.mk ALLTAR : javatest -.END + # Sample how to debug + # JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y +.END # "$(OOO_SUBSEQUENT_TESTS)" == "" + +.END # ELSE "$(OOO_JUNIT_JAR)" != "" -# -# -# PRJ = ..$/..$/.. -# TARGET = DbaComplexTests -# PRJNAME = $(TARGET) -# PACKAGE = complex$/dbaccess -# -# # --- Settings ----------------------------------------------------- -# .INCLUDE: settings.mk -# -# .IF "$(SOLAR_JAVA)" == "" -# all: -# @echo "Java not available. Build skipped" -# -# .INCLUDE : target.mk -# .ELSE -# -# #----- compile .java files ----------------------------------------- -# -# JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar ConnectivityTools.jar -# JAVAFILES := $(shell @$(FIND) ./*.java) -# JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) -# -# #----- make a jar from compiled files ------------------------------ -# -# MAXLINELENGTH = 100000 -# -# JARCLASSDIRS = $(PACKAGE) -# JARTARGET = $(TARGET).jar -# JARCOMPRESS = TRUE -# -# RUNNER_ARGS = -cp "$(CLASSPATH)$(PATH_SEPERATOR)$(SOLARBINDIR)$/OOoRunner.jar" org.openoffice.Runner -TestBase java_complex -# -# RUNNER_CALL = $(AUGMENT_LIBRARY_PATH) java -# -# # --- Targets ------------------------------------------------------ -# -# .IF "$(depend)" == "" -# ALL : ALLTAR -# .ELSE -# ALL: ALLDEP -# .ENDIF -# -# .INCLUDE : target.mk -# -# -# run: $(CLASSDIR)$/$(JARTARGET) -# +$(RUNNER_CALL) $(RUNNER_ARGS) -sce dbaccess.sce -# -# run_%: $(CLASSDIR)$/$(JARTARGET) -# +$(RUNNER_CALL) $(RUNNER_ARGS) -o complex.dbaccess.$(@:s/run_//) -# -# .ENDIF # "$(SOLAR_JAVA)" == "" -- cgit From ec99f8427269c43926e15d039b204525269dbc17 Mon Sep 17 00:00:00 2001 From: "Frank Schoenheit [fs]" Date: Tue, 23 Nov 2010 21:55:07 +0100 Subject: dba34b: disable CopyTableWizard test for now, since it fails (which is issue #i115753#) --- dbaccess/qa/complex/dbaccess/makefile.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'dbaccess/qa') diff --git a/dbaccess/qa/complex/dbaccess/makefile.mk b/dbaccess/qa/complex/dbaccess/makefile.mk index b0f0911174da..7778222349ab 100755 --- a/dbaccess/qa/complex/dbaccess/makefile.mk +++ b/dbaccess/qa/complex/dbaccess/makefile.mk @@ -55,7 +55,6 @@ JARTARGET = $(TARGET).jar JAVATESTFILES = \ ApplicationController.java \ Beamer.java \ - CopyTableWizard.java \ DataSource.java \ DatabaseDocument.java \ Parser.java \ @@ -66,6 +65,9 @@ JAVATESTFILES = \ SingleSelectQueryComposer.java \ UISettings.java \ +# CopyTableWizard.java +# disable for now (#i115753#) + # put here all other files JAVAFILES = $(JAVATESTFILES) \ CRMBasedTestCase.java \ -- cgit From b02e3bd428c662e7b3326982d1996f56a547761e Mon Sep 17 00:00:00 2001 From: "Ocke.Janssen" Date: Thu, 25 Nov 2010 14:55:38 +0100 Subject: dba34b: #i115753# add test again --- dbaccess/qa/complex/dbaccess/makefile.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'dbaccess/qa') diff --git a/dbaccess/qa/complex/dbaccess/makefile.mk b/dbaccess/qa/complex/dbaccess/makefile.mk index 7778222349ab..b96faa01d605 100755 --- a/dbaccess/qa/complex/dbaccess/makefile.mk +++ b/dbaccess/qa/complex/dbaccess/makefile.mk @@ -64,8 +64,8 @@ JAVATESTFILES = \ RowSet.java \ SingleSelectQueryComposer.java \ UISettings.java \ + CopyTableWizard.java -# CopyTableWizard.java # disable for now (#i115753#) # put here all other files -- cgit