summaryrefslogtreecommitdiff
path: root/qadevOOo/runner/convwatch/ReportDesignerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/runner/convwatch/ReportDesignerTest.java')
-rwxr-xr-xqadevOOo/runner/convwatch/ReportDesignerTest.java130
1 files changed, 65 insertions, 65 deletions
diff --git a/qadevOOo/runner/convwatch/ReportDesignerTest.java b/qadevOOo/runner/convwatch/ReportDesignerTest.java
index 703a2b2f3073..fe144ef3330c 100755
--- a/qadevOOo/runner/convwatch/ReportDesignerTest.java
+++ b/qadevOOo/runner/convwatch/ReportDesignerTest.java
@@ -2,7 +2,7 @@
************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -63,15 +63,15 @@ import helper.OfficeWatcher;
// import java.text.SimpleDateFormat;
// import java.text.ParsePosition;
// import java.sql.Time;
-//
+//
// import java.io.BufferedReader;
// import java.io.File;
// import java.io.FileReader;
// import java.io.IOException;
// import java.io.FilenameFilter;
-//
+//
// import java.util.Vector;
-//
+//
// import helper.AppProvider;
// import java.text.DecimalFormat;
// import util.DynamicClassLoader;
@@ -87,7 +87,7 @@ class PropertySetHelper
{
m_xPropertySet = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, _aObj);
}
-
+
/**
get a property and don't convert it
@param _sName the string name of the property
@@ -154,14 +154,14 @@ class PropertyHelper
}
public class ReportDesignerTest extends ComplexTestCase {
-
+
String mTestDocumentPath;
-
+
/**
* This method returns a list of Strings, each string must be a function name in this class.
* @return
*/
- public String[] getTestMethodNames()
+ public String[] getTestMethodNames()
{
return new String[] {"ReportDesignTest"}; // MAIN
}
@@ -182,7 +182,7 @@ public class ReportDesignerTest extends ComplexTestCase {
sOfficePath = _sOfficePathWithTrash.substring(0, nIndex + 7);
}
}
-
+
// if (sOfficePath.startsWith("\"") ||
// sOfficePath.startsWith("'"))
// {
@@ -198,20 +198,20 @@ public class ReportDesignerTest extends ComplexTestCase {
System.exit(0);
}
}
-
-
+
+
private static XDesktop m_xDesktop = null;
public static XDesktop getXDesktop()
{
- if (m_xDesktop == null)
+ if (m_xDesktop == null)
{
- try
+ try
{
XInterface xInterface = (XInterface) m_xXMultiServiceFactory.createInstance( "com.sun.star.frame.Desktop" );
m_xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, xInterface);
}
- catch (com.sun.star.uno.Exception e)
+ catch (com.sun.star.uno.Exception e)
{
log.println("ERROR: uno.Exception caught");
log.println("Message: " + e.getMessage());
@@ -219,7 +219,7 @@ public class ReportDesignerTest extends ComplexTestCase {
}
return m_xDesktop;
}
-
+
private void showElements(XNameAccess _xNameAccess)
{
if (_xNameAccess != null)
@@ -235,8 +235,8 @@ public class ReportDesignerTest extends ComplexTestCase {
System.out.println("Warning: Given object is null.");
}
}
-
-
+
+
private OfficeProvider m_aProvider = null;
private static XMultiServiceFactory m_xXMultiServiceFactory = null;
private void startOffice()
@@ -261,7 +261,7 @@ public class ReportDesignerTest extends ComplexTestCase {
}
TimeHelper.waitInSeconds(2, "Give close Office some time.");
}
-
+
private String m_sMailAddress = null;
private String m_sParentDistinct = null;
@@ -279,7 +279,7 @@ public class ReportDesignerTest extends ComplexTestCase {
/**
* This is the main test Function of current ReportDesignerTest
*/
- public void ReportDesignTest()
+ public void ReportDesignTest()
{
convwatch.GlobalLogWriter.set(log);
@@ -289,15 +289,15 @@ public class ReportDesignerTest extends ComplexTestCase {
try
{
-
+
// -------------------- preconditions, try to find an office --------------------
-
+
String sAppExecutionCommand = (String) param.get("AppExecutionCommand");
log.println("sAppExecutionCommand='" + sAppExecutionCommand + "'");
String sUser = System.getProperty("user.name");
log.println("user.name='" + sUser + "'");
-
+
// String sVCSID = System.getProperty("VCSID");
// log.println("VCSID='" + sVCSID + "'");
// m_sMailAddress = sVCSID + "@openoffice.org";
@@ -319,24 +319,24 @@ public class ReportDesignerTest extends ComplexTestCase {
System.out.println("Error, Sourceversion is null.");
System.exit(1);
}
-
+
sAppExecutionCommand = sAppExecutionCommand.replaceAll( "\\$\\{USERNAME\\}", sUser);
log.println("sAppExecutionCommand='" + sAppExecutionCommand + "'");
-
+
// an other way to replace strings
// sAppExecutionCommand = utils.replaceAll13(sAppExecutionCommand, "${USERNAME}", sUser);
-
+
checkIfOfficeExists(sAppExecutionCommand);
param.put("AppExecutionCommand", new String(sAppExecutionCommand));
-
+
// System.exit(1);
// --------------------------- Start the given Office ---------------------------
-
+
startOffice();
-
+
// ------------------------------ Start a test run ------------------------------
-
+
// String sCurrentDirectory = System.getProperty("user.dir");
// log.println("Current Dir: " + sCurrentDirectory);
String sDocument = (String) param.get(convwatch.PropertyName.DOC_COMPARATOR_INPUT_PATH);
@@ -360,57 +360,57 @@ public class ReportDesignerTest extends ComplexTestCase {
stopOffice();
throw new AssureException(e.getMessage());
}
-
+
// ------------------------------ Office shutdown ------------------------------
stopOffice();
}
-
+
// -----------------------------------------------------------------------------
private void startTestForFile(String _sDocument /*, int _nType*/)
{
File aFile = new File(_sDocument);
assure("Test File '" + _sDocument + "' doesn't exist.", aFile.exists());
-
+
String sFileURL = URLHelper.getFileURLFromSystemPath(_sDocument);
log.println("File URL: " + sFileURL);
-
+
XComponent xDocComponent = loadComponent(sFileURL, getXDesktop(), null);
log.println("Load done");
-// context = createUnoService("com.sun.star.sdb.DatabaseContext")
+// context = createUnoService("com.sun.star.sdb.DatabaseContext")
// oDataBase = context.getByName("hh")
// oDBDoc = oDataBase.DatabaseDocument
-//
-// dim args(1) as new com.sun.star.beans.PropertyValue
-// args(0).Name = "ActiveConnection"
-// args(0).Value = oDBDoc.getCurrentController().getPropertyValue("ActiveConnection")
-// reportContainer = oDBDoc.getReportDocuments()
+//
+// dim args(1) as new com.sun.star.beans.PropertyValue
+// args(0).Name = "ActiveConnection"
+// args(0).Value = oDBDoc.getCurrentController().getPropertyValue("ActiveConnection")
+// reportContainer = oDBDoc.getReportDocuments()
// report = reportContainer.loadComponentFromURL("Report40","",0,args)
-
+
try
{
XInterface x = (XInterface)m_xXMultiServiceFactory.createInstance("com.sun.star.sdb.DatabaseContext");
assure("can't create instance of com.sun.star.sdb.DatabaseContext", x != null);
log.println("createInstance com.sun.star.sdb.DatabaseContext done");
-
+
XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, x);
showElements(xNameAccess);
Object aObj = xNameAccess.getByName(sFileURL);
// log.println("1");
-
+
// PropertySetHelper aHelper = new PropertySetHelper(aObj);
XDocumentDataSource xDataSource = (XDocumentDataSource)UnoRuntime.queryInterface(XDocumentDataSource.class, aObj);
// Object aDatabaseDocmuent = aHelper.getPropertyValueAsObject("DatabaseDocument");
XOfficeDatabaseDocument xOfficeDBDoc = xDataSource.getDatabaseDocument();
-
+
// XOfficeDatabaseDocument xOfficeDBDoc = (XOfficeDatabaseDocument)UnoRuntime.queryInterface(XOfficeDatabaseDocument.class, aDatabaseDocument);
assure("can't access DatabaseDocument", xOfficeDBDoc != null);
// log.println("2");
-
+
XModel xDBSource = (XModel)UnoRuntime.queryInterface(XModel.class, xOfficeDBDoc);
Object aController = xDBSource.getCurrentController();
assure("Controller of xOfficeDatabaseDocument is empty!", aController != null);
// log.println("3");
-
+
XDatabaseDocumentUI aDBDocUI = (XDatabaseDocumentUI)UnoRuntime.queryInterface(XDatabaseDocumentUI.class, aController);
aDBDocUI.connect();
// if (aDBDocUI.isConnected())
@@ -422,28 +422,28 @@ public class ReportDesignerTest extends ComplexTestCase {
// System.out.println("false");
// }
// log.println("4");
-
+
// aHelper = new PropertySetHelper(aController);
-
+
// Object aActiveConnectionObj = aHelper.getPropertyValueAsObject("ActiveConnection");
- Object aActiveConnectionObj = aDBDocUI.getActiveConnection();
+ Object aActiveConnectionObj = aDBDocUI.getActiveConnection();
assure("ActiveConnection is empty", aActiveConnectionObj != null);
// log.println("5");
-
+
XReportDocumentsSupplier xSupplier = (XReportDocumentsSupplier)UnoRuntime.queryInterface(XReportDocumentsSupplier.class, xOfficeDBDoc);
xNameAccess = xSupplier.getReportDocuments();
assure("xOfficeDatabaseDocument returns no Report Document", xNameAccess != null);
// log.println("5");
-
+
showElements(xNameAccess);
-
+
ArrayList aPropertyList = new ArrayList();
-
+
PropertyValue aActiveConnection = new PropertyValue();
aActiveConnection.Name = "ActiveConnection";
aActiveConnection.Value = aActiveConnectionObj;
aPropertyList.add(aActiveConnection);
-
+
loadAndStoreReports(xNameAccess, aPropertyList /*, _nType*/ );
createDBEntry(/*_nType*/);
}
@@ -452,12 +452,12 @@ public class ReportDesignerTest extends ComplexTestCase {
log.println("ERROR: Exception caught");
log.println("Message: " + e.getMessage());
}
-
+
// String mTestDocumentPath = (String) param.get("TestDocumentPath");
// System.out.println("mTestDocumentPath: '" + mTestDocumentPath + "'");
// // workaround for issue using deprecated "DOCPTH" prop
// System.setProperty("DOCPTH", mTestDocumentPath);
-
+
// Close the document
closeComponent(xDocComponent);
}
@@ -467,7 +467,7 @@ public class ReportDesignerTest extends ComplexTestCase {
return "AutogenReportDesignTest";
// return getFileFormat(_nType);
}
-
+
// -----------------------------------------------------------------------------
private void createDBEntry(/*int _nType*/)
{
@@ -503,7 +503,7 @@ public class ReportDesignerTest extends ComplexTestCase {
// DB.test();
// System.exit(1);
}
-
+
private void loadAndStoreReports(XNameAccess _xNameAccess, ArrayList _aPropertyList /*, int _nType*/ )
{
if (_xNameAccess != null)
@@ -540,7 +540,7 @@ public class ReportDesignerTest extends ComplexTestCase {
}
return sExtension;
}
-
+
// switch(_nType)
// {
// case WRITER:
@@ -570,7 +570,7 @@ public class ReportDesignerTest extends ComplexTestCase {
// }
// return sFileType;
// }
-
+
private String m_sOutputPath = null;
private String getOutputPath(/*int _nType*/)
@@ -588,17 +588,17 @@ public class ReportDesignerTest extends ComplexTestCase {
// sOutputPath += "tmp_123";
sOutputPath += DateHelper.getDateTimeForFilename();
sOutputPath += System.getProperty("file.separator");
-
+
// sOutputPath += getFileFormat(_nType);
// sOutputPath += System.getProperty("file.separator");
-
+
File aOutputFile = new File(sOutputPath); // create the directory of the given output path
aOutputFile.mkdirs();
m_sOutputPath = sOutputPath;
}
return m_sOutputPath;
}
-
+
/*
store given _xComponent under the given Name in DOC_COMPARATOR_INPUTPATH
*/
@@ -615,7 +615,7 @@ public class ReportDesignerTest extends ComplexTestCase {
sOutputPath += _sName;
sOutputPath += getFormatExtension(_xComponent /*_nType*/);
-
+
String sOutputURL = URLHelper.getFileURLFromSystemPath(sOutputPath);
ArrayList aPropertyList = new ArrayList(); // set some properties for storeAsURL
@@ -647,7 +647,7 @@ public class ReportDesignerTest extends ComplexTestCase {
}
}
}
-
+
private XComponent loadComponent(String _sName, Object _xComponent, ArrayList _aPropertyList)
{
XComponent xDocComponent = null;
@@ -690,5 +690,5 @@ public class ReportDesignerTest extends ComplexTestCase {
log.println("Message: " + e.getMessage());
}
}
-
+
}