Class FakeDns
java.lang.Object
io.debezium.testing.testcontainers.util.FakeDns
Fake DNS resolver which allows tests to work well with testcontainer under Docker Desktop
Adaptation of https://github.com/CorfuDB/CorfuDB/blob/master/it/src/main/java/org/corfudb/universe/universe/docker/FakeDns.java
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classNameServiceListener with a NameService implementation to fallback to. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String,InetAddress> private booleanwhether the fake resolver has been installedprivate static final FakeDnsprivate static final org.slf4j.Loggerprivate Object -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddResolution(String hostname, InetAddress ip) static FakeDnsinstall()Install the fake DNS resolver into the Java runtime.private Objectbooleanstatic <T extends Throwable>
voidpropagateIfPossible(Throwable throwable, Class<T> declaredType) voidremoveResolution(String hostname, InetAddress ip) restore()Restore default DNS resolver in Java runtime.private voidrestoreDns(Object nameService)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
instance
-
forwardResolutions
-
originalNameService
-
installed
private boolean installedwhether the fake resolver has been installed
-
-
Constructor Details
-
FakeDns
private FakeDns()
-
-
Method Details
-
getInstance
-
addResolution
-
removeResolution
-
isInstalled
public boolean isInstalled() -
install
Install the fake DNS resolver into the Java runtime. -
restore
Restore default DNS resolver in Java runtime. -
installDns
private Object installDns() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, NoSuchFieldException -
restoreDns
-
propagateIfPossible
public static <T extends Throwable> void propagateIfPossible(Throwable throwable, Class<T> declaredType) throws T - Throws:
T extends Throwable
-