summaryrefslogtreecommitdiff
path: root/testtools
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-10-01 09:04:58 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-10-01 09:04:58 +0000
commit6ec4dd0f35fd61cfa69faff5545062d273559165 (patch)
treedef1f6ba56a0bb6e9e660c1b7509b43f0c3d9b35 /testtools
parent17d4c5068896b55b94a155372850e2a6ab803156 (diff)
CWS-TOOLING: integrate CWS sb93
Diffstat (limited to 'testtools')
-rw-r--r--testtools/com/sun/star/comp/bridge/TestComponentMain.java42
-rw-r--r--testtools/qa/cli/makefile.mk4
-rw-r--r--testtools/qa/cliversioning/makefile.mk4
-rw-r--r--testtools/readme.txt12
-rw-r--r--testtools/source/bridgetest/bridgetest.cxx41
-rw-r--r--testtools/source/bridgetest/bridgetest_server2
-rw-r--r--testtools/source/bridgetest/makefile.mk6
7 files changed, 89 insertions, 22 deletions
diff --git a/testtools/com/sun/star/comp/bridge/TestComponentMain.java b/testtools/com/sun/star/comp/bridge/TestComponentMain.java
index 21153e8ecea2..03c04b3baad6 100644
--- a/testtools/com/sun/star/comp/bridge/TestComponentMain.java
+++ b/testtools/com/sun/star/comp/bridge/TestComponentMain.java
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: TestComponentMain.java,v $
- * $Revision: 1.4 $
+ * $Revision: 1.4.22.1 $
*
* This file is part of OpenOffice.org.
*
@@ -34,6 +34,9 @@ import com.sun.star.bridge.XBridgeFactory;
import com.sun.star.bridge.XInstanceProvider;
import com.sun.star.uno.XComponentContext;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XEventListener;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.container.XSet;
@@ -74,8 +77,8 @@ public class TestComponentMain
}
static public void main(String args[]) throws Exception, com.sun.star.uno.Exception {
- if(args.length != 1) {
- System.err.println("usage : com.sun.star.comp.bridge.TestComponentMain uno:connection;protocol;objectName");
+ if(args.length != 2) {
+ System.err.println("usage : com.sun.star.comp.bridge.TestComponentMain uno:connection;protocol;objectName singleaccept");
System.exit(-1);
}
@@ -84,6 +87,7 @@ public class TestComponentMain
String rootOid = null;
String dcp = args[0];
+ boolean singleaccept = args[1].equals("singleaccept");
int index = dcp.indexOf(':');
String url = dcp.substring(0, index).trim();
@@ -112,10 +116,10 @@ public class TestComponentMain
XAcceptor xAcceptor = Acceptor.create(ctx);
- System.err.println("waiting for connect...");
-
while( true )
{
+ System.err.println("waiting for connect...");
+
XConnection xConnection = xAcceptor.accept(conDcp);
XBridgeFactory xBridgeFactory = (XBridgeFactory)UnoRuntime.queryInterface(
@@ -124,7 +128,35 @@ public class TestComponentMain
XBridge xBridge = xBridgeFactory.createBridge(
"", protDcp, xConnection, new InstanceProvider(ctx));
+
+ if (singleaccept) {
+ Listener listener = new Listener();
+ ((XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xBridge)).addEventListener(listener);
+ listener.await();
+ break;
+ }
+ }
+
+ }
+
+ private static final class Listener implements XEventListener {
+ public synchronized void disposing(EventObject source) {
+ done = true;
+ notifyAll();
+ }
+
+ public synchronized void await() {
+ while (!done) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new RuntimeException(e);
+ }
+ }
}
+ private boolean done = false;
}
}
diff --git a/testtools/qa/cli/makefile.mk b/testtools/qa/cli/makefile.mk
index 0e356be9c295..181c28791e60 100644
--- a/testtools/qa/cli/makefile.mk
+++ b/testtools/qa/cli/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.5 $
+# $Revision: 1.5.22.1 $
#
# This file is part of OpenOffice.org.
#
@@ -38,7 +38,7 @@ PACKAGE = clitest
#----- compile .java files -----------------------------------------
-JARFILES = sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar jut.jar java_uno.jar OOoRunner.jar
+JARFILES = sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
JAVAFILES = CLITest.java
JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
diff --git a/testtools/qa/cliversioning/makefile.mk b/testtools/qa/cliversioning/makefile.mk
index 70574804fba3..70f535c341e1 100644
--- a/testtools/qa/cliversioning/makefile.mk
+++ b/testtools/qa/cliversioning/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.2 $
+# $Revision: 1.2.12.1 $
#
# This file is part of OpenOffice.org.
#
@@ -41,7 +41,7 @@ PACKAGE = cliversion
#----- compile .java files -----------------------------------------
-JARFILES = sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar jut.jar java_uno.jar OOoRunner.jar
+JARFILES = sandbox.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar
JAVAFILES = VersionTestCase.java
JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class)
diff --git a/testtools/readme.txt b/testtools/readme.txt
index a475639ba5ed..d418da006603 100644
--- a/testtools/readme.txt
+++ b/testtools/readme.txt
@@ -20,3 +20,15 @@ This will add a new compiler define (-DCOMPCHECK) and will be used in the
bridgetest.cxx to switch off the code which uses the getCaughtException function.
However, there is still a test which causes the test component to throw
and IllegalArgumentException. This still works.
+
+
+Using source/bridgetest for stress testing
+==========================================
+
+Start a modified bridgetest_server (with the final "--singleaccept" argument
+removed from the uno executable call) or a modified bridgetest_javaserver (with
+the final "singleaccept" argument replaced with "multi" in the java executable
+call), then start a modified bridgetest_client (with a final "stress" argument
+added to the uno executable call). The client will continuously establish
+connections to the server which are immediately destroyed again. The test will
+run forever, unless an error occurs.
diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx
index 124b97e1c868..d8b3a120bf68 100644
--- a/testtools/source/bridgetest/bridgetest.cxx
+++ b/testtools/source/bridgetest/bridgetest.cxx
@@ -7,7 +7,7 @@
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: bridgetest.cxx,v $
- * $Revision: 1.24 $
+ * $Revision: 1.24.18.1 $
*
* This file is part of OpenOffice.org.
*
@@ -1160,24 +1160,47 @@ sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs )
}
Reference< XInterface > xOriginal;
+ bool remote;
sal_Int32 i;
if( rArgs.getLength() > 1 && 0 == rArgs[0].compareToAscii( "-u" ) )
{
- xOriginal = UnoUrlResolver::create( m_xContext )->resolve(
- rArgs[1] );
+ remote = true;
i = 2;
}
else
{
- // local test
- xOriginal =
- m_xContext->getServiceManager()->createInstanceWithContext(
- rArgs[0], m_xContext );
+ remote = false;
i = 1;
}
- bool noCurrentContext = i < rArgs.getLength()
+ bool noCurrentContext = false;
+ if (i < rArgs.getLength()
&& rArgs[i].equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM("noCurrentContext"));
+ RTL_CONSTASCII_STRINGPARAM("noCurrentContext")))
+ {
+ noCurrentContext = true;
+ ++i;
+ }
+ bool stress = false;
+ if (i < rArgs.getLength()
+ && rArgs[i].equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("stress")))
+ {
+ stress = true;
+ ++i;
+ }
+
+ for (;;) {
+ Reference< XInterface > o;
+ if (remote) {
+ o = UnoUrlResolver::create(m_xContext)->resolve(rArgs[1]);
+ } else {
+ o = m_xContext->getServiceManager()->createInstanceWithContext(
+ rArgs[0], m_xContext);
+ }
+ if (!stress) {
+ xOriginal = o;
+ break;
+ }
+ }
if (! xOriginal.is())
{
diff --git a/testtools/source/bridgetest/bridgetest_server b/testtools/source/bridgetest/bridgetest_server
index 8ca8180fc78f..565513ff9c48 100644
--- a/testtools/source/bridgetest/bridgetest_server
+++ b/testtools/source/bridgetest/bridgetest_server
@@ -1 +1 @@
-uno -ro uno_services.rdb -ro uno_types.rdb -s com.sun.star.test.bridge.CppTestObject -u "uno:socket,host=127.0.0.1,port=2002;urp;test"
+uno -ro uno_services.rdb -ro uno_types.rdb -s com.sun.star.test.bridge.CppTestObject -u "uno:socket,host=127.0.0.1,port=2002;urp;test" --singleaccept
diff --git a/testtools/source/bridgetest/makefile.mk b/testtools/source/bridgetest/makefile.mk
index e2824c37caee..b8e178c0158f 100644
--- a/testtools/source/bridgetest/makefile.mk
+++ b/testtools/source/bridgetest/makefile.mk
@@ -8,7 +8,7 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.37 $
+# $Revision: 1.37.18.1 $
#
# This file is part of OpenOffice.org.
#
@@ -176,8 +176,8 @@ MY_CLASSPATH=$(strip $(subst,!,$(PATH_SEPERATOR) $(MY_CLASSPATH_TMP:s/ /!/)))$(P
# Use "127.0.0.1" instead of "localhost", see #i32281#:
$(DLLDEST)$/bridgetest_javaserver$(BATCH_SUFFIX) : makefile.mk
-rm -f $@
- $(WRAPCMD) echo "java -classpath $(MY_CLASSPATH)$(PATH_SEPERATOR)..$/class$/testComponent.jar" \
- com.sun.star.comp.bridge.TestComponentMain \""uno:socket,host=127.0.0.1,port=2002;urp;test"\" > $@
+ $(WRAPCMD) echo java -classpath "$(MY_CLASSPATH)$(PATH_SEPERATOR)..$/class$/testComponent.jar" \
+ com.sun.star.comp.bridge.TestComponentMain \""uno:socket,host=127.0.0.1,port=2002;urp;test"\" singleaccept > $@
$(GIVE_EXEC_RIGHTS) $@
$(DLLDEST)$/bridgetest_inprocess_java$(BATCH_SUFFIX) : makefile.mk