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_ConnectionLineAccessibility" 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: 42Global cancelButton As Object 43Global queryWindow As Object 44 45 46Sub CreateObj() 47 48'************************************************************************* 49' COMPONENT: 50' dbaccess.ConnectionLineAccessibility 51'************************************************************************* 52On Error Goto ErrHndl 53 Dim oMSF As Object, oWin As Object 54 Dim thRunner As Object, xRoot As Object 55 Dim tk As Object 56 57 Dim dbSource As Object 58 dbSource = createUnoService("com.sun.star.sdb.DataSource") 59 60 Dim info(2) As new com.sun.star.beans.PropertyValue 61 info(0).Name = "JavaDriverClass" 62 info(0).Value = "org.gjt.mm.mysql.Driver" 63 info(1).Name = "user" 64 info(1).Value = jdbcUser 65 info(2).Name = "password" 66 info(2).Value = jdbcPassword 67 dbSource.info = info() 68 dbSource.URL = jdbcUrl 69 70 Dim dbContext As Object 71 dbContext = createUnoService("com.sun.star.sdb.DatabaseContext") 72 73 Dim sourceName As String 74 sourceName = "AAADBSource for dbu-accessibility" 75 76 if dbContext.hasByName(sourceName) then 77 dbContext.revokeObject(sourceName) 78 endif 79 80 dbContext.registerObject(sourceName, dbSource) 81 82 Dim connection As Object 83 connection = dbSource.getIsolatedConnection(jdbcUser, jdbcPassword) 84 85 Dim statement As Object 86 statement = connection.createStatement() 87 88 statement.executeUpdate("drop table if exists tst_table1") 89 statement.executeUpdate("drop table if exists tst_table2") 90 statement.executeUpdate("create table tst_table1 (id1 int)") 91 statement.executeUpdate("create table tst_table2 (id2 int)") 92 93 Dim defContainer As Object 94 defContainer = dbSource.getQueryDefinitions() 95 96 Dim newQuery As Object 97 newQuery = createUnoService("com.sun.star.sdb.QueryDefinition") 98 newQuery.Command = "select * from tst_table1, tst_table2 where " + _ 99 "tst_table1.id1=tst_table2.id2" 100 101 defContainer.insertByName("Query1", newQuery) 102 103 oMSF = getProcessServiceManager() 104 thRunner = oMSF.createInstance("basichelper.ThreadRunner") 105 tk = createUNOService("com.sun.star.awt.Toolkit") 106 wait(500) 107 thRunner.initialize(Array("ExecuteDialog", "com.sun.star.sdb.DatasourceAdministrationDialog")) 108 wait(3000) 109 110 oWin = tk.getActiveTopWindow() 111 xRoot = utils.at_getAccessibleObject(oWin) 112 113 Dim pageTabList As Object 114 pageTabList = utils.at_getAccessibleObjectForRole(xRoot, 31) 115 116 pageTabList.selectAccessibleChild(3) 117 wait(500) 118 119 Dim editQueryButton As Object 120 editQueryButton = utils.at_getAccessibleObjectForRole(xRoot, 35, "Edit Query") 121 122 cancelButton = utils.at_getAccessibleObjectForRole(xRoot, 35, "Cancel") 123 124 editQueryButton.doAccessibleAction(0) 125 wait(1000) 126 127 oWin = tk.getActiveTopWindow() 128 queryWindow = oWin 129 xRoot = utils.at_getAccessibleObject(oWin) 130 131 oObj = utils.at_getAccessibleObjectForRole(xRoot, 0, "Relation") 132 133Exit Sub 134ErrHndl: 135 Test.Exception() 136End Sub 137 138Sub DisposeObj() 139 queryWindow.dispose() 140 if NOT isNull(cancelButton) then 141 cancelButton.doAccessibleAction(0) 142 wait(1000) 143 End If 144End Sub 145 146Sub fireEvent() 147End Sub 148</script:module> 149