1 'encoding UTF-8 Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 '* Copyright 2008 by Sun Microsystems, Inc.
7 '* OpenOffice.org - a multi-platform office productivity suite
9 '* $RCSfile: DatabaseTypes.inc,v $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 07:43:45 $
15 '* This file is part of OpenOffice.org.
17 '* OpenOffice.org is free software: you can redistribute it and/or modify
18 '* it under the terms of the GNU Lesser General Public License version 3
19 '* only, as published by the Free Software Foundation.
21 '* OpenOffice.org is distributed in the hope that it will be useful,
22 '* but WITHOUT ANY WARRANTY; without even the implied warranty of
23 '* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 '* GNU Lesser General Public License version 3 for more details
25 '* (a copy is included in the LICENSE file that accompanied this code).
27 '* You should have received a copy of the GNU Lesser General Public License
28 '* version 3 along with OpenOffice.org. If not, see
29 '* <http://www.openoffice.org/license.html>
30 '* for a copy of the LGPLv3 License.
32 '/************************************************************************
34 '* owner : marc.neumann@sun.com
36 '* short description : test the database types
38 '************************************************************************
40 ' #1 tMySQLODBCProperties
41 ' #1 tMySQLJDBCProperties
42 ' #1 tAdabasProperties
43 ' #1 tOracleJDBCProperties
48 ' #1 tSpreadsheetProperties
49 ' #1 tMozillaProperties
51 ' #1 tEvolutionProperties
54 '\***********************************************************************************
57 printlog "------------------ DatabaseTypes.inc ---------------------"
59 call tMySQLODBCProperties
60 call tMySQLJDBCProperties
61 call tAdabasProperties
62 call tOracleJDBCProperties
67 call tSpreadsheetProperties
68 call tMozillaProperties
70 call tEvolutionProperties
74 '-------------------------------------------------------------------------
75 '-------------------------------------------------------------------------
76 testcase tMySQLODBCProperties
78 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
89 call DialogTest(TabGeneral)
90 DataBaseType.select(getIdForDatabaseType("MySQLODBC"))
92 Kontext "ConnectionType"
95 call fCheckConnectionTabPage("MySQLODBC")
97 Kontext "ConnectionType"
101 Kontext "TabMySQLODBC"
102 '/// check the MySQLODBC page
103 call fCheckTabPage(TabMySQLODBC)
105 Kontext "ConnectionType"
108 call fCheckAdvancedDialog("MySQLODBC")
110 call fCloseDatabase()
113 '-------------------------------------------------------------------------
114 testcase tMySQLJDBCProperties
116 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
127 call DialogTest(TabGeneral)
128 DataBaseType.select(getIdForDatabaseType("MySQLJDBC"))
130 Kontext "ConnectionType"
133 call fCheckConnectionTabPage("MySQLJDBC")
135 Kontext "ConnectionType"
139 Kontext "TabMySQLJDBC"
140 '/// check the MySQLJDBC page
141 call fCheckTabPage(TabMySQLJDBC)
143 Kontext "ConnectionType"
146 call fCheckAdvancedDialog("MySQLJDBC")
148 call fCloseDatabase()
151 '-------------------------------------------------------------------------
152 testcase tAdabasProperties
154 if gPlatform = "x86" then
155 printlog "Adabas is not available under x86."
159 if gPlatform = "osx" then
160 printlog "Adabas doesn't exists under mac osx."
164 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
177 call DialogTest(TabGeneral)
178 DataBaseType.select(getIdForDatabaseType("AdabasD"))
180 Kontext "ConnectionType"
183 call fCheckConnectionTabPage("Adabas")
185 Kontext "ConnectionType"
190 '/// check the Adabas page
191 call fCheckTabPage(TabAdabas)
193 Kontext "ConnectionType"
196 call fCheckAdvancedDialog("Adabas")
198 call fCloseDatabase()
201 '-------------------------------------------------------------------------
202 testcase tOracleJDBCProperties
204 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
215 call DialogTest(TabGeneral)
216 DataBaseType.select(getIdForDatabaseType("OracleJDBC")
218 Kontext "ConnectionType"
221 call fCheckConnectionTabPage("OracleJDBC")
223 Kontext "ConnectionType"
227 Kontext "TabOracleJDBC"
228 '/// check the TabOracleJDBC page
229 call fCheckTabPage(TabOracleJDBC)
231 Kontext "ConnectionType"
232 ConnectionType.Cancel
234 call fCloseDatabase()
237 '-------------------------------------------------------------------------
238 testcase tJDBCProperties
240 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
251 call DialogTest(TabGeneral)
252 DataBaseType.select(getIdForDatabaseType("JDBC")
254 Kontext "ConnectionType"
257 call fCheckConnectionTabPage("JDBC")
259 Kontext "ConnectionType"
260 ConnectionType.Cancel
262 call fCloseDatabase()
265 '-------------------------------------------------------------------------
266 testcase tLDAPProperties
268 if gPlatform = "osx" then
269 printlog "LDAP doesn't exists under mac osx."
273 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
284 call DialogTest(TabGeneral)
285 DataBaseType.select(getIdForDatabaseType("LDAP") + 1 ) ' +1 because for mysql there are 2 entries
287 Kontext "ConnectionType"
290 call fCheckConnectionTabPage("LDAP")
292 Kontext "ConnectionType"
297 '/// check the LDAP page
298 call fChecktabPage(TabLDAP)
300 Kontext "ConnectionType"
301 ConnectionType.Cancel
303 call fCloseDatabase()
306 '-------------------------------------------------------------------------
307 testcase tEvolutionProperties
309 if gPlatform <> "lin" then
310 printlog "Evolution does only exists under linux."
314 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
325 call DialogTest(TabGeneral)
327 if ( DatabaseType.getItemCount() > 12 ) then
328 DataBaseType.select(getIdForDatabaseType("Evolution"))
329 Kontext "ConnectionType"
332 qaerrorlog "Evolution does not appear to be available on this system"
333 Kontext "ConnectionType"
334 ConnectionType.Cancel
337 warnlog "failed to select DataBaseType Evolution - maybe not installed or activated in this build"
343 'call fCheckAdvancedDialog("Evolution")
345 call fCloseDatabase()
348 '-------------------------------------------------------------------------
349 testcase tMozillaProperties
351 if gPlatform = "osx" then
352 printlog "LDAP doesn't exists under mac osx."
356 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
367 call DialogTest(TabGeneral)
368 DataBaseType.select(getIdForDatabaseType("Mozilla"))
370 'add sleep to give OOo time to react
373 Kontext "ConnectionType"
376 'call fCheckAdvancedDialog("Mozilla")
378 'add sleep to give OOo time to react
381 call fCloseDatabase()
384 '-------------------------------------------------------------------------
385 testcase tSpreadsheetProperties
387 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
398 call DialogTest(TabGeneral)
399 DataBaseType.select(getIdForDatabaseType("Spreadsheet"))
401 Kontext "ConnectionType"
404 call fCheckConnectionTabPage("Spreadsheet")
406 Kontext "ConnectionType"
407 ConnectionType.Cancel
409 'call fCheckAdvancedDialog("Spreadsheet")
411 call fCloseDatabase()
414 '-------------------------------------------------------------------------
415 testcase tTextProperties
417 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
428 call DialogTest(TabGeneral)
429 DataBaseType.select(getIdForDatabaseType("Text"))
431 Kontext "ConnectionType"
434 call fCheckConnectionTabPage("Text")
436 Kontext "ConnectionType"
440 Kontext "TabTextBase"
441 '/// check the Text page
442 call fCheckTabPage(TabTextBase)
444 Kontext "ConnectionType"
447 call fCheckAdvancedDialog("Text")
449 call fCloseDatabase()
452 '-------------------------------------------------------------------------
453 testcase tdBaseProperties
455 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
466 call DialogTest(TabGeneral)
467 DataBaseType.select(getIdForDatabaseType("dBase"))
469 Kontext "ConnectionType"
472 call fCheckConnectionTabPage("dBase")
474 Kontext "ConnectionType"
479 '/// check the dBase page
480 call fCheckTabPage(TabdBase)
482 Kontext "ConnectionType"
485 call fCheckAdvancedDialog("dBase")
487 call fCloseDatabase()
490 '-------------------------------------------------------------------------
491 testcase tODBCProperties
493 call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
504 call DialogTest(TabGeneral)
505 DataBaseType.select(getIdForDatabaseType("ODBC"))
507 Kontext "ConnectionType"
510 call fCheckConnectionTabPage("ODBC")
512 Kontext "ConnectionType"
517 '/// check the ODBC page
518 call fCheckTabPage(TabODBC)
520 Kontext "ConnectionType"
523 call fCheckAdvancedDialog("ODBC")
525 call fCloseDatabase()
528 '-------------------------------------------------------------------------
529 testcase tCheckHSQLDB
531 Dim sDatasourceFileName as String
532 sDatasourceFileName = ConvertPath(gOfficePath + "user/work/hsqldb.odb")
533 call fCreateHSQLDatasource(sDatasourceFileName)
535 call fOpenDatabase(sDatasourceFileName)
537 Kontext "ContainerView"
540 call fCloseDatabase()
543 '-------------------------------------------------------------------------
544 '-------------------------------------------------------------------------
545 '-------------------------------------------------------------------------
546 '-------------------------------------------------------------------------
547 '-------------------------------------------------------------------------
548 function fCheckAdvancedDialog(sType as string)
550 printlog "+Check the Advanced Settings for the datasource type " + sType
560 if sType = "OracleJDBC" OR sType = "JDBC" OR sType = "ODBC" then
561 TabControl.setPage AdvancedSettingsSpecial
562 call fcheckControl(SQL92Check)
563 call fcheckControl(AppendAlias)
564 call fcheckControl(Ignoreprivileges)
565 call fcheckControl(ParameterSubstiti)
566 call fcheckControl(DisplayVersionColumns)
567 call fcheckControl(BooleanComparison)
568 call fcheckControl(EnableOuterJoin)
569 call fcheckControl(CheckRequiredFields)
571 TabControl.setPage TabGeneratedValues
572 call fcheckControl(RetrieveGeneratedValues)
573 call fcheckControl(AutoIncrementStatement)
574 call fcheckControl(QueryGeneratedValues)
576 elseif sType = "MySQLODBC" OR sType = "MySQLJDBC" then
578 'call fcheckControl(SQL92Check)
579 call fcheckControl(AppendAlias)
580 call fcheckControl(Ignoreprivileges)
581 call fcheckControl(ParameterSubstiti)
582 call fcheckControl(DisplayVersionColumns)
583 call fcheckControl(BooleanComparison)
584 call fcheckControl(EnableOuterJoin)
585 call fcheckControl(CheckRequiredFields)
588 elseif sType = "dBase" OR sType = "Text" then
589 call fcheckControl(SQL92Check)
590 'call fcheckControl(BooleanComparison)
591 'call fcheckControl(AppendAlias)
593 elseif sType = "Spreadsheet" OR sType = "Mozilla" OR sType = "Evolution" OR sType = "LDAP" then
594 ' call fcheckControl(BooleanComparison)
595 ' call fcheckControl(AppendAlias)
597 elseif sType = "Adabas" then
598 call fcheckControl(AppendAlias)
599 call fcheckControl(BooleanComparison)
600 call fcheckControl(SQL92Check)
601 call fcheckControl(DisplayVersionColumns)
602 call fcheckControl(CheckRequiredFields)
604 qaerrorlog "unknown database type"
611 '-------------------------------------------------------------------------
612 function fcheckControl(oControl as object)
614 if oControl.exists() then
615 printlog "|The control " + oControl.Name + " exists."
617 warnlog "|The control " + oControl.Name + " doesn't exists."
621 '-------------------------------------------------------------------------
622 function fCheckConnectionTabPage(sType as string)
624 printlog "+check the connection page for the datasource type " + sType
626 Kontext "TabConnection"
628 call DialogTest(TabConnection)
630 if sType = "MySQLODBC" then
631 call fcheckControl(MySQLODBCDatasource)
632 call fcheckControl(SelectPath)
633 call fcheckControl(Username)
634 call fcheckControl(PasswordRequired)
635 call fcheckControl(TestConnection)
637 elseif sType = "MySQLJDBC" then
638 call fcheckControl(MySQLJDBCDatasource)
639 call fcheckControl(Username)
640 call fcheckControl(PasswordRequired)
641 call fcheckControl(TestConnection)
643 elseif sType = "Adabas" then
644 call fcheckControl(AdabasDatasource)
645 call fcheckControl(SelectPath)
646 call fcheckControl(Username)
647 call fcheckControl(PasswordRequired)
648 call fcheckControl(TestConnection)
650 elseif sType = "OracleJDBC" then
651 call fcheckControl(OracleJDBCDatasource)
652 call fcheckControl(Username)
653 call fcheckControl(PasswordRequired)
654 call fcheckControl(TestConnection)
656 elseif sType = "JDBC" then
657 call fcheckControl(ConnectUrl)
658 call fcheckControl(Username)
659 call fcheckControl(PasswordRequired)
660 call fcheckControl(TestConnection)
661 call fcheckControl(TestDriver)
662 call fcheckControl(JDBCDriverClass)
664 elseif sType = "ODBC" then
665 call fcheckControl(OdbcDatasourceName)
666 call fcheckControl(Username)
667 call fcheckControl(PasswordRequired)
668 call fcheckControl(TestConnection)
670 elseif sType = "dBase" then
671 call fcheckControl(dBasePath)
672 call fcheckControl(SelectPath)
673 call fcheckControl(TestConnection)
675 elseif sType = "Spreadsheet" then
676 call fcheckControl(SpreadsheetPath)
677 call fcheckControl(SelectPath)
678 call fcheckControl(TestConnection)
680 elseif sType = "Text" then
681 call fcheckControl(TextPath)
682 call fcheckControl(SelectPath)
683 call fcheckControl(TestConnection)
685 elseif sType = "LDAP" then
686 call fcheckControl(HostName)
687 call fcheckControl(TestConnection)
689 elseif sType = "Mozilla" OR sType = "Evolution" then
690 call fcheckControl(TestConnection)
694 '-------------------------------------------------------------------------
695 function fCheckTabPage(oType as object)
697 printlog "+check the " + oType.Name + " page."
700 call DialogTest(oType)
702 if oType.Name = "TabMySQLJDBC" OR oType.Name = "TabOracleJDBC" then
703 call fcheckControl(CharSet)
704 call fcheckControl(HostName)
705 call fcheckControl(PortNumber)
706 call fcheckControl(DriverClass)
707 call fcheckControl(TestClass)
709 elseif oType.Name = "TabAdabas" then
710 call fcheckControl(CharSet)
711 call fcheckControl(HostName)
712 call fcheckControl(CacheSize)
713 call fcheckControl(DataIncrement)
714 call fcheckControl(CotrolUser)
715 call fcheckControl(ControlPassword)
716 call fcheckControl(ShutdownService)
717 call fcheckControl(Extended)
719 elseif oType.Name = "TabODBC" then
720 call fcheckControl(UseCatalogs)
721 call fcheckControl(Options)
722 call fcheckControl(CharSet)
724 elseif oType.Name = "TabdBase" then
725 call fcheckControl(CharSet)
726 call fcheckControl(DisplayInactiveRecords)
727 call fcheckControl(Indexes)
729 elseif ( oType.Name = "TabLDAP" ) then
730 call fcheckControl(BaseDN)
731 call fcheckControl(PortNumber)
732 call fcheckControl(Records)
734 elseif ( oType.Name = "TabTextBase" ) then
735 call fcheckControl(TextContainsHeaders)
736 call fcheckControl(FieldSeparator)
737 call fcheckControl(TextSeparator)
738 call fcheckControl(DecimalSeparator)
739 call fcheckControl(ThousandsSeparator)
740 call fcheckControl(PlainTextFiles)
741 call fcheckControl(CVSFiles)
742 call fcheckControl(Custom)
743 call fcheckControl(CustomTxt)
744 call fcheckControl(CharSet)