1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3<script:module xmlns:script="http://openoffice.org/2000/script" script:name="dbaccess_JoinViewAccessibility" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9'
10' Copyright 2000, 2010 Oracle and/or its affiliates.
11'
12' OpenOffice.org - a multi-platform office productivity suite
13'
14' This file is part of OpenOffice.org.
15'
16' OpenOffice.org is free software: you can redistribute it and/or modify
17' it under the terms of the GNU Lesser General Public License version 3
18' only, as published by the Free Software Foundation.
19'
20' OpenOffice.org is distributed in the hope that it will be useful,
21' but WITHOUT ANY WARRANTY; without even the implied warranty of
22' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23' GNU Lesser General Public License version 3 for more details
24' (a copy is included in the LICENSE file that accompanied this code).
25'
26' You should have received a copy of the GNU Lesser General Public License
27' version 3 along with OpenOffice.org.  If not, see
28' <http://www.openoffice.org/license.html>
29' for a copy of the LGPLv3 License.
30'
31'*************************************************************************
32*****
33'*************************************************************************
34
35
36
37' Be sure that all variables are dimensioned:
38option explicit
39
40
41' REQUIRED VARIABLES for interface/service tests:
42
43Global cancelButton As Object
44Global queryWindow As Object
45
46
47Sub CreateObj()
48
49'*************************************************************************
50' COMPONENT:
51' dbaccess.JoinViewAccessibility
52'*************************************************************************
53On Error Goto ErrHndl
54    Dim oMSF As Object, oWin As Object
55    Dim thRunner As Object, xRoot As Object
56    Dim tk As Object
57
58    Dim dbSource As Object
59    dbSource = createUnoService("com.sun.star.sdb.DataSource")
60
61    Dim info(2) As new com.sun.star.beans.PropertyValue
62    info(0).Name = "JavaDriverClass"
63    info(0).Value = "org.gjt.mm.mysql.Driver"
64    info(1).Name = "user"
65    info(1).Value = jdbcUser
66    info(2).Name = "password"
67    info(2).Value = jdbcPassword
68    dbSource.info = info()
69    dbSource.URL = jdbcUrl
70
71    Dim dbContext As Object
72    dbContext = createUnoService("com.sun.star.sdb.DatabaseContext")
73
74    Dim sourceName As String
75    sourceName = "AAADBSource for dbu-accessibility"
76
77    if dbContext.hasByName(sourceName) then
78        dbContext.revokeObject(sourceName)
79    endif
80
81    dbContext.registerObject(sourceName, dbSource)
82
83    Dim connection As Object
84    connection = dbSource.getIsolatedConnection(jdbcUser, jdbcPassword)
85
86    Dim statement As Object
87    statement = connection.createStatement()
88
89    statement.executeUpdate("drop table if exists tst_table1")
90    statement.executeUpdate("drop table if exists tst_table2")
91    statement.executeUpdate("create table tst_table1 (id1 int)")
92    statement.executeUpdate("create table tst_table2 (id2 int)")
93
94    Dim defContainer As Object
95    defContainer = dbSource.getQueryDefinitions()
96
97    Dim newQuery As Object
98    newQuery = createUnoService("com.sun.star.sdb.QueryDefinition")
99    newQuery.Command = "select * from tst_table1, tst_table2 where " + _
100                       "tst_table1.id1=tst_table2.id2"
101
102    defContainer.insertByName("Query1", newQuery)
103
104    oMSF = getProcessServiceManager()
105    thRunner = oMSF.createInstance("basichelper.ThreadRunner")
106    tk = createUNOService("com.sun.star.awt.Toolkit")
107    wait(500)
108    thRunner.initialize(Array("ExecuteDialog", "com.sun.star.sdb.DatasourceAdministrationDialog"))
109    wait(3000)
110
111    oWin = tk.getActiveTopWindow()
112    xRoot = utils.at_getAccessibleObject(oWin)
113
114    Dim pageTabList As Object
115    pageTabList = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PAGE_TAB_LIST)
116
117    pageTabList.selectAccessibleChild(3)
118    wait(500)
119
120    Dim editQueryButton As Object
121    editQueryButton = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON, "Edit Query")
122
123    cancelButton = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.PUSH_BUTTON, "Cancel")
124
125    editQueryButton.doAccessibleAction(0)
126    wait(1000)
127
128    oWin = tk.getActiveTopWindow()
129    queryWindow = oWin
130    xRoot = utils.at_getAccessibleObject(oWin)
131
132    oObj = utils.at_getAccessibleObjectForRole(xRoot, com.sun.star.accessibility.AccessibleRole.VIEW_PORT)
133
134Exit Sub
135ErrHndl:
136    Test.Exception()
137End Sub
138
139Sub DisposeObj()
140    utils.closeObject(queryWindow)
141    if NOT isNull(cancelButton) then
142        cancelButton.doAccessibleAction(0)
143        wait(1000)
144    End If
145End Sub
146
147Sub fireEvent()
148End Sub
149</script:module>
150