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
7a5d750c
Kaydet (Commit)
7a5d750c
authored
Agu 20, 2012
tarafından
Liu Zhe
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Set connection retry count to 5, sleep interval to 2 seconds.
üst
4904b17b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
46 deletions
+26
-46
CommunicationManager.java
.../org/openoffice/test/vcl/client/CommunicationManager.java
+6
-41
VclApp.java
...common/source/org/openoffice/test/vcl/widgets/VclApp.java
+5
-2
UnoApp.java
test/testuno/source/org/openoffice/test/uno/UnoApp.java
+15
-3
No files found.
test/testcommon/source/org/openoffice/test/vcl/client/CommunicationManager.java
Dosyayı görüntüle @
7a5d750c
...
...
@@ -33,6 +33,8 @@ import java.util.Vector;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
org.openoffice.test.common.SystemUtil
;
/**
* Manage the communication with the automation server.
* It's used to establish the connection, send and receive data package.
...
...
@@ -56,9 +58,9 @@ public class CommunicationManager implements Runnable, Constant{
private
Socket
socket
=
null
;
private
int
reconnectInterval
=
4000
;
private
double
reconnectInterval
=
2
;
private
int
reconnectCount
=
3
;
private
int
reconnectCount
=
5
;
private
List
<
CommunicationListener
>
listeners
=
new
Vector
<
CommunicationListener
>();
...
...
@@ -87,39 +89,6 @@ public class CommunicationManager implements Runnable, Constant{
this
.
port
=
port
;
}
/**
* Get the max count retrying to connect the server
* @return
*/
public
int
getReconnectCount
()
{
return
reconnectCount
;
}
/**
* Set the max count retrying to connect the server
* @param reconnectCount
*/
public
void
setReconnectCount
(
int
reconnectCount
)
{
this
.
reconnectCount
=
reconnectCount
;
}
/**
* Get the interval between retrying to connect the server
* @return
*/
public
int
getReconnectInterval
()
{
return
reconnectInterval
;
}
/**
* Set the interval between retrying to connect the server
* @param reconnectInterval
*/
public
void
setReconnectInterval
(
int
reconnectInterval
)
{
this
.
reconnectInterval
=
reconnectInterval
;
}
/**
* Send a data package to server
* @param headerType the package header type
...
...
@@ -255,14 +224,10 @@ public class CommunicationManager implements Runnable, Constant{
logger
.
log
(
Level
.
FINEST
,
"Failed to connect! Tried "
+
i
,
e
);
}
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
//ignore
}
SystemUtil
.
sleep
(
reconnectInterval
);
}
throw
new
CommunicationException
(
"Failed to connect
automation server!"
);
throw
new
CommunicationException
(
"Failed to connect
to automation server on: "
+
host
+
":"
+
port
);
}
...
...
test/testcommon/source/org/openoffice/test/vcl/widgets/VclApp.java
Dosyayı görüntüle @
7a5d750c
...
...
@@ -84,10 +84,13 @@ public class VclApp {
public
void
start
(
boolean
isCleanUserInstallation
)
{
// Default to clean user installation
if
(
openOffice
!=
null
)
{
if
(
isCleanUserInstallation
)
{
openOffice
.
kill
();
openOffice
.
cleanUserInstallation
();
openOffice
.
start
();
SystemUtil
.
sleep
(
5
);
}
else
{
openOffice
.
start
();
}
openOffice
.
start
();
}
communicationManager
.
start
();
...
...
test/testuno/source/org/openoffice/test/uno/UnoApp.java
Dosyayı görüntüle @
7a5d750c
...
...
@@ -58,10 +58,22 @@ public class UnoApp {
private
XDesktop
desktop
=
null
;
private
double
reconnectInterval
=
2
;
private
int
reconnectCount
=
5
;
public
UnoApp
()
{
this
.
openOffice
=
OpenOffice
.
getDefault
();
}
public
UnoApp
(
OpenOffice
openOffice
)
{
this
.
openOffice
=
openOffice
;
}
public
UnoApp
(
String
unoUrl
)
{
this
.
unoUrl
=
unoUrl
;
}
/**
* Start OpenOffice and connect to it
*/
...
...
@@ -71,7 +83,7 @@ public class UnoApp {
unoUrl
=
openOffice
.
getUnoUrl
();
}
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
for
(
int
i
=
0
;
i
<
reconnectCount
;
i
++)
{
try
{
XUnoUrlResolver
resolver
=
UnoUrlResolver
.
create
(
Bootstrap
.
createInitialComponentContext
(
null
));
componentContext
=
UnoRuntime
.
queryInterface
(
XComponentContext
.
class
,
resolver
.
resolve
(
"uno:"
+
unoUrl
+
";StarOffice.ComponentContext"
));
...
...
@@ -83,10 +95,10 @@ public class UnoApp {
// e.printStackTrace(); // for debugging
}
SystemUtil
.
sleep
(
2
);
SystemUtil
.
sleep
(
reconnectInterval
);
}
throw
new
RuntimeException
(
"
OpenOffice can't be connected!"
);
throw
new
RuntimeException
(
"
Failed to connect to uno url: "
+
unoUrl
);
}
private
Timer
timer
=
new
Timer
(
true
);
...
...
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