public class TestUtils extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
TestUtils.RunnableExc |
Modifier and Type | Method and Description |
---|---|
static void |
assertWebError(int expectedCode,
Runnable runnable) |
static void |
assertWebError(int expectedCode,
Runnable runnable,
boolean retry) |
static String |
generateArtifactId() |
static String |
generateSubject() |
static String |
generateTopic() |
static String |
generateTopic(String prefix) |
static String |
getRegistryApiUrl() |
static String |
getRegistryHost() |
static int |
getRegistryPort() |
static String |
getRegistryUIUrl() |
static String |
getTestRegistryClients() |
static boolean |
isExternalRegistry() |
static boolean |
isReachable()
Method which try connection to registries.
|
static boolean |
isReady(boolean logResponse)
Checks the readniess endpoint of the registry
|
static <T> T |
retry(Callable<T> callable) |
static <T> T |
retry(Callable<T> callable,
String name,
int maxRetries) |
static void |
retry(TestUtils.RunnableExc runnable) |
static void |
retry(TestUtils.RunnableExc runnable,
String name,
int maxRetries) |
static long |
waitFor(String description,
long pollIntervalMs,
long timeoutMs,
BooleanSupplier ready)
Poll the given
ready function every pollIntervalMs milliseconds until it returns true,
or throw a TimeoutException if it doesn't returns true within timeoutMs milliseconds. |
static long |
waitFor(String description,
long pollIntervalMs,
long timeoutMs,
BooleanSupplier ready,
Runnable onTimeout) |
static void |
waitForSchema(RegistryService service,
byte[] bytes) |
static void |
waitForSchema(RegistryService service,
byte[] bytes,
Function<ByteBuffer,Long> fn) |
static void |
waitForSchemaCustom(RegistryService service,
byte[] bytes,
Function<byte[],Long> fn) |
static void |
writeFile(Path filePath,
String text) |
static void |
writeFile(String filePath,
String text)
Method to create and write String content file.
|
public static boolean isExternalRegistry()
public static String getRegistryHost()
public static int getRegistryPort()
public static String getRegistryUIUrl()
public static String getRegistryApiUrl()
public static String getTestRegistryClients()
public static boolean isReachable()
public static boolean isReady(boolean logResponse)
public static long waitFor(String description, long pollIntervalMs, long timeoutMs, BooleanSupplier ready) throws TimeoutException
ready
function every pollIntervalMs
milliseconds until it returns true,
or throw a TimeoutException if it doesn't returns true within timeoutMs
milliseconds.
(helpful if you have several calls which need to share a common timeout)TimeoutException
public static long waitFor(String description, long pollIntervalMs, long timeoutMs, BooleanSupplier ready, Runnable onTimeout) throws TimeoutException
TimeoutException
public static void writeFile(String filePath, String text)
filePath
- path to filetext
- contentpublic static String generateTopic()
public static String generateSubject()
public static String generateArtifactId()
public static void retry(TestUtils.RunnableExc runnable) throws Exception
Exception
public static void retry(TestUtils.RunnableExc runnable, String name, int maxRetries) throws Exception
Exception
public static <T> T retry(Callable<T> callable, String name, int maxRetries) throws Exception
Exception
public static void assertWebError(int expectedCode, Runnable runnable)
public static void assertWebError(int expectedCode, Runnable runnable, boolean retry) throws Exception
Exception
public static void waitForSchema(RegistryService service, byte[] bytes) throws Exception
Exception
public static void waitForSchema(RegistryService service, byte[] bytes, Function<ByteBuffer,Long> fn) throws Exception
Exception
public static void waitForSchemaCustom(RegistryService service, byte[] bytes, Function<byte[],Long> fn) throws Exception
Exception
Copyright © 2020 Red Hat. All rights reserved.