public class AndesClientUtils extends Object
| Constructor and Description |
|---|
AndesClientUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
createMockFile(String filePathToRead,
String filePathToCreate,
int sizeInKB)
Creates a file using a given file and a size.
|
static String |
createRandomString(int sizeInBytes)
Creates a one line random string
|
static String |
createRandomString(int sizeInBytes,
int maxLineSize)
Creates a random string.
|
static void |
deleteRandomFile(String filePathToDelete)
Deletes a random file.
|
static void |
flushPrintWriters()
Prints print writers to file paths.
|
static void |
initializePublishedPrintWriter(String filePath)
Initialize the published messages print writer.
|
static void |
initializeReceivedMessagesPrintWriter(String filePath)
Initialize the message content print writer.
|
static void |
initializeStatisticsPrintWriter(String filePath)
Initialize the statistics print writer.
|
static void |
shutdownClient(AndesClient client)
Shutdown the client gracefully without waiting.
|
static void |
sleepForInterval(long milliseconds)
Sleeps for a certain time.
|
static void |
waitForMessagesAndShutdown(AndesClient client,
long waitTimeTillMessageCounterChanges)
Waits until no messages are received.
|
static void |
waitForMessagesAndShutdown(AndesClient client,
long waitTimeTillMessageCounterChanges,
long expectedMessageCount)
Waits until no messages are received.
|
static void |
writePublishedMessagesToFile(String content,
String filePath)
Writes published messages to a file.
|
static void |
writeReceivedMessagesToFile(String content,
String filePath)
Writes received messages to a file.
|
static void |
writeStatisticsToFile(String content,
String filePath)
Writes statistics to a file.
|
public static void waitForMessagesAndShutdown(AndesClient client, long waitTimeTillMessageCounterChanges, long expectedMessageCount) throws javax.jms.JMSException
client - The consumer clientwaitTimeTillMessageCounterChanges - The amount of milliseconds to wait for new messages
are received.expectedMessageCount - Number of messages expected from the consumerjavax.jms.JMSExceptionpublic static void waitForMessagesAndShutdown(AndesClient client, long waitTimeTillMessageCounterChanges) throws javax.jms.JMSException
client - The consumer clientwaitTimeTillMessageCounterChanges - The amount of milliseconds to wait for new messages
are received.javax.jms.JMSExceptionpublic static void shutdownClient(AndesClient client) throws javax.jms.JMSException
client - The client to shutdownjavax.jms.JMSExceptionpublic static void sleepForInterval(long milliseconds)
milliseconds - Sleep time in milliseconds.public static void writeReceivedMessagesToFile(String content, String filePath) throws IOException
content - Message content to write.filePath - File path where the message content should be written.IOExceptionpublic static void writeStatisticsToFile(String content, String filePath) throws IOException
content - Statistic content.filePath - File path where the statistics should be written.IOExceptionpublic static void writePublishedMessagesToFile(String content, String filePath) throws IOException
content - Statistic content.filePath - File path where the statistics should be written.IOExceptionpublic static void initializeReceivedMessagesPrintWriter(String filePath) throws IOException
filePath - The file path to write to.IOExceptionpublic static void initializeStatisticsPrintWriter(String filePath) throws IOException
filePath - The file path to write to.IOExceptionpublic static void initializePublishedPrintWriter(String filePath) throws IOException
filePath - The file path to write to.IOExceptionpublic static void flushPrintWriters()
public static void createMockFile(String filePathToRead, String filePathToCreate, int sizeInKB) throws IOException
filePathToRead - The file path to read contents from.filePathToCreate - The path in which the contents should be written with a given size.sizeInKB - The size of the file to be written in kilobytes.IOExceptionpublic static String createRandomString(int sizeInBytes, int maxLineSize)
sizeInBytes - The size of the file to be written in bytes.maxLineSize - The maximum size of one line of the file to be written in bytes.public static String createRandomString(int sizeInBytes)
sizeInBytes - The size of the file to be written in bytes.public static void deleteRandomFile(String filePathToDelete) throws IOException
filePathToDelete - The path in which the contents should be written with a given size.IOExceptionCopyright © 2019 WSO2. All rights reserved.