public abstract class PortMapper extends Object
This is mainly used in test environments where we provision external dependencies via docker composer. As docker assigns a more or less random port per test run, we need to determine and assign this.
As we do not want a production dependency against docker, we use this bridge class and provide an appropriate implementation as DockerHelper in the test scope.
Constructor and Description |
---|
PortMapper() |
Modifier and Type | Method and Description |
---|---|
protected abstract Tuple<String,Integer> |
map(String service,
String host,
int port)
Maps the given port for the given service.
|
static Tuple<String,Integer> |
mapPort(String service,
String host,
int port)
Maps the given port for the given service.
|
static void |
setMapper(PortMapper mapper)
Determines which port mapper to use.
|
public static void setMapper(PortMapper mapper)
mapper
- the mapper to use.public static Tuple<String,Integer> mapPort(String service, String host, int port)
service
- the service used to identify to container which provides the servicehost
- the host to mapport
- the port to mapprotected abstract Tuple<String,Integer> map(String service, String host, int port)
service
- the service used to identify to container which provides the servicehost
- the host to mapport
- the port to mapCopyright © 2018. All rights reserved.