diff options
author | Alexander Wilms <f.alexander.wilms@gmail.com> | 2014-02-25 18:11:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-27 06:44:14 -0600 |
commit | 2a33953f6eb5da62042ea3731ef9d61666d5556f (patch) | |
tree | c1af5bbad4384be6b5e5d54edf9afe3b0ec037c3 /dbaccess/qa | |
parent | f6e0d356b7b11f0ece009428e71864f0ba41ef7e (diff) |
Remove visual noise from dbaccess
Change-Id: I1130439e5883672b4ca462838d72197acd6bc1f2
Reviewed-on: https://gerrit.libreoffice.org/8251
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/qa')
-rw-r--r-- | dbaccess/qa/complex/dbaccess/ApplicationController.java | 14 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/Beamer.java | 8 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java | 10 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/CopyTableWizard.java | 8 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/DataSource.java | 6 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/DatabaseDocument.java | 74 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/Parser.java | 12 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/PropertyBag.java | 6 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/Query.java | 8 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/QueryInQuery.java | 16 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/RowSet.java | 92 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java | 8 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/TestCase.java | 24 | ||||
-rw-r--r-- | dbaccess/qa/complex/dbaccess/UISettings.java | 4 |
14 files changed, 145 insertions, 145 deletions
diff --git a/dbaccess/qa/complex/dbaccess/ApplicationController.java b/dbaccess/qa/complex/dbaccess/ApplicationController.java index 2a66d5e096b8..674115e8cf6c 100644 --- a/dbaccess/qa/complex/dbaccess/ApplicationController.java +++ b/dbaccess/qa/complex/dbaccess/ApplicationController.java @@ -40,7 +40,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; -// ------------------------------------------ + /** complex test case for Base's application UI */ @@ -56,13 +56,13 @@ public class ApplicationController extends TestCase super(); } - // -------------------------------------------------------------------------------------------------------- + public String getTestObjectName() { return getClass().getName(); } - // -------------------------------------------------------------------------------------------------------- + private void impl_closeDocument() { if (m_database != null) @@ -74,7 +74,7 @@ public class ApplicationController extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + private void impl_switchToDocument(String _documentURL) throws java.lang.Exception { // close previous database document @@ -101,7 +101,7 @@ public class ApplicationController extends TestCase docModel.getCurrentController()); } - // -------------------------------------------------------------------------------------------------------- + @Before @Override public void before() throws java.lang.Exception @@ -110,7 +110,7 @@ public class ApplicationController extends TestCase impl_switchToDocument(null); } - // -------------------------------------------------------------------------------------------------------- + @After @Override public void after() throws java.lang.Exception @@ -118,7 +118,7 @@ public class ApplicationController extends TestCase impl_closeDocument(); super.after(); } - // -------------------------------------------------------------------------------------------------------- + @Test public void checkSaveAs() throws Exception, IOException, java.lang.Exception diff --git a/dbaccess/qa/complex/dbaccess/Beamer.java b/dbaccess/qa/complex/dbaccess/Beamer.java index 97c4c6b4f45b..effc4cc555a5 100644 --- a/dbaccess/qa/complex/dbaccess/Beamer.java +++ b/dbaccess/qa/complex/dbaccess/Beamer.java @@ -47,7 +47,7 @@ import org.junit.Before; import org.junit.Test; // import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; -// ------------------------------------------ + /** complex test case for Base's application UI @@ -62,7 +62,7 @@ public class Beamer extends TestCase super(); } - // -------------------------------------------------------------------------------------------------------- + @Before @Override public void before() throws Exception, java.lang.Exception @@ -75,14 +75,14 @@ public class Beamer extends TestCase docModel = UnoRuntime.queryInterface(XModel.class, loadedComponent); } - // -------------------------------------------------------------------------------------------------------- + @After @Override public void after() { } - // -------------------------------------------------------------------------------------------------------- + @Test public void testBeamer() throws Exception, IOException, java.lang.Exception { diff --git a/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java b/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java index ea91937cbda0..81ffdbebf514 100644 --- a/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java +++ b/dbaccess/qa/complex/dbaccess/CRMBasedTestCase.java @@ -26,13 +26,13 @@ import java.util.logging.Logger; import org.junit.After; import org.junit.Before; import static org.junit.Assert.*; -// ------------------------------------------ + public abstract class CRMBasedTestCase extends TestCase { protected CRMDatabase m_database; - // -------------------------------------------------------------------------------------------------------- + protected void createTestCase() { try @@ -46,7 +46,7 @@ public abstract class CRMBasedTestCase extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + @Before @Override public void before() @@ -54,7 +54,7 @@ public abstract class CRMBasedTestCase extends TestCase createTestCase(); } - // -------------------------------------------------------------------------------------------------------- + @After @Override public void after() @@ -72,7 +72,7 @@ public abstract class CRMBasedTestCase extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + /** creates a SingleSelectQueryComposer for our connection */ protected final XSingleSelectQueryComposer createQueryComposer() throws com.sun.star.uno.Exception diff --git a/dbaccess/qa/complex/dbaccess/CopyTableWizard.java b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java index 68fba3ddb793..419d6782d19e 100644 --- a/dbaccess/qa/complex/dbaccess/CopyTableWizard.java +++ b/dbaccess/qa/complex/dbaccess/CopyTableWizard.java @@ -42,7 +42,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; -// ------------------------------------------ + /** complex test case for Base's application UI */ @@ -58,7 +58,7 @@ public class CopyTableWizard extends CRMBasedTestCase super(); } - // -------------------------------------------------------------------------------------------------------- + @After @Override @@ -88,7 +88,7 @@ public class CopyTableWizard extends CRMBasedTestCase } } - // -------------------------------------------------------------------------------------------------------- + class CopyThread implements Runnable { @@ -217,5 +217,5 @@ public class CopyTableWizard extends CRMBasedTestCase { } } - // -------------------------------------------------------------------------------------------------------- + } diff --git a/dbaccess/qa/complex/dbaccess/DataSource.java b/dbaccess/qa/complex/dbaccess/DataSource.java index 7233c8838445..8adff3a23ed4 100644 --- a/dbaccess/qa/complex/dbaccess/DataSource.java +++ b/dbaccess/qa/complex/dbaccess/DataSource.java @@ -27,7 +27,7 @@ import connectivity.tools.HsqlDatabase; // ---------- junit imports ----------------- import org.junit.Test; import static org.junit.Assert.*; -// ------------------------------------------ + public class DataSource extends TestCase @@ -36,7 +36,7 @@ public class DataSource extends TestCase HsqlDatabase m_database; connectivity.tools.DataSource m_dataSource; - // -------------------------------------------------------------------------------------------------------- + private void createTestCase() { try @@ -58,7 +58,7 @@ public class DataSource extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + @Test public void testRegistrationName() { diff --git a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java index 7f1ab1309811..6102084f48a3 100644 --- a/dbaccess/qa/complex/dbaccess/DatabaseDocument.java +++ b/dbaccess/qa/complex/dbaccess/DatabaseDocument.java @@ -82,7 +82,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; -// ------------------------------------------ + public class DatabaseDocument extends TestCase implements com.sun.star.document.XDocumentEventListener { @@ -98,7 +98,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. private static short STATE_ON_LOAD_RECEIVED = 3; private short m_loadDocState = STATE_NOT_STARTED; - // ======================================================================================================== + /** a helper class which can be used by the Basic scripts in our test documents * to notify us of events in this document */ @@ -132,13 +132,13 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } }; - // ======================================================================================================== + private static String getCallbackComponentServiceName() { return "org.openoffice.complex.dbaccess.EventCallback"; } - // ======================================================================================================== + /** a factory for a CallbackComponent */ private class CallbackComponentFactory implements XSingleComponentFactory, XServiceInfo, XComponent @@ -200,7 +200,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } }; - // ======================================================================================================== + private class MacroExecutionApprove implements XInteractionHandler { @@ -244,8 +244,8 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } }; - // ======================================================================================================== - // -------------------------------------------------------------------------------------------------------- + + @Before public void before() throws java.lang.Exception { @@ -273,7 +273,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } } - // -------------------------------------------------------------------------------------------------------- + @After public void after() throws java.lang.Exception { @@ -298,7 +298,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. super.after(); } - // -------------------------------------------------------------------------------------------------------- + private static class UnoMethodDescriptor { @@ -312,7 +312,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } } - // -------------------------------------------------------------------------------------------------------- + private void impl_checkDocumentInitState(Object _document, boolean _isInitialized) { // things you cannot do with an uninitialized document: @@ -335,7 +335,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } } - // -------------------------------------------------------------------------------------------------------- + private XModel impl_createDocument() throws Exception { final XModel databaseDoc = UnoRuntime.queryInterface(XModel.class, getMSF().createInstance("com.sun.star.sdb.OfficeDatabaseDocument")); @@ -346,14 +346,14 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. return databaseDoc; } - // -------------------------------------------------------------------------------------------------------- + private void impl_closeDocument(XModel _databaseDoc) throws CloseVetoException, IOException, Exception { final XCloseable closeDoc = UnoRuntime.queryInterface(XCloseable.class, _databaseDoc); closeDoc.close(true); } - // -------------------------------------------------------------------------------------------------------- + private XModel impl_createEmptyEmbeddedHSQLDocument() throws Exception, IOException { final XModel databaseDoc = UnoRuntime.queryInterface(XModel.class, getMSF().createInstance("com.sun.star.sdb.OfficeDatabaseDocument")); @@ -388,7 +388,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. return databaseDoc; } - // -------------------------------------------------------------------------------------------------------- + @Test public void testLoadable() throws Exception, IOException { @@ -397,12 +397,12 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. // there's three methods how you can initialize a database document: - // .................................................................... + // 1. XStorable::storeAsURL // (this is for compatibility reasons, to not break existing code) // this test is already made in impl_createEmptyEmbeddedHSQLDocument - // .................................................................... + // 2. XLoadable::load databaseDoc = UnoRuntime.queryInterface(XModel.class, getMSF().createInstance("com.sun.star.sdb.OfficeDatabaseDocument")); documentURL = copyToTempFile(documentURL); @@ -423,7 +423,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] }, DoubleInitializationException.class ); - // .................................................................... + // 3. XLoadable::initNew impl_closeDocument(databaseDoc); databaseDoc = impl_createDocument(); @@ -439,7 +439,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. DoubleInitializationException.class ); } - // -------------------------------------------------------------------------------------------------------- + private PropertyValue[] impl_getMarkerLoadArgs() { return new PropertyValue[] @@ -449,7 +449,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. }; } - // -------------------------------------------------------------------------------------------------------- + private boolean impl_hasMarker( final PropertyValue[] _args ) { for ( int i=0; i<_args.length; ++i ) @@ -462,7 +462,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. return false; } - // -------------------------------------------------------------------------------------------------------- + private PropertyValue[] impl_getDefaultLoadArgs() { return new PropertyValue[] @@ -471,7 +471,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. }; } - // -------------------------------------------------------------------------------------------------------- + private PropertyValue[] impl_getMacroExecLoadArgs() { return new PropertyValue[] @@ -482,7 +482,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. }; } - // -------------------------------------------------------------------------------------------------------- + private int impl_setMacroSecurityLevel(int _level) throws Exception { final XMultiServiceFactory configProvider = theDefaultProvider.get( @@ -503,14 +503,14 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. return oldValue; } - // -------------------------------------------------------------------------------------------------------- + private XModel impl_loadDocument( final String _documentURL, final PropertyValue[] _loadArgs ) throws Exception { final XComponentLoader loader = UnoRuntime.queryInterface(XComponentLoader.class, getMSF().createInstance("com.sun.star.frame.Desktop")); return UnoRuntime.queryInterface(XModel.class, loader.loadComponentFromURL(_documentURL, _BLANK, 0, _loadArgs)); } - // -------------------------------------------------------------------------------------------------------- + private void impl_storeDocument( final XModel _document ) throws Exception, IOException { // store the document @@ -520,7 +520,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } - // -------------------------------------------------------------------------------------------------------- + private XModel impl_createDocWithMacro( final String _libName, final String _moduleName, final String _code ) throws Exception, IOException { // create an empty document @@ -535,7 +535,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. return databaseDoc; } - // -------------------------------------------------------------------------------------------------------- + /** tests various aspects of database document "revenants" * * Well, I do not really have a good term for this ... The point is, database documents are in real @@ -604,7 +604,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. impl_closeDocument( databaseDoc ); } - // -------------------------------------------------------------------------------------------------------- + @Test public void testDocumentEvents() throws Exception, IOException { @@ -673,7 +673,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. impl_closeDocument(databaseDoc); } - // -------------------------------------------------------------------------------------------------------- + @Test public void testGlobalEvents() throws Exception, IOException { @@ -817,7 +817,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. impl_closeDocument(otherDoc); } - // -------------------------------------------------------------------------------------------------------- + private URL impl_getURL(String _completeURL) throws Exception { final URL[] url = @@ -830,7 +830,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. return url[0]; } - // -------------------------------------------------------------------------------------------------------- + private void impl_raise(XModel _document) { final XFrame frame = _document.getCurrentController().getFrame(); @@ -838,7 +838,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. topWindow.toFront(); } - // -------------------------------------------------------------------------------------------------------- + private void impl_startObservingEvents(String _context) { System.out.println(" " + _context + " {"); @@ -852,7 +852,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } } - // -------------------------------------------------------------------------------------------------------- + private void impl_stopObservingEvents(ArrayList<String> _actualEvents, String[] _expectedEvents, String _context) { try @@ -898,13 +898,13 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. } } - // -------------------------------------------------------------------------------------------------------- + int impl_waitForEvent(ArrayList<String> _eventQueue, String _expectedEvent, int _maxMilliseconds) { return impl_waitForEvent(_eventQueue, _expectedEvent, _maxMilliseconds, 0); } - // -------------------------------------------------------------------------------------------------------- + int impl_waitForEvent(ArrayList<String> _eventQueue, String _expectedEvent, int _maxMilliseconds, int _firstQueueElementToCheck) { synchronized (_eventQueue) @@ -938,7 +938,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. return -1; } - // -------------------------------------------------------------------------------------------------------- + void onDocumentEvent(DocumentEvent _Event) { if ("OnTitleChanged".equals(_Event.EventName)) @@ -967,7 +967,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. System.out.println(" document event: " + _Event.EventName); } - // -------------------------------------------------------------------------------------------------------- + public void documentEventOccured(DocumentEvent _Event) { if ("OnTitleChanged".equals(_Event.EventName)) @@ -985,7 +985,7 @@ public class DatabaseDocument extends TestCase implements com.sun.star.document. System.out.println(" global event: " + _Event.EventName); } - // -------------------------------------------------------------------------------------------------------- + public void disposing(EventObject _Event) { // not interested in diff --git a/dbaccess/qa/complex/dbaccess/Parser.java b/dbaccess/qa/complex/dbaccess/Parser.java index 0562c9021dcd..2c72173548dd 100644 --- a/dbaccess/qa/complex/dbaccess/Parser.java +++ b/dbaccess/qa/complex/dbaccess/Parser.java @@ -30,11 +30,11 @@ import com.sun.star.uno.UnoRuntime; // ---------- junit imports ----------------- import org.junit.Test; import static org.junit.Assert.*; -// ------------------------------------------ + public class Parser extends CRMBasedTestCase { - // -------------------------------------------------------------------------------------------------------- + @Override protected void createTestCase() { @@ -50,7 +50,7 @@ public class Parser extends CRMBasedTestCase } } - // -------------------------------------------------------------------------------------------------------- + @Test public void checkWhere() throws Exception { @@ -88,7 +88,7 @@ public class Parser extends CRMBasedTestCase composer.setQuery( SELECT + queries[i]); } } - // -------------------------------------------------------------------------------------------------------- + /** verifies that aliases for inner queries work as expected */ @Test @@ -133,7 +133,7 @@ public class Parser extends CRMBasedTestCase "test is bogus!", caughtExpected ); } - // -------------------------------------------------------------------------------------------------------- + private void impl_checkParameters( final String _statement, final String[] _expectedParameterNames, final int[] _expectedParameterTypes,final String _context ) throws Exception { final XSingleSelectQueryComposer composer = createQueryComposer(); @@ -157,7 +157,7 @@ public class Parser extends CRMBasedTestCase } } - // -------------------------------------------------------------------------------------------------------- + /** verifies that the parser properly recognizes the types of parameters */ @Test diff --git a/dbaccess/qa/complex/dbaccess/PropertyBag.java b/dbaccess/qa/complex/dbaccess/PropertyBag.java index 608cd1d9916d..ea1c570b86b2 100644 --- a/dbaccess/qa/complex/dbaccess/PropertyBag.java +++ b/dbaccess/qa/complex/dbaccess/PropertyBag.java @@ -34,7 +34,7 @@ import com.sun.star.lang.XMultiServiceFactory; import org.junit.Before; import org.junit.Test; import static org.junit.Assert.*; -// ------------------------------------------ + public class PropertyBag extends TestCase { @@ -152,7 +152,7 @@ public class PropertyBag extends TestCase System.out.println( "checking PropertySetAccess via sequences" ); createStandardBag( false ); - // --------------------------------- + // XPropertyAccess.setPropertyValues final PropertyValue expectedValues[] = { @@ -175,7 +175,7 @@ public class PropertyBag extends TestCase } } - // --------------------------------- + // XPropertyAccess.getPropertyValues final PropertyValue currentValues[] = m_access.getPropertyValues(); for ( int i=0; i<currentValues.length; ++i ) diff --git a/dbaccess/qa/complex/dbaccess/Query.java b/dbaccess/qa/complex/dbaccess/Query.java index 4f84257b0676..20d4c41d16ed 100644 --- a/dbaccess/qa/complex/dbaccess/Query.java +++ b/dbaccess/qa/complex/dbaccess/Query.java @@ -29,14 +29,14 @@ import connectivity.tools.CRMDatabase; // ---------- junit imports ----------------- import org.junit.Test; import static org.junit.Assert.*; -// ------------------------------------------ + public class Query extends TestCase { connectivity.tools.HsqlDatabase m_database; - // -------------------------------------------------------------------------------------------------------- + private void createTestCase() { try @@ -55,12 +55,12 @@ public class Query extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + // private XMultiServiceFactory getFactory() // { // return (XMultiServiceFactory)param.getMSF(); // } - // -------------------------------------------------------------------------------------------------------- + @Test public void testQueryColumns() { diff --git a/dbaccess/qa/complex/dbaccess/QueryInQuery.java b/dbaccess/qa/complex/dbaccess/QueryInQuery.java index 28c27188892b..4e6a9d0ffebe 100644 --- a/dbaccess/qa/complex/dbaccess/QueryInQuery.java +++ b/dbaccess/qa/complex/dbaccess/QueryInQuery.java @@ -31,13 +31,13 @@ import com.sun.star.sdbc.XResultSet; // ---------- junit imports ----------------- import org.junit.Test; import static org.junit.Assert.*; -// ------------------------------------------ + public class QueryInQuery extends CRMBasedTestCase { private static final String QUERY_PRODUCTS = "query products"; - // -------------------------------------------------------------------------------------------------------- + @Override protected void createTestCase() { @@ -53,7 +53,7 @@ public class QueryInQuery extends CRMBasedTestCase } } - // -------------------------------------------------------------------------------------------------------- + private void verifyEqualRowSetContent( int _outerCommandType, String _outerCommand, int _innerCommandType, String _innerCommand ) throws SQLException { final RowSet outerRowSet = m_database.getDatabase().createRowSet( _outerCommandType, _outerCommand ); @@ -80,7 +80,7 @@ public class QueryInQuery extends CRMBasedTestCase } } - // -------------------------------------------------------------------------------------------------------- + /** executes a SQL statement simply selecting all columns from a query */ @Test @@ -91,7 +91,7 @@ public class QueryInQuery extends CRMBasedTestCase CommandType.QUERY,QUERY_PRODUCTS); } - // -------------------------------------------------------------------------------------------------------- + /** verifies that aliases for inner queries work as expected */ @Test @@ -105,7 +105,7 @@ public class QueryInQuery extends CRMBasedTestCase CommandType.QUERY,QUERY_PRODUCTS); } - // -------------------------------------------------------------------------------------------------------- + /** verifies that aliases for inner queries work as expected */ @Test @@ -140,7 +140,7 @@ public class QueryInQuery extends CRMBasedTestCase caughtExpected ); } - // -------------------------------------------------------------------------------------------------------- + @Test public void checkCyclicReferences() throws ElementExistException, WrappedTargetException, IllegalArgumentException { @@ -159,7 +159,7 @@ public class QueryInQuery extends CRMBasedTestCase assertTrue( "executing a query with cyclic nested sub queries should fail!", caughtExpected ); } - // -------------------------------------------------------------------------------------------------------- + @Test public void checkStatementQiQSupport() { diff --git a/dbaccess/qa/complex/dbaccess/RowSet.java b/dbaccess/qa/complex/dbaccess/RowSet.java index e7f195ab9a55..c69c8a2e9f22 100644 --- a/dbaccess/qa/complex/dbaccess/RowSet.java +++ b/dbaccess/qa/complex/dbaccess/RowSet.java @@ -50,7 +50,7 @@ import java.util.Random; // ---------- junit imports ----------------- import org.junit.Test; import static org.junit.Assert.*; -// ------------------------------------------ + public class RowSet extends TestCase { @@ -69,7 +69,7 @@ public class RowSet extends TestCase XPropertySet m_rowSetProperties; XParametersSupplier m_paramsSupplier; - // -------------------------------------------------------------------------------------------------------- + class ResultSetMovementStress implements Runnable { @@ -103,7 +103,7 @@ public class RowSet extends TestCase } } } - // -------------------------------------------------------------------------------------------------------- + private void createTestCase(boolean _defaultRowSet) { if (m_database == null) @@ -135,7 +135,7 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + /** creates a com.sun.star.sdb.RowSet to use during the test * @param command * the command to use for the RowSet @@ -149,7 +149,7 @@ public class RowSet extends TestCase createRowSet(command, commandType, execute, false); } - // -------------------------------------------------------------------------------------------------------- + /** creates a com.sun.star.sdb.RowSet to use during the test * @param command * the command to use for the RowSet @@ -192,7 +192,7 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + @Test public void testRowSet() throws java.lang.Exception { @@ -216,14 +216,14 @@ public class RowSet extends TestCase testConcurrentAccess(m_resultSet); } - // -------------------------------------------------------------------------------------------------------- + XResultSet createClone() throws SQLException { final XResultSetAccess rowAcc = UnoRuntime.queryInterface( XResultSetAccess.class, m_rowSet ); return rowAcc.createResultSet(); } - // -------------------------------------------------------------------------------------------------------- + void createStruture() throws SQLException { m_database.executeSQL("DROP TABLE \"TEST1\" IF EXISTS"); @@ -242,7 +242,7 @@ public class RowSet extends TestCase connection.refreshTables(); } - // -------------------------------------------------------------------------------------------------------- + void testPosition(XResultSet m_resultSet, XRow m_row, int expectedValue, String location) throws SQLException { final int val = m_row.getInt(1); @@ -251,7 +251,7 @@ public class RowSet extends TestCase assertTrue(location + ": value/position are not as expected: " + val + " (val) != " + expectedValue + " (expected)", val == expectedValue); } - // -------------------------------------------------------------------------------------------------------- + void testSequentialPositining(XResultSet _resultSet, XRow _row) { try @@ -270,7 +270,7 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + void testAbsolutePositioning(XResultSet _resultSet, XRow _row) { try @@ -288,7 +288,7 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + void test3(XResultSet clone, XResultSet _resultSet) { try @@ -312,7 +312,7 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + void test4(XResultSet _resultSet) { try @@ -339,7 +339,7 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + void testConcurrentAccess(XResultSet _resultSet) { System.out.println("testing Thread"); @@ -367,7 +367,7 @@ public class RowSet extends TestCase fail("testConcurrentAccess failed: " + e); } } - // -------------------------------------------------------------------------------------------------------- + @Test public void testRowSetEvents() throws java.lang.Exception @@ -515,7 +515,7 @@ public class RowSet extends TestCase xComp.dispose(); } - // -------------------------------------------------------------------------------------------------------- + private void testCursorMove(Object res, Method _method, RowSetEventListener _evt, boolean _must[], Object args[]) throws java.lang.Exception { _evt.clearCalling(); @@ -546,7 +546,7 @@ public class RowSet extends TestCase _evt.clearCalling(); } - // -------------------------------------------------------------------------------------------------------- + /** returns the current row count of the RowSet */ private int currentRowCount() throws UnknownPropertyException, WrappedTargetException @@ -555,7 +555,7 @@ public class RowSet extends TestCase return rowCount.intValue(); } - // -------------------------------------------------------------------------------------------------------- + /** positions the row set at an arbitrary position between 2 and (current row count - 1) */ private int positionRandom() throws SQLException, UnknownPropertyException, WrappedTargetException @@ -566,7 +566,7 @@ public class RowSet extends TestCase return m_resultSet.getRow(); } - // -------------------------------------------------------------------------------------------------------- + /** moves the result set to a random record between 2 and (current row count - 1), and deletes this record * * After returning from this method, the row set is still positioned at the deleted record @@ -590,7 +590,7 @@ public class RowSet extends TestCase return positionBefore; } - // -------------------------------------------------------------------------------------------------------- + @Test public void testDeleteBehavior() throws Exception { @@ -603,7 +603,7 @@ public class RowSet extends TestCase // delete a random row int deletedRow = deleteRandom(); - // ..................................................................................................... + // asking for the bookmark of a deleted row should fail boolean caughtException = false; try @@ -616,13 +616,13 @@ public class RowSet extends TestCase } assertTrue("asking for the bookmark of a deleted row should throw an exception", caughtException); - // ..................................................................................................... + // isXXX methods should return |false| on a deleted row assertTrue("one of the isFoo failed after |deleteRow|", !m_resultSet.isBeforeFirst() && !m_resultSet.isAfterLast() && !m_resultSet.isFirst() && !m_resultSet.isLast()); // note that we can assume that isFirst / isLast also return |false|, since deleteRandom did // not position on the first or last record, but inbetween - // ..................................................................................................... + // check if moving away from this row in either direction yields the expected results assertTrue("|previous| after |deleteRow| failed", m_resultSet.previous()); final int positionPrevious = m_resultSet.getRow(); @@ -635,11 +635,11 @@ public class RowSet extends TestCase // since the deleted record "vanishs" as soon as the cursor is moved away from it, the absolute position does // not change with a |next| call here - // ..................................................................................................... + // check if the deleted rows really vanished after moving away from them assertTrue("row count did not change as expected after two deletions", initialRowCount - 2 == currentRowCount()); - // ..................................................................................................... + // check if the deleted row vanishes after moving to the insertion row final int rowCountBefore = currentRowCount(); final int deletedPos = deleteRandom(); @@ -657,7 +657,7 @@ public class RowSet extends TestCase m_resultSetUpdate.moveToCurrentRow(); assertTrue("|last| + |deleteRow| + |moveToInsertRow| + |moveToCurrentRow| results in wrong state", m_resultSet.isAfterLast()); - // ..................................................................................................... + // check if deleting a deleted row fails as expected deleteRandom(); caughtException = false; @@ -671,7 +671,7 @@ public class RowSet extends TestCase } assertTrue("deleting a deleted row succeeded - it shouldn't", caughtException); - // ..................................................................................................... + // check if deleteRows fails if it contains the bookmark of a previously-deleted row m_resultSet.first(); final Object firstBookmark = m_rowLocate.getBookmark(); @@ -686,7 +686,7 @@ public class RowSet extends TestCase assertTrue("XDeleteRows::deleteRows with the bookmark of an already-deleted row failed", (deleteSuccess.length == 2) && (deleteSuccess[0] != 0) && (deleteSuccess[1] == 0)); - // ..................................................................................................... + // check if refreshing a deleted row fails as expected deleteRandom(); caughtException = false; @@ -700,12 +700,12 @@ public class RowSet extends TestCase } assertTrue("refreshing a deleted row succeeded - it shouldn't", caughtException); - // ..................................................................................................... + // rowUpdated/rowDeleted deleteRandom(); assertTrue("rowDeleted and/or rowUpdated are wrong on a deleted row", !m_resultSet.rowUpdated() && !m_resultSet.rowInserted()); - // ..................................................................................................... + // updating values in a deleted row should fail deleteRandom(); final XRowUpdate rowUpdated = UnoRuntime.queryInterface( XRowUpdate.class, m_resultSet ); @@ -721,7 +721,7 @@ public class RowSet extends TestCase assertTrue("updating values in a deleted row should not succeed", caughtException); } - // -------------------------------------------------------------------------------------------------------- + /** checks whether deletions on the main RowSet properly interfere (or don't interfere) with the movement * on a clone of the RowSet */ @@ -737,7 +737,7 @@ public class RowSet extends TestCase positionRandom(); - // ..................................................................................................... + // move the clone to the same record as the RowSet, and delete this record cloneRowLocate.moveToBookmark(m_rowLocate.getBookmark()); final int clonePosition = clone.getRow(); @@ -746,19 +746,19 @@ public class RowSet extends TestCase assertTrue("clone doesn't know that its current row has been deleted via the RowSet", clone.rowDeleted()); assertTrue("clone's position changed somehow during deletion", clonePosition == clone.getRow()); - // ..................................................................................................... + // move the row set away from the deleted record. This should still not touch the state of the clone m_resultSet.previous(); assertTrue("clone doesn't know (anymore) that its current row has been deleted via the RowSet", clone.rowDeleted()); assertTrue("clone's position changed somehow during deletion and RowSet-movement", clonePosition == clone.getRow()); - // ..................................................................................................... + // move the clone away from the deleted record clone.next(); assertTrue("clone still assumes that its row is deleted - but we already moved it", !clone.rowDeleted()); - // ..................................................................................................... + // check whether deleting the extremes (first / last) work m_resultSet.first(); cloneRowLocate.moveToBookmark(m_rowLocate.getBookmark()); @@ -776,7 +776,7 @@ public class RowSet extends TestCase clone.previous(); assertTrue("deleting the first record left the clone in a strange state (after |next| + |previous|)", clone.isLast()); - // ..................................................................................................... + // check whether movements of the clone interfere with movements of the RowSet, if the latter is on a deleted row final int positionBefore = positionRandom(); m_resultSetUpdate.deleteRow(); @@ -790,7 +790,7 @@ public class RowSet extends TestCase assertTrue("wrong absolute position after |deleteRow| and clone movement", m_resultSet.getRow() == positionBefore); } - // -------------------------------------------------------------------------------------------------------- + /** checks whether insertions on the main RowSet properly interfere (or don't interfere) with the movement * on a clone of the RowSet */ @@ -804,7 +804,7 @@ public class RowSet extends TestCase final XResultSet clone = createClone(); final XRow cloneRow = UnoRuntime.queryInterface( XRow.class, clone ); - // ..................................................................................................... + // first check the basic scenario without the |moveToInsertRow| |moveToCurrentRow|, to ensure that // really those are broken, if at all m_resultSet.last(); @@ -821,7 +821,7 @@ public class RowSet extends TestCase testPosition(clone, cloneRow, 1, "mixed clone/rowset move: clone check"); testPosition(m_resultSet, m_row, MAX_TABLE_ROWS, "mixed clone/rowset move: rowset check"); - // ..................................................................................................... + // now the complete scenario m_resultSet.last(); m_resultSetUpdate.moveToInsertRow(); @@ -834,7 +834,7 @@ public class RowSet extends TestCase testPosition(m_resultSet, m_row, 100, "mixed clone/rowset move/insertion: rowset check"); } - // -------------------------------------------------------------------------------------------------------- + private void testTableParameters() { // for a row set simply based on a table, there should be not parameters at all @@ -850,7 +850,7 @@ public class RowSet extends TestCase fail("testing the parameters of a table failed" + e.getMessage()); } } - // -------------------------------------------------------------------------------------------------------- + private void testParametersAfterNormalExecute() { @@ -868,7 +868,7 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + private void verifyParameters(String[] _paramNames, String _context) throws com.sun.star.uno.Exception { final XIndexAccess params = m_paramsSupplier.getParameters(); @@ -894,7 +894,7 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + private void testParametrizedQuery() { try @@ -914,7 +914,7 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + private void testParametersInteraction() { try @@ -952,7 +952,7 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + private void testParametersInFilter() { try @@ -977,7 +977,7 @@ public class RowSet extends TestCase } } - // -------------------------------------------------------------------------------------------------------- + /** checks the XParametersSupplier functionality of a RowSet */ @Test diff --git a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java index 4b762d814e73..fc9a5a60bef0 100644 --- a/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java +++ b/dbaccess/qa/complex/dbaccess/SingleSelectQueryComposer.java @@ -40,7 +40,7 @@ import java.lang.reflect.Method; // ---------- junit imports ----------------- import org.junit.Test; import static org.junit.Assert.*; -// ------------------------------------------ + public class SingleSelectQueryComposer extends CRMBasedTestCase { @@ -54,13 +54,13 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase + " OR ( NOW( ) = {D '2010-01-01' } )"; private final static String INNERPRODUCTSQUERY = "products (inner)"; - // -------------------------------------------------------------------------------------------------------- + private void createQueries() throws Exception { m_database.getDatabase().getDataSource().createQuery(INNERPRODUCTSQUERY, "SELECT * FROM \"products\""); } - // -------------------------------------------------------------------------------------------------------- + @Override protected void createTestCase() { @@ -79,7 +79,7 @@ public class SingleSelectQueryComposer extends CRMBasedTestCase } } - // -------------------------------------------------------------------------------------------------------- + private void checkAttributeAccess(String _attributeName, String _attributeValue) { System.out.println("setting " + _attributeName + " to " + _attributeValue); diff --git a/dbaccess/qa/complex/dbaccess/TestCase.java b/dbaccess/qa/complex/dbaccess/TestCase.java index 3db21c8a936d..7a37f5d4890c 100644 --- a/dbaccess/qa/complex/dbaccess/TestCase.java +++ b/dbaccess/qa/complex/dbaccess/TestCase.java @@ -37,28 +37,28 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.openoffice.test.OfficeConnection; import static org.junit.Assert.*; -// ------------------------------------------ + public abstract class TestCase { - // -------------------------------------------------------------------------------------------------------- + protected final XComponentContext getComponentContext() { return connection.getComponentContext(); } - // -------------------------------------------------------------------------------------------------------- + public void before() throws java.lang.Exception { } - // -------------------------------------------------------------------------------------------------------- + public void after() throws java.lang.Exception { } - // -------------------------------------------------------------------------------------------------------- + /** returns the URL of a temporary file which can be used during the test. * * The file will be deleted when the process exits @@ -74,7 +74,7 @@ public abstract class TestCase return FileHelper.getOOoCompatibleFileURL( documentFile.toURI().toURL().toString() ); } - // -------------------------------------------------------------------------------------------------------- + /** * copies the file given by URL to a temporary file * @return @@ -92,7 +92,7 @@ public abstract class TestCase return FileHelper.getOOoCompatibleFileURL( targetURL ); } - // -------------------------------------------------------------------------------------------------------- + protected final XModel loadDocument( final String _docURL ) throws Exception { final XComponentLoader loader = UnoRuntime.queryInterface( XComponentLoader.class, @@ -101,7 +101,7 @@ public abstract class TestCase loader.loadComponentFromURL( _docURL, "_blank", 0, new PropertyValue[] {} ) ); } - // -------------------------------------------------------------------------------------------------------- + /** 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 @@ -198,7 +198,7 @@ public abstract class TestCase _object, _methodName, _argClasses, _methodArgs, _expectedExceptionClass ); } - // -------------------------------------------------------------------------------------------------------- + @SuppressWarnings("unchecked") protected void assureException( Object _object, Class _unoInterfaceClass, String _methodName, Object[] _methodArgs, Class _expectedExceptionClass ) @@ -207,14 +207,14 @@ public abstract class TestCase _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 @@ -222,7 +222,7 @@ public abstract class TestCase connection.setUp(); } - // -------------------------------------------------------------------------------------------------------- + @AfterClass public static void tearDownConnection() throws InterruptedException, com.sun.star.uno.Exception { diff --git a/dbaccess/qa/complex/dbaccess/UISettings.java b/dbaccess/qa/complex/dbaccess/UISettings.java index 2bac9c3bed33..c7c5fb988304 100644 --- a/dbaccess/qa/complex/dbaccess/UISettings.java +++ b/dbaccess/qa/complex/dbaccess/UISettings.java @@ -31,11 +31,11 @@ import connectivity.tools.CRMDatabase; // ---------- junit imports ----------------- import org.junit.Test; import static org.junit.Assert.*; -// ------------------------------------------ + public class UISettings extends TestCase { - // -------------------------------------------------------------------------------------------------------- + /** verifies that aliases for inner queries work as expected */ @Test |