summaryrefslogtreecommitdiff
path: root/reportdesign/qa/complex/ReportDesignerTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'reportdesign/qa/complex/ReportDesignerTest.java')
-rwxr-xr-xreportdesign/qa/complex/ReportDesignerTest.java122
1 files changed, 61 insertions, 61 deletions
diff --git a/reportdesign/qa/complex/ReportDesignerTest.java b/reportdesign/qa/complex/ReportDesignerTest.java
index 3bbb9a42fe26..2a652fa460d9 100755
--- a/reportdesign/qa/complex/ReportDesignerTest.java
+++ b/reportdesign/qa/complex/ReportDesignerTest.java
@@ -1,7 +1,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
@@ -62,15 +62,15 @@ import convwatch.DB;
// 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;
@@ -86,7 +86,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
@@ -153,10 +153,10 @@ class PropertyHelper
}
public class ReportDesignerTest extends ComplexTestCase {
-
+
String mTestDocumentPath;
- public String[] getTestMethodNames()
+ public String[] getTestMethodNames()
{
return new String[] {"firsttest"};
}
@@ -177,7 +177,7 @@ public class ReportDesignerTest extends ComplexTestCase {
sOfficePath = _sOfficePathWithTrash.substring(0, nIndex + 7);
}
}
-
+
log.println(sOfficePath);
File sOffice = new File(sOfficePath);
if (! sOffice.exists())
@@ -186,20 +186,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());
@@ -207,7 +207,7 @@ public class ReportDesignerTest extends ComplexTestCase {
}
return m_xDesktop;
}
-
+
private void showElements(XNameAccess _xNameAccess)
{
if (_xNameAccess != null)
@@ -223,8 +223,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()
@@ -248,7 +248,7 @@ public class ReportDesignerTest extends ComplexTestCase {
m_aProvider = null;
}
}
-
+
private String m_sMailAddress = null;
private String m_sUPDMinor;
private String m_sCWS_WORK_STAMP;
@@ -256,19 +256,19 @@ public class ReportDesignerTest extends ComplexTestCase {
private static final int WRITER = 1;
private static final int CALC = 2;
- public void firsttest()
+ public void firsttest()
{
convwatch.GlobalLogWriter.set(log);
try
{
-
+
// -------------------- preconditions, try to find an office --------------------
-
+
String sAppExecutionCommand = (String) param.get("AppExecutionCommand");
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";
@@ -284,22 +284,22 @@ public class ReportDesignerTest extends ComplexTestCase {
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));
-
+
// --------------------------- Start the given Office ---------------------------
-
+
startOffice();
-
+
// ------------------------------ Start a test run ------------------------------
-
+
String sCurrentDirectory = System.getProperty("user.dir");
log.println("Current Dir: " + sCurrentDirectory);
-
+
String sWriterDocument = sCurrentDirectory + "/" + "RPTWriterTests.odb";
startTestForFile(sWriterDocument, WRITER);
@@ -311,57 +311,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 doesn't '" + _sDocument + "'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);
boolean isConnect = aDBDocUI.connect();
// if (isConnect)
@@ -373,28 +373,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);
}
@@ -402,12 +402,12 @@ public class ReportDesignerTest extends ComplexTestCase {
{
log.println("ERROR: Exception caught");
}
-
+
// 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);
}
@@ -416,7 +416,7 @@ public class ReportDesignerTest extends ComplexTestCase {
{
return getFileFormat(_nType);
}
-
+
// -----------------------------------------------------------------------------
private void createDBEntry(int _nType)
{
@@ -443,7 +443,7 @@ public class ReportDesignerTest extends ComplexTestCase {
// DB.test();
// System.exit(1);
}
-
+
private void loadAndStoreReports(XNameAccess _xNameAccess, ArrayList _aPropertyList, int _nType)
{
if (_xNameAccess != null)
@@ -492,7 +492,7 @@ public class ReportDesignerTest extends ComplexTestCase {
}
return sFileType;
}
-
+
private String getOutputPath(int _nType)
{
String sOutputPath = (String)param.get( convwatch.PropertyName.DOC_COMPARATOR_OUTPUT_PATH );
@@ -513,7 +513,7 @@ public class ReportDesignerTest extends ComplexTestCase {
return sOutputPath;
}
-
+
/*
store given _xComponent under the given Name in DOC_COMPARATOR_INPUTPATH
*/
@@ -530,7 +530,7 @@ public class ReportDesignerTest extends ComplexTestCase {
sOutputPath += _sName;
sOutputPath += getFormatExtension(_nType);
-
+
String sOutputURL = URLHelper.getFileURLFromSystemPath(sOutputPath);
ArrayList aPropertyList = new ArrayList(); // set some properties for storeAsURL
@@ -562,7 +562,7 @@ public class ReportDesignerTest extends ComplexTestCase {
}
}
}
-
+
private XComponent loadComponent(String _sName, Object _xComponent, ArrayList _aPropertyList)
{
XComponent xDocComponent = null;
@@ -604,5 +604,5 @@ public class ReportDesignerTest extends ComplexTestCase {
log.println("Message: " + e.getMessage());
}
}
-
+
}