protected void initialize(TestParameters tParam, PrintWriter log) { // log.println( "creating a draw document" ); // xTextDoc = WriterTools.createTextDoc(t((XMultiServiceFactory) Param.getMSF)); tmpDir = utils.getOfficeTemp(((XMultiServiceFactory) tParam.getMSF())); origDB = util.utils.getFullTestDocName("TestDB/testDB.dbf"); dbTools = new DBTools((XMultiServiceFactory) tParam.getMSF(), log); // creating DataSource and registering it in DatabaseContext String dbURL = (String) tParam.get("test.db.url"); String dbUser = (String) tParam.get("test.db.user"); String dbPassword = (String) tParam.get("test.db.password"); log.println("Creating and registering DataSource ..."); srcInf = dbTools.newDataSourceInfo(); if ((dbURL != null) && (dbUser != null) && (dbPassword != null)) { isMySQLDB = true; log.println("dbURL = " + dbURL); log.println("dbUSER = "******"dbPASSWORD = "******"soffice_test_table"; srcInf.URL = "jdbc:" + dbURL; srcInf.IsPasswordRequired = new Boolean(true); srcInf.Password = dbPassword; srcInf.User = dbUser; PropertyValue[] propInfo = new PropertyValue[1]; propInfo[0] = new PropertyValue(); propInfo[0].Name = "JavaDriverClass"; // propInfo[0].Value = "org.gjt.mm.mysql.Driver"; propInfo[0].Value = "util.dddriver.Driver"; srcInf.Info = propInfo; dbSrc = srcInf.getDataSourceService(); dbTools.reRegisterDB(dbSourceName, dbSrc); } catch (com.sun.star.uno.Exception e) { log.println("Error while object test initialization :"); e.printStackTrace(log); throw new StatusException("Error while object test" + " initialization", e); } } else { // DataSource for sdbc db try { String myDbUrl = "sdbc:dbase:" + DBTools.dirToUrl(tmpDir); srcInf.URL = myDbUrl; log.println("try to register '" + myDbUrl + "' as '" + dbSourceName + "'"); dbSrc = srcInf.getDataSourceService(); dbTools.reRegisterDB(dbSourceName, dbSrc); } catch (com.sun.star.uno.Exception e) { log.println("Error while object test initialization :"); e.printStackTrace(log); throw new StatusException("Error while object test initialization", e); } String oldF = null; String newF = null; do { tableName = "ODatabaseForm_tmp" + uniqueSuffix; oldF = utils.getFullURL(origDB); newF = utils.getOfficeTemp((XMultiServiceFactory) tParam.getMSF()) + tableName + ".dbf"; } while (!utils.tryOverwriteFile(((XMultiServiceFactory) tParam.getMSF()), oldF, newF) && (uniqueSuffix++ < 50)); } }