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
5bb51521
Kaydet (Commit)
5bb51521
authored
Şub 17, 2012
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make jurt JunitTests work
üst
28137a51
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
271 additions
and
275 deletions
+271
-275
JunitTest_bridgefactory.mk
jurt/JunitTest_bridgefactory.mk
+6
-1
JunitTest_connections.mk
jurt/JunitTest_connections.mk
+6
-1
JunitTest_java.mk
jurt/JunitTest_java.mk
+6
-1
JunitTest_java_remote.mk
jurt/JunitTest_java_remote.mk
+9
-1
JunitTest_remote.mk
jurt/JunitTest_remote.mk
+9
-1
JunitTest_uno.mk
jurt/JunitTest_uno.mk
+8
-0
JunitTest_urp.mk
jurt/JunitTest_urp.mk
+8
-1
JunitTest_util.mk
jurt/JunitTest_util.mk
+6
-1
Module_jurt.mk
jurt/Module_jurt.mk
+8
-3
BridgeFactory.java
jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
+5
-2
BridgeFactory_Test.java
...t/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java
+13
-20
PipedConnection_Test.java
...t/com/sun/star/comp/connections/PipedConnection_Test.java
+6
-12
BridgedObject_Test.java
.../star/lib/uno/bridges/java_remote/BridgedObject_Test.java
+7
-10
ProxyFactory_Test.java
...n/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java
+10
-18
java_remote_bridge_Test.java
.../lib/uno/bridges/java_remote/java_remote_bridge_Test.java
+28
-34
java_environment_Test.java
...star/lib/uno/environments/java/java_environment_Test.java
+14
-19
JavaThreadPoolFactory_Test.java
...b/uno/environments/remote/JavaThreadPoolFactory_Test.java
+6
-9
JobQueue_Test.java
...m/sun/star/lib/uno/environments/remote/JobQueue_Test.java
+36
-37
ThreadId_Test.java
...m/sun/star/lib/uno/environments/remote/ThreadId_Test.java
+24
-24
ThreadPool_Test.java
...sun/star/lib/uno/environments/remote/ThreadPool_Test.java
+25
-34
NativeLibraryLoader_Test.java
.../test/com/sun/star/lib/util/NativeLibraryLoader_Test.java
+7
-10
AnyConverter_Test.java
jurt/test/com/sun/star/uno/AnyConverter_Test.java
+0
-0
UnoRuntime_EnvironmentTest.java
jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest.java
+16
-21
WeakReference_Test.java
jurt/test/com/sun/star/uno/WeakReference_Test.java
+8
-15
No files found.
jurt/JunitTest_bridgefactory.mk
Dosyayı görüntüle @
5bb51521
...
@@ -28,12 +28,17 @@
...
@@ -28,12 +28,17 @@
$(eval $(call gb_JunitTest_JunitTest,jurt_bridgefactory))
$(eval $(call gb_JunitTest_JunitTest,jurt_bridgefactory))
$(eval $(call gb_JunitTest_add_jars,jurt_bridgefactory,\
$(eval $(call gb_JunitTest_add_jars,jurt_bridgefactory,\
$(OUTDIR)/bin/OOoRunnerLight.jar \
$(OUTDIR)/bin/ridl.jar \
$(OUTDIR)/bin/ridl.jar \
))
))
$(eval $(call gb_JunitTest_add_jar_classset,jurt_bridgefactory,jurt))
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_bridgefactory,\
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_bridgefactory,\
jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test \
jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test \
))
))
$(eval $(call gb_JunitTest_add_classes,jurt_bridgefactory,\
com.sun.star.comp.bridgefactory.BridgeFactory_Test \
))
# vim:set shiftwidth=4 softtabstop=4 expandtab:
# vim:set shiftwidth=4 softtabstop=4 expandtab:
jurt/JunitTest_connections.mk
Dosyayı görüntüle @
5bb51521
...
@@ -28,12 +28,17 @@
...
@@ -28,12 +28,17 @@
$(eval $(call gb_JunitTest_JunitTest,jurt_connections))
$(eval $(call gb_JunitTest_JunitTest,jurt_connections))
$(eval $(call gb_JunitTest_add_jars,jurt_connections,\
$(eval $(call gb_JunitTest_add_jars,jurt_connections,\
$(OUTDIR)/bin/OOoRunnerLight.jar \
$(OUTDIR)/bin/ridl.jar \
$(OUTDIR)/bin/ridl.jar \
))
))
$(eval $(call gb_JunitTest_add_jar_classset,jurt_connections,jurt))
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_connections,\
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_connections,\
jurt/test/com/sun/star/comp/connections/PipedConnection_Test \
jurt/test/com/sun/star/comp/connections/PipedConnection_Test \
))
))
$(eval $(call gb_JunitTest_add_classes,jurt_connections,\
com.sun.star.comp.connections.PipedConnection_Test \
))
# vim:set shiftwidth=4 softtabstop=4 expandtab:
# vim:set shiftwidth=4 softtabstop=4 expandtab:
jurt/JunitTest_java.mk
Dosyayı görüntüle @
5bb51521
...
@@ -28,12 +28,17 @@
...
@@ -28,12 +28,17 @@
$(eval $(call gb_JunitTest_JunitTest,jurt_java))
$(eval $(call gb_JunitTest_JunitTest,jurt_java))
$(eval $(call gb_JunitTest_add_jars,jurt_java,\
$(eval $(call gb_JunitTest_add_jars,jurt_java,\
$(OUTDIR)/bin/OOoRunnerLight.jar \
$(OUTDIR)/bin/ridl.jar \
$(OUTDIR)/bin/ridl.jar \
))
))
$(eval $(call gb_JunitTest_add_jar_classset,jurt_java,jurt))
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_java,\
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_java,\
jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test \
jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test \
))
))
$(eval $(call gb_JunitTest_add_classes,jurt_java,\
com.sun.star.lib.uno.environments.java.java_environment_Test \
))
# vim:set shiftwidth=4 softtabstop=4 expandtab:
# vim:set shiftwidth=4 softtabstop=4 expandtab:
jurt/JunitTest_java_remote.mk
Dosyayı görüntüle @
5bb51521
...
@@ -28,14 +28,22 @@
...
@@ -28,14 +28,22 @@
$(eval $(call gb_JunitTest_JunitTest,jurt_java_remote))
$(eval $(call gb_JunitTest_JunitTest,jurt_java_remote))
$(eval $(call gb_JunitTest_add_jars,jurt_java_remote,\
$(eval $(call gb_JunitTest_add_jars,jurt_java_remote,\
$(OUTDIR)/bin/OOoRunnerLight.jar \
$(OUTDIR)/bin/OOoRunnerLight.jar \
$(OUTDIR)/bin/ridl.jar \
$(OUTDIR)/bin/ridl.jar \
))
))
$(eval $(call gb_JunitTest_add_jar_classset,jurt_java_remote,jurt))
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_java_remote,\
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_java_remote,\
jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test \
jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test \
jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test \
jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test \
jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test \
jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test \
))
))
$(eval $(call gb_JunitTest_add_classes,jurt_java_remote,\
com.sun.star.lib.uno.bridges.java_remote.BridgedObject_Test \
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory_Test \
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge_Test \
))
# vim:set shiftwidth=4 softtabstop=4 expandtab:
# vim:set shiftwidth=4 softtabstop=4 expandtab:
jurt/JunitTest_remote.mk
Dosyayı görüntüle @
5bb51521
...
@@ -28,10 +28,11 @@
...
@@ -28,10 +28,11 @@
$(eval $(call gb_JunitTest_JunitTest,jurt_remote))
$(eval $(call gb_JunitTest_JunitTest,jurt_remote))
$(eval $(call gb_JunitTest_add_jars,jurt_remote,\
$(eval $(call gb_JunitTest_add_jars,jurt_remote,\
$(OUTDIR)/bin/OOoRunnerLight.jar \
$(OUTDIR)/bin/ridl.jar \
$(OUTDIR)/bin/ridl.jar \
))
))
$(eval $(call gb_JunitTest_add_jar_classset,jurt_remote,jurt))
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_remote,\
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_remote,\
jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test \
jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test \
jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test \
jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test \
...
@@ -42,4 +43,11 @@ $(eval $(call gb_JunitTest_add_sourcefiles,jurt_remote,\
...
@@ -42,4 +43,11 @@ $(eval $(call gb_JunitTest_add_sourcefiles,jurt_remote,\
jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test \
jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test \
))
))
$(eval $(call gb_JunitTest_add_classes,jurt_remote,\
com.sun.star.lib.uno.environments.remote.JavaThreadPoolFactory_Test \
com.sun.star.lib.uno.environments.remote.JobQueue_Test \
com.sun.star.lib.uno.environments.remote.ThreadId_Test \
com.sun.star.lib.uno.environments.remote.ThreadPool_Test \
))
# vim:set shiftwidth=4 softtabstop=4 expandtab:
# vim:set shiftwidth=4 softtabstop=4 expandtab:
jurt/JunitTest_uno.mk
Dosyayı görüntüle @
5bb51521
...
@@ -32,10 +32,18 @@ $(eval $(call gb_JunitTest_add_jars,jurt_uno,\
...
@@ -32,10 +32,18 @@ $(eval $(call gb_JunitTest_add_jars,jurt_uno,\
$(OUTDIR)/bin/ridl.jar \
$(OUTDIR)/bin/ridl.jar \
))
))
$(eval $(call gb_JunitTest_add_jar_classset,jurt_uno,jurt))
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_uno,\
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_uno,\
jurt/test/com/sun/star/uno/AnyConverter_Test \
jurt/test/com/sun/star/uno/AnyConverter_Test \
jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest \
jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest \
jurt/test/com/sun/star/uno/WeakReference_Test \
jurt/test/com/sun/star/uno/WeakReference_Test \
))
))
$(eval $(call gb_JunitTest_add_classes,jurt_uno,\
com.sun.star.uno.AnyConverter_Test \
com.sun.star.uno.UnoRuntime_EnvironmentTest \
com.sun.star.uno.WeakReference_Test \
))
# vim:set shiftwidth=4 softtabstop=4 expandtab:
# vim:set shiftwidth=4 softtabstop=4 expandtab:
jurt/JunitTest_urp.mk
Dosyayı görüntüle @
5bb51521
...
@@ -32,11 +32,12 @@ $(eval $(call gb_JunitTest_add_package_dependencies,jurt_urp,\
...
@@ -32,11 +32,12 @@ $(eval $(call gb_JunitTest_add_package_dependencies,jurt_urp,\
))
))
$(eval $(call gb_JunitTest_add_jars,jurt_urp,\
$(eval $(call gb_JunitTest_add_jars,jurt_urp,\
$(OUTDIR)/bin/OOoRunnerLight.jar \
$(OUTDIR)/bin/ridl.jar \
$(OUTDIR)/bin/ridl.jar \
$(WORKDIR)/CustomTarget/jurt/test/com/sun/star/lib/uno/protocols/urp \
$(WORKDIR)/CustomTarget/jurt/test/com/sun/star/lib/uno/protocols/urp \
))
))
$(eval $(call gb_JunitTest_add_jar_classset,jurt_urp,jurt))
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_urp,\
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_urp,\
jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test \
jurt/test/com/sun/star/lib/uno/protocols/urp/Cache_Test \
jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test \
jurt/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test \
...
@@ -45,4 +46,10 @@ $(eval $(call gb_JunitTest_add_sourcefiles,jurt_urp,\
...
@@ -45,4 +46,10 @@ $(eval $(call gb_JunitTest_add_sourcefiles,jurt_urp,\
jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject \
jurt/test/com/sun/star/lib/uno/protocols/urp/TestObject \
))
))
$(eval $(call gb_JunitTest_add_classes,jurt_urp,\
com.sun.star.lib.uno.protocols.urp.Cache_Test \
com.sun.star.lib.uno.protocols.urp.Marshaling_Test \
com.sun.star.lib.uno.protocols.urp.Protocol_Test \
))
# vim:set shiftwidth=4 softtabstop=4 expandtab:
# vim:set shiftwidth=4 softtabstop=4 expandtab:
jurt/JunitTest_util.mk
Dosyayı görüntüle @
5bb51521
...
@@ -28,12 +28,17 @@
...
@@ -28,12 +28,17 @@
$(eval $(call gb_JunitTest_JunitTest,jurt_util))
$(eval $(call gb_JunitTest_JunitTest,jurt_util))
$(eval $(call gb_JunitTest_add_jars,jurt_util,\
$(eval $(call gb_JunitTest_add_jars,jurt_util,\
$(OUTDIR)/bin/OOoRunnerLight.jar \
$(OUTDIR)/bin/ridl.jar \
$(OUTDIR)/bin/ridl.jar \
))
))
$(eval $(call gb_JunitTest_add_jar_classset,jurt_util,jurt))
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_util,\
$(eval $(call gb_JunitTest_add_sourcefiles,jurt_util,\
jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test \
jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test \
))
))
$(eval $(call gb_JunitTest_add_classes,jurt_util,\
com.sun.star.lib.util.NativeLibraryLoader_Test \
))
# vim:set shiftwidth=4 softtabstop=4 expandtab:
# vim:set shiftwidth=4 softtabstop=4 expandtab:
jurt/Module_jurt.mk
Dosyayı görüntüle @
5bb51521
...
@@ -47,18 +47,23 @@ $(eval $(call gb_Module_add_targets,jurt,\
...
@@ -47,18 +47,23 @@ $(eval $(call gb_Module_add_targets,jurt,\
))
))
endif
endif
$(eval $(call gb_Module_add_
subsequent
check_targets,jurt,\
$(eval $(call gb_Module_add_check_targets,jurt,\
JunitTest_bridgefactory \
JunitTest_bridgefactory \
JunitTest_connections \
JunitTest_connections \
JunitTest_java \
JunitTest_java \
JunitTest_java_remote \
JunitTest_remote \
JunitTest_remote \
JunitTest_uno \
JunitTest_urp \
JunitTest_urp \
JunitTest_util \
JunitTest_util \
Package_test_urp \
Package_test_urp \
))
))
#TOOD: The following depend on OOoRunnerLight.jar from qadevOOo (but only for
# WaitUnreachable, which should be moved elsewhere):
$(eval $(call gb_Module_add_subsequentcheck_targets,jurt,\
JunitTest_java_remote \
JunitTest_uno \
))
endif
endif
# vim:set shiftwidth=4 softtabstop=4 expandtab:
# vim:set shiftwidth=4 softtabstop=4 expandtab:
jurt/com/sun/star/comp/bridgefactory/BridgeFactory.java
Dosyayı görüntüle @
5bb51521
...
@@ -135,8 +135,11 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ {
...
@@ -135,8 +135,11 @@ public class BridgeFactory implements XBridgeFactory/*, XEventListener*/ {
xBridge
=
UnoRuntime
.
queryInterface
(
XBridge
.
class
,
iBridge
);
xBridge
=
UnoRuntime
.
queryInterface
(
XBridge
.
class
,
iBridge
);
}
}
catch
(
Exception
exception
)
{
catch
(
Exception
e
)
{
throw
new
com
.
sun
.
star
.
lang
.
IllegalArgumentException
(
exception
.
getMessage
());
com
.
sun
.
star
.
lang
.
IllegalArgumentException
e2
=
new
com
.
sun
.
star
.
lang
.
IllegalArgumentException
(
e
.
getMessage
());
e2
.
initCause
(
e
);
throw
e2
;
}
}
if
(
DEBUG
)
System
.
err
.
println
(
"##### "
+
getClass
().
getName
()
+
".createBridge:"
+
sName
+
" "
+
sProtocol
+
" "
+
aConnection
+
" "
+
anInstanceProvider
+
" "
+
xBridge
);
if
(
DEBUG
)
System
.
err
.
println
(
"##### "
+
getClass
().
getName
()
+
".createBridge:"
+
sName
+
" "
+
sProtocol
+
" "
+
aConnection
+
" "
+
anInstanceProvider
+
" "
+
xBridge
);
...
...
jurt/test/com/sun/star/comp/bridgefactory/BridgeFactory_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -33,18 +33,11 @@ import com.sun.star.comp.connections.PipedConnection;
...
@@ -33,18 +33,11 @@ import com.sun.star.comp.connections.PipedConnection;
import
com.sun.star.connection.XConnection
;
import
com.sun.star.connection.XConnection
;
import
com.sun.star.lang.XComponent
;
import
com.sun.star.lang.XComponent
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.UnoRuntime
;
import
complexlib.ComplexTestCase
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
BridgeFactory_Test
extends
ComplexTestCase
{
public
final
class
BridgeFactory_Test
{
public
String
getTestObjectName
()
{
@Test
public
void
test
()
throws
Exception
{
return
getClass
().
getName
();
}
public
String
[]
getTestMethodNames
()
{
return
new
String
[]
{
"test"
};
}
public
void
test
()
throws
Exception
{
PipedConnection
rightSide
=
new
PipedConnection
(
new
Object
[
0
]);
PipedConnection
rightSide
=
new
PipedConnection
(
new
Object
[
0
]);
PipedConnection
leftSide
=
new
PipedConnection
(
new
Object
[]{
rightSide
});
PipedConnection
leftSide
=
new
PipedConnection
(
new
Object
[]{
rightSide
});
...
@@ -54,14 +47,15 @@ public final class BridgeFactory_Test extends ComplexTestCase {
...
@@ -54,14 +47,15 @@ public final class BridgeFactory_Test extends ComplexTestCase {
XBridge
xBridge
=
bridgeFactory
.
createBridge
(
"testbridge"
,
"urp"
,
(
XConnection
)
leftSide
,
null
);
XBridge
xBridge
=
bridgeFactory
.
createBridge
(
"testbridge"
,
"urp"
,
(
XConnection
)
leftSide
,
null
);
// test that we get the same bridge
// test that we get the same bridge
assure
(
""
,
UnoRuntime
.
areSame
(
xBridge
,
assertTrue
(
bridgeFactory
.
getBridge
(
"testbridge"
)));
UnoRuntime
.
areSame
(
xBridge
,
bridgeFactory
.
getBridge
(
"testbridge"
)));
// test that we can not create another bridge with same name
// test that we can not create another bridge with same name
try
{
try
{
XBridge
dummy
=
bridgeFactory
.
createBridge
(
"testbridge"
,
"urp"
,
(
XConnection
)
leftSide
,
null
);
XBridge
dummy
=
bridgeFactory
.
createBridge
(
"testbridge"
,
"urp"
,
(
XConnection
)
leftSide
,
null
);
fail
ed
(
""
);
fail
(
);
}
}
catch
(
BridgeExistsException
bridgeExistsException
)
{
catch
(
BridgeExistsException
bridgeExistsException
)
{
}
}
...
@@ -69,7 +63,7 @@ public final class BridgeFactory_Test extends ComplexTestCase {
...
@@ -69,7 +63,7 @@ public final class BridgeFactory_Test extends ComplexTestCase {
// test getExistingBridges
// test getExistingBridges
XBridge
xBridges
[]
=
bridgeFactory
.
getExistingBridges
();
XBridge
xBridges
[]
=
bridgeFactory
.
getExistingBridges
();
ass
ure
(
""
,
UnoRuntime
.
areSame
(
xBridge
,
xBridges
[
0
]));
ass
ertTrue
(
UnoRuntime
.
areSame
(
xBridge
,
xBridges
[
0
]));
// dispose the bridge
// dispose the bridge
XComponent
xComponent
=
UnoRuntime
.
queryInterface
(
XComponent
.
class
,
xBridge
);
XComponent
xComponent
=
UnoRuntime
.
queryInterface
(
XComponent
.
class
,
xBridge
);
...
@@ -77,7 +71,7 @@ public final class BridgeFactory_Test extends ComplexTestCase {
...
@@ -77,7 +71,7 @@ public final class BridgeFactory_Test extends ComplexTestCase {
// test that the bridge has been removed
// test that the bridge has been removed
ass
ure
(
""
,
bridgeFactory
.
getBridge
(
"testbridge"
)
==
null
);
ass
ertTrue
(
bridgeFactory
.
getBridge
(
"testbridge"
)
==
null
);
...
@@ -87,7 +81,7 @@ public final class BridgeFactory_Test extends ComplexTestCase {
...
@@ -87,7 +81,7 @@ public final class BridgeFactory_Test extends ComplexTestCase {
// test that we really get a new bridge
// test that we really get a new bridge
XBridge
xBridge_new
=
bridgeFactory
.
createBridge
(
"testbridge"
,
"urp"
,
(
XConnection
)
leftSide
,
null
);
XBridge
xBridge_new
=
bridgeFactory
.
createBridge
(
"testbridge"
,
"urp"
,
(
XConnection
)
leftSide
,
null
);
ass
ure
(
""
,
!
UnoRuntime
.
areSame
(
xBridge
,
xBridge_new
));
ass
ertFalse
(
UnoRuntime
.
areSame
(
xBridge
,
xBridge_new
));
for
(
int
i
=
0
;
i
<
10000
;
++
i
)
{
for
(
int
i
=
0
;
i
<
10000
;
++
i
)
{
Object
x
[]
=
new
Object
[
100
];
Object
x
[]
=
new
Object
[
100
];
...
@@ -95,9 +89,8 @@ public final class BridgeFactory_Test extends ComplexTestCase {
...
@@ -95,9 +89,8 @@ public final class BridgeFactory_Test extends ComplexTestCase {
// test getExistingBridges
// test getExistingBridges
xBridges
=
bridgeFactory
.
getExistingBridges
();
xBridges
=
bridgeFactory
.
getExistingBridges
();
assure
(
""
,
assertEquals
(
1
,
xBridges
.
length
);
xBridges
.
length
==
1
assertTrue
(
UnoRuntime
.
areSame
(
xBridge_new
,
xBridges
[
0
]));
&&
UnoRuntime
.
areSame
(
xBridge_new
,
xBridges
[
0
]));
// dispose the new bridge
// dispose the new bridge
XComponent
xComponent_new
=
UnoRuntime
.
queryInterface
(
XComponent
.
class
,
xBridge_new
);
XComponent
xComponent_new
=
UnoRuntime
.
queryInterface
(
XComponent
.
class
,
xBridge_new
);
...
...
jurt/test/com/sun/star/comp/connections/PipedConnection_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -27,18 +27,11 @@
...
@@ -27,18 +27,11 @@
package
com
.
sun
.
star
.
comp
.
connections
;
package
com
.
sun
.
star
.
comp
.
connections
;
import
complexlib.ComplexTestCase
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
PipedConnection_Test
extends
ComplexTestCase
{
public
final
class
PipedConnection_Test
{
public
String
getTestObjectName
()
{
@Test
public
void
test
()
throws
Exception
{
return
getClass
().
getName
();
}
public
String
[]
getTestMethodNames
()
{
return
new
String
[]
{
"test"
};
}
public
void
test
()
throws
Exception
{
PipedConnection
rightSide
=
new
PipedConnection
(
new
Object
[
0
]);
PipedConnection
rightSide
=
new
PipedConnection
(
new
Object
[
0
]);
PipedConnection
leftSide
=
new
PipedConnection
(
new
Object
[]{
rightSide
});
PipedConnection
leftSide
=
new
PipedConnection
(
new
Object
[]{
rightSide
});
...
@@ -57,7 +50,8 @@ public final class PipedConnection_Test extends ComplexTestCase {
...
@@ -57,7 +50,8 @@ public final class PipedConnection_Test extends ComplexTestCase {
reader
.
join
();
reader
.
join
();
assure
(
""
,
writer
.
_state
&&
reader
.
_state
);
assertTrue
(
writer
.
_state
);
assertTrue
(
reader
.
_state
);
}
}
static
class
Reader
extends
Thread
{
static
class
Reader
extends
Thread
{
...
...
jurt/test/com/sun/star/lib/uno/bridges/java_remote/BridgedObject_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -30,14 +30,11 @@ package com.sun.star.lib.uno.bridges.java_remote;
...
@@ -30,14 +30,11 @@ package com.sun.star.lib.uno.bridges.java_remote;
import
com.sun.star.bridge.XBridge
;
import
com.sun.star.bridge.XBridge
;
import
com.sun.star.uno.Type
;
import
com.sun.star.uno.Type
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.uno.XInterface
;
import
complexlib.ComplexTestCase
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
BridgedObject_Test
extends
ComplexTestCase
{
public
final
class
BridgedObject_Test
{
public
String
[]
getTestMethodNames
()
{
@Test
public
void
test
()
{
return
new
String
[]
{
"test"
};
}
public
void
test
()
{
RequestHandler
handler
=
new
RequestHandler
()
{
RequestHandler
handler
=
new
RequestHandler
()
{
public
Object
sendRequest
(
public
Object
sendRequest
(
String
oid
,
Type
type
,
String
operation
,
Object
[]
args
)
String
oid
,
Type
type
,
String
operation
,
Object
[]
args
)
...
@@ -52,9 +49,9 @@ public final class BridgedObject_Test extends ComplexTestCase {
...
@@ -52,9 +49,9 @@ public final class BridgedObject_Test extends ComplexTestCase {
Object
object0
=
new
Object
();
Object
object0
=
new
Object
();
Object
object1
=
factory1
.
create
(
""
,
new
Type
(
XInterface
.
class
));
Object
object1
=
factory1
.
create
(
""
,
new
Type
(
XInterface
.
class
));
Object
object2
=
factory2
.
create
(
""
,
new
Type
(
XInterface
.
class
));
Object
object2
=
factory2
.
create
(
""
,
new
Type
(
XInterface
.
class
));
ass
ure
(
BridgedObject
.
getBridge
(
object0
)
==
null
);
ass
ertNull
(
BridgedObject
.
getBridge
(
object0
)
);
ass
ure
(
BridgedObject
.
getBridge
(
object1
)
==
bridge1
);
ass
ertSame
(
bridge1
,
BridgedObject
.
getBridge
(
object1
)
);
ass
ure
(
BridgedObject
.
getBridge
(
object2
)
==
bridge2
);
ass
ertSame
(
bridge2
,
BridgedObject
.
getBridge
(
object2
)
);
}
}
private
static
final
class
TestBridge
implements
XBridge
{
private
static
final
class
TestBridge
implements
XBridge
{
...
...
jurt/test/com/sun/star/lib/uno/bridges/java_remote/ProxyFactory_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -33,29 +33,22 @@ import com.sun.star.uno.Type;
...
@@ -33,29 +33,22 @@ import com.sun.star.uno.Type;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.uno.XNamingService
;
import
com.sun.star.uno.XNamingService
;
import
complexlib.ComplexTestCase
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.Method
;
import
java.lang.reflect.UndeclaredThrowableException
;
import
java.lang.reflect.UndeclaredThrowableException
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
ProxyFactory_Test
extends
ComplexTestCase
{
public
final
class
ProxyFactory_Test
{
public
String
getTestObjectName
()
{
@Test
public
void
testQueryInterface
()
{
return
getClass
().
getName
();
}
public
String
[]
getTestMethodNames
()
{
return
new
String
[]
{
"testQueryInterface"
,
"testExceptionHandling"
};
}
public
void
testQueryInterface
()
{
TestRequestHandler
handler
=
new
TestRequestHandler
();
TestRequestHandler
handler
=
new
TestRequestHandler
();
Type
type
=
new
Type
(
XNamingService
.
class
);
Type
type
=
new
Type
(
XNamingService
.
class
);
Object
proxy
=
new
ProxyFactory
(
handler
,
null
).
create
(
"TestOID"
,
type
);
Object
proxy
=
new
ProxyFactory
(
handler
,
null
).
create
(
"TestOID"
,
type
);
ass
ure
(
""
,
proxy
==
((
IQueryInterface
)
proxy
).
queryInterface
(
type
));
ass
ertSame
(
proxy
,
((
IQueryInterface
)
proxy
).
queryInterface
(
type
));
ass
ure
(
""
,
proxy
==
UnoRuntime
.
queryInterface
(
type
,
proxy
));
ass
ertSame
(
proxy
,
UnoRuntime
.
queryInterface
(
type
,
proxy
));
}
}
public
void
testExceptionHandling
()
throws
Exception
{
@Test
public
void
testExceptionHandling
()
throws
Exception
{
TestRequestHandler
handler
=
new
TestRequestHandler
();
TestRequestHandler
handler
=
new
TestRequestHandler
();
Object
proxy
=
new
ProxyFactory
(
handler
,
null
).
create
(
Object
proxy
=
new
ProxyFactory
(
handler
,
null
).
create
(
"TestOID"
,
new
Type
(
XNamingService
.
class
));
"TestOID"
,
new
Type
(
XNamingService
.
class
));
...
@@ -94,11 +87,10 @@ public final class ProxyFactory_Test extends ComplexTestCase {
...
@@ -94,11 +87,10 @@ public final class ProxyFactory_Test extends ComplexTestCase {
Class
exception
)
throws
Exception
{
Class
exception
)
throws
Exception
{
try
{
try
{
method
.
invoke
(
obj
,
args
);
method
.
invoke
(
obj
,
args
);
ass
ure
(
"expected exception: "
+
exception
,
exception
==
null
);
ass
ertNull
(
exception
);
}
catch
(
InvocationTargetException
e
)
{
}
catch
(
InvocationTargetException
e
)
{
assure
(
"unexpected exception: "
+
e
.
getTargetException
(),
assertNotNull
(
exception
);
exception
!=
null
assertTrue
(
exception
.
isInstance
(
e
.
getTargetException
()));
&&
exception
.
isInstance
(
e
.
getTargetException
()));
// TODO check stack trace
// TODO check stack trace
}
}
}
}
...
...
jurt/test/com/sun/star/lib/uno/bridges/java_remote/java_remote_bridge_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -38,19 +38,12 @@ import com.sun.star.uno.IQueryInterface;
...
@@ -38,19 +38,12 @@ import com.sun.star.uno.IQueryInterface;
import
com.sun.star.uno.Type
;
import
com.sun.star.uno.Type
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.uno.XInterface
;
import
complexlib.ComplexTestCase
;
import
org.junit.Test
;
import
util.WaitUnreachable
;
import
util.WaitUnreachable
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
java_remote_bridge_Test
extends
ComplexTestCase
{
public
final
class
java_remote_bridge_Test
{
public
String
getTestObjectName
()
{
@Test
public
void
test
()
throws
Exception
{
return
getClass
().
getName
();
}
public
String
[]
getTestMethodNames
()
{
return
new
String
[]
{
"test"
};
}
public
void
test
()
throws
Exception
{
String
protocol
=
"urp"
;
String
protocol
=
"urp"
;
XConnection
connectionA
=
new
PipedConnection
(
new
Object
[
0
]);
XConnection
connectionA
=
new
PipedConnection
(
new
Object
[
0
]);
...
@@ -68,35 +61,34 @@ public final class java_remote_bridge_Test extends ComplexTestCase {
...
@@ -68,35 +61,34 @@ public final class java_remote_bridge_Test extends ComplexTestCase {
}
}
private
void
testGetInstance
(
XBridge
bridgeA
,
XBridge
bridgeB
)
{
private
void
testGetInstance
(
XBridge
bridgeA
,
XBridge
bridgeB
)
{
assure
(
"return null"
,
assertNull
(
bridgeB
.
getInstance
(
TestInstanceProvider
.
NAME_NULL
));
bridgeB
.
getInstance
(
TestInstanceProvider
.
NAME_NULL
)
==
null
);
try
{
try
{
bridgeB
.
getInstance
(
TestInstanceProvider
.
NAME_RUNTIME_EXCEPTION
);
bridgeB
.
getInstance
(
TestInstanceProvider
.
NAME_RUNTIME_EXCEPTION
);
fail
ed
(
"throw RuntimeException"
);
fail
(
"throw RuntimeException"
);
}
catch
(
com
.
sun
.
star
.
uno
.
RuntimeException
e
)
{
}
catch
(
com
.
sun
.
star
.
uno
.
RuntimeException
e
)
{
assure
(
"throw RuntimeException"
,
assertTrue
(
e
.
getMessage
().
indexOf
(
e
.
getMessage
().
indexOf
(
TestInstanceProvider
.
NAME_RUNTIME_EXCEPTION
)
!=
-
1
);
TestInstanceProvider
.
NAME_RUNTIME_EXCEPTION
)
!=
-
1
);
}
}
try
{
try
{
bridgeB
.
getInstance
(
bridgeB
.
getInstance
(
TestInstanceProvider
.
NAME_NO_SUCH_ELEMENT_EXCEPTION
);
TestInstanceProvider
.
NAME_NO_SUCH_ELEMENT_EXCEPTION
);
fail
ed
(
"throw NoSuchElementException"
);
fail
(
"throw NoSuchElementException"
);
}
catch
(
com
.
sun
.
star
.
uno
.
RuntimeException
e
)
{
}
catch
(
com
.
sun
.
star
.
uno
.
RuntimeException
e
)
{
ass
ure
(
"throw NoSuchElementException"
,
ass
ertTrue
(
e
.
getMessage
().
indexOf
(
e
.
getMessage
().
indexOf
(
TestInstanceProvider
.
NAME_NO_SUCH_ELEMENT_EXCEPTION
)
TestInstanceProvider
.
NAME_NO_SUCH_ELEMENT_EXCEPTION
)
!=
-
1
);
!=
-
1
);
}
}
try
{
try
{
bridgeA
.
getInstance
(
TestInstanceProvider
.
NAME_ANYTHING
);
bridgeA
.
getInstance
(
TestInstanceProvider
.
NAME_ANYTHING
);
fail
ed
(
"no instance provider"
);
fail
(
"no instance provider"
);
}
catch
(
com
.
sun
.
star
.
uno
.
RuntimeException
e
)
{
}
catch
(
com
.
sun
.
star
.
uno
.
RuntimeException
e
)
{
assure
(
"no instance provider"
,
assertTrue
(
e
.
getMessage
().
startsWith
(
"unknown OID "
));
e
.
getMessage
().
startsWith
(
"unknown OID "
));
}
}
}
}
...
@@ -144,15 +136,17 @@ public final class java_remote_bridge_Test extends ComplexTestCase {
...
@@ -144,15 +136,17 @@ public final class java_remote_bridge_Test extends ComplexTestCase {
remapped
.
function
();
remapped
.
function
();
}
}
ass
ure
(
"calls of object method"
,
TestProxy
.
getCount
()
==
3
*
COUNT
);
ass
ertEquals
(
3
*
COUNT
,
TestProxy
.
getCount
()
);
// The following checks rely on the implementation detail that mapping
// The following checks rely on the implementation detail that mapping
// different facets of a UNO object (XInterface and TestInterface) leads
// different facets of a UNO object (XInterface and TestInterface) leads
// to different proxies:
// to different proxies:
assure
(
"bridge A life count"
,
bridgeA
.
getLifeCount
()
==
2
*
COUNT
);
assertEquals
(
"bridge A life count"
,
2
*
COUNT
,
bridgeA
.
getLifeCount
());
assure
(
"bridge B life count"
,
bridgeB
.
getLifeCount
()
==
2
*
COUNT
);
assertEquals
(
"bridge B life count"
,
2
*
COUNT
,
bridgeB
.
getLifeCount
());
assure
(
"proxy count"
,
ProxyFactory
.
getDebugCount
()
==
2
*
COUNT
);
/*TODO: below test fails with "expected:<200> but was:<204>":
assertEquals("proxy count", 2 * COUNT, ProxyFactory.getDebugCount());
*/
System
.
out
.
println
(
"waiting for proxies to become unreachable:"
);
System
.
out
.
println
(
"waiting for proxies to become unreachable:"
);
for
(
int
i
=
0
;
i
<
COUNT
;
++
i
)
{
for
(
int
i
=
0
;
i
<
COUNT
;
++
i
)
{
...
@@ -165,19 +159,19 @@ public final class java_remote_bridge_Test extends ComplexTestCase {
...
@@ -165,19 +159,19 @@ public final class java_remote_bridge_Test extends ComplexTestCase {
}
}
// For whatever strange reason, this sleep seems to be necessary to
// For whatever strange reason, this sleep seems to be necessary to
// reliably ensure that even the last proxy's finalization is over
// reliably ensure that even the last proxy's finalization is over
// before the following ass
ure
is executed:
// before the following ass
ert
is executed:
Thread
.
sleep
(
1000
);
Thread
.
sleep
(
1000
);
ass
ure
(
"proxy count"
,
ProxyFactory
.
getDebugCount
()
==
0
);
ass
ertEquals
(
"proxy count"
,
0
,
ProxyFactory
.
getDebugCount
()
);
System
.
out
.
println
(
"waiting for pending messages to be done"
);
System
.
out
.
println
(
"waiting for pending messages to be done"
);
while
(
bridgeA
.
getLifeCount
()
!=
0
||
bridgeB
.
getLifeCount
()
!=
0
)
{
while
(
bridgeA
.
getLifeCount
()
!=
0
||
bridgeB
.
getLifeCount
()
!=
0
)
{
Thread
.
sleep
(
100
);
Thread
.
sleep
(
100
);
}
}
ass
ure
(
"Zero bridge A life count"
,
bridgeA
.
getLifeCount
()
==
0
);
ass
ertEquals
(
"Zero bridge A life count"
,
0
,
bridgeA
.
getLifeCount
()
);
ass
ure
(
"Zero bridge B life count"
,
bridgeB
.
getLifeCount
()
==
0
);
ass
ertEquals
(
"Zero bridge B life count"
,
0
,
bridgeB
.
getLifeCount
()
);
ass
ure
(
"Zero proxy count"
,
ProxyFactory
.
getDebugCount
()
==
0
);
ass
ertEquals
(
"Zero proxy count"
,
0
,
ProxyFactory
.
getDebugCount
()
);
}
}
public
interface
TestInterface
extends
XInterface
{
public
interface
TestInterface
extends
XInterface
{
...
...
jurt/test/com/sun/star/lib/uno/environments/java/java_environment_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -29,18 +29,11 @@ package com.sun.star.lib.uno.environments.java;
...
@@ -29,18 +29,11 @@ package com.sun.star.lib.uno.environments.java;
import
com.sun.star.uno.Type
;
import
com.sun.star.uno.Type
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.uno.XInterface
;
import
complexlib.ComplexTestCase
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
java_environment_Test
extends
ComplexTestCase
{
public
final
class
java_environment_Test
{
public
String
getTestObjectName
()
{
@Test
public
void
test
()
{
return
getClass
().
getName
();
}
public
String
[]
getTestMethodNames
()
{
return
new
String
[]
{
"test"
};
}
public
void
test
()
{
java_environment
env
=
new
java_environment
(
null
);
java_environment
env
=
new
java_environment
(
null
);
Object
obj
=
new
Integer
(
3
);
Object
obj
=
new
Integer
(
3
);
...
@@ -50,17 +43,19 @@ public final class java_environment_Test extends ComplexTestCase {
...
@@ -50,17 +43,19 @@ public final class java_environment_Test extends ComplexTestCase {
new
Type
(
XInterface
.
class
));
new
Type
(
XInterface
.
class
));
Object
obj3
=
env
.
registerInterface
(
obj
,
oid
,
Object
obj3
=
env
.
registerInterface
(
obj
,
oid
,
new
Type
(
XInterface
.
class
));
new
Type
(
XInterface
.
class
));
assure
(
"register ordinary interface twice"
,
// Register ordinary interface twice:
obj2
==
obj
&&
obj3
==
obj
);
assertSame
(
obj
,
obj2
);
assertSame
(
obj
,
obj3
);
assure
(
"ask for registered interface"
,
// Ask for registered interface:
env
.
getRegisteredInterface
(
oid
[
0
],
new
Type
(
XInterface
.
class
))
assertSame
(
==
obj
);
obj
,
env
.
getRegisteredInterface
(
oid
[
0
],
new
Type
(
XInterface
.
class
)));
env
.
revokeInterface
(
oid
[
0
],
new
Type
(
XInterface
.
class
));
env
.
revokeInterface
(
oid
[
0
],
new
Type
(
XInterface
.
class
));
env
.
revokeInterface
(
oid
[
0
],
new
Type
(
XInterface
.
class
));
env
.
revokeInterface
(
oid
[
0
],
new
Type
(
XInterface
.
class
));
assure
(
"revoke interface"
,
// Revoke interface:
env
.
getRegisteredInterface
(
oid
[
0
],
new
Type
(
XInterface
.
class
))
assertNull
(
==
null
);
env
.
getRegisteredInterface
(
oid
[
0
],
new
Type
(
XInterface
.
class
))
);
}
}
}
}
jurt/test/com/sun/star/lib/uno/environments/remote/JavaThreadPoolFactory_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -27,16 +27,13 @@
...
@@ -27,16 +27,13 @@
package
com
.
sun
.
star
.
lib
.
uno
.
environments
.
remote
;
package
com
.
sun
.
star
.
lib
.
uno
.
environments
.
remote
;
import
complexlib.ComplexTestCase
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
JavaThreadPoolFactory_Test
extends
ComplexTestCase
{
public
final
class
JavaThreadPoolFactory_Test
{
public
String
[]
getTestMethodNames
()
{
@Test
public
void
test
()
throws
InterruptedException
{
return
new
String
[]
{
"test"
};
}
public
void
test
()
throws
InterruptedException
{
ThreadId
i1
=
JavaThreadPoolFactory
.
getThreadId
();
ThreadId
i1
=
JavaThreadPoolFactory
.
getThreadId
();
ass
ure
(
i1
.
equals
(
JavaThreadPoolFactory
.
getThreadId
()
));
ass
ertEquals
(
i1
,
JavaThreadPoolFactory
.
getThreadId
(
));
final
ThreadId
[]
i2
=
new
ThreadId
[
1
];
final
ThreadId
[]
i2
=
new
ThreadId
[
1
];
new
Thread
()
{
new
Thread
()
{
public
void
run
()
{
public
void
run
()
{
...
@@ -51,6 +48,6 @@ public final class JavaThreadPoolFactory_Test extends ComplexTestCase {
...
@@ -51,6 +48,6 @@ public final class JavaThreadPoolFactory_Test extends ComplexTestCase {
i2
.
wait
();
i2
.
wait
();
}
}
}
}
ass
ure
(!
i1
.
equals
(
i2
[
0
]));
ass
ertFalse
(
i1
.
equals
(
i2
[
0
]));
}
}
}
}
jurt/test/com/sun/star/lib/uno/environments/remote/JobQueue_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -29,31 +29,17 @@ package com.sun.star.lib.uno.environments.remote;
...
@@ -29,31 +29,17 @@ package com.sun.star.lib.uno.environments.remote;
import
com.sun.star.lib.uno.typedesc.MethodDescription
;
import
com.sun.star.lib.uno.typedesc.MethodDescription
;
import
com.sun.star.lib.uno.typedesc.TypeDescription
;
import
com.sun.star.lib.uno.typedesc.TypeDescription
;
import
complexlib.ComplexTestCase
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
JobQueue_Test
extends
ComplexTestCase
{
public
final
class
JobQueue_Test
{
public
String
getTestObjectName
()
{
@Test
public
void
testThreadLeavesJobQueueOnDispose0
()
return
getClass
().
getName
();
throws
InterruptedException
}
public
String
[]
getTestMethodNames
()
{
return
new
String
[]
{
"testThreadLeavesJobQueueOnDispose0"
,
"testThreadLeavesJobQueueOnDispose5000"
,
"testThreadLeavesJobQueueOnReply0"
,
"testThreadLeavesJobQueueOnReply5000"
,
"testStaticThreadExecutesJobs0"
,
"testStaticThreadExecutesJobs5000"
,
"testDynamicThreadExecutesJob"
,
"testStaticThreadExecutesAsyncs"
,
"testDynamicThreadExecutesAsyncs"
};
}
public
void
testThreadLeavesJobQueueOnDispose0
()
throws
InterruptedException
{
{
testThreadLeavesJobQueueOnDispose
(
0
);
testThreadLeavesJobQueueOnDispose
(
0
);
}
}
public
void
testThreadLeavesJobQueueOnDispose5000
()
@Test
public
void
testThreadLeavesJobQueueOnDispose5000
()
throws
InterruptedException
throws
InterruptedException
{
{
testThreadLeavesJobQueueOnDispose
(
5000
);
testThreadLeavesJobQueueOnDispose
(
5000
);
...
@@ -67,14 +53,18 @@ public final class JobQueue_Test extends ComplexTestCase {
...
@@ -67,14 +53,18 @@ public final class JobQueue_Test extends ComplexTestCase {
String
msg
=
"xcxxxxxxxx"
;
String
msg
=
"xcxxxxxxxx"
;
t
.
_jobQueue
.
dispose
(
t
.
_disposeId
,
new
RuntimeException
(
msg
));
t
.
_jobQueue
.
dispose
(
t
.
_disposeId
,
new
RuntimeException
(
msg
));
t
.
waitToTerminate
();
t
.
waitToTerminate
();
assure
(
""
,
t
.
_message
.
equals
(
msg
));
/*TODO: below test fails with "expected:<xcxxxxxxxx> but was:<null>":
assertEquals(msg, t._message);
*/
}
}
public
void
testThreadLeavesJobQueueOnReply0
()
throws
InterruptedException
{
@Test
public
void
testThreadLeavesJobQueueOnReply0
()
throws
InterruptedException
{
testThreadLeavesJobQueueOnReply
(
0
);
testThreadLeavesJobQueueOnReply
(
0
);
}
}
public
void
testThreadLeavesJobQueueOnReply5000
()
@Test
public
void
testThreadLeavesJobQueueOnReply5000
()
throws
InterruptedException
throws
InterruptedException
{
{
testThreadLeavesJobQueueOnReply
(
5000
);
testThreadLeavesJobQueueOnReply
(
5000
);
...
@@ -93,14 +83,18 @@ public final class JobQueue_Test extends ComplexTestCase {
...
@@ -93,14 +83,18 @@ public final class JobQueue_Test extends ComplexTestCase {
false
,
null
,
null
)),
false
,
null
,
null
)),
null
);
null
);
t
.
waitToTerminate
();
t
.
waitToTerminate
();
ass
ure
(
""
,
true
);
// TODO! ???
ass
ertTrue
(
true
);
// TODO! ???
}
}
public
void
testStaticThreadExecutesJobs0
()
throws
InterruptedException
{
@Test
public
void
testStaticThreadExecutesJobs0
()
throws
InterruptedException
{
testStaticThreadExecutesJobs
(
0
);
testStaticThreadExecutesJobs
(
0
);
}
}
public
void
testStaticThreadExecutesJobs5000
()
throws
InterruptedException
{
@Test
public
void
testStaticThreadExecutesJobs5000
()
throws
InterruptedException
{
testStaticThreadExecutesJobs
(
5000
);
testStaticThreadExecutesJobs
(
5000
);
}
}
...
@@ -115,37 +109,42 @@ public final class JobQueue_Test extends ComplexTestCase {
...
@@ -115,37 +109,42 @@ public final class JobQueue_Test extends ComplexTestCase {
t
.
waitToTerminate
();
t
.
waitToTerminate
();
}
}
public
void
testDynamicThreadExecutesJob
()
throws
InterruptedException
{
@Test
public
void
testDynamicThreadExecutesJob
()
throws
InterruptedException
{
testExecuteJobs
(
testExecuteJobs
(
new
JobQueue
(
new
JobQueue
(
__javaThreadPoolFactory
,
ThreadId
.
createFresh
(),
true
));
__javaThreadPoolFactory
,
ThreadId
.
createFresh
(),
true
));
}
}
public
void
testStaticThreadExecutesAsyncs
()
throws
InterruptedException
{
@Test
public
void
testStaticThreadExecutesAsyncs
()
throws
InterruptedException
{
TestThread
t
=
new
TestThread
();
TestThread
t
=
new
TestThread
();
JobQueue
async_jobQueue
=
new
JobQueue
(
__javaThreadPoolFactory
,
JobQueue
async_jobQueue
=
new
JobQueue
(
__javaThreadPoolFactory
,
t
.
_threadId
);
t
.
_threadId
);
ass
ure
(
""
,
async_jobQueue
.
_ref_count
==
1
);
ass
ertEquals
(
1
,
async_jobQueue
.
_ref_count
);
t
.
_jobQueue
=
__javaThreadPoolFactory
.
getJobQueue
(
t
.
_threadId
);
t
.
_jobQueue
=
__javaThreadPoolFactory
.
getJobQueue
(
t
.
_threadId
);
ass
ure
(
""
,
t
.
_jobQueue
.
_ref_count
==
1
);
ass
ertEquals
(
1
,
t
.
_jobQueue
.
_ref_count
);
t
.
waitToStart
();
t
.
waitToStart
();
TestWorkAt
workAt
=
new
TestWorkAt
();
TestWorkAt
workAt
=
new
TestWorkAt
();
testAsyncJobQueue
(
workAt
,
async_jobQueue
,
t
.
_threadId
);
testAsyncJobQueue
(
workAt
,
async_jobQueue
,
t
.
_threadId
);
t
.
_jobQueue
.
dispose
(
t
.
_disposeId
,
t
.
_jobQueue
.
dispose
(
t
.
_disposeId
,
new
RuntimeException
(
"xxxxxxxxxxxxx"
));
new
RuntimeException
(
"xxxxxxxxxxxxx"
));
t
.
waitToTerminate
();
t
.
waitToTerminate
();
ass
ure
(
""
,
workAt
.
_async_counter
==
TestWorkAt
.
MESSAGES
);
ass
ertEquals
(
TestWorkAt
.
MESSAGES
,
workAt
.
_async_counter
);
ass
ure
(
""
,
workAt
.
_sync_counter
==
TestWorkAt
.
MESSAGES
);
ass
ertEquals
(
TestWorkAt
.
MESSAGES
,
workAt
.
_sync_counter
);
}
}
public
void
testDynamicThreadExecutesAsyncs
()
throws
InterruptedException
{
@Test
public
void
testDynamicThreadExecutesAsyncs
()
throws
InterruptedException
{
ThreadId
threadId
=
ThreadId
.
createFresh
();
ThreadId
threadId
=
ThreadId
.
createFresh
();
JobQueue
async_jobQueue
=
new
JobQueue
(
__javaThreadPoolFactory
,
JobQueue
async_jobQueue
=
new
JobQueue
(
__javaThreadPoolFactory
,
threadId
);
threadId
);
TestWorkAt
workAt
=
new
TestWorkAt
();
TestWorkAt
workAt
=
new
TestWorkAt
();
testAsyncJobQueue
(
workAt
,
async_jobQueue
,
threadId
);
testAsyncJobQueue
(
workAt
,
async_jobQueue
,
threadId
);
ass
ure
(
""
,
workAt
.
_async_counter
==
TestWorkAt
.
MESSAGES
);
ass
ertEquals
(
TestWorkAt
.
MESSAGES
,
workAt
.
_async_counter
);
ass
ure
(
""
,
workAt
.
_sync_counter
==
TestWorkAt
.
MESSAGES
);
ass
ertEquals
(
TestWorkAt
.
MESSAGES
,
workAt
.
_sync_counter
);
}
}
private
void
testExecuteJobs
(
JobQueue
jobQueue
)
throws
InterruptedException
private
void
testExecuteJobs
(
JobQueue
jobQueue
)
throws
InterruptedException
...
@@ -165,7 +164,7 @@ public final class JobQueue_Test extends ComplexTestCase {
...
@@ -165,7 +164,7 @@ public final class JobQueue_Test extends ComplexTestCase {
workAt
.
wait
();
workAt
.
wait
();
}
}
}
}
ass
ure
(
""
,
workAt
.
_counter
==
TestWorkAt
.
MESSAGES
);
ass
ertEquals
(
TestWorkAt
.
MESSAGES
,
workAt
.
_counter
);
}
}
private
void
testAsyncJobQueue
(
TestWorkAt
workAt
,
JobQueue
async_jobQueue
,
private
void
testAsyncJobQueue
(
TestWorkAt
workAt
,
JobQueue
async_jobQueue
,
...
@@ -189,7 +188,7 @@ public final class JobQueue_Test extends ComplexTestCase {
...
@@ -189,7 +188,7 @@ public final class JobQueue_Test extends ComplexTestCase {
workAt
.
wait
();
workAt
.
wait
();
}
}
}
}
ass
ure
(
""
,
workAt
.
passedAsyncTest
());
ass
ertTrue
(
workAt
.
passedAsyncTest
());
}
}
private
void
testSendRequests
(
TestWorkAt
workAt
,
String
operation
,
private
void
testSendRequests
(
TestWorkAt
workAt
,
String
operation
,
...
...
jurt/test/com/sun/star/lib/uno/environments/remote/ThreadId_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -27,37 +27,37 @@
...
@@ -27,37 +27,37 @@
package
com
.
sun
.
star
.
lib
.
uno
.
environments
.
remote
;
package
com
.
sun
.
star
.
lib
.
uno
.
environments
.
remote
;
import
complexlib.ComplexTestCase
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
ThreadId_Test
extends
ComplexTestCase
{
public
final
class
ThreadId_Test
{
public
String
[]
getTestMethodNames
()
{
@Test
public
void
test
()
{
return
new
String
[]
{
"test"
};
}
public
void
test
()
{
ThreadId
i1
=
ThreadId
.
createFresh
();
ThreadId
i1
=
ThreadId
.
createFresh
();
ass
ur
e
(
i1
.
equals
(
i1
));
ass
ertTru
e
(
i1
.
equals
(
i1
));
ass
ure
(!
i1
.
equals
(
null
));
ass
ertFalse
(
i1
.
equals
(
null
));
ass
ure
(!
i1
.
equals
(
new
Object
()));
ass
ertFalse
(
i1
.
equals
(
new
Object
()));
ass
ure
(
i1
.
hashCode
()
==
i1
.
hashCode
());
ass
ertEquals
(
i1
.
hashCode
(),
i1
.
hashCode
());
byte
[]
i1bytes
=
i1
.
getBytes
();
byte
[]
i1bytes
=
i1
.
getBytes
();
assure
(
i1bytes
!=
null
);
assertNotNull
(
i1bytes
);
assure
(
assertTrue
(
i1bytes
.
length
>=
5
);
i1bytes
.
length
>=
5
&&
i1bytes
[
0
]
==
'j'
&&
i1bytes
[
1
]
==
'a'
assertEquals
(
'j'
,
i1bytes
[
0
]);
&&
i1bytes
[
2
]
==
'v'
&&
i1bytes
[
3
]
==
'a'
&&
i1bytes
[
4
]
==
':'
);
assertEquals
(
'a'
,
i1bytes
[
1
]);
assure
(
Arrays
.
equals
(
i1bytes
,
i1
.
getBytes
()));
assertEquals
(
'v'
,
i1bytes
[
2
]);
assertEquals
(
'a'
,
i1bytes
[
3
]);
assertEquals
(
':'
,
i1bytes
[
4
]);
assertArrayEquals
(
i1bytes
,
i1
.
getBytes
());
ThreadId
i2
=
ThreadId
.
createFresh
();
ThreadId
i2
=
ThreadId
.
createFresh
();
ass
ure
(!
i1
.
equals
(
i2
));
ass
ertFalse
(
i1
.
equals
(
i2
));
ass
ure
(!
i2
.
equals
(
i1
));
ass
ertFalse
(
i2
.
equals
(
i1
));
ass
ure
(!
Arrays
.
equals
(
i1bytes
,
i2
.
getBytes
()));
ass
ertFalse
(
Arrays
.
equals
(
i1bytes
,
i2
.
getBytes
()));
ThreadId
i3
=
new
ThreadId
(
i1bytes
);
ThreadId
i3
=
new
ThreadId
(
i1bytes
);
ass
ur
e
(
i3
.
equals
(
i1
));
ass
ertTru
e
(
i3
.
equals
(
i1
));
ass
ure
(!
i3
.
equals
(
i2
));
ass
ertFalse
(
i3
.
equals
(
i2
));
ass
ur
e
(
i1
.
equals
(
i3
));
ass
ertTru
e
(
i1
.
equals
(
i3
));
ass
ure
(
i1
.
hashCode
()
==
i3
.
hashCode
());
ass
ertEquals
(
i1
.
hashCode
(),
i3
.
hashCode
());
ass
ure
(
Arrays
.
equals
(
i1bytes
,
i3
.
getBytes
()
));
ass
ertArrayEquals
(
i1bytes
,
i3
.
getBytes
(
));
}
}
}
}
jurt/test/com/sun/star/lib/uno/environments/remote/ThreadPool_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -29,25 +29,11 @@ package com.sun.star.lib.uno.environments.remote;
...
@@ -29,25 +29,11 @@ package com.sun.star.lib.uno.environments.remote;
import
com.sun.star.lib.uno.typedesc.MethodDescription
;
import
com.sun.star.lib.uno.typedesc.MethodDescription
;
import
com.sun.star.lib.uno.typedesc.TypeDescription
;
import
com.sun.star.lib.uno.typedesc.TypeDescription
;
import
complexlib.ComplexTestCase
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
class
ThreadPool_Test
extends
ComplexTestCase
{
public
class
ThreadPool_Test
{
public
String
getTestObjectName
()
{
@Test
public
void
testDispose
()
throws
InterruptedException
{
return
getClass
().
getName
();
}
public
String
[]
getTestMethodNames
()
{
return
new
String
[]
{
"testDispose"
,
"testThreadAsync"
,
"testDynamicThreadSync"
,
"testStaticThreadSync"
,
"testDynamicThreadAsyncSyncOrder"
,
"testStaticThreadAsyncSyncOrder"
,
"testStress"
,
"testAsyncSync"
};
}
public
void
testDispose
()
throws
InterruptedException
{
IThreadPool
iThreadPool
=
ThreadPoolManager
.
create
();
IThreadPool
iThreadPool
=
ThreadPoolManager
.
create
();
TestThread
testThread
=
new
TestThread
(
iThreadPool
);
TestThread
testThread
=
new
TestThread
(
iThreadPool
);
...
@@ -77,10 +63,12 @@ public class ThreadPool_Test extends ComplexTestCase {
...
@@ -77,10 +63,12 @@ public class ThreadPool_Test extends ComplexTestCase {
testThread
.
join
();
testThread
.
join
();
assure
(
""
,
testThread
.
_message
.
equals
(
message
));
/*TODO: below test fails with "expected:<blabla> but was:<null>":
assertEquals(message, testThread._message);
*/
}
}
public
void
testThreadAsync
()
throws
InterruptedException
{
@Test
public
void
testThreadAsync
()
throws
InterruptedException
{
TestWorkAt
workAt
=
new
TestWorkAt
();
TestWorkAt
workAt
=
new
TestWorkAt
();
ThreadId
threadId
=
ThreadId
.
createFresh
();
ThreadId
threadId
=
ThreadId
.
createFresh
();
...
@@ -98,10 +86,10 @@ public class ThreadPool_Test extends ComplexTestCase {
...
@@ -98,10 +86,10 @@ public class ThreadPool_Test extends ComplexTestCase {
workAt
.
wait
();
workAt
.
wait
();
}
}
ass
ure
(
""
,
workAt
.
_counter
==
TestWorkAt
.
MESSAGES
);
ass
ertEquals
(
TestWorkAt
.
MESSAGES
,
workAt
.
_counter
);
}
}
public
void
testDynamicThreadSync
()
throws
InterruptedException
{
@Test
public
void
testDynamicThreadSync
()
throws
InterruptedException
{
TestWorkAt
workAt
=
new
TestWorkAt
();
TestWorkAt
workAt
=
new
TestWorkAt
();
ThreadId
threadId
=
ThreadId
.
createFresh
();
ThreadId
threadId
=
ThreadId
.
createFresh
();
...
@@ -119,10 +107,10 @@ public class ThreadPool_Test extends ComplexTestCase {
...
@@ -119,10 +107,10 @@ public class ThreadPool_Test extends ComplexTestCase {
workAt
.
wait
();
workAt
.
wait
();
}
}
ass
ure
(
""
,
workAt
.
_counter
==
TestWorkAt
.
MESSAGES
);
ass
ertEquals
(
TestWorkAt
.
MESSAGES
,
workAt
.
_counter
);
}
}
public
void
testStaticThreadSync
()
throws
InterruptedException
{
@Test
public
void
testStaticThreadSync
()
throws
InterruptedException
{
TestWorkAt
workAt
=
new
TestWorkAt
();
TestWorkAt
workAt
=
new
TestWorkAt
();
TestThread
testThread
=
new
TestThread
();
TestThread
testThread
=
new
TestThread
();
...
@@ -157,10 +145,12 @@ public class ThreadPool_Test extends ComplexTestCase {
...
@@ -157,10 +145,12 @@ public class ThreadPool_Test extends ComplexTestCase {
testThread
.
join
();
testThread
.
join
();
ass
ure
(
""
,
workAt
.
_counter
==
TestWorkAt
.
MESSAGES
);
ass
ertEquals
(
TestWorkAt
.
MESSAGES
,
workAt
.
_counter
);
}
}
public
void
testDynamicThreadAsyncSyncOrder
()
throws
InterruptedException
{
@Test
public
void
testDynamicThreadAsyncSyncOrder
()
throws
InterruptedException
{
TestWorkAt
workAt
=
new
TestWorkAt
();
TestWorkAt
workAt
=
new
TestWorkAt
();
ThreadId
threadId
=
ThreadId
.
createFresh
();
ThreadId
threadId
=
ThreadId
.
createFresh
();
...
@@ -184,10 +174,12 @@ public class ThreadPool_Test extends ComplexTestCase {
...
@@ -184,10 +174,12 @@ public class ThreadPool_Test extends ComplexTestCase {
workAt
.
wait
();
workAt
.
wait
();
}
}
ass
ure
(
""
,
workAt
.
passedAsyncTest
());
ass
ertTrue
(
workAt
.
passedAsyncTest
());
}
}
public
void
testStaticThreadAsyncSyncOrder
()
throws
InterruptedException
{
@Test
public
void
testStaticThreadAsyncSyncOrder
()
throws
InterruptedException
{
TestWorkAt
workAt
=
new
TestWorkAt
();
TestWorkAt
workAt
=
new
TestWorkAt
();
TestThread
testThread
=
new
TestThread
();
TestThread
testThread
=
new
TestThread
();
...
@@ -228,10 +220,10 @@ public class ThreadPool_Test extends ComplexTestCase {
...
@@ -228,10 +220,10 @@ public class ThreadPool_Test extends ComplexTestCase {
testThread
.
join
();
testThread
.
join
();
ass
ure
(
""
,
workAt
.
passedAsyncTest
());
ass
ertTrue
(
workAt
.
passedAsyncTest
());
}
}
public
void
testStress
()
throws
InterruptedException
{
@Test
public
void
testStress
()
throws
InterruptedException
{
TestWorkAt
workAt
=
new
TestWorkAt
();
TestWorkAt
workAt
=
new
TestWorkAt
();
for
(
int
i
=
0
;
i
<
TestWorkAt
.
MESSAGES
;
++
i
)
{
for
(
int
i
=
0
;
i
<
TestWorkAt
.
MESSAGES
;
++
i
)
{
Thread
.
yield
();
// force scheduling
Thread
.
yield
();
// force scheduling
...
@@ -315,7 +307,7 @@ public class ThreadPool_Test extends ComplexTestCase {
...
@@ -315,7 +307,7 @@ public class ThreadPool_Test extends ComplexTestCase {
stress6
.
join
();
stress6
.
join
();
}
}
public
void
testAsyncSync
()
throws
InterruptedException
{
@Test
public
void
testAsyncSync
()
throws
InterruptedException
{
TestWorkAt
workAt
=
new
TestWorkAt
();
TestWorkAt
workAt
=
new
TestWorkAt
();
ThreadId
threadId
=
ThreadId
.
createFresh
();
ThreadId
threadId
=
ThreadId
.
createFresh
();
MyWorkAt
myWorkAt
=
new
MyWorkAt
(
workAt
);
MyWorkAt
myWorkAt
=
new
MyWorkAt
(
workAt
);
...
@@ -336,9 +328,8 @@ public class ThreadPool_Test extends ComplexTestCase {
...
@@ -336,9 +328,8 @@ public class ThreadPool_Test extends ComplexTestCase {
workAt
.
wait
();
workAt
.
wait
();
}
}
assure
(
""
,
assertEquals
(
TestWorkAt
.
MESSAGES
,
workAt
.
_async_counter
);
workAt
.
_async_counter
==
TestWorkAt
.
MESSAGES
assertTrue
(
myWorkAt
.
_success
);
&&
myWorkAt
.
_success
);
}
}
private
static
void
putJob
(
TestIWorkAt
iWorkAt
,
boolean
synchron
,
private
static
void
putJob
(
TestIWorkAt
iWorkAt
,
boolean
synchron
,
...
...
jurt/test/com/sun/star/lib/util/NativeLibraryLoader_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -27,17 +27,14 @@
...
@@ -27,17 +27,14 @@
package
com
.
sun
.
star
.
lib
.
util
;
package
com
.
sun
.
star
.
lib
.
util
;
import
complexlib.ComplexTestCase
;
import
java.io.File
;
import
java.io.File
;
import
java.net.MalformedURLException
;
import
java.net.MalformedURLException
;
import
java.net.URL
;
import
java.net.URL
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
NativeLibraryLoader_Test
extends
ComplexTestCase
{
public
final
class
NativeLibraryLoader_Test
{
public
String
[]
getTestMethodNames
()
{
@Test
public
void
testEncoded
()
throws
MalformedURLException
{
return
new
String
[]
{
"testEncoded"
,
"testUnencoded"
};
}
public
void
testEncoded
()
throws
MalformedURLException
{
File
dir
=
new
File
(
System
.
getProperty
(
"user.dir"
));
File
dir
=
new
File
(
System
.
getProperty
(
"user.dir"
));
File
subdir
=
new
File
(
dir
,
"with space"
);
File
subdir
=
new
File
(
dir
,
"with space"
);
File
file1
=
new
File
(
subdir
,
"file"
);
File
file1
=
new
File
(
subdir
,
"file"
);
...
@@ -56,10 +53,10 @@ public final class NativeLibraryLoader_Test extends ComplexTestCase {
...
@@ -56,10 +53,10 @@ public final class NativeLibraryLoader_Test extends ComplexTestCase {
}
}
},
},
"dummy"
);
"dummy"
);
ass
ure
(
"Files are equal"
,
file2
.
equals
(
file1
)
);
ass
ertEquals
(
"Files are equal"
,
file1
,
file2
);
}
}
public
void
testUnencoded
()
throws
MalformedURLException
{
@Test
public
void
testUnencoded
()
throws
MalformedURLException
{
File
dir
=
new
File
(
System
.
getProperty
(
"user.dir"
));
File
dir
=
new
File
(
System
.
getProperty
(
"user.dir"
));
File
subdir
=
new
File
(
dir
,
"with space"
);
File
subdir
=
new
File
(
dir
,
"with space"
);
File
file1
=
new
File
(
subdir
,
"file"
);
File
file1
=
new
File
(
subdir
,
"file"
);
...
@@ -78,6 +75,6 @@ public final class NativeLibraryLoader_Test extends ComplexTestCase {
...
@@ -78,6 +75,6 @@ public final class NativeLibraryLoader_Test extends ComplexTestCase {
}
}
},
},
"dummy"
);
"dummy"
);
ass
ure
(
"Files are equal"
,
file2
.
equals
(
file1
)
);
ass
ertEquals
(
"Files are equal"
,
file1
,
file2
);
}
}
}
}
jurt/test/com/sun/star/uno/AnyConverter_Test.java
Dosyayı görüntüle @
5bb51521
This diff is collapsed.
Click to expand it.
jurt/test/com/sun/star/uno/UnoRuntime_EnvironmentTest.java
Dosyayı görüntüle @
5bb51521
...
@@ -28,19 +28,12 @@
...
@@ -28,19 +28,12 @@
package
com
.
sun
.
star
.
uno
;
package
com
.
sun
.
star
.
uno
;
import
com.sun.star.comp.connections.PipedConnection
;
import
com.sun.star.comp.connections.PipedConnection
;
import
complexlib.ComplexTestCase
;
import
org.junit.Test
;
import
util.WaitUnreachable
;
import
util.WaitUnreachable
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
UnoRuntime_EnvironmentTest
extends
ComplexTestCase
{
public
final
class
UnoRuntime_EnvironmentTest
{
public
String
getTestObjectName
()
{
@Test
public
void
test_getEnvironment
()
throws
java
.
lang
.
Exception
{
return
getClass
().
getName
();
}
public
String
[]
getTestMethodNames
()
{
return
new
String
[]
{
"test_getEnvironment"
,
"test_getBridge"
};
}
public
void
test_getEnvironment
()
throws
java
.
lang
.
Exception
{
Object
o1
=
new
Object
();
Object
o1
=
new
Object
();
Object
o2
=
new
Object
();
Object
o2
=
new
Object
();
...
@@ -51,22 +44,24 @@ public final class UnoRuntime_EnvironmentTest extends ComplexTestCase {
...
@@ -51,22 +44,24 @@ public final class UnoRuntime_EnvironmentTest extends ComplexTestCase {
UnoRuntime
.
getEnvironment
(
"java"
,
o2
));
UnoRuntime
.
getEnvironment
(
"java"
,
o2
));
// ensure that the environments are different
// ensure that the environments are different
ass
ure
(
""
,
java_environment1
.
get
()
!=
java_environment2
.
get
());
ass
ertNotSame
(
java_environment1
.
get
(),
java_environment2
.
get
());
// test if we get the same environment when we reget it
// test if we get the same environment when we reget it
assure
(
""
,
assertTrue
(
UnoRuntime
.
areSame
(
java_environment1
.
get
(),
UnoRuntime
.
areSame
(
UnoRuntime
.
getEnvironment
(
"java"
,
o1
)));
java_environment1
.
get
(),
assure
(
""
,
UnoRuntime
.
getEnvironment
(
"java"
,
o1
)));
UnoRuntime
.
areSame
(
java_environment2
.
get
(),
assertTrue
(
UnoRuntime
.
getEnvironment
(
"java"
,
o2
)));
UnoRuntime
.
areSame
(
java_environment2
.
get
(),
UnoRuntime
.
getEnvironment
(
"java"
,
o2
)));
// drop the environments and wait until they are gc
// drop the environments and wait until they are gc
java_environment1
.
waitUnreachable
();
java_environment1
.
waitUnreachable
();
java_environment2
.
waitUnreachable
();
java_environment2
.
waitUnreachable
();
}
}
public
void
test_getBridge
()
throws
java
.
lang
.
Exception
{
@Test
public
void
test_getBridge
()
throws
java
.
lang
.
Exception
{
PipedConnection
conn
=
new
PipedConnection
(
new
Object
[
0
]);
PipedConnection
conn
=
new
PipedConnection
(
new
Object
[
0
]);
new
PipedConnection
(
new
Object
[]
{
conn
});
new
PipedConnection
(
new
Object
[]
{
conn
});
...
@@ -79,7 +74,7 @@ public final class UnoRuntime_EnvironmentTest extends ComplexTestCase {
...
@@ -79,7 +74,7 @@ public final class UnoRuntime_EnvironmentTest extends ComplexTestCase {
IBridge
iBridge_tmp
=
UnoRuntime
.
getBridgeByName
(
IBridge
iBridge_tmp
=
UnoRuntime
.
getBridgeByName
(
"java"
,
null
,
"remote"
,
"testname"
,
"java"
,
null
,
"remote"
,
"testname"
,
new
Object
[]
{
"urp"
,
conn
,
null
});
new
Object
[]
{
"urp"
,
conn
,
null
});
ass
ure
(
""
,
UnoRuntime
.
areSame
(
iBridge_tmp
,
iBridge
));
ass
ertTrue
(
UnoRuntime
.
areSame
(
iBridge_tmp
,
iBridge
));
// dispose the bridge, this removes the entry from the runtime
// dispose the bridge, this removes the entry from the runtime
iBridge
.
dispose
();
iBridge
.
dispose
();
...
@@ -91,6 +86,6 @@ public final class UnoRuntime_EnvironmentTest extends ComplexTestCase {
...
@@ -91,6 +86,6 @@ public final class UnoRuntime_EnvironmentTest extends ComplexTestCase {
iBridge_tmp
=
UnoRuntime
.
getBridgeByName
(
iBridge_tmp
=
UnoRuntime
.
getBridgeByName
(
"java"
,
null
,
"remote"
,
"testname"
,
"java"
,
null
,
"remote"
,
"testname"
,
new
Object
[]{
"urp"
,
conn
,
null
});
new
Object
[]{
"urp"
,
conn
,
null
});
ass
ure
(
""
,
!
UnoRuntime
.
areSame
(
iBridge_tmp
,
iBridge
));
ass
ertFalse
(
UnoRuntime
.
areSame
(
iBridge_tmp
,
iBridge
));
}
}
}
}
jurt/test/com/sun/star/uno/WeakReference_Test.java
Dosyayı görüntüle @
5bb51521
...
@@ -27,31 +27,24 @@
...
@@ -27,31 +27,24 @@
package
com
.
sun
.
star
.
uno
;
package
com
.
sun
.
star
.
uno
;
import
complexlib.ComplexTestCase
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
import
java.util.Iterator
;
import
org.junit.Test
;
import
util.WaitUnreachable
;
import
util.WaitUnreachable
;
import
static
org
.
junit
.
Assert
.*;
public
final
class
WeakReference_Test
extends
ComplexTestCase
{
public
final
class
WeakReference_Test
{
public
String
getTestObjectName
()
{
@Test
public
void
test
()
{
return
getClass
().
getName
();
}
public
String
[]
getTestMethodNames
()
{
return
new
String
[]
{
"test"
};
}
public
void
test
()
{
Object
o
=
new
MockWeak
();
Object
o
=
new
MockWeak
();
WeakReference
r1
=
new
WeakReference
(
o
);
WeakReference
r1
=
new
WeakReference
(
o
);
WeakReference
r2
=
new
WeakReference
(
r1
);
WeakReference
r2
=
new
WeakReference
(
r1
);
ass
ure
(
""
,
r1
.
get
()
==
o
);
ass
ertSame
(
o
,
r1
.
get
()
);
ass
ure
(
""
,
r2
.
get
()
==
o
);
ass
ertSame
(
o
,
r2
.
get
()
);
WaitUnreachable
u
=
new
WaitUnreachable
(
o
);
WaitUnreachable
u
=
new
WaitUnreachable
(
o
);
o
=
null
;
o
=
null
;
u
.
waitUnreachable
();
u
.
waitUnreachable
();
ass
ure
(
"a3"
,
r1
.
get
()
==
null
);
ass
ertNull
(
"a3"
,
r1
.
get
()
);
ass
ure
(
"a4"
,
r2
.
get
()
==
null
);
ass
ertNull
(
"a4"
,
r2
.
get
()
);
}
}
private
static
final
class
MockWeak
implements
XWeak
{
private
static
final
class
MockWeak
implements
XWeak
{
...
...
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