Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
7a058994
Kaydet (Commit)
7a058994
authored
Haz 07, 2010
tarafından
Lars Langhans
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sb123:#i111449# cleanups in unotools qa/complex tests
üst
25dc0b27
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
103 deletions
+97
-103
build.lst
unotools/prj/build.lst
+2
-0
TempFileUnitTest.java
unotools/qa/complex/tempfile/TempFileUnitTest.java
+55
-27
Test01.java
unotools/qa/complex/tempfile/Test01.java
+5
-7
Test02.java
unotools/qa/complex/tempfile/Test02.java
+5
-9
TestHelper.java
unotools/qa/complex/tempfile/TestHelper.java
+9
-11
makefile.mk
unotools/qa/complex/tempfile/makefile.mk
+21
-49
No files found.
unotools/prj/build.lst
Dosyayı görüntüle @
7a058994
...
...
@@ -10,3 +10,5 @@ ut unotools\source\i18n nmake - all ut_i18n ut_inc NULL
ut unotools\source\property nmake - all ut_property ut_inc NULL
ut unotools\source\accessibility nmake - all ut_accessibility ut_inc NULL
ut unotools\util nmake - all ut_util ut_config ut_i18n ut_misc ut_procfact ut_streaming ut_ucbhelper ut_property ut_accessibility NULL
ut unotools\qa\complex\tempfile nmake - all ut_qa_complex ut_util NULL
unotools/qa/complex/tempfile/TempFileUnitTest.java
Dosyayı görüntüle @
7a058994
...
...
@@ -26,60 +26,89 @@
************************************************************************/
package
complex
.
tempfile
;
import
complexlib.ComplexTestCase
;
//
import complexlib.ComplexTestCase;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.ucb.XSimpleFileAccess
;
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
TempFileUnitTest
extends
ComplexTestCase
{
public
class
TempFileUnitTest
/* extends ComplexTestCase */
{
private
XMultiServiceFactory
m_xMSF
=
null
;
private
XSimpleFileAccess
m_xSFA
=
null
;
public
String
[]
getTestMethodNames
()
{
return
new
String
[]
{
"ExecuteTest01"
,
"ExecuteTest02"
};
}
public
String
getTestObjectName
()
{
return
"TempFileUnitTest"
;
}
//
public String[] getTestMethodNames() {
//
return new String[] {
//
"ExecuteTest01",
//
"ExecuteTest02"};
//
}
//
//
public String getTestObjectName() {
//
return "TempFileUnitTest";
//
}
public
void
before
()
{
m_xMSF
=
(
XMultiServiceFactory
)
param
.
getMSF
();
@Before
public
void
before
()
{
m_xMSF
=
getMSF
();
if
(
m_xMSF
==
null
)
{
fail
ed
(
"Cannot create service factory!"
);
fail
(
"Cannot create service factory!"
);
}
try
{
Object
oSFA
=
m_xMSF
.
createInstance
(
"com.sun.star.ucb.SimpleFileAccess"
);
m_xSFA
=
(
XSimpleFileAccess
)
UnoRuntime
.
queryInterface
(
XSimpleFileAccess
.
class
,
oSFA
);
m_xSFA
=
UnoRuntime
.
queryInterface
(
XSimpleFileAccess
.
class
,
oSFA
);
}
catch
(
Exception
e
)
{
fail
ed
(
"Cannot get simple file access! Exception: "
+
e
);
fail
(
"Cannot get simple file access! Exception: "
+
e
);
}
if
(
m_xSFA
==
null
)
{
fail
ed
(
"Cannot get simple file access!"
);
fail
(
"Cannot get simple file access!"
);
}
}
public
void
after
()
{
@After
public
void
after
()
{
m_xMSF
=
null
;
m_xSFA
=
null
;
}
public
void
ExecuteTest01
()
{
TempFileTest
aTest
=
new
Test01
(
m_xMSF
,
m_xSFA
,
log
);
assure
(
"Test01 failed!"
,
aTest
.
test
()
);
@Test
public
void
ExecuteTest01
()
{
TempFileTest
aTest
=
new
Test01
(
m_xMSF
,
m_xSFA
);
assertTrue
(
"Test01 failed!"
,
aTest
.
test
()
);
}
@Test
public
void
ExecuteTest02
()
{
TempFileTest
aTest
=
new
Test02
(
m_xMSF
,
m_xSFA
);
assertTrue
(
"Test02 failed!"
,
aTest
.
test
()
);
}
public
void
ExecuteTest02
()
{
TempFileTest
aTest
=
new
Test02
(
m_xMSF
,
m_xSFA
,
log
);
assure
(
"Test02 failed!"
,
aTest
.
test
()
);
private
XMultiServiceFactory
getMSF
()
{
final
XMultiServiceFactory
xMSF1
=
UnoRuntime
.
queryInterface
(
XMultiServiceFactory
.
class
,
connection
.
getComponentContext
().
getServiceManager
());
return
xMSF1
;
}
};
\ No newline at end of file
// 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
{
System
.
out
.
println
(
"tearDownConnection()"
);
connection
.
tearDown
();
}
private
static
final
OfficeConnection
connection
=
new
OfficeConnection
();
};
unotools/qa/complex/tempfile/Test01.java
Dosyayı görüntüle @
7a058994
...
...
@@ -26,7 +26,7 @@
************************************************************************/
package
complex
.
tempfile
;
import
complexlib.ComplexTestCase
;
//
import complexlib.ComplexTestCase;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.ucb.XSimpleFileAccess
;
...
...
@@ -42,10 +42,10 @@ public class Test01 implements TempFileTest {
XSimpleFileAccess
m_xSFA
=
null
;
TestHelper
m_aTestHelper
=
null
;
public
Test01
(
XMultiServiceFactory
xMSF
,
XSimpleFileAccess
xSFA
,
LogWriter
aLogWriter
)
{
public
Test01
(
XMultiServiceFactory
xMSF
,
XSimpleFileAccess
xSFA
)
{
m_xMSF
=
xMSF
;
m_xSFA
=
xSFA
;
m_aTestHelper
=
new
TestHelper
(
aLogWriter
,
"Test01: "
);
m_aTestHelper
=
new
TestHelper
(
"Test01: "
);
}
public
boolean
test
()
{
...
...
@@ -56,11 +56,9 @@ public class Test01 implements TempFileTest {
//create a temporary file.
try
{
Object
oTempFile
=
m_xMSF
.
createInstance
(
"com.sun.star.io.TempFile"
);
xTempFile
=
(
XTempFile
)
UnoRuntime
.
queryInterface
(
XTempFile
.
class
,
oTempFile
);
xTempFile
=
UnoRuntime
.
queryInterface
(
XTempFile
.
class
,
oTempFile
);
m_aTestHelper
.
Message
(
"Tempfile created."
);
xTruncate
=
(
XTruncate
)
UnoRuntime
.
queryInterface
(
XTruncate
.
class
,
oTempFile
);
xTruncate
=
UnoRuntime
.
queryInterface
(
XTruncate
.
class
,
oTempFile
);
}
catch
(
Exception
e
)
{
m_aTestHelper
.
Error
(
"Cannot create TempFile. exception: "
+
e
);
return
false
;
...
...
unotools/qa/complex/tempfile/Test02.java
Dosyayı görüntüle @
7a058994
...
...
@@ -26,15 +26,13 @@
************************************************************************/
package
complex
.
tempfile
;
import
complexlib.ComplexTestCase
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.ucb.XSimpleFileAccess
;
import
com.sun.star.io.*
;
import
com.sun.star.lang.XServiceInfo
;
import
com.sun.star.uno.UnoRuntime
;
import
java.util.Random
;
import
share.LogWriter
;
public
class
Test02
implements
TempFileTest
{
...
...
@@ -42,10 +40,10 @@ public class Test02 implements TempFileTest {
XSimpleFileAccess
m_xSFA
;
TestHelper
m_aTestHelper
;
public
Test02
(
XMultiServiceFactory
xMSF
,
XSimpleFileAccess
xSFA
,
LogWriter
aLogWriter
)
{
public
Test02
(
XMultiServiceFactory
xMSF
,
XSimpleFileAccess
xSFA
)
{
m_xMSF
=
xMSF
;
m_xSFA
=
xSFA
;
m_aTestHelper
=
new
TestHelper
(
aLogWriter
,
"Test02: "
);
m_aTestHelper
=
new
TestHelper
(
"Test02: "
);
}
public
boolean
test
()
{
...
...
@@ -57,11 +55,9 @@ public class Test02 implements TempFileTest {
//create a temporary file.
try
{
oTempFile
=
m_xMSF
.
createInstance
(
"com.sun.star.io.TempFile"
);
xTempFile
=
(
XTempFile
)
UnoRuntime
.
queryInterface
(
XTempFile
.
class
,
oTempFile
);
xTempFile
=
UnoRuntime
.
queryInterface
(
XTempFile
.
class
,
oTempFile
);
m_aTestHelper
.
Message
(
"Tempfile created."
);
xTruncate
=
(
XTruncate
)
UnoRuntime
.
queryInterface
(
XTruncate
.
class
,
oTempFile
);
xTruncate
=
UnoRuntime
.
queryInterface
(
XTruncate
.
class
,
oTempFile
);
}
catch
(
Exception
e
)
{
m_aTestHelper
.
Error
(
"Cannot create TempFile. exception: "
+
e
);
return
false
;
...
...
unotools/qa/complex/tempfile/TestHelper.java
Dosyayı görüntüle @
7a058994
...
...
@@ -26,22 +26,20 @@
************************************************************************/
package
complex
.
tempfile
;
import
complexlib.ComplexTestCase
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.io.*
;
import
com.sun.star.uno.AnyConverter
;
import
com.sun.star.ucb.XSimpleFileAccess
;
import
com.sun.star.uno.UnoRuntime
;
import
share.LogWriter
;
public
class
TestHelper
{
LogWriter
m_aLogWriter
;
String
m_sTestPrefix
;
public
TestHelper
(
LogWriter
aLogWriter
,
String
sTestPrefix
)
{
m_aLogWriter
=
aLogWriter
;
public
TestHelper
(
String
sTestPrefix
)
{
m_sTestPrefix
=
sTestPrefix
;
}
public
void
SetTempFileRemove
(
XTempFile
xTempFile
,
boolean
b
)
{
...
...
@@ -69,7 +67,7 @@ public class TestHelper {
}
catch
(
Exception
e
)
{
Error
(
"Cannot get TempFileURL. exception: "
+
e
);
}
if
(
sTempFileURL
==
null
||
sTempFileURL
==
""
)
{
if
(
sTempFileURL
==
null
||
sTempFileURL
.
equals
(
""
)
)
{
Error
(
"Temporary file not valid."
);
}
return
sTempFileURL
;
...
...
@@ -82,7 +80,7 @@ public class TestHelper {
}
catch
(
Exception
e
)
{
Error
(
"Cannot get TempFileName. exception: "
+
e
);
}
if
(
sTempFileName
==
null
||
sTempFileName
==
""
)
{
if
(
sTempFileName
==
null
||
sTempFileName
.
equals
(
""
)
)
{
Error
(
"Temporary file not valid."
);
}
return
sTempFileName
;
...
...
@@ -216,10 +214,10 @@ public class TestHelper {
}
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
);
}
}
unotools/qa/complex/tempfile/makefile.mk
Dosyayı görüntüle @
7a058994
...
...
@@ -25,61 +25,33 @@
#
#*************************************************************************
PRJ
=
..
$/
..
$/
..
TARGET
=
TempFileUnitTest
PRJNAME
=
unotools
PACKAGE
=
complex
$/
tempfile
# --- Settings -----------------------------------------------------
.INCLUDE
:
settings.mk
#----- compile .java files -----------------------------------------
JARFILES
=
ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
JAVAFILES
=
\
TempFileUnitTest.java
\
TempFileTest.java
\
TestHelper.java
\
Test01.java
\
Test02.java
JAVACLASSFILES
=
$
(
foreach,i,
$(JAVAFILES)
$(CLASSDIR)$/$(PACKAGE)$/
$
(
i:b
)
.class
)
#----- make a jar from compiled files ------------------------------
MAXLINELENGTH
=
100000
JARCLASSDIRS
=
$(PACKAGE)
JARTARGET
=
$(TARGET)
.jar
JARCOMPRESS
=
TRUE
# --- Parameters for the test --------------------------------------
# start an office if the parameter is set for the makefile
.IF
"$(OFFICE)"
==
""
CT_APPEXECCOMMAND
=
.IF
"$(OOO_SUBSEQUENT_TESTS)"
==
""
nothing .PHONY
:
.ELSE
CT_APPEXECCOMMAND
=
-AppExecutionCommand
"
$(OFFICE)$/
soffice -accept=socket,host=localhost,port=8100;urp;"
.ENDIF
# test base is java complex
CT_TESTBASE
=
-TestBase
java_complex
PRJ
=
../../..
PRJNAME
=
unotools
TARGET
=
qa_complex_tempfile
# test looks something like the.full.package.TestName
CT_TEST
=
-o
$
(
PACKAGE:s
\$
/
\.\)
.
$
(
JAVAFILES:b
)
.IF
"$(OOO_JUNIT_JAR)"
!=
""
PACKAGE
=
complex/tempfile
JAVATESTFILES
=
\
TempFileUnitTest.java
# start the runner application
CT_APP
=
org.openoffice.Runner
JAVAFILES
=
$(JAVATESTFILES)
\
TempFileTest.java
\
Test01.java
\
Test02.java
\
TestHelper.java
# --- Targets ------------------------------------------------------
JARFILES
=
OOoRunner.jar ridl.jar test.jar unoil.jar jurt.jar
EXTRAJARFILES
=
$(OOO_JUNIT_JAR)
.END
.INCLUDE
:
settings.mk
.INCLUDE
:
target.mk
.INCLUDE
:
installationtest.mk
RUN
:
run
run
:
+java
-cp
$(CLASSPATH)
$(CT_APP)
$(CT_TESTBASE)
$(CT_APPEXECCOMMAND)
$(CT_TEST)
ALLTAR
:
javatest
.END
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment