From 3824ecdfa612ced51e00f7caafcc6ae40ff62e3a Mon Sep 17 00:00:00 2001
From: cramakri <cramakri>
Date: Mon, 30 Jul 2012 11:31:20 +0000
Subject: [PATCH] MINOR : Trying to get RmiConversationTest to be more reliable
 on the server

SVN: 26281
---
 .../systemtests/RmiConversationTest.java      | 20 +++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/RmiConversationTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/RmiConversationTest.java
index 1d881387baa..226e9fd8a28 100644
--- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/RmiConversationTest.java
+++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/RmiConversationTest.java
@@ -177,8 +177,7 @@ public class RmiConversationTest extends SystemTestCase
         public String echo(String input, Integer delayInMillis);
 
         @Transactional
-        public String echo(String input, Integer delayInMillis,
-                IProgressListener listener);
+        public String echo(String input, Integer delayInMillis, IProgressListener listener);
 
         @Transactional
         public String echoWithoutProgress(String input, Integer delayInMillis);
@@ -197,8 +196,7 @@ public class RmiConversationTest extends SystemTestCase
         public String echoWithStoreAndProcessingException(String input);
 
         @Transactional
-        public String echoWithStoreAndProcessingException(String input,
-                IProgressListener listener);
+        public String echoWithStoreAndProcessingException(String input, IProgressListener listener);
 
         @Transactional
         public boolean exists(String code);
@@ -242,22 +240,25 @@ public class RmiConversationTest extends SystemTestCase
         }
 
         @Override
-        public String echo(String input, Integer delayInMillis,
-                IProgressListener progress)
+        public String echo(String input, Integer delayInMillis, IProgressListener progress)
         {
 
             long startTime = System.currentTimeMillis();
+            int total = 50;
+            int unit = delayInMillis / total;
+            int i = 0;
 
+            progress.update("progress", total, i);
             while (System.currentTimeMillis() - startTime < delayInMillis)
             {
                 try
                 {
-                    Thread.sleep(delayInMillis / 50);
+                    Thread.sleep(unit);
                 } catch (InterruptedException ex)
                 {
                     ex.printStackTrace();
                 }
-                progress.update("progress", 1, 1);
+                progress.update("progress", total, ++i);
 
             }
             return input;
@@ -309,8 +310,7 @@ public class RmiConversationTest extends SystemTestCase
         }
 
         @Override
-        public String echoWithStoreAndProcessingException(String input,
-                IProgressListener progress)
+        public String echoWithStoreAndProcessingException(String input, IProgressListener progress)
         {
 
             DatabaseInstancePE db = new DatabaseInstancePE();
-- 
GitLab