Kaydet (Commit) 69309ccb authored tarafından Lars Langhans's avatar Lars Langhans

sb123:#i111449# cleanups in sot qa/complex tests

üst 7a058994
to sot : tools ucbhelper unotools NULL
to sot usr1 - all sot_mkout NULL
to sot\inc nmake - all sot_inc NULL
to sot\prj get - all sot_prj NULL
to sot\source\base nmake - all sot_base sot_inc NULL
to sot\source\sdstor nmake - all sot_sdst sot_inc NULL
to sot\source\unoolestorage nmake - all sot_unoolestor sot_inc NULL
to sot\util nmake - all sot_ut sot_base sot_sdst sot_unoolestor NULL
to sot usr1 - all sot_mkout NULL
to sot\inc nmake - all sot_inc NULL
to sot\prj get - all sot_prj NULL
to sot\source\base nmake - all sot_base sot_inc NULL
to sot\source\sdstor nmake - all sot_sdst sot_inc NULL
to sot\source\unoolestorage nmake - all sot_unoolestor sot_inc NULL
to sot\util nmake - all sot_ut sot_base sot_sdst sot_unoolestor NULL
to sot\qa\complex\olesimplestorage nmake - all sot_complex sot_ut NULL
......@@ -26,42 +26,85 @@
************************************************************************/
package complex.olesimplestorage;
import complexlib.ComplexTestCase;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openoffice.test.OfficeConnection;
import static org.junit.Assert.*;
/* Document.
*/
public class OLESimpleStorageUnitTest extends ComplexTestCase {
public class OLESimpleStorageUnitTest /* extends ComplexTestCase */
{
private XMultiServiceFactory m_xMSF = null;
public String[] getTestMethodNames() {
return new String[] {
"ExecuteTest01"};
}
public String getTestObjectName() {
return "OLESimpleStorageUnitTest";
}
// public String[] getTestMethodNames() {
// return new String[] {
// "ExecuteTest01"};
// }
//
// public String getTestObjectName() {
// return "OLESimpleStorageUnitTest";
// }
public void before () {
@Before public void before () {
System.out.println("before()");
try {
m_xMSF = (XMultiServiceFactory)param.getMSF();
m_xMSF = getMSF();
} catch ( Exception e ){
failed ( "Cannot create service factory!" );
fail( "Cannot create service factory!" );
}
if ( m_xMSF == null ) {
failed ( "Cannot create service factory!" );
fail( "Cannot create service factory!" );
}
}
public void after () {
@After public void after () {
System.out.println("after()");
m_xMSF = null;
}
public void ExecuteTest01() {
OLESimpleStorageTest aTest = new Test01( m_xMSF, log );
assure( "Test01 failed!", aTest.test() );
@Test public void ExecuteTest01() {
System.out.println("ExecuteTest01()");
OLESimpleStorageTest aTest = new Test01( m_xMSF );
assertTrue( "Test01 failed!", aTest.test() );
}
private XMultiServiceFactory getMSF()
{
final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager());
return xMSF1;
}
// setup and close connections
@BeforeClass public static void setUpConnection() throws Exception {
System.out.println("setUpConnection()");
connection.setUp();
}
@AfterClass public static void tearDownConnection()
throws InterruptedException, com.sun.star.uno.Exception
{
// try
// {
// Thread.sleep(5000);
// }
// catch (java.lang.InterruptedException e)
// {
// }
System.out.println("tearDownConnection()");
connection.tearDown();
}
private static final OfficeConnection connection = new OfficeConnection();
}
\ No newline at end of file
package complex.olesimplestorage;
import complexlib.ComplexTestCase;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.io.XInputStream;
......@@ -10,7 +10,7 @@ import com.sun.star.embed.XOLESimpleStorage;
import com.sun.star.uno.UnoRuntime;
import java.util.Random;
import share.LogWriter;
public class Test01 implements OLESimpleStorageTest
{
......@@ -19,10 +19,10 @@ public class Test01 implements OLESimpleStorageTest
final int pStreamCnt = 5;
final int pBytesCnt = 10;
public Test01 ( XMultiServiceFactory xMSF, LogWriter aLogWriter )
public Test01 ( XMultiServiceFactory xMSF )
{
m_xMSF = xMSF;
m_aTestHelper = new TestHelper (aLogWriter, "Test01: ");
m_aTestHelper = new TestHelper ("Test01: ");
}
public boolean test ()
......@@ -31,7 +31,7 @@ public class Test01 implements OLESimpleStorageTest
{
//create a new temporary stream
Object oTempFile = m_xMSF.createInstance ( "com.sun.star.io.TempFile" );
XTempFile xTempFile = (XTempFile) UnoRuntime.queryInterface ( XTempFile.class, oTempFile );
XTempFile xTempFile = UnoRuntime.queryInterface(XTempFile.class, oTempFile);
m_aTestHelper.Message ( "A new temporary stream created." );
//create OLESimpleStorage based on it
......@@ -39,7 +39,7 @@ public class Test01 implements OLESimpleStorageTest
pArgs[0] = (Object) xTempFile;
pArgs[1] = new Boolean( true );
Object oOLESimpleStorage = m_xMSF.createInstanceWithArguments ( "com.sun.star.embed.OLESimpleStorage", pArgs );
XOLESimpleStorage xOLESimpleStorage = (XOLESimpleStorage) UnoRuntime.queryInterface ( XOLESimpleStorage.class, oOLESimpleStorage );
XOLESimpleStorage xOLESimpleStorage = UnoRuntime.queryInterface(XOLESimpleStorage.class, oOLESimpleStorage);
m_aTestHelper.Message ( "OLESimpleStorage based on XStream created." );
//fill it with some streams
......@@ -53,7 +53,7 @@ public class Test01 implements OLESimpleStorageTest
{
oRandom.nextBytes (pBytesOut[i]);
oStream[i] = m_xMSF.createInstance ( "com.sun.star.io.TempFile" );
xTempStream[i] = (XTempFile) UnoRuntime.queryInterface ( XTempFile.class, oStream[i] );
xTempStream[i] = UnoRuntime.queryInterface(XTempFile.class, oStream[i]);
xTempStream[i].getOutputStream ().writeBytes (pBytesOut[i]);
xTempStream[i].seek (0);
m_aTestHelper.Message ( "Substream " + i + " initialized." );
......@@ -83,7 +83,7 @@ public class Test01 implements OLESimpleStorageTest
//open the same stream with the constructor for inputstream
pArgs[0] = (Object)xTempFile.getInputStream ();
oOLESimpleStorage = m_xMSF.createInstanceWithArguments ( "com.sun.star.embed.OLESimpleStorage", pArgs );
xOLESimpleStorage = (XOLESimpleStorage)UnoRuntime.queryInterface ( XOLESimpleStorage.class, oOLESimpleStorage );
xOLESimpleStorage = UnoRuntime.queryInterface(XOLESimpleStorage.class, oOLESimpleStorage);
m_aTestHelper.Message ( "Storage reopened, based on XInputStream." );
//check that all the streams contain correct information
......@@ -92,8 +92,7 @@ public class Test01 implements OLESimpleStorageTest
{
if ( xOLESimpleStorage.hasByName (sSubStreamPrefix + i) )
{
xTempStream[i] = (XTempFile)UnoRuntime.queryInterface (
XTempFile.class, xOLESimpleStorage.getByName (sSubStreamPrefix + i) );
xTempStream[i] = UnoRuntime.queryInterface(XTempFile.class, xOLESimpleStorage.getByName(sSubStreamPrefix + i));
xTempStream[i].seek (0);
xTempStream[i].getInputStream ().readBytes (pBytesIn[i], pBytesIn[i][0].length + 1 );
for ( int j = 0; j < pBytesCnt; ++j )
......@@ -120,6 +119,7 @@ public class Test01 implements OLESimpleStorageTest
catch ( Exception e )
{
m_aTestHelper.Error ( "Exception: " + e );
return false;
}
return true;
}
......
package complex.olesimplestorage;
import share.LogWriter;
public class TestHelper
{
LogWriter m_aLogWriter;
String m_sTestPrefix;
/** Creates a new instance of TestHelper */
public TestHelper ( LogWriter aLogWriter, String sTestPrefix )
/** Creates a new instance of TestHelper
* @param sTestPrefix
*/
public TestHelper ( String sTestPrefix )
{
m_aLogWriter = aLogWriter;
m_sTestPrefix = sTestPrefix;
}
public void Error ( String sError )
{
m_aLogWriter.println ( m_sTestPrefix + "Error: " + sError );
System.out.println ( m_sTestPrefix + "Error: " + sError );
}
public void Message ( String sMessage )
{
m_aLogWriter.println ( m_sTestPrefix + sMessage );
System.out.println ( m_sTestPrefix + sMessage );
}
}
......@@ -25,60 +25,38 @@
#
#*************************************************************************
PRJ = ..$/..$/..
TARGET = OLESimpleStorageUnitTest
PRJNAME = sot
PACKAGE = complex$/olesimplestorage
# --- Settings -----------------------------------------------------
.INCLUDE: settings.mk
#----- compile .java files -----------------------------------------
JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
JAVAFILES =\
OLESimpleStorageUnitTest.java\
OLESimpleStorageTest.java\
TestHelper.java\
Test01.java
JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
#----- make a jar from compiled files ------------------------------
.IF "$(OOO_SUBSEQUENT_TESTS)" == ""
nothing .PHONY:
.ELSE
MAXLINELENGTH = 100000
PRJ = ../../..
PRJNAME = sot
TARGET = qa_complex_olesimplestorage
JARCLASSDIRS = $(PACKAGE)
JARTARGET = $(TARGET).jar
JARCOMPRESS = TRUE
.IF "$(OOO_JUNIT_JAR)" != ""
PACKAGE = complex/olesimplestorage
JAVATESTFILES = \
OLESimpleStorageUnitTest.java
# --- Parameters for the test --------------------------------------
JAVAFILES = $(JAVATESTFILES) \
OLESimpleStorageTest.java \
Test01.java \
TestHelper.java
# start an office if the parameter is set for the makefile
.IF "$(OFFICE)" == ""
CT_APPEXECCOMMAND =
.ELSE
CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;"
.ENDIF
JARFILES = OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar
EXTRAJARFILES = $(OOO_JUNIT_JAR)
.END
# test base is java complex
CT_TESTBASE = -TestBase java_complex
.INCLUDE: settings.mk
.INCLUDE: target.mk
.INCLUDE: installationtest.mk
# test looks something like the.full.package.TestName
CT_TEST = -o $(PACKAGE:s\$/\.\).$(JAVAFILES:b)
ALLTAR : javatest
# start the runner application
CT_APP = org.openoffice.Runner
.END
# --- Targets ------------------------------------------------------
.INCLUDE: target.mk
RUN: run
run:
+java -cp $(CLASSPATH) $(CT_APP) $(CT_TESTBASE) $(CT_APPEXECCOMMAND) $(CT_TEST)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment