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
@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
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 Project: Flink-CEPplus   File: FlinkS3FileSystem.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String generateEntropy() {
	return StringUtils.generateRandomAlphanumericString(ThreadLocalRandom.current(), entropyLength);
}
 
Example 4
Source Project: flink   File: FlinkS3FileSystem.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String generateEntropy() {
	return StringUtils.generateRandomAlphanumericString(ThreadLocalRandom.current(), entropyLength);
}
 
Example 5
Source Project: stateful-functions   File: RunnerTest.java    License: 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 Project: stateful-functions   File: RunnerTest.java    License: 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 Project: flink-statefun   File: RunnerTest.java    License: 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 Project: flink-statefun   File: RunnerTest.java    License: 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 Project: flink   File: FlinkS3FileSystem.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public String generateEntropy() {
	return StringUtils.generateRandomAlphanumericString(ThreadLocalRandom.current(), entropyLength);
}