org.apache.flink.testutils.EntropyInjectingTestFileSystem Java Examples

The following examples show how to use org.apache.flink.testutils.EntropyInjectingTestFileSystem. 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: SavepointITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private static Matcher<File> hasEntropyInFileStateHandlePaths() {
	return new TypeSafeDiagnosingMatcher<File>() {

		@Override
		protected boolean matchesSafely(final File savepointDir, final Description mismatchDescription) {
			if (savepointDir == null) {
				mismatchDescription.appendText("savepoint dir must not be null");
				return false;
			}

			final List<Path> filesWithoutEntropy = listRecursively(savepointDir.toPath().resolve(EntropyInjectingTestFileSystem.ENTROPY_INJECTION_KEY));
			final Path savepointDirWithEntropy = savepointDir.toPath().resolve(EntropyInjectingTestFileSystem.ENTROPY);
			final List<Path> filesWithEntropy = listRecursively(savepointDirWithEntropy);

			if (!filesWithoutEntropy.isEmpty()) {
				mismatchDescription.appendText("there are savepoint files with unresolved entropy placeholders");
				return false;
			}

			if (!Files.exists(savepointDirWithEntropy) || filesWithEntropy.isEmpty()) {
				mismatchDescription.appendText("there are no savepoint files with added entropy");
				return false;
			}

			return true;
		}

		@Override
		public void describeTo(final Description description) {
			description.appendText("all savepoint files should have added entropy");
		}
	};
}
 
Example #2
Source File: SavepointITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private static Matcher<File> hasEntropyInFileStateHandlePaths() {
	return new TypeSafeDiagnosingMatcher<File>() {

		@Override
		protected boolean matchesSafely(final File savepointDir, final Description mismatchDescription) {
			if (savepointDir == null) {
				mismatchDescription.appendText("savepoint dir must not be null");
				return false;
			}

			final List<Path> filesWithoutEntropy = listRecursively(savepointDir.toPath().resolve(EntropyInjectingTestFileSystem.ENTROPY_INJECTION_KEY));
			final Path savepointDirWithEntropy = savepointDir.toPath().resolve(EntropyInjectingTestFileSystem.ENTROPY);
			final List<Path> filesWithEntropy = listRecursively(savepointDirWithEntropy);

			if (!filesWithoutEntropy.isEmpty()) {
				mismatchDescription.appendText("there are savepoint files with unresolved entropy placeholders");
				return false;
			}

			if (!Files.exists(savepointDirWithEntropy) || filesWithEntropy.isEmpty()) {
				mismatchDescription.appendText("there are no savepoint files with added entropy");
				return false;
			}

			return true;
		}

		@Override
		public void describeTo(final Description description) {
			description.appendText("all savepoint files should have added entropy");
		}
	};
}
 
Example #3
Source File: SavepointITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
private static Matcher<File> hasEntropyInFileStateHandlePaths() {
	return new TypeSafeDiagnosingMatcher<File>() {

		@Override
		protected boolean matchesSafely(final File savepointDir, final Description mismatchDescription) {
			if (savepointDir == null) {
				mismatchDescription.appendText("savepoint dir must not be null");
				return false;
			}

			final List<Path> filesWithoutEntropy = listRecursively(savepointDir.toPath().resolve(EntropyInjectingTestFileSystem.ENTROPY_INJECTION_KEY));
			final Path savepointDirWithEntropy = savepointDir.toPath().resolve(EntropyInjectingTestFileSystem.ENTROPY);
			final List<Path> filesWithEntropy = listRecursively(savepointDirWithEntropy);

			if (!filesWithoutEntropy.isEmpty()) {
				mismatchDescription.appendText("there are savepoint files with unresolved entropy placeholders");
				return false;
			}

			if (!Files.exists(savepointDirWithEntropy) || filesWithEntropy.isEmpty()) {
				mismatchDescription.appendText("there are no savepoint files with added entropy");
				return false;
			}

			return true;
		}

		@Override
		public void describeTo(final Description description) {
			description.appendText("all savepoint files should have added entropy");
		}
	};
}
 
Example #4
Source File: SavepointITCase.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
private Configuration getCheckpointingWithEntropyConfig() {
	final String savepointPathWithEntropyPlaceholder = new File(savepointDir, EntropyInjectingTestFileSystem.ENTROPY_INJECTION_KEY).getPath();
	final Configuration config = getFileBasedCheckpointsConfig("test-entropy://" + savepointPathWithEntropyPlaceholder);
	config.setString("s3.entropy.key", EntropyInjectingTestFileSystem.ENTROPY_INJECTION_KEY);
	return config;
}
 
Example #5
Source File: SavepointITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
private Configuration getCheckpointingWithEntropyConfig() {
	final String savepointPathWithEntropyPlaceholder = new File(savepointDir, EntropyInjectingTestFileSystem.ENTROPY_INJECTION_KEY).getPath();
	final Configuration config = getFileBasedCheckpointsConfig("test-entropy://" + savepointPathWithEntropyPlaceholder);
	config.setString("s3.entropy.key", EntropyInjectingTestFileSystem.ENTROPY_INJECTION_KEY);
	return config;
}
 
Example #6
Source File: SavepointITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
private Configuration getCheckpointingWithEntropyConfig() {
	final String savepointPathWithEntropyPlaceholder = new File(savepointDir, EntropyInjectingTestFileSystem.ENTROPY_INJECTION_KEY).getPath();
	final Configuration config = getFileBasedCheckpointsConfig("test-entropy://" + savepointPathWithEntropyPlaceholder);
	config.setString("s3.entropy.key", EntropyInjectingTestFileSystem.ENTROPY_INJECTION_KEY);
	return config;
}