merge the formfield patch from ooo-build
[ooovba.git] / testautomation / dbaccess / required / includes / DatabaseTypes.inc
blob2c2178f1c6ee8e32527f5ff67a06f5d009257a70
1 'encoding UTF-8  Do not remove or change this line!
2 '**************************************************************************
3 '* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 '* 
5 '* Copyright 2008 by Sun Microsystems, Inc.
6 '*
7 '* OpenOffice.org - a multi-platform office productivity suite
8 '*
9 '* $RCSfile: DatabaseTypes.inc,v $
11 '* $Revision: 1.1 $
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 '************************************************************************
39 '*    
40 ' #1 tMySQLODBCProperties
41 ' #1 tMySQLJDBCProperties
42 ' #1 tAdabasProperties
43 ' #1 tOracleJDBCProperties
44 ' #1 tJDBCProperties
45 ' #1 tODBCProperties
46 ' #1 tdBaseProperties
47 ' #1 tTextProperties
48 ' #1 tSpreadsheetProperties
49 ' #1 tMozillaProperties
50 ' #1 tLDAPProperties
51 ' #1 tEvolutionProperties
52 ' #1 tCheckHSQLDB
54 '\***********************************************************************************
55 sub DatabaseTypes
57     printlog "------------------ DatabaseTypes.inc ---------------------"
58     
59     call tMySQLODBCProperties
60     call tMySQLJDBCProperties
61     call tAdabasProperties
62     call tOracleJDBCProperties
63     call tJDBCProperties
64     call tODBCProperties
65     call tdBaseProperties
66     call tTextProperties
67     call tSpreadsheetProperties
68     call tMozillaProperties
69     call tLDAPProperties
70     call tEvolutionProperties
71     call tCheckHSQLDB
73 end sub
74 '-------------------------------------------------------------------------
75 '-------------------------------------------------------------------------
76 testcase tMySQLODBCProperties 
77     
78     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
80     ViewForms
81     
82     Kontext "DATABASE"    
83         Database.UseMenu    
84         hMenuSelectNr(2)
85         hMenuSelectNr(15)
86         hMenuSelectNr(2)
87     
88     Kontext "TabGeneral"    
89         call DialogTest(TabGeneral)
90         DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:odbc:*"))
91         
92     Kontext "ConnectionType"        
93         NextBtn.Click
94         sleep(1)
95         call fCheckConnectionTabPage("MySQLODBC")        
96     
97     Kontext "ConnectionType"        
98         NextBtn.Click
99         sleep(1)
100         
101     Kontext "TabMySQLODBC"
102         '/// check the MySQLODBC page        
103         call fCheckTabPage(TabMySQLODBC)
104     
105     Kontext "ConnectionType"        
106         ConnectionType.OK
107         
108     call fCheckAdvancedDialog("MySQLODBC")        
109         
110     call fCloseDatabase()
111     
112 endcase
113 '-------------------------------------------------------------------------
114 testcase tMySQLJDBCProperties 
115     
116     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
118     ViewForms    
119     
120     Kontext "DATABASE"    
121         Database.UseMenu    
122         hMenuSelectNr(2)
123         hMenuSelectNr(15)
124         hMenuSelectNr(2)
125     
126     Kontext "TabGeneral"    
127         call DialogTest(TabGeneral)
128         DataBaseType.select(hGetDatabaseDisplayName("sdbc:mysql:jdbc:*"))    
129         
130     Kontext "ConnectionType"        
131         NextBtn.Click
132         sleep(1)        
133         call fCheckConnectionTabPage("MySQLJDBC")
134         
135     Kontext "ConnectionType"        
136         NextBtn.Click
137         sleep(1)
138         
139     Kontext "TabMySQLJDBC"
140         '/// check the MySQLJDBC page        
141         call fCheckTabPage(TabMySQLJDBC)
142     
143     Kontext "ConnectionType"        
144         ConnectionType.OK
145         
146     call fCheckAdvancedDialog("MySQLJDBC")
147         
148     call fCloseDatabase()
149     
150 endcase
151 '-------------------------------------------------------------------------
152 testcase tAdabasProperties 
154     if gPlatform = "x86" then
155         printlog "Adabas is not available under x86."
156         goto endsub    
157     end if
158     
159     if gPlatform = "osx" then
160         printlog "Adabas doesn't exists under mac osx."
161         goto endsub    
162     end if
164     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
166     ViewForms    
167             
168     Kontext "DATABASE"    
169         Database.UseMenu    
170         hMenuSelectNr(2)
171         hMenuSelectNr(15)
172         hMenuSelectNr(2)
173     
174     sleep(2)        
175     
176     Kontext "TabGeneral"    
177         call DialogTest(TabGeneral)
178         DataBaseType.select(hGetDatabaseDisplayName("sdbc:adabas:*"))    
179         
180     Kontext "ConnectionType"        
181         NextBtn.Click
182         sleep(1)        
183         call fCheckConnectionTabPage("Adabas")
184         
185     Kontext "ConnectionType"        
186         NextBtn.Click
187         sleep(1)
188         
189     Kontext "TabAdabas"
190         '/// check the Adabas page                
191         call fCheckTabPage(TabAdabas)
192     
193     Kontext "ConnectionType"        
194         ConnectionType.OK
195     
196     call fCheckAdvancedDialog("Adabas")
197     
198     call fCloseDatabase()
199     
200 endcase
201 '-------------------------------------------------------------------------
202 testcase tOracleJDBCProperties
203     
204     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
206     ViewForms    
207             
208     Kontext "DATABASE"    
209         Database.UseMenu    
210         hMenuSelectNr(2)
211         hMenuSelectNr(15)
212         hMenuSelectNr(2)
213     
214     Kontext "TabGeneral"    
215         call DialogTest(TabGeneral)
216         DataBaseType.select(hGetDatabaseDisplayName("jdbc:oracle:thin:*"))    
217         
218     Kontext "ConnectionType"        
219         NextBtn.Click
220         sleep(1)        
221         call fCheckConnectionTabPage("OracleJDBC")
222         
223     Kontext "ConnectionType"        
224         NextBtn.Click
225         sleep(1)
226         
227     Kontext "TabOracleJDBC"
228         '/// check the TabOracleJDBC page        
229         call fCheckTabPage(TabOracleJDBC)
230     
231     Kontext "ConnectionType"        
232         ConnectionType.Cancel
233         
234     call fCloseDatabase()    
235     
236 endcase
237 '-------------------------------------------------------------------------
238 testcase tJDBCProperties 
239     
240     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
242     ViewForms    
243             
244     Kontext "DATABASE"    
245         Database.UseMenu    
246         hMenuSelectNr(2)
247         hMenuSelectNr(15)
248         hMenuSelectNr(2)
249     
250     Kontext "TabGeneral"    
251         call DialogTest(TabGeneral)
252         DataBaseType.select(hGetDatabaseDisplayName("jdbc:*"))    
253         
254     Kontext "ConnectionType"        
255         NextBtn.Click
256         sleep(1)        
257         call fCheckConnectionTabPage("JDBC")
258         
259     Kontext "ConnectionType"        
260         ConnectionType.Cancel
261         
262     call fCloseDatabase()
263     
264 endcase
265 '-------------------------------------------------------------------------
266 testcase tLDAPProperties 
268     if gPlatform = "osx" then
269         printlog "LDAP doesn't exists under mac osx."
270         goto endsub    
271     end if
272     
273     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
275     ViewForms    
276             
277     Kontext "DATABASE"    
278         Database.UseMenu    
279         hMenuSelectNr(2)
280         hMenuSelectNr(15)
281         hMenuSelectNr(2)
282     
283     Kontext "TabGeneral"    
284         call DialogTest(TabGeneral)
285         DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:ldap:*"))
286         
287     Kontext "ConnectionType"        
288         NextBtn.Click
289         sleep(1)        
290         call fCheckConnectionTabPage("LDAP")
291         
292     Kontext "ConnectionType"        
293         NextBtn.Click
294         sleep(1)
295         
296     Kontext "TabLDAP"
297         '/// check the LDAP page        
298         call fChecktabPage(TabLDAP)
299     
300     Kontext "ConnectionType"        
301         ConnectionType.Cancel
302         
303     call fCloseDatabase()  
304     
305 endcase
306 '-------------------------------------------------------------------------
307 testcase tEvolutionProperties    
309     if gPlatform <> "lin" then
310         printlog "Evolution does only exists under linux."
311         goto endsub    
312     end if
314     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
316     ViewForms    
317             
318     Kontext "DATABASE"    
319         Database.UseMenu    
320         hMenuSelectNr(2)
321         hMenuSelectNr(15)
322         hMenuSelectNr(2)
323     
324     Kontext "TabGeneral"    
325         call DialogTest(TabGeneral)
326         try
327             if ( DatabaseType.getItemCount() > 12 ) then
328                 DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:evolution:ldap"))
329                 Kontext "ConnectionType"        
330                 ConnectionType.OK
331             else
332                 qaerrorlog "Evolution does not appear to be available on this system"
333                 Kontext "ConnectionType"
334                 ConnectionType.Cancel
335             endif
336         catch
337             warnlog "failed to select DataBaseType Evolution - maybe not installed or activated in this build"
338             TabGeneral.Cancel
339             call fCloseDatabase
340             goto endsub
341         endcatch
342         
343     'call fCheckAdvancedDialog("Evolution")
344         
345     call fCloseDatabase()  
346     
347 endcase
348 '-------------------------------------------------------------------------
349 testcase tMozillaProperties 
351     if gPlatform = "osx" then
352         printlog "LDAP doesn't exists under mac osx."
353         goto endsub    
354     end if
355     
356     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
358     ViewForms    
359             
360     Kontext "DATABASE"    
361         Database.UseMenu    
362         hMenuSelectNr(2)
363         hMenuSelectNr(15)
364         hMenuSelectNr(2)
365     
366     Kontext "TabGeneral"    
367         call DialogTest(TabGeneral)
368         DataBaseType.select(hGetDatabaseDisplayName("sdbc:address:mozilla:"))
370     'add sleep to give OOo time to react 
371     sleep(2)    
373     Kontext "ConnectionType"        
374         ConnectionType.OK
375         
376     'call fCheckAdvancedDialog("Mozilla")
377     
378     'add sleep to give OOo time to react 
379     sleep(2)
380     
381     call fCloseDatabase()  
382     
383 endcase
384 '-------------------------------------------------------------------------
385 testcase tSpreadsheetProperties 
386     
387     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
389     ViewForms    
390             
391     Kontext "DATABASE"    
392         Database.UseMenu    
393         hMenuSelectNr(2)
394         hMenuSelectNr(15)
395         hMenuSelectNr(2)
396     
397     Kontext "TabGeneral"    
398         call DialogTest(TabGeneral)
399         DataBaseType.select(hGetDatabaseDisplayName("sdbc:calc:*"))    
400         
401     Kontext "ConnectionType"        
402         NextBtn.Click
403         sleep(1)        
404         call fCheckConnectionTabPage("CALC")
405     
406     Kontext "ConnectionType"        
407         ConnectionType.Cancel
408         
409     'call fCheckAdvancedDialog("CALC")
410         
411     call fCloseDatabase()  
412     
413 endcase
414 '-------------------------------------------------------------------------
415 testcase tTextProperties 
416     
417     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
419     ViewForms    
420             
421     Kontext "DATABASE"    
422         Database.UseMenu    
423         hMenuSelectNr(2)
424         hMenuSelectNr(15)
425         hMenuSelectNr(2)
426     
427     Kontext "TabGeneral"    
428         call DialogTest(TabGeneral)
429         DataBaseType.select(hGetDatabaseDisplayName("sdbc:flat:*"))
430         
431     Kontext "ConnectionType"        
432         NextBtn.Click
433         sleep(1)        
434         call fCheckConnectionTabPage("Text")
435         
436     Kontext "ConnectionType"        
437         NextBtn.Click
438         sleep(1)
439         
440     Kontext "TabTextBase"
441         '/// check the Text page        
442         call fCheckTabPage(TabTextBase)
443     
444     Kontext "ConnectionType"        
445         ConnectionType.ok
446         
447     call fCheckAdvancedDialog("Text")
448         
449     call fCloseDatabase()  
450     
451 endcase
452 '-------------------------------------------------------------------------
453 testcase tdBaseProperties
454     
455     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
457     ViewForms    
458             
459     Kontext "DATABASE"    
460         Database.UseMenu    
461         hMenuSelectNr(2)
462         hMenuSelectNr(15)
463         hMenuSelectNr(2)
464     
465     Kontext "TabGeneral"    
466         call DialogTest(TabGeneral)
467         DataBaseType.select(hGetDatabaseDisplayName("sdbc:dbase:*"))
468         
469     Kontext "ConnectionType"        
470         NextBtn.Click
471         sleep(1)        
472         call fCheckConnectionTabPage("dBase")
473         
474     Kontext "ConnectionType"        
475         NextBtn.Click
476         sleep(1)
477         
478     Kontext "TabdBase"
479         '/// check the dBase page        
480         call fCheckTabPage(TabdBase)
481     
482     Kontext "ConnectionType"        
483         ConnectionType.OK
484         
485     call fCheckAdvancedDialog("dBase")
486         
487     call fCloseDatabase()  
488     
489 endcase
490 '-------------------------------------------------------------------------
491 testcase tODBCProperties
493     call fOpenDatabase (gOfficePath + ConvertPath("user/database/biblio.odb"))
495     ViewForms    
496             
497     Kontext "DATABASE"    
498         Database.UseMenu    
499         hMenuSelectNr(2)
500         hMenuSelectNr(15)
501         hMenuSelectNr(2)
502     
503     Kontext "TabGeneral"    
504         call DialogTest(TabGeneral)
505         DataBaseType.select(hGetDatabaseDisplayName("sdbc:odbc:*"))    
506         
507     Kontext "ConnectionType"        
508         NextBtn.Click
509         sleep(1)        
510         call fCheckConnectionTabPage("ODBC")
511         
512     Kontext "ConnectionType"        
513         NextBtn.Click
514         sleep(1)
515         
516     Kontext "TabODBC"
517         '/// check the ODBC page        
518         call fCheckTabPage(TabODBC)
519     
520     Kontext "ConnectionType"        
521         ConnectionType.OK
522         
523     call fCheckAdvancedDialog("ODBC")        
524         
525     call fCloseDatabase()    
526    
527 endcase
528 '-------------------------------------------------------------------------
529 testcase tCheckHSQLDB
531     Dim sDatasourceFileName as String
532     sDatasourceFileName = ConvertPath(gOfficePath + "user/work/hsqldb.odb")
533     call fCreateHSQLDatasource(sDatasourceFileName)
534     
535     call fOpenDatabase(sDatasourceFileName) 
537     Kontext "ContainerView"
538         ViewTables
539   
540     call fCloseDatabase()
542 endcase
543 '-------------------------------------------------------------------------
544 '-------------------------------------------------------------------------
545 '-------------------------------------------------------------------------
546 '-------------------------------------------------------------------------
547 '-------------------------------------------------------------------------
548 function fCheckAdvancedDialog(sType as string)
549     
550     printlog "+Check the Advanced Settings for the datasource type " + sType
551     
552     Kontext "DATABASE"    
553         Database.UseMenu    
554         hMenuSelectNr(2)
555         hMenuSelectNr(15)
556         hMenuSelectNr(3)    
558     Kontext "Advanced"        
559         
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)
570             
571             TabControl.setPage TabGeneratedValues
572             call fcheckControl(RetrieveGeneratedValues)
573             call fcheckControl(AutoIncrementStatement)
574             call fcheckControl(QueryGeneratedValues)
575             
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)
586         
587             
588         elseif sType = "dBase" OR sType = "Text" then
589             call fcheckControl(SQL92Check)
590             'call fcheckControl(BooleanComparison)
591             'call fcheckControl(AppendAlias)
592         
593         elseif sType = "CALC" OR sType = "Mozilla" OR sType = "Evolution" OR sType = "LDAP" then            
594            ' call fcheckControl(BooleanComparison)
595            ' call fcheckControl(AppendAlias)    
596         
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)
603         else
604             qaerrorlog "unknown database type"
605         end if
606     
607     Kontext "Advanced"
608         Advanced.Cancel
609         
610 end function
611 '-------------------------------------------------------------------------
612 function fcheckControl(oControl as object)
613         
614         if oControl.exists() then
615             printlog "|The control " + oControl.Name + " exists."
616         else        
617             warnlog "|The control " + oControl.Name + " doesn't exists."
618         end if
620 end function
621 '-------------------------------------------------------------------------
622 function fCheckConnectionTabPage(sType as string)
623     
624     printlog "+check the connection page for the datasource type " + sType    
626     Kontext "TabConnection"        
627     
628     call DialogTest(TabConnection)  
629         
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)
636     
637     elseif sType = "MySQLJDBC" then        
638         call fcheckControl(MySQLJDBCDatasource)
639         call fcheckControl(Username)        
640         call fcheckControl(PasswordRequired)
641         call fcheckControl(TestConnection)
642     
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)
649     
650     elseif sType = "OracleJDBC" then        
651         call fcheckControl(OracleJDBCDatasource)        
652         call fcheckControl(Username)        
653         call fcheckControl(PasswordRequired)
654         call fcheckControl(TestConnection)
655         
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)  
663     
664     elseif sType = "ODBC" then        
665         call fcheckControl(OdbcDatasourceName)
666         call fcheckControl(Username)        
667         call fcheckControl(PasswordRequired)        
668         call fcheckControl(TestConnection)
669     
670     elseif sType = "dBase" then        
671         call fcheckControl(dBasePath)
672         call fcheckControl(SelectPath)
673         call fcheckControl(TestConnection)
674     
675     elseif sType = "CALC" then        
676         call fcheckControl(SpreadsheetPath)
677         call fcheckControl(SelectPath)
678         call fcheckControl(TestConnection)
679     
680     elseif sType = "Text" then        
681         call fcheckControl(TextPath)
682         call fcheckControl(SelectPath)
683         call fcheckControl(TestConnection)    
684     
685     elseif sType = "LDAP" then      
686         call fcheckControl(HostName)
687         call fcheckControl(TestConnection)        
688         
689     elseif sType = "Mozilla" OR sType = "Evolution" then
690         call fcheckControl(TestConnection)    
691     end if
693 end function
694 '-------------------------------------------------------------------------
695 function fCheckTabPage(oType as object)
696         
697     printlog "+check the " + oType.Name + " page."    
698     Kontext oType.Name
699     
700     call DialogTest(oType)
701     
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)
708         
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)        
718     
719     elseif oType.Name = "TabODBC" then   
720         call fcheckControl(UseCatalogs) 
721         call fcheckControl(Options)
722         call fcheckControl(CharSet)
723     
724     elseif oType.Name = "TabdBase" then
725         call fcheckControl(CharSet)
726         call fcheckControl(DisplayInactiveRecords)  
727         call fcheckControl(Indexes)
728         
729     elseif ( oType.Name = "TabLDAP" ) then
730         call fcheckControl(BaseDN)
731         call fcheckControl(PortNumber)
732         call fcheckControl(Records)
733     
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)
745     end if
746     
747 end function