Java Code Examples for org.apache.flink.util.StringUtils#generateRandomAlphanumericString()

The following examples show how to use org.apache.flink.util.StringUtils#generateRandomAlphanumericString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractKubernetesParametersTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testClusterIdLengthLimitation() {
	final String stringWithIllegalLength =
		StringUtils.generateRandomAlphanumericString(new Random(), Constants.MAXIMUM_CHARACTERS_OF_CLUSTER_ID + 1);
	flinkConfig.set(KubernetesConfigOptions.CLUSTER_ID, stringWithIllegalLength);
	assertThrows(
		"must be no more than " + Constants.MAXIMUM_CHARACTERS_OF_CLUSTER_ID + " characters",
		IllegalArgumentException.class,
		testingKubernetesParameters::getClusterId
	);
}
 
Example 2
Source File: JobManagerLogListHandlerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private void createFile(final File file, final long size) {
	try {
		final String randomFileContent = StringUtils.generateRandomAlphanumericString(
			ThreadLocalRandom.current(),
			Math.toIntExact(size));
		FileUtils.writeStringToFile(file, randomFileContent, StandardCharsets.UTF_8);
	} catch (IOException e) {
		throw new RuntimeException(e);
	}
}
 
Example 3
Source File: FlinkS3FileSystem.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public String generateEntropy() {
	return StringUtils.generateRandomAlphanumericString(ThreadLocalRandom.current(), entropyLength);
}
 
Example 4
Source File: FlinkS3FileSystem.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public String generateEntropy() {
	return StringUtils.generateRandomAlphanumericString(ThreadLocalRandom.current(), entropyLength);
}
 
Example 5
Source File: RunnerTest.java    From stateful-functions with Apache License 2.0 4 votes vote down vote up
@Nonnull
private TaskStartedEvent randomMessage() {
  final ThreadLocalRandom random = ThreadLocalRandom.current();
  final String taskId = StringUtils.generateRandomAlphanumericString(random, 2);
  return new TaskStartedEvent(taskId, System.currentTimeMillis());
}
 
Example 6
Source File: RunnerTest.java    From stateful-functions with Apache License 2.0 4 votes vote down vote up
@Nonnull
private MyMessages.MyInputMessage randomMessage() {
  final ThreadLocalRandom random = ThreadLocalRandom.current();
  final String userId = StringUtils.generateRandomAlphanumericString(random, 2);
  return new MyMessages.MyInputMessage(userId, "hello " + userId);
}
 
Example 7
Source File: RunnerTest.java    From flink-statefun with Apache License 2.0 4 votes vote down vote up
@Nonnull
private MyMessages.MyInputMessage randomMessage() {
  final ThreadLocalRandom random = ThreadLocalRandom.current();
  final String userId = StringUtils.generateRandomAlphanumericString(random, 2);
  return new MyMessages.MyInputMessage(userId, "hello " + userId);
}
 
Example 8
Source File: RunnerTest.java    From flink-statefun with Apache License 2.0 4 votes vote down vote up
@Nonnull
private TaskStartedEvent randomMessage() {
  final ThreadLocalRandom random = ThreadLocalRandom.current();
  final String taskId = StringUtils.generateRandomAlphanumericString(random, 2);
  return new TaskStartedEvent(taskId, System.currentTimeMillis());
}
 
Example 9
Source File: FlinkS3FileSystem.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public String generateEntropy() {
	return StringUtils.generateRandomAlphanumericString(ThreadLocalRandom.current(), entropyLength);
}