tdf#130857 qt weld: Introduce QtInstanceScrolledWindow
[LibreOffice.git] / qadevOOo / tests / java / mod / _dbpool / OConnectionPool.java
blob5e0d6517d3cc4dea7730245bdb15d1ce15fceb64
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package mod._dbpool;
21 import java.io.PrintWriter;
23 import lib.Status;
24 import lib.StatusException;
25 import lib.TestCase;
26 import lib.TestEnvironment;
27 import lib.TestParameters;
28 import util.DBTools;
30 import com.sun.star.beans.PropertyValue;
31 import com.sun.star.lang.XMultiServiceFactory;
32 import com.sun.star.uno.XInterface;
34 /**
35 * Test for object which is represented by service
36 * <code>com.sun.star.sdbc.ConnectionPool</code>. <p>
37 * Object implements the following interfaces :
38 * <ul>
39 * <li> <code>com::sun::star::sdbc::XDriverManager</code></li>
40 * </ul>
41 * @see com.sun.star.sdbc.XDriverManager
42 * @see ifc.sdbc._XDriverManager
44 public class OConnectionPool extends TestCase {
45 @Override
46 protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) throws Exception {
48 XMultiServiceFactory xMSF = Param.getMSF();
49 XInterface oObj = null;
51 oObj = (XInterface)
52 xMSF.createInstance("com.sun.star.sdbc.ConnectionPool");
54 log.println("creating a new environment for object");
55 TestEnvironment tEnv = new TestEnvironment( oObj );
57 //adding relations for XDriverManager
58 String dbaseURL = (String) Param.get("dbase.url");
59 if (dbaseURL == null) {
60 throw new StatusException(
61 Status.failed("Couldn't get parameter 'dbase.url'"));
64 tEnv.addObjRelation("SDBC.URL", "sdbc:dbase:" + dbaseURL);
66 String jdbcURL = (String) Param.get("jdbc.url");
67 if (jdbcURL == null) {
68 throw new StatusException(
69 Status.failed("Couldn't get parameter 'jdbc.url'"));
72 tEnv.addObjRelation("JDBC.URL", "jdbc:" + jdbcURL);
74 String jdbcUser = (String) Param.get("jdbc.user");
75 if (jdbcUser == null) {
76 throw new StatusException(
77 Status.failed("Couldn't get parameter 'jdbc.user'"));
80 String jdbcPassword = (String) Param.get("jdbc.password");
81 if (jdbcPassword == null) {
82 throw new StatusException(
83 Status.failed("Couldn't get parameter 'jdbc.password'"));
86 PropertyValue[] jdbcInfo = new PropertyValue[3];
87 jdbcInfo[0] = new PropertyValue();
88 jdbcInfo[0].Name = "user";
89 jdbcInfo[0].Value = jdbcUser;
90 jdbcInfo[1] = new PropertyValue();
91 jdbcInfo[1].Name = "password";
92 jdbcInfo[1].Value = jdbcPassword;
93 jdbcInfo[2] = new PropertyValue();
94 jdbcInfo[2].Name = "JavaDriverClass";
95 jdbcInfo[2].Value = DBTools.TST_JDBC_DRIVER;
97 tEnv.addObjRelation("JDBC.INFO", jdbcInfo);
99 return tEnv;