Merge branch 'jetty-9.4.x' into jetty-10.0.x

This commit is contained in:
olivier lamy 2020-07-09 07:54:59 +10:00
commit 4cd6a71134
1 changed files with 10 additions and 9 deletions

View File

@ -58,18 +58,19 @@ public class MongoTestHelper
static MongoClient mongoClient;
static String mongoHost;
static int mongoPort;
public static void startMongo()
{
try
{
long start = System.currentTimeMillis();
mongo.start();
String containerIpAddress = mongo.getContainerIpAddress();
int mongoPort = mongo.getMappedPort(27017);
LOG.info("Mongo container started for {}:{} - {}ms", containerIpAddress, mongoPort,
System.currentTimeMillis() - start);
System.setProperty("embedmongoHost", containerIpAddress);
System.setProperty("embedmongoPort", Integer.toString(mongoPort));
mongoHost = mongo.getHost();
mongoPort = mongo.getMappedPort(27017);
LOG.info("Mongo container started for {}:{} - {}ms", mongoHost, mongoPort,
System.currentTimeMillis() - start);
}
catch (Exception e)
{
@ -94,7 +95,7 @@ public class MongoTestHelper
}
if (mongoClient == null || restart)
{
mongoClient = new MongoClient(System.getProperty("embedmongoHost"), Integer.getInteger("embedmongoPort"));
mongoClient = new MongoClient(mongoHost, mongoPort);
}
return mongoClient;
}
@ -117,8 +118,8 @@ public class MongoTestHelper
public static MongoSessionDataStoreFactory newSessionDataStoreFactory()
{
MongoSessionDataStoreFactory storeFactory = new MongoSessionDataStoreFactory();
storeFactory.setHost(System.getProperty("embedmongoHost"));
storeFactory.setPort(Integer.getInteger("embedmongoPort"));
storeFactory.setHost(mongoHost);
storeFactory.setPort(mongoPort);
storeFactory.setCollectionName(COLLECTION_NAME);
storeFactory.setDbName(DB_NAME);
return storeFactory;