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="sdb_DataSource" script:language="StarBasic">
4
5
6'*************************************************************************
7'
8'  Licensed to the Apache Software Foundation (ASF) under one
9'  or more contributor license agreements.  See the NOTICE file
10'  distributed with this work for additional information
11'  regarding copyright ownership.  The ASF licenses this file
12'  to you under the Apache License, Version 2.0 (the
13'  "License"); you may not use this file except in compliance
14'  with the License.  You may obtain a copy of the License at
15'
16'    http://www.apache.org/licenses/LICENSE-2.0
17'
18'  Unless required by applicable law or agreed to in writing,
19'  software distributed under the License is distributed on an
20'  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21'  KIND, either express or implied.  See the License for the
22'  specific language governing permissions and limitations
23'  under the License.
24'
25'*************************************************************************
26
27
28
29
30
31'*************************************************************************
32' This Interface/Service test depends on the following GLOBAL variables,
33' which must be specified in the object creation:
34
35'     - SuppressVersionColumns
36'     - IsReadOnly
37'     - NumberFormatsSupplier
38'     - TableFilter
39'     - TableTypeFilter
40
41'*************************************************************************
42
43
44
45
46
47Sub RunTest()
48
49'*************************************************************************
50' SERVICE:
51' com.sun.star.sdb.DataSource
52'*************************************************************************
53On Error Goto ErrHndl
54    Dim infoUsr as new com.sun.star.beans.PropertyValue
55    Dim infoPass as new com.sun.star.beans.PropertyValue
56    Dim bOk as Boolean
57
58    PropertyTester.TestProperty("Name")
59
60    PropertyTester.TestProperty("URL")
61
62    Test.StartMethod("Info")
63    props() = oObj.Info
64
65    infoUsr.Name = "user"
66    if ubound(props()) > -1 then
67        infoUsr.Value = "New" + props(0).Value
68    else
69        infoUsr.Value = "DataSourceUser"
70    endif
71
72    infoPass.Name = "password"
73    infoPass.Value = "DataSourcePasswd"
74
75    newProps = Array(infoUsr, infoPass)
76    oObj.Info = newProps
77    getProps() = oObj.Info
78    Out.Log("ubound = " + ubound(getProps()))
79
80    bOk = PropertyTester.equals(newProps, getProps)
81
82    Test.MethodTested("Info", bOk)
83
84    PropertyTester.TestProperty("User")
85
86    PropertyTester.TestProperty("Password")
87
88    PropertyTester.TestProperty("IsPasswordRequired")
89
90    PropertyTester.TestProperty("SuppressVersionColumns")
91
92    PropertyTester.TestProperty("IsReadOnly")
93
94    PropertyTester.TestProperty("NumberFormatsSupplier")
95
96    PropertyTester.TestProperty("TableFilter")
97
98    PropertyTester.TestProperty("TableTypeFilter")
99
100Exit Sub
101ErrHndl:
102    Test.Exception()
103    bOK = false
104    resume next
105End Sub
106</script:module>
107