update dev300-m58
[ooovba.git] / testautomation / dbaccess / optional / includes / wiz_DatabaseWizard.inc
blob98771d2340eada853b4d33e1a76f1299004be35d
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: wiz_DatabaseWizard.inc,v $
11 '* $Revision: 1.1 $
13 '* last change: $Author: jsi $ $Date: 2008-06-16 07:43:42 $
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 : Database Wizard
38 '\***********************************************************************
39 sub wiz_DatabaseWizard
40     call tNewDatabase
41     call tOpenDatabase
42     call tOpenNoneDatabaseDocument
43     call tODBC
44     call tEvolution
45     call tMozilla
46     call tJDBC
47     call tAdabas
48     call tdBase
49     call tMySQLODBC
50     call tMySQLJDBC
51     call tSpreadsheet
52     call tText
53     call tOracleJDBC
54 end sub
55 '-------------------------------------------------------------------------
56 testcase tNewDatabase
57         
58     Kontext "DocumentWriter"
59         if (DocumentWriter.exists(1)) then        
60             DocumentWriter.UseMenu
61         else
62             Kontext "DocumentBackground"
63             DocumentBackground.UseMenu
64         endif  
65         hMenuSelectNr(1)
66         hMenuSelectNr(1)
67         hMenuSelectNr(5)
68         
69     sleep(10)
70     
71     Kontext "DatabaseWizard"    
72         CreateNewDatabase.Check
73         sleep(1)
74         NextBtn.Click
75         sleep(1)        
76         FinishBtn.Click
77         sleep(1)
78                           
79     Kontext "SpeichernDlg"
80         if ( Dateiname.getSelText() = "" ) then
81             warnlog "#i58413# Default filename is missing"
82             Dim sFileName as String
83             sFileName = ConvertPath(gOfficePath + "user/work/TTDB1.odb")
84             if ( app.Dir( ConvertPath(sFileName) ) ) <> "" then
85                 app.kill(ConvertPath(sFileName))
86             endif
87             Dateiname.setText(sFileName)
88         endif            
89         Speichern.click 
90         sleep(10)
91         
92     Kontext "MessageBox" 
93         if MessageBox.exists then
94             MessageBox.yes
95         end if
96         
97     sleep(5)
99     Kontext "ContainerView"
100     
101     ViewTables
102     
103     sleep(1)
104     
105     call fCloseDatabase(true)
106     
107 endcase
108 '-------------------------------------------------------------------------
109 testcase tOpenDatabase
110         
111     Kontext "DocumentWriter"
112         if (DocumentWriter.exists(1)) then        
113             DocumentWriter.UseMenu
114         else
115             Kontext "DocumentBackground"
116             DocumentBackground.UseMenu
117         endif  
118         hMenuSelectNr(1)
119         hMenuSelectNr(1)
120         hMenuSelectNr(5)
121     
122     sleep(5)
123         
124     Kontext "DatabaseWizard"    
125         OpenExistingDoc.Check
126         sleep(1)
127         OpenBtn.Click
128         sleep(1)        
129                       
130     Kontext "GeneralFileDialog"
131         printlog "open database from: " + Convertpath(gofficePath + "user/database/biblio.odb")
132         Dateiname.setText(Convertpath(gofficePath + "user/database/biblio.odb"))            
133         Oeffnen.click 
134         sleep(5)
135         
136     Kontext "ContainerView"
137     
138     ViewTables
139     
140     sleep(1)
141     
142     call fCloseDatabase(false)
143     
144 endcase   
145 '-------------------------------------------------------------------------
146 testcase tOpenNoneDatabaseDocument
147         
148     Kontext "DocumentWriter"
149         if (DocumentWriter.exists(1)) then        
150             DocumentWriter.UseMenu
151         else
152             Kontext "DocumentBackground"
153             DocumentBackground.UseMenu
154         endif  
155         hMenuSelectNr(1)
156         hMenuSelectNr(1)
157         hMenuSelectNr(5)
158     
159     sleep(5)
160         
161     Kontext "DatabaseWizard"    
162         OpenExistingDoc.Check
163         sleep(1)
164         OpenBtn.Click
165         sleep(1)        
166                       
167     Kontext "GeneralFileDialog"
168         printlog "open spreadsheet file from: " + Convertpath(gTesttoolPath + "dbaccess/optional/input/spreadsheet_datasource/TT_Query1.ods")
169         Dateiname.setText(Convertpath(gTesttoolPath + "dbaccess/optional/input/spreadsheet_datasource/TT_Query1.ods"))            
170         Oeffnen.click 
171         sleep(5)
172         
173     Kontext "DocumentCalc"
174     if (DocumentCalc.exists()) then
175                 warnlog "the spreadsheet should not appear"
176         call hCloseDocument()
177     else
178         Kontext "MessageBox"
179         if(MessageBox.exists(1)) then
180                 printlog "messagebox appear ->> OK"
181                 MessageBox.OK
182             Kontext "DatabaseWizard"    
183                 DatabaseWizard.Cancel
184         else
185                 warnlog "there should be a message box about the fact that this is no database"
186                 Kontext "DatabaseWizard"        
187                     DatabaseWizard.Cancel
188         endif
189     endif
190     
191 endcase
192 '-------------------------------------------------------------------------
193 testcase tODBC
194 qaerrorlog "not yet implemented"
195 endcase
196 '-------------------------------------------------------------------------
197 testcase tEvolution
199     if gPlatgroup <> "lin" then
200         printlog "Evolution does only exists under linux."
201         goto endsub    
202     end if   
204     call fCreateEvolutionAddressbookDatasource(gOfficePath + "user/work/tt_evolution.odb")
205     call fOpendatabase(gOfficePath + "user/work/tt_evolution.odb")
206     
207     Kontext "ContainerView"
208         ViewTables
209     
210     call fCloseDatabase(true)   
211     
212 endcase
213 '-------------------------------------------------------------------------
214 testcase tMozilla
216     if ( fCreateMozillaAddressbookDatasource(gOfficePath + "user/work/tt_mozilla.odb") = true) then
217         if ( fOpendatabase(gOfficePath + "user/work/tt_mozilla.odb") = true) then        
218             Kontext "ContainerView"
219                 ViewTables
220         else
221             warnlog "mozilla database could not be open."
223         endif
224     else
225         qaerrorlog "mozilla database could not be created. Maybe you have no mozilla installed."
226         Kontext "MessageBox"
227                 if (MessageBox.exists(1)) then
228                         MessageBox.OK
229                 endif
230     endif
231         ' try to close the database    
232     call fCloseDatabase(false)
233     
234 endcase
235 '-------------------------------------------------------------------------
236 testcase tJDBC
237 qaerrorlog "not yet implemented"
238 endcase
239 '-------------------------------------------------------------------------
240 testcase tAdabas
242     qaerrorlog "not yet implemented"
243     goto endsub
245     qaerrorlog "not yet implemented"
246     goto endsub
248     if gPlatform = "x86" then
249         printlog "Adabas doesn't exists under x86."
250         goto endsub    
251     elseif gOOO then
252         printlog "Adabas doesn't exists under Openoffice.org."
253         goto endsub    
254     end if
255     
256     dim aDatabaseProperties(6) as string
257     aDatabaseProperties() = tools_dbtools_fgetAdabasDatabaseProperties()
259     ' if and only if no properties are defined in the environment file the test is stopped
260     if(aDatabaseProperties(1) = "no") then
261         qaerrorlog "No database properties from Adabas defiened. The Test is stopped here."
262         goto endsub
263     endif        
264     
265         call fCreateAdabasDatasource( sFileName, aDatabaseProperties(2), aDatabaseProperties(3), aDatabaseProperties(4))
266     call fOpendatabase(gOfficePath + "user/work/tt_adabas.odb","testuser")
267     
268     Kontext "ContainerView"
269         ViewTables
270     
271     call fCloseDatabase(true)    
272     
273 endcase
274 '-------------------------------------------------------------------------
275 testcase tdBase
277     call fCreateDbaseDatasource(gOfficePath + "user/work/tt_dbase.odb",gOfficePath + "user/work/")
278     call fOpendatabase(gOfficePath + "user/work/tt_dbase.odb")
279     
280     Kontext "ContainerView"
281         ViewTables
282     
283     call fCloseDatabase(true)
284     
285 endcase
286 '-------------------------------------------------------------------------
287 testcase tMySQLODBC
288 qaerrorlog "not yet implemented"
289 endcase
290 '-------------------------------------------------------------------------
291 testcase tMySQLJDBC
292 qaerrorlog "not yet implemented"
293 endcase
294 '-------------------------------------------------------------------------
295 testcase tSpreadsheet
296 qaerrorlog "not yet implemented"
297 endcase
298 '-------------------------------------------------------------------------
299 testcase tText
301     call fCreateTextDatasource(gOfficePath + "user/work/tt_text.odb",gOfficePath + "user/work/")
302     call fOpendatabase(gOfficePath + "user/work/tt_text.odb")
303     
304     Kontext "ContainerView"
305         ViewTables
306     
307     call fCloseDatabase(true)    
308     
309 endcase
310 '-------------------------------------------------------------------------
311 testcase tOracleJDBC
312 qaerrorlog "not yet implemented"
313 endcase
314 '-------------------------------------------------------------------------