diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/DssComponentTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/DssComponentTest.java
index dc5a569d6015df5f98a77cb48d1a0e29cea33de5..8f41f8e0e7a1c017b4cf2904e424b291ebf40894 100644
--- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/DssComponentTest.java
+++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/DssComponentTest.java
@@ -48,6 +48,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDTO.DataSetO
 import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.NewDataSetDTO.DataSetOwnerType;
 import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.validation.ValidationError;
 import ch.systemsx.cisd.openbis.generic.shared.dto.SimpleDataSetInformationDTO;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * @author Franz-Josef Elmer
@@ -85,8 +86,6 @@ public class DssComponentTest extends SystemTestCase
                     }
                 };
 
-    private static final String OPENBIS_URL = "http://localhost:8888";
-
     private IDssComponent dss;
 
     @BeforeMethod
@@ -382,7 +381,7 @@ public class DssComponentTest extends SystemTestCase
 
     private IDssComponent createDssComponent(String userName)
     {
-        return DssComponentFactory.tryCreate(userName, "a", OPENBIS_URL,
+        return DssComponentFactory.tryCreate(userName, "a", TestInstanceHostUtils.getOpenBISUrl(),
                 5 * DateUtils.MILLIS_PER_MINUTE);
     }
 
diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/JsonDssServiceRpcGenericTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/JsonDssServiceRpcGenericTest.java
index 0a9011ea9272bb2a7e1dbd9f86ecaaeabfd4e63e..5c8ed6f49250f05ce44ae7eadb39d5fc4b55c8f4 100644
--- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/JsonDssServiceRpcGenericTest.java
+++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/JsonDssServiceRpcGenericTest.java
@@ -34,6 +34,7 @@ import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO;
 import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.IDssServiceRpcGeneric;
 import ch.systemsx.cisd.openbis.generic.shared.api.json.GenericObjectMapper;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * Verifies that the functionality of {@link IDssServiceRpcGeneric} is accessible over JSON-RPC.
@@ -44,11 +45,11 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService
     { "slow" })
 public class JsonDssServiceRpcGenericTest extends SystemTestCase
 {
-    private static final String OPENBIS_URL = "http://localhost:8888"
+    private static final String OPENBIS_URL = TestInstanceHostUtils.getOpenBISUrl()
             + IGeneralInformationService.JSON_SERVICE_URL;
 
     // TODO KE: put the suffix in a constant
-    private static final String DSS_URL = "http://localhost:8889"
+    private static final String DSS_URL = TestInstanceHostUtils.getDSSPort()
             + "/datastore_server/rmi-dss-api-v1.json";
 
     private IGeneralInformationService openbisService;
diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/OpenbisServiceFacadeTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/OpenbisServiceFacadeTest.java
index fb6da2c0ea0757aa217a8265d457a4600e67e774..43fc2f64bb20e3a8c21b382ae18c0cab426a087a 100644
--- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/OpenbisServiceFacadeTest.java
+++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/OpenbisServiceFacadeTest.java
@@ -50,6 +50,7 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClause;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClauseAttribute;
 import ch.systemsx.cisd.openbis.generic.shared.dto.SimpleDataSetInformationDTO;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * @author Chandrasekhar Ramakrishnan
@@ -67,8 +68,6 @@ public class OpenbisServiceFacadeTest extends SystemTestCase
                     }
                 };
 
-    private static final String OPENBIS_URL = "http://localhost:8888";
-
     private IOpenbisServiceFacade serviceFacade;
 
     @BeforeMethod
@@ -251,8 +250,8 @@ public class OpenbisServiceFacadeTest extends SystemTestCase
 
     private IOpenbisServiceFacade createServiceFacade(String userName)
     {
-        return OpenbisServiceFacadeFactory.tryCreate(userName, "a", OPENBIS_URL,
-                5 * DateUtils.MILLIS_PER_MINUTE);
+        return OpenbisServiceFacadeFactory.tryCreate(userName, "a",
+                TestInstanceHostUtils.getOpenBISUrl(), 5 * DateUtils.MILLIS_PER_MINUTE);
     }
 
     private NewDataSetDTO createNewDataSetDTO(File exampleDataSet) throws IOException
diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/QueryFacadeTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/QueryFacadeTest.java
index 284b707d9c80328838637d170e6483a1bb17ab72..454dda7cf066d3360ac59f485846bc13b5d1a5c1 100644
--- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/QueryFacadeTest.java
+++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/QueryFacadeTest.java
@@ -28,6 +28,7 @@ import ch.systemsx.cisd.openbis.plugin.query.client.api.v1.IQueryApiFacade;
 import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.dto.AggregationServiceDescription;
 import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.dto.QueryTableModel;
 import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.dto.ReportDescription;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * @author Jakub Straszewski
@@ -35,9 +36,6 @@ import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.dto.ReportDescription
 @Test(groups = "slow")
 public class QueryFacadeTest extends AbstractQueryFacadeTest
 {
-
-    private static final String OPENBIS_URL = "http://localhost:8888";
-
     IQueryApiFacade queryFacade;
 
     @BeforeMethod
@@ -48,7 +46,7 @@ public class QueryFacadeTest extends AbstractQueryFacadeTest
 
     private IQueryApiFacade createServiceFacade(String userName)
     {
-        return FacadeFactory.create(OPENBIS_URL, userName, "a");
+        return FacadeFactory.create(TestInstanceHostUtils.getOpenBISUrl(), userName, "a");
     }
 
     @Override
diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/SystemTestCase.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/SystemTestCase.java
index 4f02598b28af1b9c75662d79343fa3f510566f88..169bce1d2b67ce70180c4629bd935d56a8f4895c 100644
--- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/SystemTestCase.java
+++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/datastoreserver/systemtests/SystemTestCase.java
@@ -58,6 +58,7 @@ import ch.systemsx.cisd.openbis.dss.generic.server.DataStoreServer;
 import ch.systemsx.cisd.openbis.dss.generic.shared.utils.DssPropertyParametersUtil;
 import ch.systemsx.cisd.openbis.generic.server.util.TestInitializer;
 import ch.systemsx.cisd.openbis.generic.shared.Constants;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * @author Franz-Josef Elmer
@@ -68,8 +69,6 @@ public abstract class SystemTestCase extends AssertJUnit
 
     private static final String SOURCE_TEST_CORE_PLUGINS = "sourceTest/core-plugins";
 
-    public static final int SYSTEM_TEST_CASE_SERVER_PORT = 8888;
-
     private static final String UNIT_TEST_WORKING_DIRECTORY = "unit-test-wd";
 
     private static final String TARGETS_DIRECTORY = "targets";
@@ -83,7 +82,8 @@ public abstract class SystemTestCase extends AssertJUnit
 
     // this message appears if the dropbox has successfully completed the registration, even if no
     // datasets have been imported
-    private static final String REGISTRATION_FINISHED_LOG_MARKER = DataSetRegistrationTransaction.SUCCESS_MESSAGE;
+    private static final String REGISTRATION_FINISHED_LOG_MARKER =
+            DataSetRegistrationTransaction.SUCCESS_MESSAGE;
 
     protected static GenericWebApplicationContext applicationContext;
 
@@ -149,7 +149,7 @@ public abstract class SystemTestCase extends AssertJUnit
         setUpDatabaseProperties();
         Server server = new Server();
         Connector connector = new SelectChannelConnector();
-        connector.setPort(SYSTEM_TEST_CASE_SERVER_PORT);
+        connector.setPort(TestInstanceHostUtils.getOpenBISPort());
         server.addConnector(connector);
         DispatcherServlet dispatcherServlet = new DispatcherServlet()
             {
@@ -176,8 +176,8 @@ public abstract class SystemTestCase extends AssertJUnit
         System.setProperty(OPENBIS_DSS_SYSTEM_PROPERTIES_PREFIX + "inputs", "");
         System.setProperty(OPENBIS_DSS_SYSTEM_PROPERTIES_PREFIX + "core-plugins-folder",
                 SOURCE_TEST_CORE_PLUGINS);
-        System.setProperty(OPENBIS_DSS_SYSTEM_PROPERTIES_PREFIX
-                + Constants.ENABLED_MODULES_KEY, getEnabledTechnologies());
+        System.setProperty(OPENBIS_DSS_SYSTEM_PROPERTIES_PREFIX + Constants.ENABLED_MODULES_KEY,
+                getEnabledTechnologies());
         System.setProperty(OPENBIS_DSS_SYSTEM_PROPERTIES_PREFIX + ROOT_DIR_KEY,
                 rootDir.getAbsolutePath());
         System.setProperty(OPENBIS_DSS_SYSTEM_PROPERTIES_PREFIX
@@ -266,7 +266,7 @@ public abstract class SystemTestCase extends AssertJUnit
         return logContent.contains(DATA_SET_IMPORTED_LOG_MARKER)
                 || logContent.contains(REGISTRATION_FINISHED_LOG_MARKER);
     }
-    
+
     protected Set<String> getSuccessfullyRegisteredDataSets(String logContent)
     {
         BufferedReader reader = new BufferedReader(new StringReader(logContent));
@@ -292,7 +292,7 @@ public abstract class SystemTestCase extends AssertJUnit
             IOUtils.closeQuietly(reader);
         }
     }
-    
+
     private Set<String> extractDataSetCodes(String logLineExtract)
     {
         Set<String> result = new HashSet<String>();
@@ -321,7 +321,8 @@ public abstract class SystemTestCase extends AssertJUnit
         FileUtils.moveDirectoryToDirectory(exampleDataSet, getIncomingDirectory(), false);
     }
 
-    protected boolean checkForFinalPostRegistrationLogEntry(String logContent, Set<String> registeredDataSets)
+    protected boolean checkForFinalPostRegistrationLogEntry(String logContent,
+            Set<String> registeredDataSets)
     {
         Pattern pattern = Pattern.compile(".*Post registration of (\\d*). of \\1 data sets: (.*)");
         String[] lines = logContent.split("\\n");
diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DataSetArgumentsTest.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DataSetArgumentsTest.java
index 67c25660cc832075b9f20f33a1addf727cf98b18..d2c02c64f0c3a5ddd66bf08c9d38225b8e33e355 100644
--- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DataSetArgumentsTest.java
+++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/cli/DataSetArgumentsTest.java
@@ -22,6 +22,7 @@ import org.testng.annotations.Test;
 
 import ch.systemsx.cisd.args4j.CmdLineException;
 import ch.systemsx.cisd.args4j.CmdLineParser;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * @author Chandrasekhar Ramakrishnan
@@ -44,14 +45,16 @@ public class DataSetArgumentsTest extends AssertJUnit
     public void testParseBasicArguments()
     {
         String[] args =
-                    { "-u", "foo", "-p", "bar", "-s", "http://localhost:8888/openbis",
+                    { "-u", "foo", "-p", "bar", "-s",
+                            TestInstanceHostUtils.getOpenBISUrl() + "/openbis",
                             "20100318094819344-4" };
         try
         {
             parser.parseArgument(args);
             assertEquals("foo", arguments.getUsername());
             assertEquals("bar", arguments.getPassword());
-            assertEquals("http://localhost:8888/openbis", arguments.getServerBaseUrl());
+            assertEquals(TestInstanceHostUtils.getOpenBISUrl() + "/openbis",
+                    arguments.getServerBaseUrl());
             assertEquals("20100318094819344-4", arguments.getDataSetCode());
             assertTrue(arguments.isComplete());
             assertFalse(arguments.isHelp());
@@ -65,7 +68,7 @@ public class DataSetArgumentsTest extends AssertJUnit
     public void testParseIncompleteArguments()
     {
         String[] args =
-            { "-u", "foo", "-p", "bar", "-s", "http://localhost:8888/openbis" };
+            { "-u", "foo", "-p", "bar", "-s", TestInstanceHostUtils.getOpenBISUrl() + "/openbis" };
         try
         {
             parser.parseArgument(args);
diff --git a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponentTestClient.java b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponentTestClient.java
index 691a431e28cccb8f91a694fa6d514d84fbb9879b..30a2720dad2c1a454b398551b299b275b7b52242 100644
--- a/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponentTestClient.java
+++ b/datastore_server/sourceTest/java/ch/systemsx/cisd/openbis/dss/client/api/v1/impl/DssComponentTestClient.java
@@ -24,6 +24,7 @@ import ch.systemsx.cisd.openbis.dss.client.api.v1.DssComponentFactory;
 import ch.systemsx.cisd.openbis.dss.client.api.v1.IDataSetDss;
 import ch.systemsx.cisd.openbis.dss.client.api.v1.IDssComponent;
 import ch.systemsx.cisd.openbis.dss.generic.shared.api.v1.FileInfoDssDTO;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * @author Chandrasekhar Ramakrishnan
@@ -36,7 +37,8 @@ public class DssComponentTestClient
         configureLogging();
         System.out.println("Logging in");
         IDssComponent component =
-                DssComponentFactory.tryCreate("test", "foobar", "http://localhost:8888", 0);
+                DssComponentFactory.tryCreate("test", "foobar",
+                        TestInstanceHostUtils.getOpenBISUrl(), 0);
         IDataSetDss dataSet = component.getDataSet("20100318094819344-4");
         FileInfoDssDTO fileInfos[] = dataSet.listFiles("/", true);
         for (FileInfoDssDTO fileInfo : fileInfos)
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/OpenbisClientTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/OpenbisClientTest.java
index 7c250cef2cd03a817139b9747fcdbb7d864d0dfc..5d3bbdd040b162a9c33efeac9d3b8d96b414e460 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/OpenbisClientTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/generic/OpenbisClientTest.java
@@ -25,6 +25,7 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TrackingDataSetCriteria
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.TrackingSampleCriteria;
 import ch.systemsx.cisd.openbis.generic.shared.dto.SessionContextDTO;
 import ch.systemsx.cisd.openbis.plugin.generic.shared.IGenericServer;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /*
  * Copyright 2009 ETH Zuerich, CISD
@@ -54,7 +55,7 @@ public class OpenbisClientTest
 
     private static final String USER_PASSWORD = "test";
 
-    private static final String SERVER_URL = "http://localhost:8888/openbis";
+    private static final String SERVER_URL = TestInstanceHostUtils.getOpenBISUrl() + "/openbis";
 
     // CommonServiceServer
     private static final String COMMON_SERVICE_PATH = SERVER_URL + "/rmi-common";
@@ -157,8 +158,8 @@ public class OpenbisClientTest
                 {
                     entityInfo.add(toString(entity));
                 }
-                return String.format("\nTracked %d %s(s): \n%s", entityInfo.size(), entityKind
-                        .getDescription(), StringUtils.join(entityInfo, "\n"));
+                return String.format("\nTracked %d %s(s): \n%s", entityInfo.size(),
+                        entityKind.getDescription(), StringUtils.join(entityInfo, "\n"));
             }
         }
 
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/RemoteApiTestCase.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/RemoteApiTestCase.java
index f78e77f67fca77d3b4c52df9bc5285d5523d5dd7..78b8e3d8be3aa985df1222d1f10c70fd6afb91fb 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/RemoteApiTestCase.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/RemoteApiTestCase.java
@@ -32,6 +32,7 @@ import org.springframework.web.servlet.DispatcherServlet;
 import org.testng.annotations.BeforeSuite;
 
 import ch.systemsx.cisd.openbis.generic.server.util.TestInitializer;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * Test cases which have access to the public API services of a running, fully-fledged openBIS
@@ -52,7 +53,7 @@ public class RemoteApiTestCase extends AbstractTransactionalTestNGSpringContextT
         TestInitializer.init();
         server = new Server();
         Connector connector = new SelectChannelConnector();
-        connector.setPort(8888);
+        connector.setPort(TestInstanceHostUtils.getOpenBISPort());
         server.addConnector(connector);
         DispatcherServlet dispatcherServlet = new DispatcherServlet()
             {
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceHttpInvokerApiTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceHttpInvokerApiTest.java
index 7d711ed5fc47d7afe09fd06dc0d3bb1d2f7ecf44..b3644fb7aeaeb98bc0b9272d72505e8cbeec8072 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceHttpInvokerApiTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/GeneralInformationServiceHttpInvokerApiTest.java
@@ -39,6 +39,7 @@ import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClause;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.dto.SearchCriteria.MatchClauseAttribute;
 import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * Verifies that an instance of {@link IGeneralInformationService} is published via
@@ -51,16 +52,13 @@ import ch.systemsx.cisd.openbis.generic.shared.basic.dto.Vocabulary;
 public class GeneralInformationServiceHttpInvokerApiTest extends
         GeneralInformationServiceJsonApiTest
 {
-
-    private static final String SERVICE_URL = "http://localhost:8888/";
-
     @Override
     protected IGeneralInformationService createService()
     {
         ServiceFinder generalInformationServiceFinder =
                 new ServiceFinder("openbis", IGeneralInformationService.SERVICE_URL);
         return generalInformationServiceFinder.createService(IGeneralInformationService.class,
-                SERVICE_URL, 10000000);
+                TestInstanceHostUtils.getOpenBISUrl(), 10000000);
     }
 
     @Test
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/QueryApiServerJsonTest.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/QueryApiServerJsonTest.java
index fd440a8a56dfccbe1355bde145b3245f8400a6cd..226c1a018a6908e3ae7b7b56914affa43903db0e 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/QueryApiServerJsonTest.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/QueryApiServerJsonTest.java
@@ -27,13 +27,14 @@ import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import com.googlecode.jsonrpc4j.JsonRpcHttpClient;
+import com.googlecode.jsonrpc4j.ProxyUtil;
+
 import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.IQueryApiServer;
 import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.dto.QueryDescription;
 import ch.systemsx.cisd.openbis.plugin.query.shared.api.v1.dto.QueryTableModel;
 import ch.systemsx.cisd.openbis.remoteapitest.RemoteApiTestCase;
-
-import com.googlecode.jsonrpc4j.JsonRpcHttpClient;
-import com.googlecode.jsonrpc4j.ProxyUtil;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * Verifies that an instance of {@link IQueryApiServer} is published via JSON-RPC and that it is
@@ -45,7 +46,7 @@ import com.googlecode.jsonrpc4j.ProxyUtil;
     { "remote api" })
 public class QueryApiServerJsonTest extends RemoteApiTestCase
 {
-    private static final String SERVICE_URL = "http://localhost:8888/openbis/"
+    private static final String SERVICE_URL = TestInstanceHostUtils.getOpenBISUrl() + "/openbis/"
             + IQueryApiServer.JSON_SERVICE_URL;
 
     protected IQueryApiServer queryApiService;
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/TestJsonServiceFactory.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/TestJsonServiceFactory.java
index 373350cd6e821d6f6f44d7c8841f6770f73fb3cd..806428e669ca328fa13d7d48abd6f529081557a4 100644
--- a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/TestJsonServiceFactory.java
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/remoteapitest/api/v1/TestJsonServiceFactory.java
@@ -26,13 +26,15 @@ import com.googlecode.jsonrpc4j.ProxyUtil;
 import ch.systemsx.cisd.openbis.generic.shared.api.json.GenericObjectMapper;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationChangingService;
 import ch.systemsx.cisd.openbis.generic.shared.api.v1.IGeneralInformationService;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * @author Kaloyan Enimanev
  */
 public class TestJsonServiceFactory
 {
-    private static final String OPENBIS_SERVER_URL = "http://localhost:8888/openbis/";
+    private static final String OPENBIS_SERVER_URL = TestInstanceHostUtils.getOpenBISUrl()
+            + "/openbis/";
 
     private static final String GENERAL_INFO_SERVICE_URL = OPENBIS_SERVER_URL
             + IGeneralInformationService.JSON_SERVICE_URL;
diff --git a/openbis/sourceTest/java/ch/systemsx/cisd/openbis/util/TestInstanceHostUtils.java b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/util/TestInstanceHostUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..a13714be79cdc726dec6b48591b42e0cbd1b05be
--- /dev/null
+++ b/openbis/sourceTest/java/ch/systemsx/cisd/openbis/util/TestInstanceHostUtils.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2013 ETH Zuerich, CISD
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package ch.systemsx.cisd.openbis.util;
+
+/**
+ * @author Pawel Glyzewski
+ */
+public class TestInstanceHostUtils
+{
+    private static final String OPENBIS_URL = "http://localhost";
+
+    public static int getOpenBISPort()
+    {
+        return 8888;
+    }
+
+    public static String getOpenBISUrl()
+    {
+        return OPENBIS_URL + ":" + getOpenBISPort();
+    }
+
+    public static int getDSSPort()
+    {
+        return 8889;
+    }
+
+    public static String getDSSUrl()
+    {
+        return OPENBIS_URL + ":" + getDSSPort();
+    }
+
+}
diff --git a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/api/v1/ScreeningClientApiTest.java b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/api/v1/ScreeningClientApiTest.java
index 27cb00676e36cd276b42f7f3ff27323ed3a113d9..b50159177736f8261f5d61524b06e6016922c52c 100644
--- a/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/api/v1/ScreeningClientApiTest.java
+++ b/screening/source/java/ch/systemsx/cisd/openbis/plugin/screening/client/api/v1/ScreeningClientApiTest.java
@@ -69,7 +69,8 @@ public class ScreeningClientApiTest
         if (args.length != 3)
         {
             System.err.println("Usage: <user> <password> <openbis-server-url>");
-            System.err.println("Example parameters: test-user my-password http://localhost:8888");
+            System.err
+                    .println("Example parameters: test-user my-password http://localhost:8888/openbis/openbis");
             System.exit(1);
             return;
         }
@@ -79,7 +80,7 @@ public class ScreeningClientApiTest
         String userPassword = args[1];
         String serverUrl = args[2];
 
-        print(String.format("Connecting to the server '%s' as a user '%s.", serverUrl, userId));
+        print(String.format("Connecting to the server '%s' as a user '%s'.", serverUrl, userId));
         IScreeningOpenbisServiceFacade facade =
                 ScreeningOpenbisServiceFacadeFactory.INSTANCE.tryToCreate(userId, userPassword,
                         serverUrl);
@@ -89,6 +90,7 @@ public class ScreeningClientApiTest
             System.exit(1);
             return;
         }
+
         List<ExperimentIdentifier> experiments = facade.listExperiments();
         print("Experiments: " + experiments);
 
@@ -150,13 +152,15 @@ public class ScreeningClientApiTest
                 }
             });
         print("Feature vector datasets: "
-                + featureVectorDatasets.subList(0, Math.min(5, featureVectorDatasets.size())));
+                + featureVectorDatasets.subList(0, Math.min(1, featureVectorDatasets.size())));
 
         List<String> featureCodes = facade.listAvailableFeatureCodes(featureVectorDatasets);
         Collections.sort(featureCodes);
         print("Feature codes: " + featureCodes);
         List<FeatureVectorDataset> features =
-                facade.loadFeatures(featureVectorDatasets, featureCodes);
+                facade.loadFeatures(new ArrayList<FeatureVectorDatasetReference>(
+                        featureVectorDatasets.subList(0, 1)),
+                        new ArrayList<String>(featureCodes.subList(0, 10)));
         Collections.sort(features, new Comparator<FeatureVectorDataset>()
             {
                 @Override
@@ -195,7 +199,8 @@ public class ScreeningClientApiTest
         // loadImagesFromFeatureVectors(facade, getFirstTwo(facade, featureVectorDatasets));
 
         List<PlateMetadata> plateMetadata =
-                facade.getPlateMetadataList(Arrays.asList(plates.get(0), plates.get(1), plates.get(2)));
+                facade.getPlateMetadataList(Arrays.asList(plates.get(0), plates.get(1),
+                        plates.get(2)));
         for (PlateMetadata metadata : plateMetadata)
         {
             WellMetadata well = metadata.getWell(1, 1);
@@ -217,17 +222,18 @@ public class ScreeningClientApiTest
         return builder.toString();
     }
 
-    private static void renderMaterials(Map<String, Material> materialProperties, StringBuilder builder,
-            String indent)
+    private static void renderMaterials(Map<String, Material> materialProperties,
+            StringBuilder builder, String indent)
     {
         Set<Entry<String, Material>> entrySet = materialProperties.entrySet();
         for (Entry<String, Material> entry : entrySet)
         {
-            builder.append(indent).append("material property of type ").append(entry.getKey()).append(":\n");
+            builder.append(indent).append("material property of type ").append(entry.getKey())
+                    .append(":\n");
             renderMaterial(entry.getValue(), builder, indent + "  ");
         }
     }
-    
+
     private static void renderMaterial(Material material, StringBuilder builder, String indent)
     {
         builder.append(indent).append(material.getAugmentedCode()).append(" properties: ");
diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/PlateImageReferenceTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/PlateImageReferenceTest.java
index 976bda9f7a835d53a185407f24049720203207fa..a15a785e00f3141ac61abe048e9211c31cb6a7ce 100644
--- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/PlateImageReferenceTest.java
+++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/plugin/screening/shared/api/v1/dto/PlateImageReferenceTest.java
@@ -19,6 +19,8 @@ package ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto;
 import org.testng.AssertJUnit;
 import org.testng.annotations.Test;
 
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
+
 /**
  * @author Chandrasekhar Ramakrishnan
  */
@@ -65,7 +67,7 @@ public class PlateImageReferenceTest extends AssertJUnit
                 @Override
                 public String getDatastoreServerUrl()
                 {
-                    return "http://localhost:8888";
+                    return TestInstanceHostUtils.getOpenBISUrl();
                 }
 
             };
diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/FeatureVectorsDropboxTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/FeatureVectorsDropboxTest.java
index 2165c506dd0a04d2fae92863dd899e24c9218dcd..406061fc6245598881839e72c9e483410b0f71a3 100644
--- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/FeatureVectorsDropboxTest.java
+++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/FeatureVectorsDropboxTest.java
@@ -43,6 +43,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.FeatureVector
 import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.FeatureVectorDataset;
 import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.FeatureVectorDatasetReference;
 import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.Plate;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * @author Chandrasekhar Ramakrishnan
@@ -97,8 +98,8 @@ public class FeatureVectorsDropboxTest extends AbstractScreeningSystemTestCase
         screeningServer = (IScreeningApiServer) bean;
         sessionToken = screeningClientService.tryToLogin("admin", "a").getSessionID();
         screeningFacade =
-                ScreeningOpenbisServiceFacade.tryCreateForTest(sessionToken, "http://localhost:"
-                        + SYSTEM_TEST_CASE_SERVER_PORT, screeningServer);
+                ScreeningOpenbisServiceFacade.tryCreateForTest(sessionToken,
+                        TestInstanceHostUtils.getOpenBISUrl(), screeningServer);
     }
 
     @AfterMethod
diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/ImageBase64EncodingTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/ImageBase64EncodingTest.java
index 8d2adb16de68b98fcdcb392d1e08a2f0834e5439..7f9e8c4ecb50424fe368490b8014d7b153186f13 100644
--- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/ImageBase64EncodingTest.java
+++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/ImageBase64EncodingTest.java
@@ -53,14 +53,18 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.ImageDatasetR
 import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.Plate;
 import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateImageReference;
 import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.WellPosition;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 @Test(groups =
     { "slow", "systemtest" })
 public class ImageBase64EncodingTest extends AbstractScreeningSystemTestCase
 {
-    private static String IMAGE1_FILENAME = getTestDataFolder() + "TRANSFORMED-THUMB-PLATE/bPLATE_wA1_s1_cRGB.png";
-    private static String IMAGE2_FILENAME = getTestDataFolder() + "TRANSFORMED-THUMB-PLATE/bPLATE_wA2_s1_cRGB.png";
-    
+    private static String IMAGE1_FILENAME = getTestDataFolder()
+            + "TRANSFORMED-THUMB-PLATE/bPLATE_wA1_s1_cRGB.png";
+
+    private static String IMAGE2_FILENAME = getTestDataFolder()
+            + "TRANSFORMED-THUMB-PLATE/bPLATE_wA2_s1_cRGB.png";
+
     private MockHttpServletRequest request;
 
     private String sessionToken;
@@ -70,7 +74,7 @@ public class ImageBase64EncodingTest extends AbstractScreeningSystemTestCase
     private IScreeningApiServer screeningServer;
 
     private IScreeningOpenbisServiceFacade screeningFacade;
-    
+
     private IDssServiceRpcScreening screeningJsonApi;
 
     @BeforeTest
@@ -80,7 +84,7 @@ public class ImageBase64EncodingTest extends AbstractScreeningSystemTestCase
         moveFileToIncoming(exampleDataSet);
         waitUntilDataSetImported();
     }
-    
+
     @BeforeMethod
     public void setUp() throws Exception
     {
@@ -93,11 +97,16 @@ public class ImageBase64EncodingTest extends AbstractScreeningSystemTestCase
         Object bean = applicationContext.getBean(ResourceNames.SCREENING_PLUGIN_SERVER);
         screeningServer = (IScreeningApiServer) bean;
         sessionToken = screeningClientService.tryToLogin("admin", "a").getSessionID();
-        screeningFacade = ScreeningOpenbisServiceFacade.tryCreateForTest(sessionToken, "http://localhost:" + SYSTEM_TEST_CASE_SERVER_PORT, screeningServer);
+        screeningFacade =
+                ScreeningOpenbisServiceFacade.tryCreateForTest(sessionToken,
+                        TestInstanceHostUtils.getOpenBISUrl(), screeningServer);
 
         JsonRpcHttpClient client =
-                new JsonRpcHttpClient(new URL("http://localhost:8889/rmi-datastore-server-screening-api-v1.json/"));
-        screeningJsonApi =  ProxyUtil.createProxy(this.getClass().getClassLoader(), IDssServiceRpcScreening.class, client);
+                new JsonRpcHttpClient(new URL(TestInstanceHostUtils.getDSSUrl()
+                        + "/rmi-datastore-server-screening-api-v1.json/"));
+        screeningJsonApi =
+                ProxyUtil.createProxy(this.getClass().getClassLoader(),
+                        IDssServiceRpcScreening.class, client);
 
     }
 
@@ -111,51 +120,57 @@ public class ImageBase64EncodingTest extends AbstractScreeningSystemTestCase
         }
     }
 
-
     @Test
     public void base64EncodedImagesContainTheOriginalData() throws Exception
     {
         byte[] originalImage1 = getBytes(IMAGE1_FILENAME);
         byte[] originalImage2 = getBytes(IMAGE2_FILENAME);
-        
+
         List<Plate> p = screeningFacade.listPlates();
         List<Plate> plates = new ArrayList<Plate>();
-        for (Plate plate : p) {
-            if (plate.getAugmentedCode().equals("/TEST/BASE64PLATE")) {
+        for (Plate plate : p)
+        {
+            if (plate.getAugmentedCode().equals("/TEST/BASE64PLATE"))
+            {
                 plates.add(plate);
                 break;
             }
         }
-        
+
         List<ImageDatasetReference> imageDatasets = screeningFacade.listRawImageDatasets(plates);
-        
+
         System.out.println(plates);
         System.out.println(imageDatasets);
-        
+
         List<PlateImageReference> plateImages = new ArrayList<PlateImageReference>();
-        
-        plateImages.add(new PlateImageReference(0, "MERGED CHANNELS", new WellPosition(1,1), imageDatasets.get(0)));
-        plateImages.add(new PlateImageReference(0, "MERGED CHANNELS", new WellPosition(1,2), imageDatasets.get(0)));
-        
-        List<String> results = screeningJsonApi.loadImagesBase64(sessionToken, new PlateImageReferenceList(plateImages), false);
+
+        plateImages.add(new PlateImageReference(0, "MERGED CHANNELS", new WellPosition(1, 1),
+                imageDatasets.get(0)));
+        plateImages.add(new PlateImageReference(0, "MERGED CHANNELS", new WellPosition(1, 2),
+                imageDatasets.get(0)));
+
+        List<String> results =
+                screeningJsonApi.loadImagesBase64(sessionToken, new PlateImageReferenceList(
+                        plateImages), false);
 
         byte[] image1 = Base64.decode(results.get(0));
         byte[] image2 = Base64.decode(results.get(1));
-        
+
         assertThat(image1, is(equalTo(originalImage1)));
         assertThat(image2, is(equalTo(originalImage2)));
-        assertThat(results.size(), is(2));        
+        assertThat(results.size(), is(2));
     }
-    
-    private static byte[] getBytes(String filename) throws FileNotFoundException, IOException {
+
+    private static byte[] getBytes(String filename) throws FileNotFoundException, IOException
+    {
         File file = new File(filename);
         FileInputStream fis = new FileInputStream(file);
-        byte[] bytes = new byte[(int)file.length()];
+        byte[] bytes = new byte[(int) file.length()];
         fis.read(bytes);
         fis.close();
         return bytes;
     }
-    
+
     private File createTestDataContents() throws IOException
     {
         File dest = new File(workingDirectory, "test-data");
@@ -177,14 +192,15 @@ public class ImageBase64EncodingTest extends AbstractScreeningSystemTestCase
     {
         return 6000;
     }
-    
+
     @Override
     protected boolean checkLogContentForFinishedDataSetRegistration(String logContent)
     {
         return checkOnFinishedPostRegistration(logContent);
     }
 
-    private static class PlateImageReferenceList extends ArrayList<PlateImageReference> implements IModifiable
+    private static class PlateImageReferenceList extends ArrayList<PlateImageReference> implements
+            IModifiable
     {
 
         private static final long serialVersionUID = 1845499753563383092L;
diff --git a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/TransformedImageRepresentationsTest.java b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/TransformedImageRepresentationsTest.java
index 56c17a34a46fdc32d3dfaa493ec31846036d3085..841512b9c7bc6c2f4c77ff9f29ef3398314f5131 100644
--- a/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/TransformedImageRepresentationsTest.java
+++ b/screening/sourceTest/java/ch/systemsx/cisd/openbis/screening/systemtests/TransformedImageRepresentationsTest.java
@@ -41,6 +41,7 @@ import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.DatasetImageR
 import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.ImageDatasetReference;
 import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.ImageRepresentationFormat;
 import ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto.PlateIdentifier;
+import ch.systemsx.cisd.openbis.util.TestInstanceHostUtils;
 
 /**
  * @author Chandrasekhar Ramakrishnan
@@ -66,7 +67,7 @@ public class TransformedImageRepresentationsTest extends AbstractScreeningSystem
         moveFileToIncoming(exampleDataSet);
         waitUntilDataSetImported();
     }
-    
+
     @BeforeMethod
     public void setUp() throws Exception
     {
@@ -79,7 +80,9 @@ public class TransformedImageRepresentationsTest extends AbstractScreeningSystem
         Object bean = applicationContext.getBean(ResourceNames.SCREENING_PLUGIN_SERVER);
         screeningServer = (IScreeningApiServer) bean;
         sessionToken = screeningClientService.tryToLogin("admin", "a").getSessionID();
-        screeningFacade = ScreeningOpenbisServiceFacade.tryCreateForTest(sessionToken, "http://localhost:" + SYSTEM_TEST_CASE_SERVER_PORT, screeningServer);
+        screeningFacade =
+                ScreeningOpenbisServiceFacade.tryCreateForTest(sessionToken,
+                        TestInstanceHostUtils.getOpenBISUrl(), screeningServer);
     }
 
     @AfterMethod
@@ -98,25 +101,31 @@ public class TransformedImageRepresentationsTest extends AbstractScreeningSystem
         // The components of the plate identifier come from the dropbox code
         // (resource/test-data/TransformedImageRepresentationsTest/data-set-handler.py)
         PlateIdentifier plate = new PlateIdentifier("TRANSFORMED-THUMB-PLATE", "TEST", null);
-        List<ImageDatasetReference> imageDataSets = screeningFacade.listRawImageDatasets(Arrays.asList(plate));
-        List<DatasetImageRepresentationFormats> representationFormats = screeningFacade.listAvailableImageRepresentationFormats(imageDataSets);
+        List<ImageDatasetReference> imageDataSets =
+                screeningFacade.listRawImageDatasets(Arrays.asList(plate));
+        List<DatasetImageRepresentationFormats> representationFormats =
+                screeningFacade.listAvailableImageRepresentationFormats(imageDataSets);
         assertEquals(1, representationFormats.size());
-        List<ImageRepresentationFormat> formats = representationFormats.get(0).getImageRepresentationFormats();
+        List<ImageRepresentationFormat> formats =
+                representationFormats.get(0).getImageRepresentationFormats();
 
         HashSet<Dimension> expectedResolutions = new HashSet<Dimension>();
-        expectedResolutions.addAll(Arrays.asList(new Dimension(64, 64), new Dimension(128, 128), new Dimension(256, 256), new Dimension(512, 512)));
+        expectedResolutions.addAll(Arrays.asList(new Dimension(64, 64), new Dimension(128, 128),
+                new Dimension(256, 256), new Dimension(512, 512)));
         for (ImageRepresentationFormat format : formats)
         {
             Dimension resolution = new Dimension(format.getWidth(), format.getHeight());
             // Make sure the resolution we specified was found
-            assertTrue("" + resolution + " was not expected", expectedResolutions.remove(resolution));
+            assertTrue("" + resolution + " was not expected",
+                    expectedResolutions.remove(resolution));
         }
         assertEquals(0, expectedResolutions.size());
 
         // Check that the representations are JPEG for the following resolutions: 64x64, 128x128,
         // 256x256
         HashSet<Dimension> jpegResolutions = new HashSet<Dimension>();
-        jpegResolutions.addAll(Arrays.asList(new Dimension(64, 64), new Dimension(128, 128), new Dimension(256, 256)));
+        jpegResolutions.addAll(Arrays.asList(new Dimension(64, 64), new Dimension(128, 128),
+                new Dimension(256, 256)));
         for (ImageRepresentationFormat format : formats)
         {
             Dimension resolution = new Dimension(format.getWidth(), format.getHeight());